UNPKG

ncats-protvista-viewer

Version:

A collection of nightingale and custom components to show details of a protein sequence

2 lines 220 kB
/*! For license information please see bundle.js.LICENSE.txt */ (()=>{var t={676:t=>{window,t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=10)}([function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}t.exports=function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var i=n(14),r=n(15),s=n(5),o=n(16);t.exports=function(t){return i(t)||r(t)||s(t)||o()}},function(t,e,n){var i=n(17);function r(e,n,s){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=r=Reflect.get:t.exports=r=function(t,e,n){var r=i(t,e);if(r){var s=Object.getOwnPropertyDescriptor(r,e);return s.get?s.get.call(n):s.value}},r(e,n,s||e)}t.exports=r},function(t,e,n){var i=n(6);t.exports=function(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}},function(t,e,n){var i=n(11),r=n(12),s=n(5),o=n(13);t.exports=function(t,e){return i(t)||r(t,e)||s(t,e)||o()}},function(t,e,n){var i=n(18);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}},function(t,e,n){var i=n(19),r=n(20);t.exports=function(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?r(t):e}},function(t,e,n){t.exports=n(21)},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],i=!0,r=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done)&&(n.push(o.value),!e||n.length!==e);i=!0);}catch(t){r=!0,s=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return n}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e,n){var i=n(6);t.exports=function(t){if(Array.isArray(t))return i(t)}},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e,n){var i=n(2);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=i(t)););return t}},function(t,e){function n(e,i){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,i)}t.exports=n},function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(t){return typeof t}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(e)}t.exports=n},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e,n){"use strict";n.r(e),n.d(e,"Region",(function(){return N})),n.d(e,"TrackHighlighter",(function(){return T})),n.d(e,"ColorScaleParser",(function(){return O})),n.d(e,"String2Object",(function(){return P})),n.d(e,"ScrollFilter",(function(){return R})),n.d(e,"withMargin",(function(){return j}));var i=n(7),r=n.n(i),s=n(0),o=n.n(s),a=n(1),h=n.n(a),l=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.min,i=void 0===n?-1/0:n,r=e.max,s=void 0===r?1/0:r;o()(this,t),this.segments=[],this.max=s,this.min=i,this.regionString=null}return h()(t,[{key:"encode",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.segments.map((function(n){var i=n.start,r=n.end;if(e)return"".concat(i,":").concat(r);var s=i===t.min?"":i,o=r===t.max?"":r;return"".concat(s,":").concat(o)})).join(",")}},{key:"decode",value:function(t){var e=this;void 0!==t&&(this.regionString=t),this.regionString?this.segments=this.regionString.split(",").map((function(t){var n=t.split(":"),i=r()(n,3),s=i[0],o=i[1];if(void 0!==i[2])throw new Error("there should be at most 1 ':' per region. Region: ".concat(t));var a=s?Number(s):e.min,h=o?Number(o):e.max;if(a>h){var l=[h,a];a=l[0],h=l[1]}if(a<e.min&&(a=e.min),h>e.max&&(h=e.max),Number.isNaN(a))throw new Error("The parsed value of ".concat(s," is NaN. Region: ").concat(t));if(Number.isNaN(h))throw new Error("The parsed value of ".concat(o," is NaN. Region: ").concat(t));return{start:a,end:h}})):this.segments=[]}}]),t}(),u=function(t,e){return t?e?"".concat(t,",").concat(e):t:e},c=function(){function t(e){var n=e.element,i=e.min,r=e.max;o()(this,t),this.element=n,this.region=new l({min:i,max:r}),this.fixedHighlight=null}return h()(t,[{key:"setAttributesInElement",value:function(){this.region.decode(this.element.getAttribute("highlight")),0===this.region.segments.length&&(this.element._highlightstart=Number(this.element.getAttribute("highlightstart")),this.element._highlightend=Number(this.element.getAttribute("highlightend")),null!==this.element._highlightstart&&null!==this.element._highlightend&&"number"==typeof this.element._highlightstart&&"number"==typeof this.element._highlightend&&(this.element._highlight="".concat(this.element._highlightstart,":").concat(this.element._highlightend),this.region.decode(u(this.fixedHighlight,this.element._highlight))))}},{key:"setFloatAttribute",value:function(t,e){var n=parseFloat(e);this.element["_".concat(t)]=Number.isNaN(n)?e:n}},{key:"changedCallBack",value:function(t,e){switch(t){case"highlightstart":case"highlightend":this.setFloatAttribute(t,e),this.element._highlight=Number.isNaN(this.element._highlightstart)||Number.isNaN(this.element._highlightend)||void 0===this.element._highlightstart||void 0===this.element._highlightend||null===this.element._highlightstart||null===this.element._highlightend?"":"".concat(Math.max(this.region.min,this.element._highlightstart),":").concat(Math.min(this.region.max,this.element._highlightend));break;default:this.element._highlight=e}this.region.decode(u(this.fixedHighlight,this.element._highlight)),this.element.refresh()}},{key:"setFixedHighlight",value:function(t){this.fixedHighlight=t,this.region.decode(u(t,this.element._highlight)),this.element.refresh()}},{key:"appendHighlightTo",value:function(t){this.highlighted=t.append("g").attr("class","highlighted")}},{key:"updateHighlight",value:function(){var t=this,e=this.highlighted.selectAll("rect").data(this.region.segments);e.enter().append("rect").style("opacity",.5).attr("fill","rgba(255, 235, 59, 0.8)").style("pointer-events","none").merge(e).attr("height",this.element._height).attr("x",(function(e){return t.element.getXFromSeqPosition(e.start)})).attr("width",(function(e){return t.element.getSingleBaseWidth()*(e.end-e.start+1)})),e.exit().remove()}},{key:"max",set:function(t){this.region.max=t}}]),t}();function f(t){var e=document.createElement("div");return e.style.borderColor="",e.style.borderColor=t,""!==e.style.borderColor}var p=function(t){return t},d=function(){function t(e){o()(this,t),this.element=e,this.timeStampWheelOutside=0,this.resetScrollableTimeout=null}return h()(t,[{key:"setElementScrollable",value:function(t){this.element.setAttribute("scrollable",t)}},{key:"startResetScrollableTimer",value:function(){var t=this;this.resetScrollableTimeout&&clearTimeout(this.resetScrollableTimeout),this.resetScrollableTimeout=setTimeout((function(){t.setElementScrollable(!0),t.resetScrollableTimeout=null}),400)}},{key:"blockScroll",value:function(t){this.timeStampWheelOutside=t,this.setElementScrollable(!1),this.startResetScrollableTimer()}},{key:"isWheelEventInsideElement",value:function(t,e){var n=this.element.getBoundingClientRect(),i=n.height,r=n.width,s=n.x,o=n.y;return t>s&&e<s+r&&e>o&&e<o+i}},{key:"wheel",value:function(t){var e=t.x,n=t.y,i=t.timeStamp;this.isWheelEventInsideElement(e,n)?i<this.timeStampWheelOutside+400?this.blockScroll(i):this.setElementScrollable(!0):this.blockScroll(i)}}]),t}(),g=n(3),m=n.n(g),v=n(4),y=n.n(v),_=n(8),b=n.n(_),w=n(9),x=n.n(w),A=n(2),L=n.n(A);function S(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return M(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function E(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=L()(t);if(e){var r=L()(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return x()(this,n)}}var k=["left","right","top","bottom"],C=k.map((function(t){return"margin".concat(t)})),N=l,T=c,O=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=[],n=[];if(null!==t&&"string"!=typeof t)throw new Error("The attribute text has to be of type string");if(t&&""!==t.trim()){var i=t.split(",").map((function(t){return t.split(":")}));if(i.length<2)throw new Error("There should be at least 2 points to create a scale");e=i.map((function(t){var e=t[0].trim().toUpperCase();if(!f(e))throw new Error("The color '".concat(e," is not valid'"));return e})),n=i.map((function(t,e){var n=parseFloat(t[1]);if(Number.isNaN(n))throw new Error("The second part of every point should be a number. Error in point ".concat(e,": ").concat(t));return n}))}return{range:e,domain:n}},P=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.keyFormatter,i=void 0===n?p:n,r=e.valueFormatter,s=void 0===r?p:r;if(null!==t&&"string"!=typeof t)throw new Error("The attribute text has to be of type string");if(t&&""!==t.trim()){var o=t.split(",").map((function(t){return t.split(":")})),a={};return o.forEach((function(t){if(2!==t.length)throw new Error("Bad block: ".concat(t.join(":"),"\n The blocks of the string should follow the format KEY:VALUE"));a[i(t[0])]=s(t[1])})),a}return{}},R=d,j=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{initialValue:{top:0,bottom:0,left:0,right:0}},i=function(t){b()(i,t);var e=E(i);function i(){var t;return o()(this,i),(t=e.call(this)).margin=n.initialValue,t}return h()(i,[{key:"attributeChangedCallback",value:function(t,e,n){e!==n&&C.includes(t)&&(this[t]=n),y()(L()(i.prototype),"attributeChangedCallback",this).call(this,t,e,n)}}],[{key:"observedAttributes",get:function(){return[].concat(m()(y()(L()(i),"observedAttributes",this)),m()(C))}}]),i}(t),r=S(k);try{var s=function(){var t=e.value;Object.defineProperty(i.prototype,"margin".concat(t),{get:function(){return this.margin[t]||0},set:function(e){this.margin[t]=+e}})};for(r.s();!(e=r.n()).done;)s()}catch(t){r.e(t)}finally{r.f()}return i}}])},13:(t,e,n)=>{"use strict";const i="length",r="displaystart",s="displayend",o="highlight";class a extends HTMLElement{constructor(){super(),this.protvistaElements=new Set,this.attributeValues=new Map,this.propertyValues=new Map,this.mouseOver=!1}static get observedAttributes(){return["attributes",i,r,s,o]}set length(t){this.attributeValues.set(i,t)}get length(){return this.attributeValues.get(i)}set displaystart(t){this.attributeValues.set(r,t)}get displaystart(){return this.attributeValues.get(r)}set displayend(t){this.attributeValues.set(s,t)}get displayend(){return this.attributeValues.get(s)}set highlight(t){this.attributeValues.set(o,t)}get highlight(){return this.attributeValues.get(o)}attributeChangedCallback(t,e,n){if(e!==n){if("attributes"===t){if(this._attributes=n.split(" "),-1!==this._attributes.indexOf("type"))throw new Error("'type' can't be used as a protvista attribute");if(-1!==this._attributes.indexOf("value"))throw new Error("'value' can't be used as a protvista attribute");this.attributeValues=new Map(this._attributes.filter((t=>!a.observedAttributes.includes(t))).map((t=>[t,null])))}else t===i&&(this.length=n),t===r&&(this.displaystart=n),t===s&&(this.displayend=n),t===o&&(this.highlight=n);this.applyAttributes()}}register(t){this.protvistaElements.add(t),this.applyAttributes()}unregister(t){this.protvistaElements.delete(t)}_polyfillElementClosest(){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=t=>{let e=this;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null})}applyAttributes(){this.protvistaElements.forEach((t=>{this.attributeValues.forEach(((e,n)=>{!1===e||null==e?t.removeAttribute(n):t.setAttribute(n,"boolean"==typeof e?"":e)}))}))}applyProperties(t){if(t){const e=this.querySelector(`#${t}`);this.propertyValues.forEach(((t,n)=>{e[n]=t}))}else this.protvistaElements.forEach((t=>{this.propertyValues.forEach(((e,n)=>{t[n]=e}))}))}isRegisteredAttribute(t){return[...this.attributeValues.keys()].includes(t)||a.observedAttributes.includes(t)}_changeListener(t){switch(t.detail.handler){case"property":this.propertyValues.set(t.detail.type,t.detail.value),this.applyProperties(t.detail.for);break;default:this.isRegisteredAttribute(t.detail.type)&&this.attributeValues.set(t.detail.type,t.detail.value),Object.keys(t.detail).forEach((e=>{this.isRegisteredAttribute(e)&&this.attributeValues.set(e,t.detail[e])})),this.applyAttributes()}}connectedCallback(){this.addEventListener("change",this._changeListener)}}const h=a;function l(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var u,c;const f=(1===(u=l).length&&(c=u,u=function(t,e){return l(c(t),e)}),{left:function(t,e,n,i){for(null==n&&(n=0),null==i&&(i=t.length);n<i;){var r=n+i>>>1;u(t[r],e)<0?n=r+1:i=r}return n},right:function(t,e,n,i){for(null==n&&(n=0),null==i&&(i=t.length);n<i;){var r=n+i>>>1;u(t[r],e)>0?i=r:n=r+1}return n}}).right;var p=Array.prototype,d=(p.slice,p.map,Math.sqrt(50)),g=Math.sqrt(10),m=Math.sqrt(2);function v(t,e,n){var i=(e-t)/Math.max(0,n),r=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,r);return r>=0?(s>=d?10:s>=g?5:s>=m?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(s>=d?10:s>=g?5:s>=m?2:1)}var y=Array.prototype.slice;function _(t){return t}var b=1e-6;function w(t){return"translate("+(t+.5)+",0)"}function x(t){return"translate(0,"+(t+.5)+")"}function A(t){return function(e){return+t(e)}}function L(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return+t(n)+e}}function S(){return!this.__axis}function M(t,e){var n=[],i=null,r=null,s=6,o=6,a=3,h=1===t||4===t?-1:1,l=4===t||2===t?"x":"y",u=1===t||3===t?w:x;function c(c){var f=null==i?e.ticks?e.ticks.apply(e,n):e.domain():i,p=null==r?e.tickFormat?e.tickFormat.apply(e,n):_:r,d=Math.max(s,0)+a,g=e.range(),m=+g[0]+.5,v=+g[g.length-1]+.5,y=(e.bandwidth?L:A)(e.copy()),w=c.selection?c.selection():c,x=w.selectAll(".domain").data([null]),M=w.selectAll(".tick").data(f,e).order(),E=M.exit(),k=M.enter().append("g").attr("class","tick"),C=M.select("line"),N=M.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),M=M.merge(k),C=C.merge(k.append("line").attr("stroke","currentColor").attr(l+"2",h*s)),N=N.merge(k.append("text").attr("fill","currentColor").attr(l,h*d).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),c!==w&&(x=x.transition(c),M=M.transition(c),C=C.transition(c),N=N.transition(c),E=E.transition(c).attr("opacity",b).attr("transform",(function(t){return isFinite(t=y(t))?u(t):this.getAttribute("transform")})),k.attr("opacity",b).attr("transform",(function(t){var e=this.parentNode.__axis;return u(e&&isFinite(e=e(t))?e:y(t))}))),E.remove(),x.attr("d",4===t||2==t?o?"M"+h*o+","+m+"H0.5V"+v+"H"+h*o:"M0.5,"+m+"V"+v:o?"M"+m+","+h*o+"V0.5H"+v+"V"+h*o:"M"+m+",0.5H"+v),M.attr("opacity",1).attr("transform",(function(t){return u(y(t))})),C.attr(l+"2",h*s),N.attr(l,h*d).text(p),w.filter(S).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each((function(){this.__axis=y}))}return c.scale=function(t){return arguments.length?(e=t,c):e},c.ticks=function(){return n=y.call(arguments),c},c.tickArguments=function(t){return arguments.length?(n=null==t?[]:y.call(t),c):n.slice()},c.tickValues=function(t){return arguments.length?(i=null==t?null:y.call(t),c):i&&i.slice()},c.tickFormat=function(t){return arguments.length?(r=t,c):r},c.tickSize=function(t){return arguments.length?(s=o=+t,c):s},c.tickSizeInner=function(t){return arguments.length?(s=+t,c):s},c.tickSizeOuter=function(t){return arguments.length?(o=+t,c):o},c.tickPadding=function(t){return arguments.length?(a=+t,c):a},c}function E(t){return M(3,t)}var k={value:function(){}};function C(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new N(i)}function N(t){this._=t}function T(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function O(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function P(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=k,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}N.prototype=C.prototype={constructor:N,on:function(t,e){var n,i=this._,r=T(t+"",i),s=-1,o=r.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<o;)if(n=(t=r[s]).type)i[n]=P(i[n],t.name,e);else if(null==e)for(n in i)i[n]=P(i[n],t.name,null);return this}for(;++s<o;)if((n=(t=r[s]).type)&&(n=O(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new N(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),s=0;s<n;++s)r[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,n=(i=this._[t]).length;s<n;++s)i[s].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,s=i.length;r<s;++r)i[r].value.apply(e,n)}};const R=C;function j(){}function z(t){return null==t?j:function(){return this.querySelector(t)}}function F(){return[]}function H(t){return null==t?F:function(){return this.querySelectorAll(t)}}function q(t){return function(){return this.matches(t)}}function $(t){return new Array(t.length)}function V(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function Q(t,e,n,i,r,s){for(var o,a=0,h=e.length,l=s.length;a<l;++a)(o=e[a])?(o.__data__=s[a],i[a]=o):n[a]=new V(t,s[a]);for(;a<h;++a)(o=e[a])&&(r[a]=o)}function I(t,e,n,i,r,s,o){var a,h,l,u={},c=e.length,f=s.length,p=new Array(c);for(a=0;a<c;++a)(h=e[a])&&(p[a]=l="$"+o.call(h,h.__data__,a,e),l in u?r[a]=h:u[l]=h);for(a=0;a<f;++a)(h=u[l="$"+o.call(t,s[a],a,s)])?(i[a]=h,h.__data__=s[a],u[l]=null):n[a]=new V(t,s[a]);for(a=0;a<c;++a)(h=e[a])&&u[p[a]]===h&&(r[a]=h)}function W(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}V.prototype={constructor:V,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var U="http://www.w3.org/1999/xhtml";const D={svg:"http://www.w3.org/2000/svg",xhtml:U,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function B(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),D.hasOwnProperty(e)?{space:D[e],local:t}:t}function Z(t){return function(){this.removeAttribute(t)}}function X(t){return function(){this.removeAttributeNS(t.space,t.local)}}function G(t,e){return function(){this.setAttribute(t,e)}}function Y(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function K(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function J(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function tt(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function et(t){return function(){this.style.removeProperty(t)}}function nt(t,e,n){return function(){this.style.setProperty(t,e,n)}}function it(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function rt(t,e){return t.style.getPropertyValue(e)||tt(t).getComputedStyle(t,null).getPropertyValue(e)}function st(t){return function(){delete this[t]}}function ot(t,e){return function(){this[t]=e}}function at(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ht(t){return t.trim().split(/^|\s+/)}function lt(t){return t.classList||new ut(t)}function ut(t){this._node=t,this._names=ht(t.getAttribute("class")||"")}function ct(t,e){for(var n=lt(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function ft(t,e){for(var n=lt(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function pt(t){return function(){ct(this,t)}}function dt(t){return function(){ft(this,t)}}function gt(t,e){return function(){(e.apply(this,arguments)?ct:ft)(this,t)}}function mt(){this.textContent=""}function vt(t){return function(){this.textContent=t}}function yt(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function _t(){this.innerHTML=""}function bt(t){return function(){this.innerHTML=t}}function wt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function xt(){this.nextSibling&&this.parentNode.appendChild(this)}function At(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Lt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===U&&e.documentElement.namespaceURI===U?e.createElement(t):e.createElementNS(n,t)}}function St(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Mt(t){var e=B(t);return(e.local?St:Lt)(e)}function Et(){return null}function kt(){var t=this.parentNode;t&&t.removeChild(this)}function Ct(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Nt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}ut.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Tt={},Ot=null;function Pt(t,e,n){return t=Rt(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function Rt(t,e,n){return function(i){var r=Ot;Ot=i;try{t.call(this,this.__data__,e,n)}finally{Ot=r}}}function jt(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function zt(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,s=e.length;i<s;++i)n=e[i],t.type&&n.type!==t.type||n.name!==t.name?e[++r]=n:this.removeEventListener(n.type,n.listener,n.capture);++r?e.length=r:delete this.__on}}}function Ft(t,e,n){var i=Tt.hasOwnProperty(t.type)?Pt:Rt;return function(r,s,o){var a,h=this.__on,l=i(e,s,o);if(h)for(var u=0,c=h.length;u<c;++u)if((a=h[u]).type===t.type&&a.name===t.name)return this.removeEventListener(a.type,a.listener,a.capture),this.addEventListener(a.type,a.listener=l,a.capture=n),void(a.value=e);this.addEventListener(t.type,l,n),a={type:t.type,name:t.name,value:e,listener:l,capture:n},h?h.push(a):this.__on=[a]}}function Ht(t,e,n,i){var r=Ot;t.sourceEvent=Ot,Ot=t;try{return e.apply(n,i)}finally{Ot=r}}function qt(t,e,n){var i=tt(t),r=i.CustomEvent;"function"==typeof r?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function $t(t,e){return function(){return qt(this,t,e)}}function Vt(t,e){return function(){return qt(this,t,e.apply(this,arguments))}}"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(Tt={mouseenter:"mouseover",mouseleave:"mouseout"}));var Qt=[null];function It(t,e){this._groups=t,this._parents=e}function Wt(){return new It([[document.documentElement]],Qt)}It.prototype=Wt.prototype={constructor:It,select:function(t){"function"!=typeof t&&(t=z(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s,o,a=e[r],h=a.length,l=i[r]=new Array(h),u=0;u<h;++u)(s=a[u])&&(o=t.call(s,s.__data__,u,a))&&("__data__"in s&&(o.__data__=s.__data__),l[u]=o);return new It(i,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=H(t));for(var e=this._groups,n=e.length,i=[],r=[],s=0;s<n;++s)for(var o,a=e[s],h=a.length,l=0;l<h;++l)(o=a[l])&&(i.push(t.call(o,o.__data__,l,a)),r.push(o));return new It(i,r)},filter:function(t){"function"!=typeof t&&(t=q(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s,o=e[r],a=o.length,h=i[r]=[],l=0;l<a;++l)(s=o[l])&&t.call(s,s.__data__,l,o)&&h.push(s);return new It(i,this._parents)},data:function(t,e){if(!t)return d=new Array(this.size()),u=-1,this.each((function(t){d[++u]=t})),d;var n,i=e?I:Q,r=this._parents,s=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var o=s.length,a=new Array(o),h=new Array(o),l=new Array(o),u=0;u<o;++u){var c=r[u],f=s[u],p=f.length,d=t.call(c,c&&c.__data__,u,r),g=d.length,m=h[u]=new Array(g),v=a[u]=new Array(g);i(c,f,m,v,l[u]=new Array(p),d,e);for(var y,_,b=0,w=0;b<g;++b)if(y=m[b]){for(b>=w&&(w=b+1);!(_=v[w])&&++w<g;);y._next=_||null}}return(a=new It(a,r))._enter=h,a._exit=l,a},enter:function(){return new It(this._enter||this._groups.map($),this._parents)},exit:function(){return new It(this._exit||this._groups.map($),this._parents)},join:function(t,e,n){var i=this.enter(),r=this,s=this.exit();return i="function"==typeof t?t(i):i.append(t+""),null!=e&&(r=e(r)),null==n?s.remove():n(s),i&&r?i.merge(r).order():r},merge:function(t){for(var e=this._groups,n=t._groups,i=e.length,r=n.length,s=Math.min(i,r),o=new Array(i),a=0;a<s;++a)for(var h,l=e[a],u=n[a],c=l.length,f=o[a]=new Array(c),p=0;p<c;++p)(h=l[p]||u[p])&&(f[p]=h);for(;a<i;++a)o[a]=e[a];return new It(o,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i,r=t[e],s=r.length-1,o=r[s];--s>=0;)(i=r[s])&&(o&&4^i.compareDocumentPosition(o)&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=W);for(var n=this._groups,i=n.length,r=new Array(i),s=0;s<i;++s){for(var o,a=n[s],h=a.length,l=r[s]=new Array(h),u=0;u<h;++u)(o=a[u])&&(l[u]=o);l.sort(e)}return new It(r,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),e=-1;return this.each((function(){t[++e]=this})),t},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,s=i.length;r<s;++r){var o=i[r];if(o)return o}return null},size:function(){var t=0;return this.each((function(){++t})),t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r,s=e[n],o=0,a=s.length;o<a;++o)(r=s[o])&&t.call(r,r.__data__,o,s);return this},attr:function(t,e){var n=B(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==e?n.local?X:Z:"function"==typeof e?n.local?J:K:n.local?Y:G)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?et:"function"==typeof e?it:nt)(t,e,null==n?"":n)):rt(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?st:"function"==typeof e?at:ot)(t,e)):this.node()[t]},classed:function(t,e){var n=ht(t+"");if(arguments.length<2){for(var i=lt(this.node()),r=-1,s=n.length;++r<s;)if(!i.contains(n[r]))return!1;return!0}return this.each(("function"==typeof e?gt:e?pt:dt)(n,e))},text:function(t){return arguments.length?this.each(null==t?mt:("function"==typeof t?yt:vt)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?_t:("function"==typeof t?wt:bt)(t)):this.node().innerHTML},raise:function(){return this.each(xt)},lower:function(){return this.each(At)},append:function(t){var e="function"==typeof t?t:Mt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:Mt(t),i=null==e?Et:"function"==typeof e?e:z(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each(kt)},clone:function(t){return this.select(t?Nt:Ct)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,r,s=jt(t+""),o=s.length;if(!(arguments.length<2)){for(a=e?Ft:zt,null==n&&(n=!1),i=0;i<o;++i)this.each(a(s[i],e,n));return this}var a=this.node().__on;if(a)for(var h,l=0,u=a.length;l<u;++l)for(i=0,h=a[l];i<o;++i)if((r=s[i]).type===h.type&&r.name===h.name)return h.value},dispatch:function(t,e){return this.each(("function"==typeof e?Vt:$t)(t,e))}};const Ut=Wt;function Dt(t){return"string"==typeof t?new It([[document.querySelector(t)]],[document.documentElement]):new It([[t]],Qt)}function Bt(){Ot.preventDefault(),Ot.stopImmediatePropagation()}function Zt(t){var e=t.document.documentElement,n=Dt(t).on("dragstart.drag",Bt,!0);"onselectstart"in e?n.on("selectstart.drag",Bt,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Xt(t,e){var n=t.document.documentElement,i=Dt(t).on("dragstart.drag",null);e&&(i.on("click.drag",Bt,!0),setTimeout((function(){i.on("click.drag",null)}),0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function Gt(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Yt(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Kt(){}var Jt=.7,te=1/Jt,ee="\\s*([+-]?\\d+)\\s*",ne="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",ie="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",re=/^#([0-9a-f]{3,8})$/,se=new RegExp("^rgb\\("+[ee,ee,ee]+"\\)$"),oe=new RegExp("^rgb\\("+[ie,ie,ie]+"\\)$"),ae=new RegExp("^rgba\\("+[ee,ee,ee,ne]+"\\)$"),he=new RegExp("^rgba\\("+[ie,ie,ie,ne]+"\\)$"),le=new RegExp("^hsl\\("+[ne,ie,ie]+"\\)$"),ue=new RegExp("^hsla\\("+[ne,ie,ie,ne]+"\\)$"),ce={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function fe(){return this.rgb().formatHex()}function pe(){return this.rgb().formatRgb()}function de(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=re.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?ge(e):3===n?new _e(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?me(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?me(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=se.exec(t))?new _e(e[1],e[2],e[3],1):(e=oe.exec(t))?new _e(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=ae.exec(t))?me(e[1],e[2],e[3],e[4]):(e=he.exec(t))?me(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=le.exec(t))?Ae(e[1],e[2]/100,e[3]/100,1):(e=ue.exec(t))?Ae(e[1],e[2]/100,e[3]/100,e[4]):ce.hasOwnProperty(t)?ge(ce[t]):"transparent"===t?new _e(NaN,NaN,NaN,0):null}function ge(t){return new _e(t>>16&255,t>>8&255,255&t,1)}function me(t,e,n,i){return i<=0&&(t=e=n=NaN),new _e(t,e,n,i)}function ve(t){return t instanceof Kt||(t=de(t)),t?new _e((t=t.rgb()).r,t.g,t.b,t.opacity):new _e}function ye(t,e,n,i){return 1===arguments.length?ve(t):new _e(t,e,n,null==i?1:i)}function _e(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function be(){return"#"+xe(this.r)+xe(this.g)+xe(this.b)}function we(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function xe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ae(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Se(t,e,n,i)}function Le(t){if(t instanceof Se)return new Se(t.h,t.s,t.l,t.opacity);if(t instanceof Kt||(t=de(t)),!t)return new Se;if(t instanceof Se)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),s=Math.max(e,n,i),o=NaN,a=s-r,h=(s+r)/2;return a?(o=e===s?(n-i)/a+6*(n<i):n===s?(i-e)/a+2:(e-n)/a+4,a/=h<.5?s+r:2-s-r,o*=60):a=h>0&&h<1?0:o,new Se(o,a,h,t.opacity)}function Se(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function Me(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Ee(t,e,n,i,r){var s=t*t,o=s*t;return((1-3*t+3*s-o)*e+(4-6*s+3*o)*n+(1+3*t+3*s-3*o)*i+o*r)/6}function ke(t){return function(){return t}}function Ce(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):ke(isNaN(t)?e:t)}Gt(Kt,de,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:fe,formatHex:fe,formatHsl:function(){return Le(this).formatHsl()},formatRgb:pe,toString:pe}),Gt(_e,ye,Yt(Kt,{brighter:function(t){return t=null==t?te:Math.pow(te,t),new _e(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Jt:Math.pow(Jt,t),new _e(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:be,formatHex:be,formatRgb:we,toString:we})),Gt(Se,(function(t,e,n,i){return 1===arguments.length?Le(t):new Se(t,e,n,null==i?1:i)}),Yt(Kt,{brighter:function(t){return t=null==t?te:Math.pow(te,t),new Se(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Jt:Math.pow(Jt,t),new Se(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new _e(Me(t>=240?t-240:t+120,r,i),Me(t,r,i),Me(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));const Ne=function t(e){var n=function(t){return 1==(t=+t)?Ce:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):ke(isNaN(e)?n:e)}}(e);function i(t,e){var i=n((t=ye(t)).r,(e=ye(e)).r),r=n(t.g,e.g),s=n(t.b,e.b),o=Ce(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=s(e),t.opacity=o(e),t+""}}return i.gamma=t,i}(1);function Te(t){return function(e){var n,i,r=e.length,s=new Array(r),o=new Array(r),a=new Array(r);for(n=0;n<r;++n)i=ye(e[n]),s[n]=i.r||0,o[n]=i.g||0,a[n]=i.b||0;return s=t(s),o=t(o),a=t(a),i.opacity=1,function(t){return i.r=s(t),i.g=o(t),i.b=a(t),i+""}}}function Oe(t,e){var n,i=e?e.length:0,r=t?Math.min(i,t.length):0,s=new Array(r),o=new Array(i);for(n=0;n<r;++n)s[n]=$e(t[n],e[n]);for(;n<i;++n)o[n]=e[n];return function(t){for(n=0;n<r;++n)o[n]=s[n](t);return o}}function Pe(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function Re(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function je(t,e){var n,i={},r={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?i[n]=$e(t[n],e[n]):r[n]=e[n];return function(t){for(n in i)r[n]=i[n](t);return r}}Te((function(t){var e=t.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),r=t[i],s=t[i+1],o=i>0?t[i-1]:2*r-s,a=i<e-1?t[i+2]:2*s-r;return Ee((n-i/e)*e,o,r,s,a)}})),Te((function(t){var e=t.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*e),r=t[(i+e-1)%e],s=t[i%e],o=t[(i+1)%e],a=t[(i+2)%e];return Ee((n-i/e)*e,r,s,o,a)}}));var ze=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Fe=new RegExp(ze.source,"g");function He(t,e){var n,i,r,s=ze.lastIndex=Fe.lastIndex=0,o=-1,a=[],h=[];for(t+="",e+="";(n=ze.exec(t))&&(i=Fe.exec(e));)(r=i.index)>s&&(r=e.slice(s,r),a[o]?a[o]+=r:a[++o]=r),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,h.push({i:o,x:Re(n,i)})),s=Fe.lastIndex;return s<e.length&&(r=e.slice(s),a[o]?a[o]+=r:a[++o]=r),a.length<2?h[0]?function(t){return function(e){return t(e)+""}}(h[0].x):function(t){return function(){return t}}(e):(e=h.length,function(t){for(var n,i=0;i<e;++i)a[(n=h[i]).i]=n.x(t);return a.join("")})}function qe(t,e){e||(e=[]);var n,i=t?Math.min(e.length,t.length):0,r=e.slice();return function(s){for(n=0;n<i;++n)r[n]=t[n]*(1-s)+e[n]*s;return r}}function $e(t,e){var n,i,r=typeof e;return null==e||"boolean"===r?ke(e):("number"===r?Re:"string"===r?(n=de(e))?(e=n,Ne):He:e instanceof de?Ne:e instanceof Date?Pe:(i=e,!ArrayBuffer.isView(i)||i instanceof DataView?Array.isArray(e)?Oe:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?je:Re:qe))(t,e)}function Ve(){for(var t,e=Ot;t=e.sourceEvent;)e=t;return e}function Qe(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}function Ie(t,e,n){arguments.length<3&&(n=e,e=Ve().changedTouches);for(var i,r=0,s=e?e.length:0;r<s;++r)if((i=e[r]).identifier===n)return Qe(t,i);return null}function We(t){var e=Ve();return e.changedTouches&&(e=e.changedTouches[0]),Qe(t,e)}var Ue,De,Be=0,Ze=0,Xe=0,Ge=0,Ye=0,Ke=0,Je="object"==typeof performance&&performance.now?performance:Date,tn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function en(){return Ye||(tn(nn),Ye=Je.now()+Ke)}function nn(){Ye=0}function rn(){this._call=this._time=this._next=null}function sn(t,e,n){var i=new rn;return i.restart(t,e,n),i}function on(){Ye=(Ge=Je.now())+Ke,Be=Ze=0;try{!function(){en(),++Be;for(var t,e=Ue;e;)(t=Ye-e._time)>=0&&e._call.call(null,t),e=e._next;--Be}()}finally{Be=0,function(){for(var t,e,n=Ue,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Ue=e);De=t,hn(i)}(),Ye=0}}function an(){var t=Je.now(),e=t-Ge;e>1e3&&(Ke-=e,Ge=t)}function hn(t){Be||(Ze&&(Ze=clearTimeout(Ze)),t-Ye>24?(t<1/0&&(Ze=setTimeout(on,t-Je.now()-Ke)),Xe&&(Xe=clearInterval(Xe))):(Xe||(Ge=Je.now(),Xe=setInterval(an,1e3)),Be=1,tn(on)))}function ln(t,e,n){var i=new rn;return e=null==e?0:+e,i.restart((function(n){i.stop(),t(n+e)}),e,n),i}rn.prototype=sn.prototype={constructor:rn,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?en():+n)+(null==e?0:+e),this._next||De===this||(De?De._next=this:Ue=this,De=this),this._call=t,this._time=n,hn()},stop:function(){this._call&&(this._call=null,this._time=1/0,hn())}};var un=R("start","end","cancel","interrupt"),cn=[];function fn(t,e,n,i,r,s){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var i,r=t.__transition;function s(h){var l,u,c,f;if(1!==n.state)return a();for(l in r)if((f=r[l]).name===n.name){if(3===f.state)return ln(s);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete r[l]):+l<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete r[l])}if(ln((function(){3===n.state&&(n.state=4,n.timer.restart(o,n.delay,n.time),o(h))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,i=new Array(c=n.tween.length),l=0,u=-1;l<c;++l)(f=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function o(e){for(var r=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(a),n.state=5,1),s=-1,o=i.length;++s<o;)i[s].call(t,r);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),a())}function a(){for(var i in n.state=6,n.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=n,n.timer=sn((function(t){n.state=1,n.timer.restart(s,n.delay,n.time),n.delay<=t&&s(t-n.delay)}),0,n.time)}(t,n,{name:e,index:i,group:r,on:un,tween:cn,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:0})}function pn(t,e){var n=gn(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function dn(t,e){var n=gn(t,e);if(n.state>3)throw new Error("too late; already running");return n}function gn(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function mn(t,e){var n,i,r,s=t.__transition,o=!0;if(s){for(r in e=null==e?null:e+"",s)(n=s[r]).name===e?(i=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete s[r]):o=!1;o&&delete t.__transition}}var vn,yn,_n,bn,wn=180/Math.PI,xn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function An(t,e,n,i,r,s){var o,a,h;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(h=t*n+e*i)&&(n-=t*h,i-=e*h),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,h/=a),t*i<e*n&&(t=-t,e=-e,h=-h,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(e,t)*wn,skewX:Math.atan(h)*wn,scaleX:o,scaleY:a}}function Ln(t,e,n,i){function r(t){return t.length?t.pop()+" ":""}return function(s,o){var a=[],h=[];return s=t(s),o=t(o),function(t,i,r,s,o,a){if(t!==r||i!==s){var h=o.push("translate(",null,e,null,n);a.push({i:h-4,x:Re(t,r)},{i:h-2,x:Re(i,s)})}else(r||s)&&o.push("translate("+r+e+s+n)}(s.translateX,s.translateY,o.translateX,o.translateY,a,h),function(t,e,n,s){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),s.push({i:n.push(r(n)+"rotate(",null,i)-2,x:Re(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(s.rotate,o.rotate,a,h),function(t,e,n,s){t!==e?s.push({i:n.push(r(n)+"skewX(",null,i)-2,x:Re(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(s.skewX,o.skewX,a,h),function(t,e,n,i,s,o){if(t!==n||e!==i){var a=s.push(r(s)+"scale(",null,",",null,")");o.push({i:a-4,x:Re(t,n)},{i:a-2,x:Re(e,i)})}else 1===n&&1===i||s.push(r(s)+"scale("+n+","+i+")")}(s.scaleX,s.scaleY,o.scaleX,o.scaleY,a,h),s=o=null,function(t){for(var e,n=-1,i=h.length;++n<i;)a[(e=h[n]).i]=e.x(t);return a.join("")}}}var Sn=Ln((function(t){return"none"===t?xn:(vn||(vn=document.createElement("DIV"),yn=document.documentElement,_n=document.defaultView),vn.style.transform=t,t=_n.getComputedStyle(yn.appendChild(vn),null).getPropertyValue("transform"),yn.removeChild(vn),An(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}),"px, ","px)","deg)"),Mn=Ln((function(t){return null==t?xn:(bn||(bn=document.createElementNS("http://www.w3.org/2000/svg","g")),bn.setAttribute("transform",t),(t=bn.transform.baseVal.consolidate())?An((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):xn)}),", ",")",")");function En(t,e){var n,i;return function(){var r=dn(this,t),s=r.tween;if(s!==n)for(var o=0,a=(i=n=s).length;o<a;++o)if(i[o].name===e){(i=i.slice()).splice(o,1);break}r.tween=i}}function kn(t,e,n){var i,r;if("function"!=typeof n)throw new Error;return function(){var s=dn(this,t),o=s.tween;if(o!==i){r=(i=o).slice();for(var a={name:e,value:n},h=0,l=r.length;h<l;++h)if(r[h].name===e){r[h]=a;break}h===l&&r.push(a)}s.tween=r}}function Cn(t,e,n){var i=t._id;return t.each((function(){var t=dn(this,i);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return gn(t,i).value[e]}}function Nn(t,e){var n;return("number"==typeof e?Re:e instanceof de?Ne:(n=de(e))?(e=n,Ne):He)(t,e)}function Tn(t){return function(){this.removeAttribute(t)}}function On(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Pn(t,e,n){var i,r,s=n+"";return function(){var o=this.getAttribute(t);return o===s?null:o===i?r:r=e(i=o,n)}}function Rn(t,e,n){var i,r,s=n+"";return function(){var o=this.getAttributeNS(t.space,t.local);return o===s?null:o===i?r:r=e(i=o,n)}}function jn(t,e,n){var i,r,s;return function(){var o,a,h=n(this);if(null!=h)return(o=this.getAttribute(t))===(a=h+"")?null:o===i&&a===r?s:(r=a,s=e(i=o,h));this.removeAttribute(t)}}function zn(t,e,n){var i,r,s;return function(){var o,a,h=n(this);if(null!=h)return(o=this.getAttributeNS(t.space,t.local))===(a=h+"")?null:o===i&&a===r?s:(r=a,s=e(i=o,h));this.removeAttributeNS(t.space,t.local)}}function Fn(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Hn(t,e){return function(