@equinor/esv-intersection 3.0.9 → 3.0.10
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/dist/components/axis.d.ts +1 -2
- package/dist/components/axis.d.ts.map +1 -1
- package/dist/control/ExtendedCurveInterpolator.d.ts.map +1 -1
- package/dist/control/IntersectionReferenceSystem.d.ts +2 -6
- package/dist/control/IntersectionReferenceSystem.d.ts.map +1 -1
- package/dist/control/LayerManager.d.ts +2 -2
- package/dist/control/LayerManager.d.ts.map +1 -1
- package/dist/control/MainController.d.ts +3 -3
- package/dist/control/MainController.d.ts.map +1 -1
- package/dist/control/ZoomPanHandler.d.ts +5 -4
- package/dist/control/ZoomPanHandler.d.ts.map +1 -1
- package/dist/control/interfaces.d.ts +3 -4
- package/dist/control/interfaces.d.ts.map +1 -1
- package/dist/control/overlay.d.ts +3 -3
- package/dist/control/overlay.d.ts.map +1 -1
- package/dist/datautils/colortable.d.ts +1 -1
- package/dist/datautils/colortable.d.ts.map +1 -1
- package/dist/datautils/findsample.d.ts.map +1 -1
- package/dist/datautils/schematicShapeGenerator.d.ts +3 -3
- package/dist/datautils/schematicShapeGenerator.d.ts.map +1 -1
- package/dist/datautils/seismicimage.d.ts.map +1 -1
- package/dist/datautils/trajectory.d.ts +1 -1
- package/dist/datautils/trajectory.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1373 -1272
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/interfaces.d.ts +1 -2
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/layers/CalloutCanvasLayer.d.ts +2 -2
- package/dist/layers/CalloutCanvasLayer.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/ComplexRopeGeometry.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRopeGeometry.d.ts.map +1 -1
- package/dist/layers/GeomodelCanvasLayer.d.ts +1 -1
- package/dist/layers/GeomodelCanvasLayer.d.ts.map +1 -1
- package/dist/layers/GeomodelLabelsLayer.d.ts +4 -4
- package/dist/layers/GeomodelLabelsLayer.d.ts.map +1 -1
- package/dist/layers/GeomodelLayerV2.d.ts.map +1 -1
- package/dist/layers/GridLayer.d.ts.map +1 -1
- package/dist/layers/ImageCanvasLayer.d.ts +1 -1
- package/dist/layers/ImageCanvasLayer.d.ts.map +1 -1
- package/dist/layers/ReferenceLineLayer.d.ts +1 -2
- package/dist/layers/ReferenceLineLayer.d.ts.map +1 -1
- package/dist/layers/SchematicLayer.d.ts.map +1 -1
- package/dist/layers/WellborePathLayer.d.ts +1 -1
- package/dist/layers/WellborePathLayer.d.ts.map +1 -1
- package/dist/layers/base/CanvasLayer.d.ts +3 -3
- package/dist/layers/base/CanvasLayer.d.ts.map +1 -1
- package/dist/layers/base/HTMLLayer.d.ts +1 -1
- package/dist/layers/base/HTMLLayer.d.ts.map +1 -1
- package/dist/layers/base/Layer.d.ts +10 -10
- package/dist/layers/base/Layer.d.ts.map +1 -1
- package/dist/layers/base/PixiLayer.d.ts +4 -4
- package/dist/layers/base/PixiLayer.d.ts.map +1 -1
- package/dist/layers/base/SVGLayer.d.ts +1 -1
- package/dist/layers/base/SVGLayer.d.ts.map +1 -1
- package/dist/utils/arc-length.d.ts.map +1 -1
- package/dist/utils/color.d.ts.map +1 -1
- package/dist/utils/root-finder.d.ts +1 -1
- package/dist/utils/root-finder.d.ts.map +1 -1
- package/dist/utils/text.d.ts +2 -2
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/vectorUtils.d.ts.map +1 -1
- package/dist/vendor/pixi-dashed-line/index.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/components/axis.ts +23 -30
- package/src/control/ExtendedCurveInterpolator.ts +7 -7
- package/src/control/IntersectionReferenceSystem.ts +33 -41
- package/src/control/LayerManager.ts +33 -31
- package/src/control/MainController.ts +5 -7
- package/src/control/ZoomPanHandler.ts +50 -45
- package/src/control/interfaces.ts +3 -3
- package/src/control/overlay.ts +20 -16
- package/src/datautils/colortable.ts +4 -4
- package/src/datautils/findsample.ts +8 -7
- package/src/datautils/picks.ts +13 -13
- package/src/datautils/schematicShapeGenerator.ts +47 -17
- package/src/datautils/seismicimage.ts +12 -13
- package/src/datautils/surfacedata.ts +27 -26
- package/src/datautils/trajectory.ts +34 -32
- package/src/interfaces.ts +1 -1
- package/src/layers/CalloutCanvasLayer.ts +55 -58
- package/src/layers/CustomDisplayObjects/ComplexRopeGeometry.ts +23 -20
- package/src/layers/CustomDisplayObjects/FixedWidthSimpleRopeGeometry.ts +9 -10
- package/src/layers/CustomDisplayObjects/UniformTextureStretchRopeGeometry.ts +13 -13
- package/src/layers/GeomodelCanvasLayer.ts +43 -36
- package/src/layers/GeomodelLabelsLayer.ts +99 -96
- package/src/layers/GeomodelLayerV2.ts +11 -11
- package/src/layers/GridLayer.ts +25 -21
- package/src/layers/ImageCanvasLayer.ts +17 -11
- package/src/layers/ReferenceLineLayer.ts +53 -45
- package/src/layers/SchematicLayer.ts +78 -75
- package/src/layers/WellborePathLayer.ts +48 -46
- package/src/layers/base/CanvasLayer.ts +18 -18
- package/src/layers/base/HTMLLayer.ts +5 -5
- package/src/layers/base/Layer.ts +18 -18
- package/src/layers/base/PixiLayer.ts +24 -20
- package/src/layers/base/SVGLayer.ts +5 -5
- package/src/utils/arc-length.ts +3 -10
- package/src/utils/binary-search.ts +2 -2
- package/src/utils/color.ts +9 -5
- package/src/utils/root-finder.ts +4 -4
- package/src/utils/text.ts +5 -5
- package/src/utils/vectorUtils.ts +13 -6
- package/src/vendor/pixi-dashed-line/index.ts +3 -2
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(A,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("pixi.js")):typeof define=="function"&&define.amd?define(["exports","pixi.js"],k):(A=typeof globalThis<"u"?globalThis:A||self,k(A.esvintersection={},A.PIXI))})(this,function(A,k){"use strict";function Ts(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ot=Ts(k);function Ms(e){return e}var Ue=1,ie=2,Ye=3,re=4,qn=1e-6;function As(e){return"translate("+e+",0)"}function Ps(e){return"translate(0,"+e+")"}function Cs(e){return t=>+e(t)}function Ls(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function ks(){return!this.__axis}function Zn(e,t){var n=[],i=null,r=null,s=6,o=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,h=e===Ue||e===re?-1:1,l=e===re||e===ie?"x":"y",u=e===Ue||e===Ye?As:Ps;function f(p){var d=i??(t.ticks?t.ticks.apply(t,n):t.domain()),g=r??(t.tickFormat?t.tickFormat.apply(t,n):Ms),y=Math.max(s,0)+a,_=t.range(),v=+_[0]+c,x=+_[_.length-1]+c,P=(t.bandwidth?Ls:Cs)(t.copy(),c),b=p.selection?p.selection():p,S=b.selectAll(".domain").data([null]),T=b.selectAll(".tick").data(d,t).order(),O=T.exit(),E=T.enter().append("g").attr("class","tick"),I=T.select("line"),L=T.select("text");S=S.merge(S.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(E),I=I.merge(E.append("line").attr("stroke","currentColor").attr(l+"2",h*s)),L=L.merge(E.append("text").attr("fill","currentColor").attr(l,h*y).attr("dy",e===Ue?"0em":e===Ye?"0.71em":"0.32em")),p!==b&&(S=S.transition(p),T=T.transition(p),I=I.transition(p),L=L.transition(p),O=O.transition(p).attr("opacity",qn).attr("transform",function(D){return isFinite(D=P(D))?u(D+c):this.getAttribute("transform")}),E.attr("opacity",qn).attr("transform",function(D){var B=this.parentNode.__axis;return u((B&&isFinite(B=B(D))?B:P(D))+c)})),O.remove(),S.attr("d",e===re||e===ie?o?"M"+h*o+","+v+"H"+c+"V"+x+"H"+h*o:"M"+c+","+v+"V"+x:o?"M"+v+","+h*o+"V"+c+"H"+x+"V"+h*o:"M"+v+","+c+"H"+x),T.attr("opacity",1).attr("transform",function(D){return u(P(D)+c)}),I.attr(l+"2",h*s),L.attr(l,h*y).text(g),b.filter(ks).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===ie?"start":e===re?"end":"middle"),b.each(function(){this.__axis=P})}return f.scale=function(p){return arguments.length?(t=p,f):t},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(p){return arguments.length?(n=p==null?[]:Array.from(p),f):n.slice()},f.tickValues=function(p){return arguments.length?(i=p==null?null:Array.from(p),f):i&&i.slice()},f.tickFormat=function(p){return arguments.length?(r=p,f):r},f.tickSize=function(p){return arguments.length?(s=o=+p,f):s},f.tickSizeInner=function(p){return arguments.length?(s=+p,f):s},f.tickSizeOuter=function(p){return arguments.length?(o=+p,f):o},f.tickPadding=function(p){return arguments.length?(a=+p,f):a},f.offset=function(p){return arguments.length?(c=+p,f):c},f}function Es(e){return Zn(ie,e)}function Fs(e){return Zn(Ye,e)}function se(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Rs(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Kn(e){let t,n,i;e.length!==2?(t=se,n=(a,c)=>se(e(a),c),i=(a,c)=>e(a)-c):(t=e===se||e===Rs?e:Os,n=e,i=e);function r(a,c,h=0,l=a.length){if(h<l){if(t(c,c)!==0)return l;do{const u=h+l>>>1;n(a[u],c)<0?h=u+1:l=u}while(h<l)}return h}function s(a,c,h=0,l=a.length){if(h<l){if(t(c,c)!==0)return l;do{const u=h+l>>>1;n(a[u],c)<=0?h=u+1:l=u}while(h<l)}return h}function o(a,c,h=0,l=a.length){const u=r(a,c,h,l-1);return u>h&&i(a[u-1],c)>-i(a[u],c)?u-1:u}return{left:r,center:o,right:s}}function Os(){return 0}function zs(e){return e===null?NaN:+e}const Ds=Kn(se).right;Kn(zs).center;const Ns=Ds;class Qn extends Map{constructor(t,n=Bs){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[i,r]of t)this.set(i,r)}get(t){return super.get(Jn(this,t))}has(t){return super.has(Jn(this,t))}set(t,n){return super.set($s(this,t),n)}delete(t){return super.delete(Is(this,t))}}function Jn({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):n}function $s({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):(e.set(i,n),n)}function Is({_intern:e,_key:t},n){const i=t(n);return e.has(i)&&(n=e.get(n),e.delete(i)),n}function Bs(e){return e!==null&&typeof e=="object"?e.valueOf():e}const Hs=Math.sqrt(50),Vs=Math.sqrt(10),Us=Math.sqrt(2);function oe(e,t,n){const i=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),o=s>=Hs?10:s>=Vs?5:s>=Us?2:1;let a,c,h;return r<0?(h=Math.pow(10,-r)/o,a=Math.round(e*h),c=Math.round(t*h),a/h<e&&++a,c/h>t&&--c,h=-h):(h=Math.pow(10,r)*o,a=Math.round(e/h),c=Math.round(t/h),a*h<e&&++a,c*h>t&&--c),c<a&&.5<=n&&n<2?oe(e,t,n*2):[a,c,h]}function Ys(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const i=t<e,[r,s,o]=i?oe(t,e,n):oe(e,t,n);if(!(s>=r))return[];const a=s-r+1,c=new Array(a);if(i)if(o<0)for(let h=0;h<a;++h)c[h]=(s-h)/-o;else for(let h=0;h<a;++h)c[h]=(s-h)*o;else if(o<0)for(let h=0;h<a;++h)c[h]=(r+h)/-o;else for(let h=0;h<a;++h)c[h]=(r+h)*o;return c}function We(e,t,n){return t=+t,e=+e,n=+n,oe(e,t,n)[2]}function Ws(e,t,n){t=+t,e=+e,n=+n;const i=t<e,r=i?We(t,e,n):We(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}function Ge(e,t){let n;if(t===void 0)for(const i of e)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);else{let i=-1;for(let r of e)(r=t(r,++i,e))!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}return n}function Xe(e,t){let n=0;if(t===void 0)for(let i of e)(i=+i)&&(n+=i);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function ti(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const ei=Symbol("implicit");function ni(){var e=new Qn,t=[],n=[],i=ei;function r(s){let o=e.get(s);if(o===void 0){if(i!==ei)return i;e.set(s,o=t.push(s)-1)}return n[o%n.length]}return r.domain=function(s){if(!arguments.length)return t.slice();t=[],e=new Qn;for(const o of s)e.has(o)||e.set(o,t.push(o)-1);return r},r.range=function(s){return arguments.length?(n=Array.from(s),r):n.slice()},r.unknown=function(s){return arguments.length?(i=s,r):i},r.copy=function(){return ni(t,n).unknown(i)},ti.apply(r,arguments),r}function je(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ii(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function Bt(){}var Ht=.7,ae=1/Ht,kt="\\s*([+-]?\\d+)\\s*",Vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",at="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gs=/^#([0-9a-f]{3,8})$/,Xs=new RegExp(`^rgb\\(${kt},${kt},${kt}\\)$`),js=new RegExp(`^rgb\\(${at},${at},${at}\\)$`),qs=new RegExp(`^rgba\\(${kt},${kt},${kt},${Vt}\\)$`),Zs=new RegExp(`^rgba\\(${at},${at},${at},${Vt}\\)$`),Ks=new RegExp(`^hsl\\(${Vt},${at},${at}\\)$`),Qs=new RegExp(`^hsla\\(${Vt},${at},${at},${Vt}\\)$`),ri={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};je(Bt,lt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:si,formatHex:si,formatHex8:Js,formatHsl:to,formatRgb:oi,toString:oi});function si(){return this.rgb().formatHex()}function Js(){return this.rgb().formatHex8()}function to(){return ui(this).formatHsl()}function oi(){return this.rgb().formatRgb()}function lt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Gs.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ai(t):n===3?new W(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ce(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ce(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Xs.exec(e))?new W(t[1],t[2],t[3],1):(t=js.exec(e))?new W(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=qs.exec(e))?ce(t[1],t[2],t[3],t[4]):(t=Zs.exec(e))?ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ks.exec(e))?li(t[1],t[2]/100,t[3]/100,1):(t=Qs.exec(e))?li(t[1],t[2]/100,t[3]/100,t[4]):ri.hasOwnProperty(e)?ai(ri[e]):e==="transparent"?new W(NaN,NaN,NaN,0):null}function ai(e){return new W(e>>16&255,e>>8&255,e&255,1)}function ce(e,t,n,i){return i<=0&&(e=t=n=NaN),new W(e,t,n,i)}function eo(e){return e instanceof Bt||(e=lt(e)),e?(e=e.rgb(),new W(e.r,e.g,e.b,e.opacity)):new W}function qe(e,t,n,i){return arguments.length===1?eo(e):new W(e,t,n,i??1)}function W(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}je(W,qe,ii(Bt,{brighter(e){return e=e==null?ae:Math.pow(ae,e),new W(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ht:Math.pow(Ht,e),new W(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new W(Tt(this.r),Tt(this.g),Tt(this.b),he(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ci,formatHex:ci,formatHex8:no,formatRgb:hi,toString:hi}));function ci(){return`#${Mt(this.r)}${Mt(this.g)}${Mt(this.b)}`}function no(){return`#${Mt(this.r)}${Mt(this.g)}${Mt(this.b)}${Mt((isNaN(this.opacity)?1:this.opacity)*255)}`}function hi(){const e=he(this.opacity);return`${e===1?"rgb(":"rgba("}${Tt(this.r)}, ${Tt(this.g)}, ${Tt(this.b)}${e===1?")":`, ${e})`}`}function he(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Tt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mt(e){return e=Tt(e),(e<16?"0":"")+e.toString(16)}function li(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new J(e,t,n,i)}function ui(e){if(e instanceof J)return new J(e.h,e.s,e.l,e.opacity);if(e instanceof Bt||(e=lt(e)),!e)return new J;if(e instanceof J)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),o=NaN,a=s-r,c=(s+r)/2;return a?(t===s?o=(n-i)/a+(n<i)*6:n===s?o=(i-t)/a+2:o=(t-n)/a+4,a/=c<.5?s+r:2-s-r,o*=60):a=c>0&&c<1?0:o,new J(o,a,c,e.opacity)}function io(e,t,n,i){return arguments.length===1?ui(e):new J(e,t,n,i??1)}function J(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}je(J,io,ii(Bt,{brighter(e){return e=e==null?ae:Math.pow(ae,e),new J(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ht:Math.pow(Ht,e),new J(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new W(Ze(e>=240?e-240:e+120,r,i),Ze(e,r,i),Ze(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new J(fi(this.h),le(this.s),le(this.l),he(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=he(this.opacity);return`${e===1?"hsl(":"hsla("}${fi(this.h)}, ${le(this.s)*100}%, ${le(this.l)*100}%${e===1?")":`, ${e})`}`}}));function fi(e){return e=(e||0)%360,e<0?e+360:e}function le(e){return Math.max(0,Math.min(1,e||0))}function Ze(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ke=e=>()=>e;function ro(e,t){return function(n){return e+n*t}}function so(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function oo(e){return(e=+e)==1?di:function(t,n){return n-t?so(t,n,e):Ke(isNaN(t)?n:t)}}function di(e,t){var n=t-e;return n?ro(e,n):Ke(isNaN(e)?t:e)}const Ut=function e(t){var n=oo(t);function i(r,s){var o=n((r=qe(r)).r,(s=qe(s)).r),a=n(r.g,s.g),c=n(r.b,s.b),h=di(r.opacity,s.opacity);return function(l){return r.r=o(l),r.g=a(l),r.b=c(l),r.opacity=h(l),r+""}}return i.gamma=e,i}(1);function ao(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),r;return function(s){for(r=0;r<n;++r)i[r]=e[r]*(1-s)+t[r]*s;return i}}function co(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ho(e,t){var n=t?t.length:0,i=e?Math.min(n,e.length):0,r=new Array(i),s=new Array(n),o;for(o=0;o<i;++o)r[o]=tn(e[o],t[o]);for(;o<n;++o)s[o]=t[o];return function(a){for(o=0;o<i;++o)s[o]=r[o](a);return s}}function lo(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function tt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function uo(e,t){var n={},i={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=tn(e[r],t[r]):i[r]=t[r];return function(s){for(r in n)i[r]=n[r](s);return i}}var Qe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Je=new RegExp(Qe.source,"g");function fo(e){return function(){return e}}function po(e){return function(t){return e(t)+""}}function pi(e,t){var n=Qe.lastIndex=Je.lastIndex=0,i,r,s,o=-1,a=[],c=[];for(e=e+"",t=t+"";(i=Qe.exec(e))&&(r=Je.exec(t));)(s=r.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(i=i[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:tt(i,r)})),n=Je.lastIndex;return n<t.length&&(s=t.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?c[0]?po(c[0].x):fo(t):(t=c.length,function(h){for(var l=0,u;l<t;++l)a[(u=c[l]).i]=u.x(h);return a.join("")})}function tn(e,t){var n=typeof t,i;return t==null||n==="boolean"?Ke(t):(n==="number"?tt:n==="string"?(i=lt(t))?(t=i,Ut):pi:t instanceof lt?Ut:t instanceof Date?lo:co(t)?ao:Array.isArray(t)?ho:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?uo:tt)(e,t)}function go(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var gi=180/Math.PI,en={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mi(e,t,n,i,r,s){var o,a,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*i)&&(n-=e*c,i-=t*c),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,c/=a),e*i<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*gi,skewX:Math.atan(c)*gi,scaleX:o,scaleY:a}}var ue;function mo(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?en:mi(t.a,t.b,t.c,t.d,t.e,t.f)}function yo(e){return e==null||(ue||(ue=document.createElementNS("http://www.w3.org/2000/svg","g")),ue.setAttribute("transform",e),!(e=ue.transform.baseVal.consolidate()))?en:(e=e.matrix,mi(e.a,e.b,e.c,e.d,e.e,e.f))}function yi(e,t,n,i){function r(h){return h.length?h.pop()+" ":""}function s(h,l,u,f,p,d){if(h!==u||l!==f){var g=p.push("translate(",null,t,null,n);d.push({i:g-4,x:tt(h,u)},{i:g-2,x:tt(l,f)})}else(u||f)&&p.push("translate("+u+t+f+n)}function o(h,l,u,f){h!==l?(h-l>180?l+=360:l-h>180&&(h+=360),f.push({i:u.push(r(u)+"rotate(",null,i)-2,x:tt(h,l)})):l&&u.push(r(u)+"rotate("+l+i)}function a(h,l,u,f){h!==l?f.push({i:u.push(r(u)+"skewX(",null,i)-2,x:tt(h,l)}):l&&u.push(r(u)+"skewX("+l+i)}function c(h,l,u,f,p,d){if(h!==u||l!==f){var g=p.push(r(p)+"scale(",null,",",null,")");d.push({i:g-4,x:tt(h,u)},{i:g-2,x:tt(l,f)})}else(u!==1||f!==1)&&p.push(r(p)+"scale("+u+","+f+")")}return function(h,l){var u=[],f=[];return h=e(h),l=e(l),s(h.translateX,h.translateY,l.translateX,l.translateY,u,f),o(h.rotate,l.rotate,u,f),a(h.skewX,l.skewX,u,f),c(h.scaleX,h.scaleY,l.scaleX,l.scaleY,u,f),h=l=null,function(p){for(var d=-1,g=f.length,y;++d<g;)u[(y=f[d]).i]=y.x(p);return u.join("")}}}var _o=yi(mo,"px, ","px)","deg)"),vo=yi(yo,", ",")",")"),xo=1e-12;function _i(e){return((e=Math.exp(e))+1/e)/2}function wo(e){return((e=Math.exp(e))-1/e)/2}function bo(e){return((e=Math.exp(2*e))-1)/(e+1)}const So=function e(t,n,i){function r(s,o){var a=s[0],c=s[1],h=s[2],l=o[0],u=o[1],f=o[2],p=l-a,d=u-c,g=p*p+d*d,y,_;if(g<xo)_=Math.log(f/h)/t,y=function(T){return[a+T*p,c+T*d,h*Math.exp(t*T*_)]};else{var v=Math.sqrt(g),x=(f*f-h*h+i*g)/(2*h*n*v),P=(f*f-h*h-i*g)/(2*f*n*v),b=Math.log(Math.sqrt(x*x+1)-x),S=Math.log(Math.sqrt(P*P+1)-P);_=(S-b)/t,y=function(T){var O=T*_,E=_i(b),I=h/(n*v)*(E*bo(t*O+b)-wo(b));return[a+I*p,c+I*d,h*E/_i(t*O+b)]}}return y.duration=_*1e3*t/Math.SQRT2,y}return r.rho=function(s){var o=Math.max(.001,+s),a=o*o,c=a*a;return e(o,a,c)},r}(Math.SQRT2,2,4);function To(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}function Mo(e){return function(){return e}}function Ao(e){return+e}var vi=[0,1];function Et(e){return e}function nn(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Mo(isNaN(t)?NaN:.5)}function Po(e,t){var n;return e>t&&(n=e,e=t,t=n),function(i){return Math.max(e,Math.min(t,i))}}function Co(e,t,n){var i=e[0],r=e[1],s=t[0],o=t[1];return r<i?(i=nn(r,i),s=n(o,s)):(i=nn(i,r),s=n(s,o)),function(a){return s(i(a))}}function Lo(e,t,n){var i=Math.min(e.length,t.length)-1,r=new Array(i),s=new Array(i),o=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<i;)r[o]=nn(e[o],e[o+1]),s[o]=n(t[o],t[o+1]);return function(a){var c=Ns(e,a,1,i)-1;return s[c](r[c](a))}}function ko(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Eo(){var e=vi,t=vi,n=tn,i,r,s,o=Et,a,c,h;function l(){var f=Math.min(e.length,t.length);return o!==Et&&(o=Po(e[0],e[f-1])),a=f>2?Lo:Co,c=h=null,u}function u(f){return f==null||isNaN(f=+f)?s:(c||(c=a(e.map(i),t,n)))(i(o(f)))}return u.invert=function(f){return o(r((h||(h=a(t,e.map(i),tt)))(f)))},u.domain=function(f){return arguments.length?(e=Array.from(f,Ao),l()):e.slice()},u.range=function(f){return arguments.length?(t=Array.from(f),l()):t.slice()},u.rangeRound=function(f){return t=Array.from(f),n=go,l()},u.clamp=function(f){return arguments.length?(o=f?!0:Et,l()):o!==Et},u.interpolate=function(f){return arguments.length?(n=f,l()):n},u.unknown=function(f){return arguments.length?(s=f,u):s},function(f,p){return i=f,r=p,l()}}function Fo(){return Eo()(Et,Et)}function Ro(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function fe(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function Ft(e){return e=fe(Math.abs(e)),e?e[1]:NaN}function Oo(e,t){return function(n,i){for(var r=n.length,s=[],o=0,a=e[0],c=0;r>0&&a>0&&(c+a+1>i&&(a=Math.max(1,i-c)),s.push(n.substring(r-=a,r+a)),!((c+=a+1)>i));)a=e[o=(o+1)%e.length];return s.reverse().join(t)}}function zo(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Do=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function de(e){if(!(t=Do.exec(e)))throw new Error("invalid format: "+e);var t;return new rn({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}de.prototype=rn.prototype;function rn(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}rn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function No(e){t:for(var t=e.length,n=1,i=-1,r;n<t;++n)switch(e[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+e[n])break t;i>0&&(i=0);break}return i>0?e.slice(0,i)+e.slice(r+1):e}var xi;function $o(e,t){var n=fe(e,t);if(!n)return e+"";var i=n[0],r=n[1],s=r-(xi=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+fe(e,Math.max(0,t+s-1))[0]}function wi(e,t){var n=fe(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const bi={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ro,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>wi(e*100,t),r:wi,s:$o,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Si(e){return e}var Ti=Array.prototype.map,Mi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Io(e){var t=e.grouping===void 0||e.thousands===void 0?Si:Oo(Ti.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",i=e.currency===void 0?"":e.currency[1]+"",r=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?Si:zo(Ti.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function h(u){u=de(u);var f=u.fill,p=u.align,d=u.sign,g=u.symbol,y=u.zero,_=u.width,v=u.comma,x=u.precision,P=u.trim,b=u.type;b==="n"?(v=!0,b="g"):bi[b]||(x===void 0&&(x=12),P=!0,b="g"),(y||f==="0"&&p==="=")&&(y=!0,f="0",p="=");var S=g==="$"?n:g==="#"&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",T=g==="$"?i:/[%p]/.test(b)?o:"",O=bi[b],E=/[defgprs%]/.test(b);x=x===void 0?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function I(L){var D=S,B=T,m,M,w;if(b==="c")B=O(L)+B,L="";else{L=+L;var C=L<0||1/L<0;if(L=isNaN(L)?c:O(Math.abs(L),x),P&&(L=No(L)),C&&+L==0&&d!=="+"&&(C=!1),D=(C?d==="("?d:a:d==="-"||d==="("?"":d)+D,B=(b==="s"?Mi[8+xi/3]:"")+B+(C&&d==="("?")":""),E){for(m=-1,M=L.length;++m<M;)if(w=L.charCodeAt(m),48>w||w>57){B=(w===46?r+L.slice(m+1):L.slice(m))+B,L=L.slice(0,m);break}}}v&&!y&&(L=t(L,1/0));var F=D.length+L.length+B.length,R=F<_?new Array(_-F+1).join(f):"";switch(v&&y&&(L=t(R+L,R.length?_-B.length:1/0),R=""),p){case"<":L=D+L+B+R;break;case"=":L=D+R+L+B;break;case"^":L=R.slice(0,F=R.length>>1)+D+L+B+R.slice(F);break;default:L=R+D+L+B;break}return s(L)}return I.toString=function(){return u+""},I}function l(u,f){var p=h((u=de(u),u.type="f",u)),d=Math.max(-8,Math.min(8,Math.floor(Ft(f)/3)))*3,g=Math.pow(10,-d),y=Mi[8+d/3];return function(_){return p(g*_)+y}}return{format:h,formatPrefix:l}}var pe,Ai,Pi;Bo({thousands:",",grouping:[3],currency:["$",""]});function Bo(e){return pe=Io(e),Ai=pe.format,Pi=pe.formatPrefix,pe}function Ho(e){return Math.max(0,-Ft(Math.abs(e)))}function Vo(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ft(t)/3)))*3-Ft(Math.abs(e)))}function Uo(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ft(t)-Ft(e))+1}function Yo(e,t,n,i){var r=Ws(e,t,n),s;switch(i=de(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return i.precision==null&&!isNaN(s=Vo(r,o))&&(i.precision=s),Pi(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(s=Uo(r,Math.max(Math.abs(e),Math.abs(t))))&&(i.precision=s-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(s=Ho(r))&&(i.precision=s-(i.type==="%")*2);break}}return Ai(i)}function Wo(e){var t=e.domain;return e.ticks=function(n){var i=t();return Ys(i[0],i[i.length-1],n??10)},e.tickFormat=function(n,i){var r=t();return Yo(r[0],r[r.length-1],n??10,i)},e.nice=function(n){n==null&&(n=10);var i=t(),r=0,s=i.length-1,o=i[r],a=i[s],c,h,l=10;for(a<o&&(h=o,o=a,a=h,h=r,r=s,s=h);l-- >0;){if(h=We(o,a,n),h===c)return i[r]=o,i[s]=a,t(i);if(h>0)o=Math.floor(o/h)*h,a=Math.ceil(a/h)*h;else if(h<0)o=Math.ceil(o*h)/h,a=Math.floor(a*h)/h;else break;c=h}return e},e}function At(){var e=Fo();return e.copy=function(){return ko(e,At())},ti.apply(e,arguments),Wo(e)}class Ci{constructor(t,n=!0,i,r,s,o){this._showLabels=!0,this._offsetX=0,this._offsetY=0,this._flipX=!1,this._flipY=!1,this.visible=!0,this.createOrGet=a=>{const{mainGroup:c}=this;let h=c.select(`g.${a}`);return h.empty()&&(h=c.append("g").attr("class",a)),h},this.mainGroup=t,this._showLabels=n,this._labelXDesc=i,this._labelYDesc=r,this._unitOfMeasure=s,o&&o.offsetX&&(this._offsetX=o.offsetX),o&&o.offsetX&&(this._offsetY=o.offsetY),o&&o.visible&&(this.visible=o.visible),this.mainGroup.style("pointer-events","none"),this._scaleX=At().domain([0,1]).range([0,1]),this._scaleY=At().domain([0,1]).range([0,1])}renderLabelx(){const{_labelXDesc:t,_unitOfMeasure:n,_showLabels:i,_scaleX:r}=this,[,s]=r.range(),o=this.renderGx();let a=o.select("text.axis-labelx");return i?a.empty()&&(a=o.append("text").attr("class","axis-labelx").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(`${t} (${n})`)):a.remove(),a.attr("transform",`translate(${s/2},-4)`),a}renderLabely(){const{_labelYDesc:t,_unitOfMeasure:n,_showLabels:i,_scaleY:r}=this,[,s]=r.range(),o=this.renderGy();let a=o.select("text.axis-labely");return i?(a.empty()&&(a=o.append("text").attr("class","axis-labely").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(`${t} (${n})`)),a.attr("transform",`translate(-10,${s/2})rotate(90)`)):a.remove(),a}renderGy(){const{_scaleX:t,_scaleY:n}=this,i=Es(n),[,r]=t.range(),s=this.createOrGet("y-axis");return s.call(i),s.attr("transform",`translate(${r},0)`),s}renderGx(){const{_scaleX:t,_scaleY:n}=this,i=Fs(t),[,r]=n.range(),s=this.createOrGet("x-axis");return s.attr("transform",`translate(0 ${r})`),s.call(i),s}render(){this.renderLabelx(),this.renderLabely()}onResize(t){this.mainGroup.attr("height",`${t.height}px`).attr("width",`${t.width}px`)}onRescale(t){const{_scaleX:n,_scaleY:i,offsetX:r,offsetY:s}=this,{xScale:o,yScale:a}=t,c=o.domain(),h=a.domain(),l=o.range(),u=a.range();n.domain([c[0]-r,c[1]-r]).range(l),i.domain([h[0]-s,h[1]-s]).range(u),this.flipX(this._flipX),this.flipY(this._flipY),this.visible&&this.render()}show(){return this.visible=!0,this.mainGroup.attr("visibility","visible"),this.render(),this}hide(){return this.visible=!1,this.mainGroup.attr("visibility","hidden"),this}flipX(t){this._flipX=t;const n=this._scaleX.domain(),i=t?-1:1;return this._scaleX.domain([i*n[0],i*n[1]]),this}flipY(t){this._flipY=t;const n=this._scaleY.domain(),i=t?-1:1;return this._scaleY.domain([i*n[0],i*n[1]]),this}showLabels(){return this._showLabels=!0,this.render(),this}hideLabels(){return this._showLabels=!1,this.render(),this}setLabelX(t){return this._labelXDesc=t,this}setLabelY(t){return this._labelYDesc=t,this}setUnitOfMeasure(t){return this._unitOfMeasure=t,this}setLabels(t,n,i){return this._labelXDesc=t,this._labelYDesc=n,this._unitOfMeasure=i,this}get offsetX(){return this._offsetX}set offsetX(t){this._offsetX=t}get offsetY(){return this._offsetY}set offsetY(t){this._offsetY=t}get scaleX(){return this._scaleX.copy()}get scaleY(){return this._scaleY.copy()}}var Go=Math.PI/180;function gt(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e<t?t:e>n?n:e}function Xo(e){return e*Go}function Li(e){var t=new Array(e),n=1/(e-1);t[0]=0;for(var i=1;i<e-1;i++)t[i]=i*n;return t[e-1]=1,t}function Yt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]+t[i];return n}function Wt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]-t[i];return n}function Pt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]*t;return n}function jo(e){for(var t=0,n=0;n<e.length;n++)t+=Math.pow(e[n],2);return t}function Gt(e){var t=jo(e);return t===0?t:Math.sqrt(t)}function ki(e,t){t===void 0&&(t=e);var n=Gt(e);return n===0?qo(0,t):Pt(e,1/n,t)}function qo(e,t){for(var n=0;n<t.length;n++)t[n]=e;return t}function Zo(e,t){for(var n=0,i=0;i<e.length;i++)n+=Math.pow(t[i]-e[i],2);return n===0?n:Math.sqrt(n)}function Ko(e,t){for(var n=0,i=0;i<e.length;i++)n+=e[i]*t[i];return n}function Qo(e,t,n,i){i===void 0&&(i=e);for(var r=gt(n,0,1),s=1-r,o=0;o<e.length;o++)i[o]=e[o]*s+t[o]*r;return i}function Jo(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function Ei(e,t){t===void 0&&(t=0),t===void 0&&(t=0);for(var n=0;n<e.length;n++)if(Math.abs(e[n])>t)return!1;return!0}var sn=180/Math.PI,ta=Math.PI/180;function on(e,t,n){var i=Math.cos(t),r=Math.sin(t),s=e[0];return n[0]=i*s-r*e[1],n[1]=r*s+i*e[1],n}function Fi(e){return Math.atan2(e[1],e[0])}function Xt(e,t){var n=Math.atan2(t[1],t[0])-Math.atan2(e[1],e[0]);return n>Math.PI?n-=2*Math.PI:n<=-Math.PI&&(n+=2*Math.PI),n}var N=function(){function e(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];this.isMutating=!1,this.length=2,typeof t=="number"?typeof n[0]=="number"?(this[0]=t,this[1]=n[0]):(this[0]=t,this[1]=t):"x"in t&&"y"in t?(this[0]=t.x,this[1]=t.y):(this[0]=t[0],this[1]=t[1])}return Object.defineProperty(e.prototype,"x",{get:function(){return this[0]},set:function(t){this[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this[1]},set:function(t){this[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"magnitude",{get:function(){return Gt(this)},set:function(t){var n=Gt(this);Pt(this,t/n,this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mutable",{get:function(){return this.isMutating=!0,this},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"immutable",{get:function(){return this.isMutating=!1,this},enumerable:!0,configurable:!0}),e.prototype.set=function(t,n){return typeof t=="number"?typeof n=="number"?(this[0]=t,this[1]=n):(this[0]=t,this[1]=t):(this[0]=t[0],this[1]=t[1]),this},e.prototype.add=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?Yt(this,[t,n]):Yt(this.clone(),[t,n]):this.isMutating?Yt(this,t):Yt(this.clone(),t)},e.add=function(t,n){var i=new e(t);return Yt(i,n)},e.prototype.sub=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?Wt(this,[t,n]):Wt(this.clone(),[t,n]):this.isMutating?Wt(this,t):Wt(this.clone(),t)},e.sub=function(t,n){var i=new e(t);return Wt(i,n)},e.prototype.subFrom=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?(this[0]=t-this[0],this[1]=n-this[1],this):new e(t-this[0],n-this[1]):this.isMutating?(this[0]=t[0]-this[0],this[1]=t[1]-this[1],this):new e(t[0]-this[0],t[1]-this[1])},e.divide=function(t,n){var i=new e(t);return Pt(i,1/n)},e.multiply=function(t,n){var i=new e(t);return Pt(i,n)},e.prototype.scale=function(t){return Pt(this,t,this.isMutating?this:e.zero)},e.prototype.rescale=function(t){var n=Gt(this);return n<=0?this.isMutating?this:e.zero:Pt(this,t/n,this.isMutating?this:e.zero)},e.prototype.clampMagnitude=function(t){var n=Gt(this);return n>t?Pt(this,t/n,this.isMutating?this:e.zero):this.isMutating?this:this.clone()},e.prototype.rotate=function(t){return on(this,t,this.isMutating?this:e.zero)},e.prototype.rotateDeg=function(t){return on(this,t*ta,this.isMutating?this:e.zero)},e.prototype.rotate90=function(){return t=this,n=this.isMutating?this:e.zero,i=t[0],n[0]=-t[1],n[1]=i,n;var t,n,i},e.prototype.rotate180=function(){return t=this,(n=this.isMutating?this:e.zero)[0]=-t[0],n[1]=-t[1],n;var t,n},e.prototype.rotate270=function(){return t=this,n=this.isMutating?this:e.zero,i=t[0],n[0]=t[1],n[1]=-i,n;var t,n,i},e.prototype.normalize=function(){return ki(this)},e.prototype.normalized=function(){return ki(this,e.zero)},e.distance=function(t,n){return Zo(t,n)},e.dot=function(t,n){return Ko(t,n)},e.cross=function(t,n){return function(i,r){return i[0]*r[1]-i[1]*r[0]}(t,n)},e.angleRight=function(t){return Fi(t)},e.angleRightDeg=function(t){return Fi(t)*sn},e.angle=function(t,n){return Math.abs(Xt(t,n))},e.angleDeg=function(t,n){return Math.abs(Xt(t,n))*sn},e.signedAngle=function(t,n){return Xt(t,n)},e.signedAngleDeg=function(t,n){return Xt(t,n)*sn},e.lerp=function(t,n,i){var r=new e(t);return Qo(r,n,i)},e.lerpRot=function(t,n,i){return function(r,s,o,a){return a===void 0&&(a=r),on(r,o*Xt(r,s),a)}(t,n,i,e.zero)},e.prototype.clone=function(){return new e(this[0],this[1])},e.equals=function(t,n,i){return i===void 0&&(i=0),!(Math.abs(t[0]-n[0])>i)&&!(Math.abs(t[1]-n[1])>i)},e.prototype.equals=function(t,n){return n===void 0&&(n=0),e.equals(this,t,n)},e.isZeroVector=function(t,n){return n===void 0&&(n=0),Ei(t,n)},e.prototype.isZeroVector=function(t){return t===void 0&&(t=0),Ei(this,t)},e.prototype.toArray=function(){return[this[0],this[1]]},e.prototype.modify=function(t){return Jo(this,t)},e.prototype[Symbol.iterator]=function(){var t=this,n=0;return{next:function(){switch(n++){case 0:return{value:t[0],done:!1};case 1:return{value:t[1],done:!1};default:return{value:-1,done:!0}}}}},Object.defineProperty(e,"zero",{get:function(){return new e(0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"one",{get:function(){return new e(1,1)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"positiveInfinity",{get:function(){return new e(1/0,1/0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"negativeInfinity",{get:function(){return new e(-1/0,-1/0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"up",{get:function(){return new e(0,1)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"right",{get:function(){return new e(1,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"down",{get:function(){return new e(0,-1)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"left",{get:function(){return new e(-1,0)},enumerable:!0,configurable:!0}),e}();/*! *****************************************************************************
|
|
1
|
+
(function(C,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("pixi.js")):typeof define=="function"&&define.amd?define(["exports","pixi.js"],E):(C=typeof globalThis<"u"?globalThis:C||self,E(C.esvintersection={},C.PIXI))})(this,function(C,E){"use strict";function Ts(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ot=Ts(E);function Ms(e){return e}var Ue=1,ie=2,We=3,re=4,jn=1e-6;function As(e){return"translate("+e+",0)"}function Cs(e){return"translate(0,"+e+")"}function Ps(e){return t=>+e(t)}function Ls(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function ks(){return!this.__axis}function Zn(e,t){var n=[],i=null,r=null,s=6,o=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,h=e===Ue||e===re?-1:1,l=e===re||e===ie?"x":"y",u=e===Ue||e===We?As:Cs;function f(d){var g=i??(t.ticks?t.ticks.apply(t,n):t.domain()),p=r??(t.tickFormat?t.tickFormat.apply(t,n):Ms),y=Math.max(s,0)+a,m=t.range(),_=+m[0]+c,x=+m[m.length-1]+c,M=(t.bandwidth?Ls:Ps)(t.copy(),c),S=d.selection?d.selection():d,w=S.selectAll(".domain").data([null]),T=S.selectAll(".tick").data(g,t).order(),F=T.exit(),k=T.enter().append("g").attr("class","tick"),N=T.select("line"),P=T.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(k),N=N.merge(k.append("line").attr("stroke","currentColor").attr(l+"2",h*s)),P=P.merge(k.append("text").attr("fill","currentColor").attr(l,h*y).attr("dy",e===Ue?"0em":e===We?"0.71em":"0.32em")),d!==S&&(w=w.transition(d),T=T.transition(d),N=N.transition(d),P=P.transition(d),F=F.transition(d).attr("opacity",jn).attr("transform",function(z){return isFinite(z=M(z))?u(z+c):this.getAttribute("transform")}),k.attr("opacity",jn).attr("transform",function(z){var B=this.parentNode.__axis;return u((B&&isFinite(B=B(z))?B:M(z))+c)})),F.remove(),w.attr("d",e===re||e===ie?o?"M"+h*o+","+_+"H"+c+"V"+x+"H"+h*o:"M"+c+","+_+"V"+x:o?"M"+_+","+h*o+"V"+c+"H"+x+"V"+h*o:"M"+_+","+c+"H"+x),T.attr("opacity",1).attr("transform",function(z){return u(M(z)+c)}),N.attr(l+"2",h*s),P.attr(l,h*y).text(p),S.filter(ks).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===ie?"start":e===re?"end":"middle"),S.each(function(){this.__axis=M})}return f.scale=function(d){return arguments.length?(t=d,f):t},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),f):n.slice()},f.tickValues=function(d){return arguments.length?(i=d==null?null:Array.from(d),f):i&&i.slice()},f.tickFormat=function(d){return arguments.length?(r=d,f):r},f.tickSize=function(d){return arguments.length?(s=o=+d,f):s},f.tickSizeInner=function(d){return arguments.length?(s=+d,f):s},f.tickSizeOuter=function(d){return arguments.length?(o=+d,f):o},f.tickPadding=function(d){return arguments.length?(a=+d,f):a},f.offset=function(d){return arguments.length?(c=+d,f):c},f}function Es(e){return Zn(ie,e)}function Fs(e){return Zn(We,e)}function se(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Rs(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Kn(e){let t,n,i;e.length!==2?(t=se,n=(a,c)=>se(e(a),c),i=(a,c)=>e(a)-c):(t=e===se||e===Rs?e:Os,n=e,i=e);function r(a,c,h=0,l=a.length){if(h<l){if(t(c,c)!==0)return l;do{const u=h+l>>>1;n(a[u],c)<0?h=u+1:l=u}while(h<l)}return h}function s(a,c,h=0,l=a.length){if(h<l){if(t(c,c)!==0)return l;do{const u=h+l>>>1;n(a[u],c)<=0?h=u+1:l=u}while(h<l)}return h}function o(a,c,h=0,l=a.length){const u=r(a,c,h,l-1);return u>h&&i(a[u-1],c)>-i(a[u],c)?u-1:u}return{left:r,center:o,right:s}}function Os(){return 0}function zs(e){return e===null?NaN:+e}const Ds=Kn(se).right;Kn(zs).center;const Ns=Ds;class Qn extends Map{constructor(t,n=Bs){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[i,r]of t)this.set(i,r)}get(t){return super.get(Jn(this,t))}has(t){return super.has(Jn(this,t))}set(t,n){return super.set($s(this,t),n)}delete(t){return super.delete(Is(this,t))}}function Jn({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):n}function $s({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):(e.set(i,n),n)}function Is({_intern:e,_key:t},n){const i=t(n);return e.has(i)&&(n=e.get(n),e.delete(i)),n}function Bs(e){return e!==null&&typeof e=="object"?e.valueOf():e}const Hs=Math.sqrt(50),Vs=Math.sqrt(10),Us=Math.sqrt(2);function oe(e,t,n){const i=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),o=s>=Hs?10:s>=Vs?5:s>=Us?2:1;let a,c,h;return r<0?(h=Math.pow(10,-r)/o,a=Math.round(e*h),c=Math.round(t*h),a/h<e&&++a,c/h>t&&--c,h=-h):(h=Math.pow(10,r)*o,a=Math.round(e/h),c=Math.round(t/h),a*h<e&&++a,c*h>t&&--c),c<a&&.5<=n&&n<2?oe(e,t,n*2):[a,c,h]}function Ws(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const i=t<e,[r,s,o]=i?oe(t,e,n):oe(e,t,n);if(!(s>=r))return[];const a=s-r+1,c=new Array(a);if(i)if(o<0)for(let h=0;h<a;++h)c[h]=(s-h)/-o;else for(let h=0;h<a;++h)c[h]=(s-h)*o;else if(o<0)for(let h=0;h<a;++h)c[h]=(r+h)/-o;else for(let h=0;h<a;++h)c[h]=(r+h)*o;return c}function Ye(e,t,n){return t=+t,e=+e,n=+n,oe(e,t,n)[2]}function Ys(e,t,n){t=+t,e=+e,n=+n;const i=t<e,r=i?Ye(t,e,n):Ye(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}function Ge(e,t){let n;if(t===void 0)for(const i of e)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);else{let i=-1;for(let r of e)(r=t(r,++i,e))!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}return n}function Xe(e,t){let n=0;if(t===void 0)for(let i of e)(i=+i)&&(n+=i);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function ti(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const ei=Symbol("implicit");function ni(){var e=new Qn,t=[],n=[],i=ei;function r(s){let o=e.get(s);if(o===void 0){if(i!==ei)return i;e.set(s,o=t.push(s)-1)}return n[o%n.length]}return r.domain=function(s){if(!arguments.length)return t.slice();t=[],e=new Qn;for(const o of s)e.has(o)||e.set(o,t.push(o)-1);return r},r.range=function(s){return arguments.length?(n=Array.from(s),r):n.slice()},r.unknown=function(s){return arguments.length?(i=s,r):i},r.copy=function(){return ni(t,n).unknown(i)},ti.apply(r,arguments),r}function qe(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ii(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function Ht(){}var Vt=.7,ae=1/Vt,Et="\\s*([+-]?\\d+)\\s*",Ut="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",at="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gs=/^#([0-9a-f]{3,8})$/,Xs=new RegExp(`^rgb\\(${Et},${Et},${Et}\\)$`),qs=new RegExp(`^rgb\\(${at},${at},${at}\\)$`),js=new RegExp(`^rgba\\(${Et},${Et},${Et},${Ut}\\)$`),Zs=new RegExp(`^rgba\\(${at},${at},${at},${Ut}\\)$`),Ks=new RegExp(`^hsl\\(${Ut},${at},${at}\\)$`),Qs=new RegExp(`^hsla\\(${Ut},${at},${at},${Ut}\\)$`),ri={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};qe(Ht,ut,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:si,formatHex:si,formatHex8:Js,formatHsl:to,formatRgb:oi,toString:oi});function si(){return this.rgb().formatHex()}function Js(){return this.rgb().formatHex8()}function to(){return ui(this).formatHsl()}function oi(){return this.rgb().formatRgb()}function ut(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Gs.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ai(t):n===3?new G(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ce(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ce(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Xs.exec(e))?new G(t[1],t[2],t[3],1):(t=qs.exec(e))?new G(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=js.exec(e))?ce(t[1],t[2],t[3],t[4]):(t=Zs.exec(e))?ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ks.exec(e))?li(t[1],t[2]/100,t[3]/100,1):(t=Qs.exec(e))?li(t[1],t[2]/100,t[3]/100,t[4]):ri.hasOwnProperty(e)?ai(ri[e]):e==="transparent"?new G(NaN,NaN,NaN,0):null}function ai(e){return new G(e>>16&255,e>>8&255,e&255,1)}function ce(e,t,n,i){return i<=0&&(e=t=n=NaN),new G(e,t,n,i)}function eo(e){return e instanceof Ht||(e=ut(e)),e?(e=e.rgb(),new G(e.r,e.g,e.b,e.opacity)):new G}function je(e,t,n,i){return arguments.length===1?eo(e):new G(e,t,n,i??1)}function G(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}qe(G,je,ii(Ht,{brighter(e){return e=e==null?ae:Math.pow(ae,e),new G(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Vt:Math.pow(Vt,e),new G(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new G(Mt(this.r),Mt(this.g),Mt(this.b),he(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ci,formatHex:ci,formatHex8:no,formatRgb:hi,toString:hi}));function ci(){return`#${At(this.r)}${At(this.g)}${At(this.b)}`}function no(){return`#${At(this.r)}${At(this.g)}${At(this.b)}${At((isNaN(this.opacity)?1:this.opacity)*255)}`}function hi(){const e=he(this.opacity);return`${e===1?"rgb(":"rgba("}${Mt(this.r)}, ${Mt(this.g)}, ${Mt(this.b)}${e===1?")":`, ${e})`}`}function he(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Mt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function At(e){return e=Mt(e),(e<16?"0":"")+e.toString(16)}function li(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new et(e,t,n,i)}function ui(e){if(e instanceof et)return new et(e.h,e.s,e.l,e.opacity);if(e instanceof Ht||(e=ut(e)),!e)return new et;if(e instanceof et)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),o=NaN,a=s-r,c=(s+r)/2;return a?(t===s?o=(n-i)/a+(n<i)*6:n===s?o=(i-t)/a+2:o=(t-n)/a+4,a/=c<.5?s+r:2-s-r,o*=60):a=c>0&&c<1?0:o,new et(o,a,c,e.opacity)}function io(e,t,n,i){return arguments.length===1?ui(e):new et(e,t,n,i??1)}function et(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}qe(et,io,ii(Ht,{brighter(e){return e=e==null?ae:Math.pow(ae,e),new et(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Vt:Math.pow(Vt,e),new et(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new G(Ze(e>=240?e-240:e+120,r,i),Ze(e,r,i),Ze(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new et(fi(this.h),le(this.s),le(this.l),he(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=he(this.opacity);return`${e===1?"hsl(":"hsla("}${fi(this.h)}, ${le(this.s)*100}%, ${le(this.l)*100}%${e===1?")":`, ${e})`}`}}));function fi(e){return e=(e||0)%360,e<0?e+360:e}function le(e){return Math.max(0,Math.min(1,e||0))}function Ze(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ke=e=>()=>e;function ro(e,t){return function(n){return e+n*t}}function so(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function oo(e){return(e=+e)==1?di:function(t,n){return n-t?so(t,n,e):Ke(isNaN(t)?n:t)}}function di(e,t){var n=t-e;return n?ro(e,n):Ke(isNaN(e)?t:e)}const Wt=function e(t){var n=oo(t);function i(r,s){var o=n((r=je(r)).r,(s=je(s)).r),a=n(r.g,s.g),c=n(r.b,s.b),h=di(r.opacity,s.opacity);return function(l){return r.r=o(l),r.g=a(l),r.b=c(l),r.opacity=h(l),r+""}}return i.gamma=e,i}(1);function ao(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),r;return function(s){for(r=0;r<n;++r)i[r]=e[r]*(1-s)+t[r]*s;return i}}function co(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ho(e,t){var n=t?t.length:0,i=e?Math.min(n,e.length):0,r=new Array(i),s=new Array(n),o;for(o=0;o<i;++o)r[o]=tn(e[o],t[o]);for(;o<n;++o)s[o]=t[o];return function(a){for(o=0;o<i;++o)s[o]=r[o](a);return s}}function lo(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function nt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function uo(e,t){var n={},i={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=tn(e[r],t[r]):i[r]=t[r];return function(s){for(r in n)i[r]=n[r](s);return i}}var Qe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Je=new RegExp(Qe.source,"g");function fo(e){return function(){return e}}function go(e){return function(t){return e(t)+""}}function gi(e,t){var n=Qe.lastIndex=Je.lastIndex=0,i,r,s,o=-1,a=[],c=[];for(e=e+"",t=t+"";(i=Qe.exec(e))&&(r=Je.exec(t));)(s=r.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(i=i[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:nt(i,r)})),n=Je.lastIndex;return n<t.length&&(s=t.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?c[0]?go(c[0].x):fo(t):(t=c.length,function(h){for(var l=0,u;l<t;++l)a[(u=c[l]).i]=u.x(h);return a.join("")})}function tn(e,t){var n=typeof t,i;return t==null||n==="boolean"?Ke(t):(n==="number"?nt:n==="string"?(i=ut(t))?(t=i,Wt):gi:t instanceof ut?Wt:t instanceof Date?lo:co(t)?ao:Array.isArray(t)?ho:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?uo:nt)(e,t)}function po(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var pi=180/Math.PI,en={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mi(e,t,n,i,r,s){var o,a,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*i)&&(n-=e*c,i-=t*c),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,c/=a),e*i<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*pi,skewX:Math.atan(c)*pi,scaleX:o,scaleY:a}}var ue;function mo(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?en:mi(t.a,t.b,t.c,t.d,t.e,t.f)}function yo(e){return e==null||(ue||(ue=document.createElementNS("http://www.w3.org/2000/svg","g")),ue.setAttribute("transform",e),!(e=ue.transform.baseVal.consolidate()))?en:(e=e.matrix,mi(e.a,e.b,e.c,e.d,e.e,e.f))}function yi(e,t,n,i){function r(h){return h.length?h.pop()+" ":""}function s(h,l,u,f,d,g){if(h!==u||l!==f){var p=d.push("translate(",null,t,null,n);g.push({i:p-4,x:nt(h,u)},{i:p-2,x:nt(l,f)})}else(u||f)&&d.push("translate("+u+t+f+n)}function o(h,l,u,f){h!==l?(h-l>180?l+=360:l-h>180&&(h+=360),f.push({i:u.push(r(u)+"rotate(",null,i)-2,x:nt(h,l)})):l&&u.push(r(u)+"rotate("+l+i)}function a(h,l,u,f){h!==l?f.push({i:u.push(r(u)+"skewX(",null,i)-2,x:nt(h,l)}):l&&u.push(r(u)+"skewX("+l+i)}function c(h,l,u,f,d,g){if(h!==u||l!==f){var p=d.push(r(d)+"scale(",null,",",null,")");g.push({i:p-4,x:nt(h,u)},{i:p-2,x:nt(l,f)})}else(u!==1||f!==1)&&d.push(r(d)+"scale("+u+","+f+")")}return function(h,l){var u=[],f=[];return h=e(h),l=e(l),s(h.translateX,h.translateY,l.translateX,l.translateY,u,f),o(h.rotate,l.rotate,u,f),a(h.skewX,l.skewX,u,f),c(h.scaleX,h.scaleY,l.scaleX,l.scaleY,u,f),h=l=null,function(d){for(var g=-1,p=f.length,y;++g<p;)u[(y=f[g]).i]=y.x(d);return u.join("")}}}var _o=yi(mo,"px, ","px)","deg)"),vo=yi(yo,", ",")",")"),xo=1e-12;function _i(e){return((e=Math.exp(e))+1/e)/2}function wo(e){return((e=Math.exp(e))-1/e)/2}function bo(e){return((e=Math.exp(2*e))-1)/(e+1)}const So=function e(t,n,i){function r(s,o){var a=s[0],c=s[1],h=s[2],l=o[0],u=o[1],f=o[2],d=l-a,g=u-c,p=d*d+g*g,y,m;if(p<xo)m=Math.log(f/h)/t,y=function(T){return[a+T*d,c+T*g,h*Math.exp(t*T*m)]};else{var _=Math.sqrt(p),x=(f*f-h*h+i*p)/(2*h*n*_),M=(f*f-h*h-i*p)/(2*f*n*_),S=Math.log(Math.sqrt(x*x+1)-x),w=Math.log(Math.sqrt(M*M+1)-M);m=(w-S)/t,y=function(T){var F=T*m,k=_i(S),N=h/(n*_)*(k*bo(t*F+S)-wo(S));return[a+N*d,c+N*g,h*k/_i(t*F+S)]}}return y.duration=m*1e3*t/Math.SQRT2,y}return r.rho=function(s){var o=Math.max(.001,+s),a=o*o,c=a*a;return e(o,a,c)},r}(Math.SQRT2,2,4);function To(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}function Mo(e){return function(){return e}}function Ao(e){return+e}var vi=[0,1];function Ft(e){return e}function nn(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Mo(isNaN(t)?NaN:.5)}function Co(e,t){var n;return e>t&&(n=e,e=t,t=n),function(i){return Math.max(e,Math.min(t,i))}}function Po(e,t,n){var i=e[0],r=e[1],s=t[0],o=t[1];return r<i?(i=nn(r,i),s=n(o,s)):(i=nn(i,r),s=n(s,o)),function(a){return s(i(a))}}function Lo(e,t,n){var i=Math.min(e.length,t.length)-1,r=new Array(i),s=new Array(i),o=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<i;)r[o]=nn(e[o],e[o+1]),s[o]=n(t[o],t[o+1]);return function(a){var c=Ns(e,a,1,i)-1;return s[c](r[c](a))}}function ko(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Eo(){var e=vi,t=vi,n=tn,i,r,s,o=Ft,a,c,h;function l(){var f=Math.min(e.length,t.length);return o!==Ft&&(o=Co(e[0],e[f-1])),a=f>2?Lo:Po,c=h=null,u}function u(f){return f==null||isNaN(f=+f)?s:(c||(c=a(e.map(i),t,n)))(i(o(f)))}return u.invert=function(f){return o(r((h||(h=a(t,e.map(i),nt)))(f)))},u.domain=function(f){return arguments.length?(e=Array.from(f,Ao),l()):e.slice()},u.range=function(f){return arguments.length?(t=Array.from(f),l()):t.slice()},u.rangeRound=function(f){return t=Array.from(f),n=po,l()},u.clamp=function(f){return arguments.length?(o=f?!0:Ft,l()):o!==Ft},u.interpolate=function(f){return arguments.length?(n=f,l()):n},u.unknown=function(f){return arguments.length?(s=f,u):s},function(f,d){return i=f,r=d,l()}}function Fo(){return Eo()(Ft,Ft)}function Ro(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function fe(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function Rt(e){return e=fe(Math.abs(e)),e?e[1]:NaN}function Oo(e,t){return function(n,i){for(var r=n.length,s=[],o=0,a=e[0],c=0;r>0&&a>0&&(c+a+1>i&&(a=Math.max(1,i-c)),s.push(n.substring(r-=a,r+a)),!((c+=a+1)>i));)a=e[o=(o+1)%e.length];return s.reverse().join(t)}}function zo(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Do=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function de(e){if(!(t=Do.exec(e)))throw new Error("invalid format: "+e);var t;return new rn({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}de.prototype=rn.prototype;function rn(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}rn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function No(e){t:for(var t=e.length,n=1,i=-1,r;n<t;++n)switch(e[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+e[n])break t;i>0&&(i=0);break}return i>0?e.slice(0,i)+e.slice(r+1):e}var xi;function $o(e,t){var n=fe(e,t);if(!n)return e+"";var i=n[0],r=n[1],s=r-(xi=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+fe(e,Math.max(0,t+s-1))[0]}function wi(e,t){var n=fe(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const bi={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ro,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>wi(e*100,t),r:wi,s:$o,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Si(e){return e}var Ti=Array.prototype.map,Mi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Io(e){var t=e.grouping===void 0||e.thousands===void 0?Si:Oo(Ti.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",i=e.currency===void 0?"":e.currency[1]+"",r=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?Si:zo(Ti.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function h(u){u=de(u);var f=u.fill,d=u.align,g=u.sign,p=u.symbol,y=u.zero,m=u.width,_=u.comma,x=u.precision,M=u.trim,S=u.type;S==="n"?(_=!0,S="g"):bi[S]||(x===void 0&&(x=12),M=!0,S="g"),(y||f==="0"&&d==="=")&&(y=!0,f="0",d="=");var w=p==="$"?n:p==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",T=p==="$"?i:/[%p]/.test(S)?o:"",F=bi[S],k=/[defgprs%]/.test(S);x=x===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function N(P){var z=w,B=T,v,A,b;if(S==="c")B=F(P)+B,P="";else{P=+P;var L=P<0||1/P<0;if(P=isNaN(P)?c:F(Math.abs(P),x),M&&(P=No(P)),L&&+P==0&&g!=="+"&&(L=!1),z=(L?g==="("?g:a:g==="-"||g==="("?"":g)+z,B=(S==="s"?Mi[8+xi/3]:"")+B+(L&&g==="("?")":""),k){for(v=-1,A=P.length;++v<A;)if(b=P.charCodeAt(v),48>b||b>57){B=(b===46?r+P.slice(v+1):P.slice(v))+B,P=P.slice(0,v);break}}}_&&!y&&(P=t(P,1/0));var R=z.length+P.length+B.length,O=R<m?new Array(m-R+1).join(f):"";switch(_&&y&&(P=t(O+P,O.length?m-B.length:1/0),O=""),d){case"<":P=z+P+B+O;break;case"=":P=z+O+P+B;break;case"^":P=O.slice(0,R=O.length>>1)+z+P+B+O.slice(R);break;default:P=O+z+P+B;break}return s(P)}return N.toString=function(){return u+""},N}function l(u,f){var d=h((u=de(u),u.type="f",u)),g=Math.max(-8,Math.min(8,Math.floor(Rt(f)/3)))*3,p=Math.pow(10,-g),y=Mi[8+g/3];return function(m){return d(p*m)+y}}return{format:h,formatPrefix:l}}var ge,Ai,Ci;Bo({thousands:",",grouping:[3],currency:["$",""]});function Bo(e){return ge=Io(e),Ai=ge.format,Ci=ge.formatPrefix,ge}function Ho(e){return Math.max(0,-Rt(Math.abs(e)))}function Vo(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Rt(t)/3)))*3-Rt(Math.abs(e)))}function Uo(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Rt(t)-Rt(e))+1}function Wo(e,t,n,i){var r=Ys(e,t,n),s;switch(i=de(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return i.precision==null&&!isNaN(s=Vo(r,o))&&(i.precision=s),Ci(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(s=Uo(r,Math.max(Math.abs(e),Math.abs(t))))&&(i.precision=s-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(s=Ho(r))&&(i.precision=s-(i.type==="%")*2);break}}return Ai(i)}function Yo(e){var t=e.domain;return e.ticks=function(n){var i=t();return Ws(i[0],i[i.length-1],n??10)},e.tickFormat=function(n,i){var r=t();return Wo(r[0],r[r.length-1],n??10,i)},e.nice=function(n){n==null&&(n=10);var i=t(),r=0,s=i.length-1,o=i[r],a=i[s],c,h,l=10;for(a<o&&(h=o,o=a,a=h,h=r,r=s,s=h);l-- >0;){if(h=Ye(o,a,n),h===c)return i[r]=o,i[s]=a,t(i);if(h>0)o=Math.floor(o/h)*h,a=Math.ceil(a/h)*h;else if(h<0)o=Math.ceil(o*h)/h,a=Math.floor(a*h)/h;else break;c=h}return e},e}function Ct(){var e=Fo();return e.copy=function(){return ko(e,Ct())},ti.apply(e,arguments),Yo(e)}class Pi{constructor(t,n=!0,i,r,s,o){this._showLabels=!0,this._offsetX=0,this._offsetY=0,this._flipX=!1,this._flipY=!1,this.visible=!0,this.createOrGet=a=>{const{mainGroup:c}=this;let h=c.select(`g.${a}`);return h.empty()&&(h=c.append("g").attr("class",a)),h},this.mainGroup=t,this._showLabels=n,this._labelXDesc=i,this._labelYDesc=r,this._unitOfMeasure=s,o&&o.offsetX&&(this._offsetX=o.offsetX),o&&o.offsetX&&(this._offsetY=o.offsetY),o&&o.visible&&(this.visible=o.visible),this.mainGroup.style("pointer-events","none"),this._scaleX=Ct().domain([0,1]).range([0,1]),this._scaleY=Ct().domain([0,1]).range([0,1])}renderLabelx(){const{_labelXDesc:t,_unitOfMeasure:n,_showLabels:i,_scaleX:r}=this,[,s]=r.range(),o=this.renderGx();let a=o.select("text.axis-labelx");return i?a.empty()&&(a=o.append("text").attr("class","axis-labelx").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(`${t} (${n})`)):a.remove(),a.attr("transform",`translate(${s/2},-4)`),a}renderLabely(){const{_labelYDesc:t,_unitOfMeasure:n,_showLabels:i,_scaleY:r}=this,[,s]=r.range(),o=this.renderGy();let a=o.select("text.axis-labely");return i?(a.empty()&&(a=o.append("text").attr("class","axis-labely").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(`${t} (${n})`)),a.attr("transform",`translate(-10,${s/2})rotate(90)`)):a.remove(),a}renderGy(){const{_scaleX:t,_scaleY:n}=this,i=Es(n),[,r]=t.range(),s=this.createOrGet("y-axis");return s.call(i),s.attr("transform",`translate(${r},0)`),s}renderGx(){const{_scaleX:t,_scaleY:n}=this,i=Fs(t),[,r]=n.range(),s=this.createOrGet("x-axis");return s.attr("transform",`translate(0 ${r})`),s.call(i),s}render(){this.renderLabelx(),this.renderLabely()}onResize(t){this.mainGroup.attr("height",`${t.height}px`).attr("width",`${t.width}px`)}onRescale(t){const{_scaleX:n,_scaleY:i,offsetX:r,offsetY:s}=this,{xScale:o,yScale:a}=t,c=o.domain(),h=a.domain(),l=o.range(),u=a.range();n.domain([c[0]-r,c[1]-r]).range(l),i.domain([h[0]-s,h[1]-s]).range(u),this.flipX(this._flipX),this.flipY(this._flipY),this.visible&&this.render()}show(){return this.visible=!0,this.mainGroup.attr("visibility","visible"),this.render(),this}hide(){return this.visible=!1,this.mainGroup.attr("visibility","hidden"),this}flipX(t){this._flipX=t;const n=this._scaleX.domain(),i=t?-1:1;return this._scaleX.domain([i*n[0],i*n[1]]),this}flipY(t){this._flipY=t;const n=this._scaleY.domain(),i=t?-1:1;return this._scaleY.domain([i*n[0],i*n[1]]),this}showLabels(){return this._showLabels=!0,this.render(),this}hideLabels(){return this._showLabels=!1,this.render(),this}setLabelX(t){return this._labelXDesc=t,this}setLabelY(t){return this._labelYDesc=t,this}setUnitOfMeasure(t){return this._unitOfMeasure=t,this}setLabels(t,n,i){return this._labelXDesc=t,this._labelYDesc=n,this._unitOfMeasure=i,this}get offsetX(){return this._offsetX}set offsetX(t){this._offsetX=t}get offsetY(){return this._offsetY}set offsetY(t){this._offsetY=t}get scaleX(){return this._scaleX.copy()}get scaleY(){return this._scaleY.copy()}}var Go=Math.PI/180;function mt(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e<t?t:e>n?n:e}function Xo(e){return e*Go}function Li(e){var t=new Array(e),n=1/(e-1);t[0]=0;for(var i=1;i<e-1;i++)t[i]=i*n;return t[e-1]=1,t}function Yt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]+t[i];return n}function Gt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]-t[i];return n}function Pt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]*t;return n}function qo(e){for(var t=0,n=0;n<e.length;n++)t+=Math.pow(e[n],2);return t}function Xt(e){var t=qo(e);return t===0?t:Math.sqrt(t)}function ki(e,t){t===void 0&&(t=e);var n=Xt(e);return n===0?jo(0,t):Pt(e,1/n,t)}function jo(e,t){for(var n=0;n<t.length;n++)t[n]=e;return t}function Zo(e,t){for(var n=0,i=0;i<e.length;i++)n+=Math.pow(t[i]-e[i],2);return n===0?n:Math.sqrt(n)}function Ko(e,t){for(var n=0,i=0;i<e.length;i++)n+=e[i]*t[i];return n}function Qo(e,t,n,i){i===void 0&&(i=e);for(var r=mt(n,0,1),s=1-r,o=0;o<e.length;o++)i[o]=e[o]*s+t[o]*r;return i}function Jo(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function Ei(e,t){t===void 0&&(t=0),t===void 0&&(t=0);for(var n=0;n<e.length;n++)if(Math.abs(e[n])>t)return!1;return!0}var sn=180/Math.PI,ta=Math.PI/180;function on(e,t,n){var i=Math.cos(t),r=Math.sin(t),s=e[0];return n[0]=i*s-r*e[1],n[1]=r*s+i*e[1],n}function Fi(e){return Math.atan2(e[1],e[0])}function qt(e,t){var n=Math.atan2(t[1],t[0])-Math.atan2(e[1],e[0]);return n>Math.PI?n-=2*Math.PI:n<=-Math.PI&&(n+=2*Math.PI),n}var $=function(){function e(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];this.isMutating=!1,this.length=2,typeof t=="number"?typeof n[0]=="number"?(this[0]=t,this[1]=n[0]):(this[0]=t,this[1]=t):"x"in t&&"y"in t?(this[0]=t.x,this[1]=t.y):(this[0]=t[0],this[1]=t[1])}return Object.defineProperty(e.prototype,"x",{get:function(){return this[0]},set:function(t){this[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this[1]},set:function(t){this[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"magnitude",{get:function(){return Xt(this)},set:function(t){var n=Xt(this);Pt(this,t/n,this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mutable",{get:function(){return this.isMutating=!0,this},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"immutable",{get:function(){return this.isMutating=!1,this},enumerable:!0,configurable:!0}),e.prototype.set=function(t,n){return typeof t=="number"?typeof n=="number"?(this[0]=t,this[1]=n):(this[0]=t,this[1]=t):(this[0]=t[0],this[1]=t[1]),this},e.prototype.add=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?Yt(this,[t,n]):Yt(this.clone(),[t,n]):this.isMutating?Yt(this,t):Yt(this.clone(),t)},e.add=function(t,n){var i=new e(t);return Yt(i,n)},e.prototype.sub=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?Gt(this,[t,n]):Gt(this.clone(),[t,n]):this.isMutating?Gt(this,t):Gt(this.clone(),t)},e.sub=function(t,n){var i=new e(t);return Gt(i,n)},e.prototype.subFrom=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?(this[0]=t-this[0],this[1]=n-this[1],this):new e(t-this[0],n-this[1]):this.isMutating?(this[0]=t[0]-this[0],this[1]=t[1]-this[1],this):new e(t[0]-this[0],t[1]-this[1])},e.divide=function(t,n){var i=new e(t);return Pt(i,1/n)},e.multiply=function(t,n){var i=new e(t);return Pt(i,n)},e.prototype.scale=function(t){return Pt(this,t,this.isMutating?this:e.zero)},e.prototype.rescale=function(t){var n=Xt(this);return n<=0?this.isMutating?this:e.zero:Pt(this,t/n,this.isMutating?this:e.zero)},e.prototype.clampMagnitude=function(t){var n=Xt(this);return n>t?Pt(this,t/n,this.isMutating?this:e.zero):this.isMutating?this:this.clone()},e.prototype.rotate=function(t){return on(this,t,this.isMutating?this:e.zero)},e.prototype.rotateDeg=function(t){return on(this,t*ta,this.isMutating?this:e.zero)},e.prototype.rotate90=function(){return t=this,n=this.isMutating?this:e.zero,i=t[0],n[0]=-t[1],n[1]=i,n;var t,n,i},e.prototype.rotate180=function(){return t=this,(n=this.isMutating?this:e.zero)[0]=-t[0],n[1]=-t[1],n;var t,n},e.prototype.rotate270=function(){return t=this,n=this.isMutating?this:e.zero,i=t[0],n[0]=t[1],n[1]=-i,n;var t,n,i},e.prototype.normalize=function(){return ki(this)},e.prototype.normalized=function(){return ki(this,e.zero)},e.distance=function(t,n){return Zo(t,n)},e.dot=function(t,n){return Ko(t,n)},e.cross=function(t,n){return function(i,r){return i[0]*r[1]-i[1]*r[0]}(t,n)},e.angleRight=function(t){return Fi(t)},e.angleRightDeg=function(t){return Fi(t)*sn},e.angle=function(t,n){return Math.abs(qt(t,n))},e.angleDeg=function(t,n){return Math.abs(qt(t,n))*sn},e.signedAngle=function(t,n){return qt(t,n)},e.signedAngleDeg=function(t,n){return qt(t,n)*sn},e.lerp=function(t,n,i){var r=new e(t);return Qo(r,n,i)},e.lerpRot=function(t,n,i){return function(r,s,o,a){return a===void 0&&(a=r),on(r,o*qt(r,s),a)}(t,n,i,e.zero)},e.prototype.clone=function(){return new e(this[0],this[1])},e.equals=function(t,n,i){return i===void 0&&(i=0),!(Math.abs(t[0]-n[0])>i)&&!(Math.abs(t[1]-n[1])>i)},e.prototype.equals=function(t,n){return n===void 0&&(n=0),e.equals(this,t,n)},e.isZeroVector=function(t,n){return n===void 0&&(n=0),Ei(t,n)},e.prototype.isZeroVector=function(t){return t===void 0&&(t=0),Ei(this,t)},e.prototype.toArray=function(){return[this[0],this[1]]},e.prototype.modify=function(t){return Jo(this,t)},e.prototype[Symbol.iterator]=function(){var t=this,n=0;return{next:function(){switch(n++){case 0:return{value:t[0],done:!1};case 1:return{value:t[1],done:!1};default:return{value:-1,done:!0}}}}},Object.defineProperty(e,"zero",{get:function(){return new e(0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"one",{get:function(){return new e(1,1)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"positiveInfinity",{get:function(){return new e(1/0,1/0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"negativeInfinity",{get:function(){return new e(-1/0,-1/0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"up",{get:function(){return new e(0,1)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"right",{get:function(){return new e(1,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"down",{get:function(){return new e(0,-1)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"left",{get:function(){return new e(-1,0)},enumerable:!0,configurable:!0}),e}();/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
4
|
this file except in compliance with the License. You may obtain a copy of the
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
|
|
12
12
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
13
|
and limitations under the License.
|
|
14
|
-
***************************************************************************** */var an=function(e,t){return an=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)i.hasOwnProperty(r)&&(n[r]=i[r])},an(e,t)};function cn(e,t){function n(){this.constructor=e}an(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var hn=function(){return hn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},hn.apply(this,arguments)};function Ri(e,t){for(var n=new Array(e.length),i=0;i<e.length;i++)n[i]=2*e[i]-t[i];return n}function ln(e,t,n){var i,r,s,o,a=t.length-1;if(n)i=t[e-1<0?a:e-1],r=t[e%t.length],s=t[(e+1)%t.length],o=t[(e+2)%t.length];else{if(e===a)throw Error("There is no spline segment at this index for a closed curve!");r=t[e],s=t[e+1],i=e>0?t[e-1]:Ri(r,s),o=e<a-1?t[e+2]:Ri(s,r)}return[i,r,s,o]}function ea(e,t,n){n===void 0&&(n=!1);var i=n?t.length:t.length-1;if(e===1)return{index:i-1,weight:1};var r=i*e,s=Math.floor(r);return{index:s,weight:r-s}}function na(e,t){for(var n=0;n<e.length;n++)e[n]=t;return e}function ia(e,t){for(var n=0;n<e.length;n++)e[n]=t(e[n],n);return e}function ra(e,t,n){n===void 0&&(n=0);for(var i=0;i<e.length;i++)n=t(n,e[i],i);return n}function ge(e,t){t=t||new Array(e.length);for(var n=0;n<e.length;n++)t[n]=e[n];return t}function Q(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e<t?t:e>n?n:e}function un(e,t){var n=t[0];if(e>=t[t.length-1])return t.length-1;if(e<=n)return 0;for(var i=0,r=t.length-1;i<=r;){var s=Math.floor((i+r)/2),o=t[s];if(o<e)i=s+1;else{if(!(o>e))return s;r=s-1}}return Math.max(0,r)}var et=Math.pow(2,-42);function Oi(e){var t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}function zi(e,t,n){if(Math.abs(e)<et)return Math.abs(t)<et?[]:[-n/t];var i=t*t-4*e*n;return Math.abs(i)<et?[-t/(2*e)]:i>0?[(-t+Math.sqrt(i))/(2*e),(-t-Math.sqrt(i))/(2*e)]:[]}function sa(e,t,n,i){if(Math.abs(e)<et)return zi(t,n,i);var r,s=(3*e*n-t*t)/(3*e*e),o=(2*t*t*t-9*e*t*n+27*e*e*i)/(27*e*e*e);if(Math.abs(s)<et)r=[Oi(-o)];else if(Math.abs(o)<et)r=[0].concat(s<0?[Math.sqrt(-s),-Math.sqrt(-s)]:[]);else{var a=o*o/4+s*s*s/27;if(Math.abs(a)<et)r=[-1.5*o/s,3*o/s];else if(a>0)r=[(c=Oi(-o/2-Math.sqrt(a)))-s/(3*c)];else{var c=2*Math.sqrt(-s/3),h=Math.acos(3*o/s/c)/3,l=2*Math.PI/3;r=[c*Math.cos(h),c*Math.cos(h-l),c*Math.cos(h-2*l)]}}for(var u=0;u<r.length;u++)r[u]-=t/(3*e);return r}function oa(e,t){if(e.length!==t.length)throw Error("Vectors must be of equal length!");for(var n=0,i=0;i<e.length;i++)n+=e[i]*t[i];return n}function me(e,t,n){if(!(e.length>3)){n=n||new Array(3);var i=e[0],r=e[1],s=e[2]||0,o=t[0],a=t[1],c=t[2]||0;return n[0]=r*c-s*a,n[1]=s*o-i*c,n[2]=i*a-r*o,n}}function Di(e,t){for(var n=0,i=0;i<e.length;i++)n+=(e[i]-t[i])*(e[i]-t[i]);return n}function Rt(e){for(var t=0,n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function ye(e,t){var n=Di(e,t);return n===0?0:Math.sqrt(n)}function mt(e,t){var n=t?ge(e,t):e,i=ra(n,function(s,o){return s+Math.pow(o,2)}),r=Math.sqrt(i);return r===0?na(n,0):ia(n,function(s){return s/r})}function aa(e,t){if(e.length>2)throw Error("Only supported for 2d vectors");var n=t?ge(e,t):e,i=-n[1];return n[1]=n[0],n[0]=i,n}function ca(e,t,n,i,r){if(r===void 0&&(r=0),r===0)return[0,1,2,3];var s=function(c,h){return Math.pow(Di(c,h),.5*r)},o=s(t,e),a=s(n,t)+o;return[0,o,a,s(i,n)+a]}function ha(e,t,n,i,r){for(var s=Number.isFinite(r.tension)?r.tension:.5,o=Number.isFinite(r.alpha)?r.alpha:null,a=o>0?ca(e,t,n,i,o):null,c=new Array(e.length),h=0;h<e.length;h++){var l=0,u=0,f=e[h],p=t[h],d=n[h],g=i[h];if(a){var y=a[0],_=a[1],v=a[2],x=a[3];_-v!=0&&(y-_!=0&&y-v!=0&&(l=(1-s)*(v-_)*((f-p)/(y-_)-(f-d)/(y-v)+(p-d)/(_-v))),_-x!=0&&v-x!=0&&(u=(1-s)*(v-_)*((p-d)/(_-v)-(p-g)/(_-x)+(d-g)/(v-x))))}else l=(1-s)*(d-f)*.5,u=(1-s)*(g-p)*.5;var P=2*p-2*d+l+u,b=-3*p+3*d-2*l-u,S=l,T=p;c[h]=[P,b,S,T]}return c}function Ot(e,t){var n=e*e,i=e*n;return t[0]*i+t[1]*n+t[2]*e+t[3]}function zt(e,t){var n=e*e;return 3*t[0]*n+2*t[1]*e+t[2]}function fn(e,t){return 6*t[0]*e+2*t[1]}function la(e,t){var n=t[0],i=t[1],r=t[2],s=t[3]-e;return n===0&&i===0&&r===0&&s===0?[0]:sa(n,i,r,s).filter(function(o){return o>-et&&o<=1+et}).map(function(o){return Q(o,0,1)})}function dn(e,t,n,i){i===void 0&&(i=null),i=i||new Array(n.length);for(var r=0;r<n.length;r++)i[r]=e(t,n[r]);return i}var Ni=function(){function e(t){t===void 0&&(t=null),this._alpha=0,this._tension=.5,this._closed=!1,this._onInvalidateCache=null,this._onInvalidateCache=t,this._cache={arcLengths:null,coefficients:null}}return e.prototype._invalidateCache=function(){this.points&&(this._cache={arcLengths:null,coefficients:null},this._onInvalidateCache&&this._onInvalidateCache())},Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){Number.isFinite(t)&&t!==this._alpha&&(this._invalidateCache(),this._alpha=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tension",{get:function(){return this._tension},set:function(t){Number.isFinite(t)&&t!==this._tension&&(this._invalidateCache(),this._tension=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"points",{get:function(){return this._points},set:function(t){if(!t||t.length<2)throw Error("At least 2 control points are required!");this._points=t,this._invalidateCache()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._closed},set:function(t){t=!!t,this._closed!==t&&(this._invalidateCache(),this._closed=t)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._invalidateCache()},e.prototype.evaluateForT=function(t,n,i){var r=ea(n,this.points,this.closed),s=r.index;return dn(t,r.weight,this.getCoefficients(s),i)},e.prototype.getCoefficients=function(t){if(this.points){if(this._cache.coefficients||(this._cache.coefficients=new Map),!this._cache.coefficients.has(t)){var n=ln(t,this.points,this.closed),i=ha(n[0],n[1],n[2],n[3],{tension:this.tension,alpha:this.alpha});this._cache.coefficients.set(t,i)}return this._cache.coefficients.get(t)}},e}(),ua=function(e){function t(n,i){n===void 0&&(n=300),i===void 0&&(i=null);var r=e.call(this,i)||this;return r._subDivisions=n,r}return cn(t,e),Object.defineProperty(t.prototype,"arcLengths",{get:function(){return this._cache.arcLengths||(this._cache.arcLengths=this.computeArcLengths()),this._cache.arcLengths},enumerable:!1,configurable:!0}),t.prototype._invalidateCache=function(){e.prototype._invalidateCache.call(this),this._cache.arcLengths=null},t.prototype.computeArcLengths=function(){var n,i=[],r=this.evaluateForT(Ot,0),s=0;i.push(0);for(var o=1;o<=this._subDivisions;o++)s+=ye(n=this.evaluateForT(Ot,o/this._subDivisions),r),i.push(s),r=n;return i},t.prototype.lengthAt=function(n){var i=this.arcLengths;return n*i[i.length-1]},t.prototype.getT=function(n){var i=this.arcLengths,r=i.length,s=n*i[r-1],o=un(s,i);if(i[o]===s)return o/(r-1);var a=i[o];return(o+(s-a)/(i[o+1]-a))/(r-1)},t.prototype.getU=function(n){if(n===0)return 0;if(n===1)return 1;var i=this.arcLengths,r=i.length-1,s=i[r],o=n*r,a=Math.floor(o),c=i[a];if(o===a)return c/s;var h=a/r;return(c+ye(this.evaluateForT(Ot,h),this.evaluateForT(Ot,n)))/s},t}(Ni),$i=[[[-.906179845938664,.23692688505618908],[-.5384693101056831,.47862867049936647],[0,.5688888888888889],[.5384693101056831,.47862867049936647],[.906179845938664,.23692688505618908]],[[-.932469514203152,.17132449237917036],[-.6612093864662645,.3607615730481386],[-.2386191860831969,.46791393457269104],[.2386191860831969,.46791393457269104],[.6612093864662645,.3607615730481386],[.932469514203152,.17132449237917036]],[[-.9491079123427585,.1294849661688697],[-.7415311855993945,.27970539148927664],[-.4058451513773972,.3818300505051189],[0,.4179591836734694],[.4058451513773972,.3818300505051189],[.7415311855993945,.27970539148927664],[.9491079123427585,.1294849661688697]],[[-.9602898564975363,.10122853629037626],[-.7966664774136267,.22238103445337448],[-.525532409916329,.31370664587788727],[-.1834346424956498,.362683783378362],[.1834346424956498,.362683783378362],[.525532409916329,.31370664587788727],[.7966664774136267,.22238103445337448],[.9602898564975363,.10122853629037626]],[[-.9681602395076261,.08127438836157441],[-.8360311073266358,.1806481606948574],[-.6133714327005904,.26061069640293544],[-.3242534234038089,.31234707704000286],[0,.3302393550012598],[.3242534234038089,.31234707704000286],[.6133714327005904,.26061069640293544],[.8360311073266358,.1806481606948574],[.9681602395076261,.08127438836157441]],[[-.9739065285171717,.06667134430868814],[-.8650633666889845,.1494513491505806],[-.6794095682990244,.21908636251598204],[-.4333953941292472,.26926671930999635],[-.14887433898163122,.29552422471475287],[.14887433898163122,.29552422471475287],[.4333953941292472,.26926671930999635],[.6794095682990244,.21908636251598204],[.8650633666889845,.1494513491505806],[.9739065285171717,.06667134430868814]],[[-.978228658146056,.0556685671161736],[-.887062599768095,.125580369464904],[-.730152005574049,.186290210927734],[-.519096129206811,.23319376459199],[-.269543155952344,.262804544510246],[0,.2729250867779],[.269543155952344,.262804544510246],[.519096129206811,.23319376459199],[.730152005574049,.186290210927734],[.887062599768095,.125580369464904],[.978228658146056,.0556685671161736]],[[-.981560634246719,.0471753363865118],[-.904117256370474,.106939325995318],[-.769902674194304,.160078328543346],[-.587317954286617,.203167426723065],[-.36783149899818,.233492536538354],[-.125233408511468,.249147045813402],[.125233408511468,.249147045813402],[.36783149899818,.233492536538354],[.587317954286617,.203167426723065],[.769902674194304,.160078328543346],[.904117256370474,.106939325995318],[.981560634246719,.0471753363865118]],[[-.984183054718588,.0404840047653158],[-.917598399222977,.0921214998377284],[-.801578090733309,.138873510219787],[-.64234933944034,.178145980761945],[-.448492751036446,.207816047536888],[-.230458315955134,.226283180262897],[0,.232551553230873],[.230458315955134,.226283180262897],[.448492751036446,.207816047536888],[.64234933944034,.178145980761945],[.801578090733309,.138873510219787],[.917598399222977,.0921214998377284],[.984183054718588,.0404840047653158]],[[-.986283808696812,.0351194603317518],[-.928434883663573,.0801580871597602],[-.827201315069764,.121518570687903],[-.687292904811685,.157203167158193],[-.515248636358154,.185538397477937],[-.319112368927889,.205198463721295],[-.108054948707343,.215263853463157],[.108054948707343,.215263853463157],[.319112368927889,.205198463721295],[.515248636358154,.185538397477937],[.687292904811685,.157203167158193],[.827201315069764,.121518570687903],[.928434883663573,.0801580871597602],[.986283808696812,.0351194603317518]],[[-.987992518020485,.0307532419961172],[-.937273392400705,.0703660474881081],[-.848206583410427,.107159220467171],[-.72441773136017,.139570677926154],[-.570972172608538,.166269205816993],[-.394151347077563,.186161000015562],[-.201194093997434,.198431485327111],[0,.202578241925561],[.201194093997434,.198431485327111],[.394151347077563,.186161000015562],[.570972172608538,.166269205816993],[.72441773136017,.139570677926154],[.848206583410427,.107159220467171],[.937273392400705,.0703660474881081],[.987992518020485,.0307532419961172]],[[-.989400934991649,.027152459411754],[-.944575023073232,.0622535239386478],[-.865631202387831,.0951585116824927],[-.755404408355003,.124628971255533],[-.617876244402643,.149595988816576],[-.458016777657227,.169156519395002],[-.281603550779258,.182603415044923],[-.0950125098376374,.189450610455068],[.0950125098376374,.189450610455068],[.281603550779258,.182603415044923],[.458016777657227,.169156519395002],[.617876244402643,.149595988816576],[.755404408355003,.124628971255533],[.865631202387831,.0951585116824927],[.944575023073232,.0622535239386478],[.989400934991649,.027152459411754]],[[-.990575475314417,.0241483028685479],[-.950675521768767,.0554595293739872],[-.880239153726985,.0850361483171791],[-.781514003896801,.111883847193403],[-.65767115921669,.135136368468525],[-.512690537086476,.15404576107681],[-.351231763453876,.16800410215645],[-.178484181495847,.176562705366992],[0,.179446470356206],[.178484181495847,.176562705366992],[.351231763453876,.16800410215645],[.512690537086476,.15404576107681],[.65767115921669,.135136368468525],[.781514003896801,.111883847193403],[.880239153726985,.0850361483171791],[.950675521768767,.0554595293739872],[.990575475314417,.0241483028685479]],[[-.99156516842093,.0216160135264833],[-.955823949571397,.0497145488949698],[-.892602466497555,.076425730254889],[-.803704958972523,.100942044106287],[-.691687043060353,.122555206711478],[-.559770831073947,.14064291467065],[-.411751161462842,.154684675126265],[-.251886225691505,.164276483745832],[-.0847750130417353,.169142382963143],[.0847750130417353,.169142382963143],[.251886225691505,.164276483745832],[.411751161462842,.154684675126265],[.559770831073947,.14064291467065],[.691687043060353,.122555206711478],[.803704958972523,.100942044106287],[.892602466497555,.076425730254889],[.955823949571397,.0497145488949697],[.99156516842093,.0216160135264833]],[[-.992406843843584,.0194617882297264],[-.96020815213483,.0448142267656996],[-.903155903614817,.0690445427376412],[-.822714656537142,.0914900216224499],[-.720966177335229,.111566645547333],[-.600545304661681,.128753962539336],[-.46457074137596,.142606702173606],[-.316564099963629,.152766042065859],[-.160358645640225,.158968843393954],[0,.161054449848783],[.160358645640225,.158968843393954],[.316564099963629,.152766042065859],[.46457074137596,.142606702173606],[.600545304661681,.128753962539336],[.720966177335229,.111566645547333],[.822714656537142,.0914900216224499],[.903155903614817,.0690445427376412],[.96020815213483,.0448142267656996],[.992406843843584,.0194617882297264]],[[-.993128599185094,.0176140071391521],[-.963971927277913,.0406014298003869],[-.912234428251325,.062672048334109],[-.839116971822218,.0832767415767047],[-.74633190646015,.10193011981724],[-.636053680726515,.118194531961518],[-.510867001950827,.131688638449176],[-.373706088715419,.142096109318382],[-.227785851141645,.149172986472603],[-.0765265211334973,.152753387130725],[.0765265211334973,.152753387130725],[.227785851141645,.149172986472603],[.373706088715419,.142096109318382],[.510867001950827,.131688638449176],[.636053680726515,.118194531961518],[.74633190646015,.10193011981724],[.839116971822218,.0832767415767047],[.912234428251325,.062672048334109],[.963971927277913,.0406014298003869],[.993128599185094,.0176140071391521]],[[-.993752170620389,.0160172282577743],[-.967226838566306,.0369537897708524],[-.9200993341504,.0571344254268572],[-.853363364583317,.0761001136283793],[-.768439963475677,.0934444234560338],[-.667138804197412,.108797299167148],[-.551618835887219,.121831416053728],[-.424342120207438,.132268938633337],[-.288021316802401,.139887394791073],[-.145561854160895,.14452440398997],[0,.14608113364969],[.145561854160895,.14452440398997],[.288021316802401,.139887394791073],[.424342120207438,.132268938633337],[.551618835887219,.121831416053728],[.667138804197412,.108797299167148],[.768439963475677,.0934444234560338],[.853363364583317,.0761001136283793],[.9200993341504,.0571344254268572],[.967226838566306,.0369537897708524],[.993752170620389,.0160172282577743]],[[-.994294585482399,.0146279952982722],[-.970060497835428,.0337749015848141],[-.926956772187174,.0522933351526832],[-.8658125777203,.0697964684245204],[-.787816805979208,.0859416062170677],[-.694487263186682,.10041414444288],[-.587640403506911,.112932296080539],[-.469355837986757,.123252376810512],[-.341935820892084,.131173504787062],[-.207860426688221,.136541498346015],[-.0697392733197222,.139251872855631],[.0697392733197222,.139251872855631],[.207860426688221,.136541498346015],[.341935820892084,.131173504787062],[.469355837986757,.123252376810512],[.587640403506911,.112932296080539],[.694487263186682,.10041414444288],[.787816805979208,.0859416062170677],[.8658125777203,.0697964684245204],[.926956772187174,.0522933351526832],[.970060497835428,.0337749015848141],[.994294585482399,.0146279952982722]],[[-.994769334997552,.0134118594871417],[-.972542471218115,.0309880058569794],[-.932971086826016,.0480376717310846],[-.876752358270441,.0642324214085258],[-.804888401618839,.0792814117767189],[-.71866136313195,.0929157660600351],[-.619609875763646,.104892091464541],[-.509501477846007,.114996640222411],[-.39030103803029,.123049084306729],[-.264135680970344,.128905722188082],[-.133256824298466,.132462039404696],[0,.133654572186106],[.133256824298466,.132462039404696],[.264135680970344,.128905722188082],[.39030103803029,.123049084306729],[.509501477846007,.114996640222411],[.619609875763646,.104892091464541],[.71866136313195,.0929157660600351],[.804888401618839,.0792814117767189],[.876752358270441,.0642324214085258],[.932971086826016,.0480376717310846],[.972542471218115,.0309880058569794],[.994769334997552,.0134118594871417]],[[-.995187219997021,.0123412297999872],[-.974728555971309,.0285313886289336],[-.938274552002732,.0442774388174198],[-.886415527004401,.0592985849154367],[-.820001985973902,.0733464814110803],[-.740124191578554,.0861901615319532],[-.648093651936975,.0976186521041138],[-.545421471388839,.107444270115965],[-.433793507626045,.115505668053725],[-.315042679696163,.121670472927803],[-.191118867473616,.125837456346828],[-.0640568928626056,.127938195346752],[.0640568928626056,.127938195346752],[.191118867473616,.125837456346828],[.315042679696163,.121670472927803],[.433793507626045,.115505668053725],[.545421471388839,.107444270115965],[.648093651936975,.0976186521041138],[.740124191578554,.0861901615319532],[.820001985973902,.0733464814110803],[.886415527004401,.0592985849154367],[.938274552002732,.0442774388174198],[.974728555971309,.0285313886289336],[.995187219997021,.0123412297999872]],[[-.995556969790498,.0113937985010262],[-.976663921459517,.0263549866150321],[-.942974571228974,.0409391567013063],[-.894991997878275,.0549046959758351],[-.833442628760834,.0680383338123569],[-.759259263037357,.080140700335001],[-.673566368473468,.0910282619829636],[-.577662930241222,.10053594906705],[-.473002731445714,.108519624474263],[-.361172305809387,.114858259145711],[-.243866883720988,.119455763535784],[-.12286469261071,.12224244299031],[0,.123176053726715],[.12286469261071,.12224244299031],[.243866883720988,.119455763535784],[.361172305809387,.114858259145711],[.473002731445714,.108519624474263],[.577662930241222,.10053594906705],[.673566368473468,.0910282619829636],[.759259263037357,.080140700335001],[.833442628760834,.0680383338123569],[.894991997878275,.0549046959758351],[.942974571228974,.0409391567013063],[.976663921459517,.0263549866150321],[.995556969790498,.0113937985010262]],[[-.995885701145616,.010551372617343],[-.97838544595647,.0244178510926319],[-.947159066661714,.0379623832943627],[-.902637861984307,.0509758252971478],[-.845445942788498,.0632740463295748],[-.776385948820678,.0746841497656597],[-.696427260419957,.0850458943134852],[-.606692293017618,.0942138003559141],[-.508440714824505,.102059161094425],[-.403051755123486,.108471840528576],[-.292004839485956,.113361816546319],[-.17685882035689,.116660443485296],[-.0592300934293132,.118321415279262],[.0592300934293132,.118321415279262],[.17685882035689,.116660443485296],[.292004839485956,.113361816546319],[.403051755123486,.108471840528576],[.508440714824505,.102059161094425],[.606692293017618,.0942138003559141],[.696427260419957,.0850458943134852],[.776385948820678,.0746841497656597],[.845445942788498,.0632740463295748],[.902637861984307,.0509758252971478],[.947159066661714,.0379623832943627],[.97838544595647,.0244178510926319],[.995885701145616,.010551372617343]],[[-.996179262888988,.00979899605129436],[-.979923475961501,.0226862315961806],[-.950900557814705,.0352970537574197],[-.909482320677491,.047449412520615],[-.856207908018294,.0589835368598335],[-.791771639070508,.0697488237662455],[-.717013473739423,.0796048677730577],[-.632907971946495,.0884231585437569],[-.540551564579456,.0960887273700285],[-.441148251750026,.102501637817745],[-.335993903638508,.107578285788533],[-.226459365439536,.111252488356845],[-.113972585609529,.113476346108965],[0,.114220867378956],[.113972585609529,.113476346108965],[.226459365439536,.111252488356845],[.335993903638508,.107578285788533],[.441148251750026,.102501637817745],[.540551564579456,.0960887273700285],[.632907971946495,.0884231585437569],[.717013473739423,.0796048677730577],[.791771639070508,.0697488237662455],[.856207908018294,.0589835368598336],[.909482320677491,.047449412520615],[.950900557814705,.0352970537574197],[.979923475961501,.0226862315961806],[.996179262888988,.00979899605129436]],[[-.996442497573954,.00912428259309452],[-.981303165370872,.0211321125927712],[-.954259280628938,.0329014277823043],[-.915633026392132,.0442729347590042],[-.865892522574395,.0551073456757167],[-.805641370917179,.0652729239669995],[-.735610878013631,.0746462142345687],[-.656651094038864,.0831134172289012],[-.569720471811401,.0905717443930328],[-.475874224955118,.0969306579979299],[-.376251516089078,.10211296757806],[-.272061627635178,.106055765922846],[-.16456928213338,.108711192258294],[-.0550792898840342,.110047013016475],[.0550792898840342,.110047013016475],[.16456928213338,.108711192258294],[.272061627635178,.106055765922846],[.376251516089078,.10211296757806],[.475874224955118,.0969306579979299],[.569720471811401,.0905717443930328],[.656651094038864,.0831134172289012],[.735610878013631,.0746462142345687],[.805641370917179,.0652729239669995],[.865892522574395,.0551073456757167],[.915633026392132,.0442729347590042],[.954259280628938,.0329014277823043],[.981303165370872,.0211321125927712],[.996442497573954,.00912428259309452]],[[-.996679442260596,.00851690387874641],[-.982545505261413,.0197320850561227],[-.957285595778087,.0307404922020936],[-.921180232953058,.0414020625186828],[-.874637804920102,.0515948269024979],[-.818185487615252,.0612030906570791],[-.752462851734477,.0701179332550512],[-.678214537602686,.0782383271357637],[-.596281797138227,.0854722573661725],[-.507592955124227,.0917377571392587],[-.413152888174008,.0969638340944086],[-.314031637867639,.101091273759914],[-.211352286166001,.104073310077729],[-.106278230132679,.10587615509732],[0,.106479381718314],[.106278230132679,.10587615509732],[.211352286166001,.104073310077729],[.314031637867639,.101091273759914],[.413152888174008,.0969638340944086],[.507592955124227,.0917377571392587],[.596281797138227,.0854722573661725],[.678214537602686,.0782383271357637],[.752462851734477,.0701179332550512],[.818185487615252,.0612030906570791],[.874637804920102,.0515948269024979],[.921180232953058,.0414020625186828],[.957285595778087,.0307404922020936],[.982545505261413,.0197320850561227],[.996679442260596,.00851690387874641]],[[-.996893484074649,.0079681924961666],[-.983668123279747,.0184664683110909],[-.960021864968307,.0287847078833233],[-.926200047429274,.038799192569627],[-.882560535792052,.048402672830594],[-.829565762382768,.057493156217619],[-.767777432104826,.0659742298821805],[-.697850494793315,.0737559747377052],[-.620526182989242,.0807558952294202],[-.536624148142019,.0868997872010829],[-.447033769538089,.0921225222377861],[-.352704725530878,.0963687371746442],[-.254636926167889,.0995934205867952],[-.153869913608583,.101762389748405],[-.0514718425553176,.102852652893558],[.0514718425553176,.102852652893558],[.153869913608583,.101762389748405],[.254636926167889,.0995934205867952],[.352704725530878,.0963687371746442],[.447033769538089,.0921225222377861],[.536624148142019,.0868997872010829],[.620526182989242,.0807558952294202],[.697850494793315,.0737559747377052],[.767777432104826,.0659742298821805],[.829565762382768,.057493156217619],[.882560535792052,.048402672830594],[.926200047429274,.038799192569627],[.960021864968307,.0287847078833233],[.983668123279747,.0184664683110909],[.996893484074649,.0079681924961666]]],Ii=$i.length+5,fa=function(e){function t(n,i,r){n===void 0&&(n=24),i===void 0&&(i=21);var s=e.call(this,r)||this;return s._nSamples=21,s._gauss=function(o){if(o<5||o>Ii)throw Error("Order for Gaussian Quadrature must be in the range of ".concat(5," and ").concat(Ii,"."));return $i[o-5]}(n),s._nSamples=i,s}return cn(t,e),t.prototype._invalidateCache=function(){e.prototype._invalidateCache.call(this),this._cache.arcLengths=null,this._cache.samples=null},Object.defineProperty(t.prototype,"arcLengths",{get:function(){return this._cache.arcLengths||(this._cache.arcLengths=this.computeArcLengths()),this._cache.arcLengths},enumerable:!1,configurable:!0}),t.prototype.getSamples=function(n){if(this.points){if(this._cache.samples||(this._cache.samples=new Map),!this._cache.samples.has(n)){for(var i=this._nSamples,r=[],s=[],o=this.getCoefficients(n),a=0;a<i;++a){var c=a/(i-1);r.push(this.computeArcLength(n,0,c));var h=Rt(dn(zt,c,o)),l=h===0?0:1/h;this.tension>.95&&(l=Q(l,-1,1)),s.push(l)}var u=i-1,f=[],p=[],d=r[0],g=s[0],y=1/u;for(a=0;a<u;++a){var _=d,v=(d=r[a+1])-_,x=g,P=s[a+1];g=P;var b=y/v,S=(x+P-2*b)/(v*v),T=(3*b-2*x-P)/v;f.push(S),p.push(T)}this._cache.samples.set(n,[r,s,p,f])}return this._cache.samples.get(n)}},t.prototype.computeArcLength=function(n,i,r){if(i===void 0&&(i=0),r===void 0&&(r=1),i===r)return 0;for(var s=this.getCoefficients(n),o=.5*(r-i),a=0,c=0;c<this._gauss.length;c++){var h=this._gauss[c],l=h[0];a+=h[1]*Rt(dn(zt,o*l+o+i,s))}return o*a},t.prototype.computeArcLengths=function(){if(this.points){var n=[];n.push(0);for(var i=this.closed?this.points.length:this.points.length-1,r=0,s=0;s<i;s++)r+=this.computeArcLength(s),n.push(r);return n}},t.prototype.inverse=function(n,i){var r=1/(this._nSamples-1),s=this.getSamples(n),o=s[0],a=s[1],c=s[2],h=s[3];if(i>=o[o.length-1])return 1;if(i<=0)return 0;var l=Math.max(0,un(i,o)),u=l*r;if(o[l]===i)return u;var f=a[l],p=h[l],d=c[l],g=i-o[l];return((p*g+d)*g+f)*g+u},t.prototype.lengthAt=function(n){return n*this.arcLengths[this.arcLengths.length-1]},t.prototype.getT=function(n){var i=this.arcLengths,r=i.length,s=n*i[r-1],o=un(s,i),a=o/(r-1);if(i[o]===s)return a;var c=s-i[o];return(o+this.inverse(o,c))/(r-1)},t.prototype.getU=function(n){if(n===0)return 0;if(n===1)return 1;var i=this.arcLengths,r=i.length-1,s=i[r],o=n*r,a=Math.floor(o),c=i[a];if(o===a)return c/s;var h=o-a;return(c+this.computeArcLength(a,0,h))/s},t}(Ni),pn=function(){function e(t,n){n===void 0&&(n={});var i=this;this._cache=new Map;var r=(n=hn({tension:.5,alpha:0,closed:!1},n)).arcDivisions?new ua(n.arcDivisions,function(){return i._invalidateCache()}):new fa(n.numericalApproximationOrder,n.numericalInverseSamples,function(){return i._invalidateCache()});r.alpha=n.alpha,r.tension=n.tension,r.closed=n.closed,r.points=t,this._lmargin=n.lmargin||1-r.tension,this._curveMapper=r}return e.prototype.getTimeFromPosition=function(t,n){return n===void 0&&(n=!1),this._curveMapper.getT(n?Q(t,0,1):t)},e.prototype.getPositionFromTime=function(t,n){return n===void 0&&(n=!1),this._curveMapper.getU(n?Q(t,0,1):t)},e.prototype.getPositionFromLength=function(t,n){n===void 0&&(n=!1);var i=n?Q(t,0,this.length):t;return this._curveMapper.getU(i/this.length)},e.prototype.getLengthAt=function(t,n){return t===void 0&&(t=1),n===void 0&&(n=!1),this._curveMapper.lengthAt(n?Q(t,0,1):t)},e.prototype.getTimeAtKnot=function(t){if(t<0||t>this.points.length-1)throw Error("Invalid index!");return t===0?0:this.closed||t!==this.points.length-1?t/(this.closed?this.points.length:this.points.length-1):1},e.prototype.getPositionAtKnot=function(t){return this.getPositionFromTime(this.getTimeAtKnot(t))},e.prototype.getPointAtTime=function(t,n){return(t=Q(t,0,1))===0?ge(this.points[0],n):t===1?ge(this.closed?this.points[0]:this.points[this.points.length-1],n):this._curveMapper.evaluateForT(Ot,t,n)},e.prototype.getPointAt=function(t,n){return this.getPointAtTime(this.getTimeFromPosition(t),n)},e.prototype.getTangentAt=function(t,n){var i=Q(this.getTimeFromPosition(t),0,1);return this.getTangentAtTime(i,n)},e.prototype.getTangentAtTime=function(t,n){return mt(this._curveMapper.evaluateForT(zt,t,n))},e.prototype.getNormalAt=function(t,n){var i=Q(this.getTimeFromPosition(t),0,1);return this.getNormalAtTime(i,n)},e.prototype.getNormalAtTime=function(t,n){var i=mt(this._curveMapper.evaluateForT(zt,t));if(!(i.length<2||i.length>3)){var r=n||new Array(i.length);if(i.length===2)return r[0]=-i[1],r[1]=i[0],r;var s=mt(this._curveMapper.evaluateForT(fn,t));return mt(me(me(i,s),i),r)}},e.prototype.getCurvatureAt=function(t){var n=Q(this.getTimeFromPosition(t),0,1);return this.getCurvatureAtTime(n)},e.prototype.getCurvatureAtTime=function(t){var n=this._curveMapper.evaluateForT(zt,t),i=this._curveMapper.evaluateForT(fn,t),r=mt(n,[]),s=0,o=void 0;if(n.length===2){if((u=Math.pow(n[0]*n[0]+n[1]*n[1],1.5))!==0){var a=(n[0]*i[1]-n[1]*i[0])/u;o=a<0?[r[1],-r[0]]:[-r[1],r[0]],s=Math.abs(a)}}else if(n.length===3){var c=Rt(n),h=me(n,i);o=mt(me(h,n)),c!==0&&(s=Rt(h)/Math.pow(c,3))}else{c=Rt(n);var l=Rt(i),u=Math.pow(c,3),f=oa(n,i);u!==0&&(s=Math.sqrt(Math.pow(c,2)*Math.pow(l,2)-Math.pow(f,2))/u)}return{curvature:s,radius:s!==0?1/s:0,tangent:r,direction:o}},e.prototype.getDerivativeAt=function(t,n){var i=Q(this.getTimeFromPosition(t),0,1);return this._curveMapper.evaluateForT(zt,i,n)},e.prototype.getSecondDerivativeAt=function(t,n){var i=Q(this.getTimeFromPosition(t),0,1);return this._curveMapper.evaluateForT(fn,i,n)},e.prototype.getBoundingBox=function(t,n){if(t===void 0&&(t=0),n===void 0&&(n=1),t===0&&n===1&&this._cache.has("bbox"))return this._cache.get("bbox");for(var i=[],r=[],s=this.getTimeFromPosition(t),o=this.getTimeFromPosition(n),a=this.getPointAtTime(s),c=this.getPointAtTime(o),h=this.closed?this.points.length:this.points.length-1,l=Math.floor(h*s),u=Math.ceil(h*o),f=0;f<a.length;f++)i[f]=Math.min(a[f],c[f]),r[f]=Math.max(a[f],c[f]);for(var p=function(_){var v=ln(_-1,d.points,d.closed)[2];if(_<u)for(var x=0;x<v.length;x++)v[x]<i[x]&&(i[x]=v[x]),v[x]>r[x]&&(r[x]=v[x]);if(d.tension<1){var P=h*s-(_-1),b=h*o-(_-1),S=function(E){return E>-et&&E<=1+et&&(_-1!==l||E>P)&&(_!==u||E<b)},T=d._curveMapper.getCoefficients(_-1),O=function(E){var I=T[E];zi(3*I[0],2*I[1],I[2]).filter(S).forEach(function(L){var D=Ot(L,T[E]);D<i[E]&&(i[E]=D),D>r[E]&&(r[E]=D)})};for(x=0;x<T.length;x++)O(x)}},d=this,g=l+1;g<=u;g++)p(g);var y={min:i,max:r};return t===0&&n===1&&this._cache.set("bbox",y),y},e.prototype.getPoints=function(t,n,i,r){if(t===void 0&&(t=100),i===void 0&&(i=0),r===void 0&&(r=1),!t||t<=0)throw Error("Invalid arguments passed to getPoints(). You must specify at least 1 sample/segment.");if(!(i<0||r>1||r<i)){for(var s=[],o=0;o<=t;o++){var a=i===0&&r===1?o/t:i+o/t*(r-i);s.push(this.getPointAt(a,n&&new n))}return s}},e.prototype.getNearestPosition=function(t,n){var i=this;if(n===void 0&&(n=1e-5),n<=0||!Number.isFinite(n))throw Error("Invalid threshold. Must be a number greater than zero!");var r=10*this.points.length-1,s=new Array(t.length),o=1/0,a=0,c=this.createLookupTable(r);Array.from(c.keys()).forEach(function(f){var p=c.get(f),d=ye(t,p);if(d<o)return o=d,a=f,!0});for(var h=this.getTimeFromPosition(a),l=function(f){if(f>=0&&f<=1){i.getPointAtTime(f,s);var p=ye(t,s);if(p<o)return o=p,h=f,!0}},u=.005;u>n;)l(h-u)||l(h+u)||(u/=2);return{u:a=this._curveMapper.getU(h),distance:o,point:s}},e.prototype.getIntersects=function(t,n,i,r){var s=this;n===void 0&&(n=0),i===void 0&&(i=0),r===void 0&&(r=this._lmargin);var o=this.getIntersectsAsTime(t,n,i,r).map(function(a){return s.getPointAtTime(a)});return Math.abs(i)===1?o.length===1?o[0]:null:o},e.prototype.getIntersectsAsPositions=function(t,n,i,r){var s=this;return n===void 0&&(n=0),i===void 0&&(i=0),r===void 0&&(r=this._lmargin),this.getIntersectsAsTime(t,n,i,r).map(function(o){return s.getPositionFromTime(o)})},e.prototype.getIntersectsAsTime=function(t,n,i,r){n===void 0&&(n=0),i===void 0&&(i=0),r===void 0&&(r=this._lmargin);for(var s=n,o=new Set,a=this.closed?this.points.length:this.points.length-1,c=0;c<a&&(i===0||o.size<Math.abs(i));c+=1){var h=i<0?a-(c+1):c,l=ln(h,this.points,this.closed),u=l[1],f=l[2],p=this._curveMapper.getCoefficients(h),d=void 0,g=void 0;if(u[s]<f[s]?(d=u[s],g=f[s]):(d=f[s],g=u[s]),t-r<=g&&t+r>=d){var y=la(t,p[s]);i<0?y.sort(function(x,P){return P-x}):i>=0&&y.sort(function(x,P){return x-P});for(var _=0;_<y.length;_++){var v=(y[_]+h)/a;if(o.add(v),i!==0&&o.size===Math.abs(i))break}}}return Array.from(o)},e.prototype.createLookupTable=function(t,n,i){if(n===void 0&&(n=0),i===void 0&&(i=1),!t||t<=1)throw Error("Invalid arguments passed to createLookupTable(). You must specify at least 2 samples.");if(!(n<0||i>1||i<n)){var r="lut_".concat(t,"_").concat(n,"_").concat(i);if(!this._cache.has(r)){for(var s=new Map,o=0;o<t;o++){var a=n===0&&i===1?o/(t-1):n+o/(t-1)*(i-n),c=this.getPointAt(a);s.set(a,c)}this._cache.set(r,s)}return this._cache.get(r)}},e.prototype.forEach=function(t,n,i,r){var s=this;i===void 0&&(i=0),r===void 0&&(r=1);var o=[];if(Number.isFinite(n)){if(n<=1)throw Error("Invalid arguments passed to forEach(). You must specify at least 2 samples.");for(var a=n,c=0;c<n;c++){var h=i===0&&r===1?c/(a-1):i+c/(a-1)*(r-i);o.push(h)}}else Array.isArray(n)&&(o=n);var l=null;o.forEach(function(u,f){if(!Number.isFinite(u)||u<0||u>1)throw Error("Invalid position (u) for sample in forEach!");var p=s.getTimeFromPosition(u),d=t({u,t:p,i:f,prev:l});l={u,t:p,i:f,value:d}})},e.prototype.map=function(t,n,i,r){var s=this;i===void 0&&(i=0),r===void 0&&(r=1);var o=[];if(Number.isFinite(n)){if(n<=1)throw Error("Invalid arguments passed to map(). You must specify at least 2 samples.");for(var a=n,c=0;c<n;c++){var h=i===0&&r===1?c/(a-1):i+c/(a-1)*(r-i);o.push(h)}}else Array.isArray(n)&&(o=n);var l=null;return o.map(function(u,f){if(!Number.isFinite(u)||u<0||u>1)throw Error("Invalid position (u) for sample in map()!");var p=s.getTimeFromPosition(u),d=t({u,t:p,i:f,prev:l});return l={u,t:p,i:f,value:d},d})},e.prototype.reduce=function(t,n,i,r,s){var o=this;r===void 0&&(r=0),s===void 0&&(s=1);var a=[];if(Number.isFinite(i)){if(i<=1)throw Error("Invalid arguments passed to map(). You must specify at least 2 samples.");for(var c=i,h=0;h<i;h++){var l=r===0&&s===1?h/(c-1):r+h/(c-1)*(s-r);a.push(l)}}else Array.isArray(i)&&(a=i);return a.reduce(function(u,f,p){if(!Number.isFinite(f)||f<0||f>1)throw Error("Invalid position (u) for sample in map()!");var d=o.getTimeFromPosition(f);return t({acc:u,u:f,t:d,i:p})},n)},e.prototype._invalidateCache=function(){return this._cache=new Map,this},e.prototype.reset=function(){this._curveMapper.reset()},Object.defineProperty(e.prototype,"points",{get:function(){return this._curveMapper.points},set:function(t){this._curveMapper.points=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tension",{get:function(){return this._curveMapper.tension},set:function(t){this._curveMapper.tension=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._curveMapper.alpha},set:function(t){this._curveMapper.alpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._curveMapper.closed},set:function(t){this._curveMapper.closed=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._curveMapper.lengthAt(1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minX",{get:function(){return this.getBoundingBox().min[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxX",{get:function(){return this.getBoundingBox().max[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minY",{get:function(){return this.getBoundingBox().min[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxY",{get:function(){return this.getBoundingBox().max[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minZ",{get:function(){return this.getBoundingBox().min[2]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxZ",{get:function(){return this.getBoundingBox().max[2]},enumerable:!1,configurable:!0}),e}();(function(e){function t(n,i,r,s,o){return i===void 0&&(i=.5),r===void 0&&(r=300),s===void 0&&(s=!1),o===void 0&&(o=0),e.call(this,n.map(function(a){return[a[0],a[1]]}),{tension:i,alpha:o,arcDivisions:r,closed:s})||this}return cn(t,e),t.prototype.x=function(n,i,r){i===void 0&&(i=0),r===void 0&&(r=this._lmargin);var s=this.getIntersects(n,1,i,r);return Math.abs(i)===1?s[0]:s.map(function(o){return o[0]})},t.prototype.y=function(n,i,r){i===void 0&&(i=0),r===void 0&&(r=this._lmargin);var s=this.getIntersects(n,0,i,r);return Math.abs(i)===1?s[1]:s.map(function(o){return o[1]})},t.prototype.getNormalAt=function(n,i){return mt(aa(this.getTangentAt(n,i)))},t.prototype.getAngleAt=function(n){var i=this.getTangentAt(n);return Math.atan2(i[1],i[0])},t.prototype.getBoundingBox=function(n,i){n===void 0&&(n=0),i===void 0&&(i=1);var r=e.prototype.getBoundingBox.call(this,n,i);return{x1:r.min[0],x2:r.max[0],y1:r.min[1],y2:r.max[1],min:r.min,max:r.max}},t})(pn);class _e{static newton(t,n=.01,i=1e3,r=.5,s=0,o=1){let c=r;for(let h=0;h<i;h++){const l=t(c);if(Math.abs(l)<n)return gt(c,s,o);const u=(t(c+1e-4)-l)/1e-4;c=c-l/u}return null}static bisect(t,n=.01,i=1e3,r=.5,s=0,o=1){let a=s,c=o,h=r,l,u;for(u=0;u<i;u++){if(l=t(h),Math.abs(l)<n)return h;l<0?c=h:a=h,h=(c+a)/2}return h}static findRoot(t,n=.01,i=1e3,r=.5,s=0,o=1){let a=_e.newton(t,n,i,r);return a==null&&(a=_e.bisect(t,n,i,r,s,o)),a}}class da{static bisect(t,n=0,i=1,r=.005,s=4,o=10){const a=(f,p,d,g,y,_,v=0)=>{const x=(f+p)/2,P=t(x),b=N.distance(d,P),S=N.distance(P,g),T=b+S;if(v>=s&&Math.abs(T-y)<_||v>=o)return T;const O=_/2,E=v+1;return a(f,x,d,P,b,O,E)+a(x,p,P,g,S,O,E)},c=t(n),h=t(i),l=N.distance(c,h);return a(n,i,c,h,l,r)}static trapezoid(t,n=0,i=1,r=1e3){let s=0,o=t(n);const a=(i-n)/(r-1);for(let c=1;c<r;c++){const h=t(n+c*a),l=N.distance(o,h);s+=l,o=h}return s}}class pa{static search(t,n){let i=0,r=t.length-1,s=Math.floor(i+r/2);for(;s>i&&s<r;){const o=t[s],a=t[s+1];if(o<=n&&a>=n)return s;n<o?r=s:i=s,s=Math.floor(i+r/2)}return s}}class gn extends pn{constructor(t,n){super(t,n),this.arcLengthLookup=[],this.findTForArcLength=this.findTForArcLength.bind(this),this.findTByRootForArcLength=this.findTByRootForArcLength.bind(this),this.findApproxTForArcLength=this.findApproxTForArcLength.bind(this),this.findTQuickForArcLength=this.findTQuickForArcLength.bind(this),this.generateArcLengthLookup=this.generateArcLengthLookup.bind(this),this.getArcLength=this.getArcLength.bind(this),this.getQuickArcLength=this.getQuickArcLength.bind(this),this.getPointAtArcLength=this.getPointAtArcLength.bind(this),this.getPointAt=this.getPointAt.bind(this)}findTForArcLength(t,n){let i;return n!=null&&n.approxT?i=this.findApproxTForArcLength(t,n==null?void 0:n.normalizedLength):n!=null&&n.quickT?i=this.findTQuickForArcLength(t):i=this.findTByRootForArcLength(t),i}findTByRootForArcLength(t,n=.01,i=100){return t<=0?0:t>=this.length?1:_e.findRoot(s=>t-this.getQuickArcLength(0,s),n,i,t/this.length)}findApproxTForArcLength(t,n){return t/(n||this.length)}findTQuickForArcLength(t){this.arcLengthLookup.length===0&&this.generateArcLengthLookup();const n=pa.search(this.arcLengthLookup,t),i=this.arcLengthLookup[n],r=this.arcLengthLookup[n+1];return(n+(t-i)/(r-i))/this.arcLengthLookup.length}generateArcLengthLookup(t=1e3){let n=this.getPointAt(0),i=0;for(let r=0;r<t;r++){const s=this.getPointAt(r/(t-1)),o=N.distance(n,s);i+=o,this.arcLengthLookup.push(i),n=s}}getArcLength(t=0,n=1){if(t===0&&n===1)return this.length;const i=.002;return da.bisect(r=>this.getPointAt(r),t,n,i)}getQuickArcLength(t=0,n=1){let i=0,r=this.length;if(this.arcLengthLookup.length===0&&this.generateArcLengthLookup(),t!==0){const o=Math.floor(t*this.arcLengthLookup.length),a=this.arcLengthLookup[o],c=this.arcLengthLookup[o+1];i=a+t*this.arcLengthLookup.length%this.arcLengthLookup.length*(c-a)}if(n!==1){const o=Math.floor(n*this.arcLengthLookup.length),a=this.arcLengthLookup[o],c=this.arcLengthLookup[o+1];r=a+t*this.arcLengthLookup.length%this.arcLengthLookup.length*(c-a)}return r-i}getPointAtArcLength(t,n){const i=this.findTForArcLength(t,n);return this.getPointAt(i)}getPointAt(t){const n=gt(t,0,1);return super.getPointAt(n)}}const Bi=.75,Hi=5e3,Vi=.001,ga=1e3,ma=1e3,ya=5e-4,_a=.1,va={approxT:!0};class Dt{constructor(t,n){if(this.path=[],this.projectedPath=[],this._offset=0,t.length<1)throw new Error("Missing coordinates");if(t[0]&&t[0].length!==3)throw new Error("Coordinates should be in 3d");this.setPath(t,n),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.getPosition=this.getPosition.bind(this),this.getProjectedLength=this.getProjectedLength.bind(this),this.getTrajectory=this.getTrajectory.bind(this)}setPath(t,n={}){this.options={...va,...n};const{arcDivisions:i,tension:r,calculateDisplacementFromBottom:s}=this.options;this.path=t,this.projectedPath=Dt.toDisplacement(t);const[o]=this.projectedPath[this.projectedPath.length-1];this.displacement=o,this.interpolators={curve:n.curveInterpolator||new gn(t),trajectory:n.trajectoryInterpolator||new gn(t.map(h=>[h[0],h[1]]),{tension:r||Bi,arcDivisions:i||Hi}),curtain:n.curtainInterpolator||new gn(this.projectedPath,{tension:r||Bi,arcDivisions:i||Hi})};const a=this.getTrajectoryVector(),c=a.map(h=>h*-1);s?(this.endVector=c,this.startVector=a):(this.endVector=a,this.startVector=c),this._curtainPathCache=void 0}project(t){const{curtain:n}=this.interpolators,{calculateDisplacementFromBottom:i}=this.options,r=gt(i?this.length-(t-this._offset):t-this._offset,0,this.length);return n.getPointAtArcLength(r,this.options)}curtainTangent(t){const{curtain:n}=this.interpolators,i=t-this._offset,r=n.findTForArcLength(i,this.options);return r&&n.getTangentAt(r)}getCurtainPath(t,n,i=!1){if(!this._curtainPathCache){const r=[];let s=Math.PI*2;for(let o=this._offset;o<=this.length+this._offset;o+=_a){const a=this.project(o),c=Math.atan2(a[1],a[0]);Math.abs(c-s)>ya&&(r.push({point:a,md:o}),s=c)}this._curtainPathCache=r}if(i){const r={point:this.project(t),md:t},s=this._curtainPathCache.filter(a=>a.md>t&&a.md<n),o={point:this.project(n),md:n};return[r,...s,o]}return this._curtainPathCache.filter(r=>r.md>=t&&r.md<=n)}unproject(t){const{normalizedLength:n,calculateDisplacementFromBottom:i}=this.options,r=i?this.displacement-t:t,s=n||this.length;if(r<0)return r;if(r>this.displacement)return s+(r-this.displacement);const o=this.interpolators.curtain.getIntersectsAsPositions(r,0,1);return o&&o.length?o[0]*s+this._offset:null}getProjectedLength(t){const{curtain:n}=this.interpolators,r=this.project(t)[0]/n.maxX;return Number.isFinite(r)?gt(r,0,1):0}getPosition(t){const{trajectory:n}=this.interpolators,i=this.getProjectedLength(t);return n.getPointAt(i)}getTrajectory(t,n=0,i=1){const r=n<0?-n:0,s=i>1?i-1:0,o=this.interpolators.trajectory.getPointAt(0),a=this.interpolators.trajectory.getPointAt(1);let c,h,l=0;const u=Math.max(0,n),f=Math.min(1,i),p=this.interpolators.trajectory.getPointAt(u),d=this.interpolators.trajectory.getPointAt(f);r?(c=[o[0]+this.startVector[0]*r*this.displacement,o[1]+this.startVector[1]*r*this.displacement],l=-N.distance(c,o)):n>0&&(l=N.distance(p,o)),s&&(h=[a[0]+this.endVector[0]*s*this.displacement,a[1]+this.endVector[1]*s*this.displacement]);const g=[],y=i-n,_=Math.floor(r/y*t),v=Math.ceil((f-u)/y*t),x=t-v-_;if(c){g.push(c);for(let b=1;b<_;b++){const S=b/_*r*this.displacement;g.push([c[0]-this.startVector[0]*S,c[1]-this.startVector[1]*S])}}const P=this.interpolators.trajectory.getPoints(v-1,null,u,f);if(g.push(...P),h){for(let b=1;b<x-1;b++){const S=b/x*s*this.displacement;g.push([d[0]+this.endVector[0]*S,d[1]+this.endVector[1]*S])}g.push(h)}return{points:g,offset:l}}getExtendedTrajectory(t,n=ga,i=ma){if(!isFinite(n)||n<0)throw new Error("Invalid parameter, getExtendedTrajectory() must be called with a valid and positive startExtensionLength parameter");if(!isFinite(i)||i<0)throw new Error("Invalid parameter, getExtendedTrajectory() must be called with a valid and positive endExtensionLength parameter");const r=this.displacement+n+i,s=Math.floor(n/r*t),o=Math.max(Math.ceil(this.displacement/r*t),1),a=t-o-s,c=[],h=new N(this.interpolators.trajectory.getPointAt(0)),l=new N(this.startVector),u=n/s;for(let v=s;v>0;v--){const x=v*u,P=h.add(l.scale(x));c.push(P.toArray())}const f=this.interpolators.trajectory.getPoints(o,null,0,1);c.push(...f);const p=new N(this.interpolators.trajectory.getPointAt(1)),d=new N(this.endVector),g=i/(a-1);for(let v=1;v<a;v++){const x=v*g,P=p.add(d.scale(x));c.push(P.toArray())}const y=-n;return{points:c,offset:y}}getTrajectoryVector(){const{trajectoryAngle:t,calculateDisplacementFromBottom:n}=this.options;if(isFinite(t)){const r=Xo(t);return new N(Math.cos(r),Math.sin(r)).toArray()}return Dt.getDirectionVector(this.interpolators.trajectory,n?Vi:1-Vi,n?0:1)}static toDisplacement(t,n=0){let i=t[0],r=0;return t.map(o=>{const a=o[0]-i[0],c=o[1]-i[1];return r+=Math.sqrt(a**2+c**2),i=o,[n>0?n-r:r,o[2]||0]})}static getDirectionVector(t,n,i){const r=t.getPointAt(i),s=t.getPointAt(n);return mt([r[0]-s[0],r[1]-s[1]])}get length(){return this.interpolators.curve.length}get offset(){return this._offset}set offset(t){this._curtainPathCache=void 0,this._offset=t}}var mn="http://www.w3.org/1999/xhtml";const Ui={svg:"http://www.w3.org/2000/svg",xhtml:mn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ve(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ui.hasOwnProperty(t)?{space:Ui[t],local:e}:e}function xa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===mn&&t.documentElement.namespaceURI===mn?t.createElement(e):t.createElementNS(n,e)}}function wa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Yi(e){var t=ve(e);return(t.local?wa:xa)(t)}function ba(){}function yn(e){return e==null?ba:function(){return this.querySelector(e)}}function Sa(e){typeof e!="function"&&(e=yn(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s=t[r],o=s.length,a=i[r]=new Array(o),c,h,l=0;l<o;++l)(c=s[l])&&(h=e.call(c,c.__data__,l,s))&&("__data__"in c&&(h.__data__=c.__data__),a[l]=h);return new X(i,this._parents)}function Ta(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ma(){return[]}function Wi(e){return e==null?Ma:function(){return this.querySelectorAll(e)}}function Aa(e){return function(){return Ta(e.apply(this,arguments))}}function Pa(e){typeof e=="function"?e=Aa(e):e=Wi(e);for(var t=this._groups,n=t.length,i=[],r=[],s=0;s<n;++s)for(var o=t[s],a=o.length,c,h=0;h<a;++h)(c=o[h])&&(i.push(e.call(c,c.__data__,h,o)),r.push(c));return new X(i,r)}function Gi(e){return function(){return this.matches(e)}}function Xi(e){return function(t){return t.matches(e)}}var Ca=Array.prototype.find;function La(e){return function(){return Ca.call(this.children,e)}}function ka(){return this.firstElementChild}function Ea(e){return this.select(e==null?ka:La(typeof e=="function"?e:Xi(e)))}var Fa=Array.prototype.filter;function Ra(){return Array.from(this.children)}function Oa(e){return function(){return Fa.call(this.children,e)}}function za(e){return this.selectAll(e==null?Ra:Oa(typeof e=="function"?e:Xi(e)))}function Da(e){typeof e!="function"&&(e=Gi(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s=t[r],o=s.length,a=i[r]=[],c,h=0;h<o;++h)(c=s[h])&&e.call(c,c.__data__,h,s)&&a.push(c);return new X(i,this._parents)}function ji(e){return new Array(e.length)}function Na(){return new X(this._enter||this._groups.map(ji),this._parents)}function xe(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xe.prototype={constructor:xe,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function $a(e){return function(){return e}}function Ia(e,t,n,i,r,s){for(var o=0,a,c=t.length,h=s.length;o<h;++o)(a=t[o])?(a.__data__=s[o],i[o]=a):n[o]=new xe(e,s[o]);for(;o<c;++o)(a=t[o])&&(r[o]=a)}function Ba(e,t,n,i,r,s,o){var a,c,h=new Map,l=t.length,u=s.length,f=new Array(l),p;for(a=0;a<l;++a)(c=t[a])&&(f[a]=p=o.call(c,c.__data__,a,t)+"",h.has(p)?r[a]=c:h.set(p,c));for(a=0;a<u;++a)p=o.call(e,s[a],a,s)+"",(c=h.get(p))?(i[a]=c,c.__data__=s[a],h.delete(p)):n[a]=new xe(e,s[a]);for(a=0;a<l;++a)(c=t[a])&&h.get(f[a])===c&&(r[a]=c)}function Ha(e){return e.__data__}function Va(e,t){if(!arguments.length)return Array.from(this,Ha);var n=t?Ba:Ia,i=this._parents,r=this._groups;typeof e!="function"&&(e=$a(e));for(var s=r.length,o=new Array(s),a=new Array(s),c=new Array(s),h=0;h<s;++h){var l=i[h],u=r[h],f=u.length,p=Ua(e.call(l,l&&l.__data__,h,i)),d=p.length,g=a[h]=new Array(d),y=o[h]=new Array(d),_=c[h]=new Array(f);n(l,u,g,y,_,p,t);for(var v=0,x=0,P,b;v<d;++v)if(P=g[v]){for(v>=x&&(x=v+1);!(b=y[x])&&++x<d;);P._next=b||null}}return o=new X(o,i),o._enter=a,o._exit=c,o}function Ua(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ya(){return new X(this._exit||this._groups.map(ji),this._parents)}function Wa(e,t,n){var i=this.enter(),r=this,s=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),i&&r?i.merge(r).order():r}function Ga(e){for(var t=e.selection?e.selection():e,n=this._groups,i=t._groups,r=n.length,s=i.length,o=Math.min(r,s),a=new Array(r),c=0;c<o;++c)for(var h=n[c],l=i[c],u=h.length,f=a[c]=new Array(u),p,d=0;d<u;++d)(p=h[d]||l[d])&&(f[d]=p);for(;c<r;++c)a[c]=n[c];return new X(a,this._parents)}function Xa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var i=e[t],r=i.length-1,s=i[r],o;--r>=0;)(o=i[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function ja(e){e||(e=qa);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,i=n.length,r=new Array(i),s=0;s<i;++s){for(var o=n[s],a=o.length,c=r[s]=new Array(a),h,l=0;l<a;++l)(h=o[l])&&(c[l]=h);c.sort(t)}return new X(r,this._parents).order()}function qa(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Za(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ka(){return Array.from(this)}function Qa(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],r=0,s=i.length;r<s;++r){var o=i[r];if(o)return o}return null}function Ja(){let e=0;for(const t of this)++e;return e}function tc(){return!this.node()}function ec(e){for(var t=this._groups,n=0,i=t.length;n<i;++n)for(var r=t[n],s=0,o=r.length,a;s<o;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function nc(e){return function(){this.removeAttribute(e)}}function ic(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rc(e,t){return function(){this.setAttribute(e,t)}}function sc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function oc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ac(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function cc(e,t){var n=ve(e);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((t==null?n.local?ic:nc:typeof t=="function"?n.local?ac:oc:n.local?sc:rc)(n,t))}function qi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hc(e){return function(){this.style.removeProperty(e)}}function lc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function uc(e,t,n){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,n)}}function fc(e,t,n){return arguments.length>1?this.each((t==null?hc:typeof t=="function"?uc:lc)(e,t,n??"")):Nt(this.node(),e)}function Nt(e,t){return e.style.getPropertyValue(t)||qi(e).getComputedStyle(e,null).getPropertyValue(t)}function dc(e){return function(){delete this[e]}}function pc(e,t){return function(){this[e]=t}}function gc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mc(e,t){return arguments.length>1?this.each((t==null?dc:typeof t=="function"?gc:pc)(e,t)):this.node()[e]}function Zi(e){return e.trim().split(/^|\s+/)}function _n(e){return e.classList||new Ki(e)}function Ki(e){this._node=e,this._names=Zi(e.getAttribute("class")||"")}Ki.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Qi(e,t){for(var n=_n(e),i=-1,r=t.length;++i<r;)n.add(t[i])}function Ji(e,t){for(var n=_n(e),i=-1,r=t.length;++i<r;)n.remove(t[i])}function yc(e){return function(){Qi(this,e)}}function _c(e){return function(){Ji(this,e)}}function vc(e,t){return function(){(t.apply(this,arguments)?Qi:Ji)(this,e)}}function xc(e,t){var n=Zi(e+"");if(arguments.length<2){for(var i=_n(this.node()),r=-1,s=n.length;++r<s;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?vc:t?yc:_c)(n,t))}function wc(){this.textContent=""}function bc(e){return function(){this.textContent=e}}function Sc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Tc(e){return arguments.length?this.each(e==null?wc:(typeof e=="function"?Sc:bc)(e)):this.node().textContent}function Mc(){this.innerHTML=""}function Ac(e){return function(){this.innerHTML=e}}function Pc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Cc(e){return arguments.length?this.each(e==null?Mc:(typeof e=="function"?Pc:Ac)(e)):this.node().innerHTML}function Lc(){this.nextSibling&&this.parentNode.appendChild(this)}function kc(){return this.each(Lc)}function Ec(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fc(){return this.each(Ec)}function Rc(e){var t=typeof e=="function"?e:Yi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Oc(){return null}function zc(e,t){var n=typeof e=="function"?e:Yi(e),i=t==null?Oc:typeof t=="function"?t:yn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function Dc(){var e=this.parentNode;e&&e.removeChild(this)}function Nc(){return this.each(Dc)}function $c(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ic(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bc(e){return this.select(e?Ic:$c)}function Hc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Vc(e){return function(t){e.call(this,t,this.__data__)}}function Uc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");return i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function Yc(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++i]=s;++i?t.length=i:delete this.__on}}}function Wc(e,t,n){return function(){var i=this.__on,r,s=Vc(t);if(i){for(var o=0,a=i.length;o<a;++o)if((r=i[o]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},i?i.push(r):this.__on=[r]}}function Gc(e,t,n){var i=Uc(e+""),r,s=i.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,h=a.length,l;c<h;++c)for(r=0,l=a[c];r<s;++r)if((o=i[r]).type===l.type&&o.name===l.name)return l.value}return}for(a=t?Wc:Yc,r=0;r<s;++r)this.each(a(i[r],t,n));return this}function tr(e,t,n){var i=qi(e),r=i.CustomEvent;typeof r=="function"?r=new r(t,n):(r=i.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Xc(e,t){return function(){return tr(this,e,t)}}function jc(e,t){return function(){return tr(this,e,t.apply(this,arguments))}}function qc(e,t){return this.each((typeof t=="function"?jc:Xc)(e,t))}function*Zc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],r=0,s=i.length,o;r<s;++r)(o=i[r])&&(yield o)}var er=[null];function X(e,t){this._groups=e,this._parents=t}function jt(){return new X([[document.documentElement]],er)}function Kc(){return this}X.prototype=jt.prototype={constructor:X,select:Sa,selectAll:Pa,selectChild:Ea,selectChildren:za,filter:Da,data:Va,enter:Na,exit:Ya,join:Wa,merge:Ga,selection:Kc,order:Xa,sort:ja,call:Za,nodes:Ka,node:Qa,size:Ja,empty:tc,each:ec,attr:cc,style:fc,property:mc,classed:xc,text:Tc,html:Cc,raise:kc,lower:Fc,append:Rc,insert:zc,remove:Nc,clone:Bc,datum:Hc,on:Gc,dispatch:qc,[Symbol.iterator]:Zc};function j(e){return typeof e=="string"?new X([[document.querySelector(e)]],[document.documentElement]):new X([[e]],er)}function Qc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function yt(e,t){if(e=Qc(e),t===void 0&&(t=e.currentTarget),t){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()),[i.x,i.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}var Jc={value:()=>{}};function vn(){for(var e=0,t=arguments.length,n={},i;e<t;++e){if(!(i=arguments[e]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new we(n)}function we(e){this._=e}function th(e,t){return e.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}we.prototype=vn.prototype={constructor:we,on:function(e,t){var n=this._,i=th(e+"",n),r,s=-1,o=i.length;if(arguments.length<2){for(;++s<o;)if((r=(e=i[s]).type)&&(r=eh(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<o;)if(r=(e=i[s]).type)n[r]=nr(n[r],e.name,t);else if(t==null)for(r in n)n[r]=nr(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new we(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,s;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],i=0,r=s.length;i<r;++i)s[i].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)}};function eh(e,t){for(var n=0,i=e.length,r;n<i;++n)if((r=e[n]).name===t)return r.value}function nr(e,t,n){for(var i=0,r=e.length;i<r;++i)if(e[i].name===t){e[i]=Jc,e=e.slice(0,i).concat(e.slice(i+1));break}return n!=null&&e.push({name:t,value:n}),e}const xn={capture:!0,passive:!1};function wn(e){e.preventDefault(),e.stopImmediatePropagation()}function nh(e){var t=e.document.documentElement,n=j(e).on("dragstart.drag",wn,xn);"onselectstart"in t?n.on("selectstart.drag",wn,xn):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ih(e,t){var n=e.document.documentElement,i=j(e).on("dragstart.drag",null);t&&(i.on("click.drag",wn,xn),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var $t=0,qt=0,Zt=0,ir=1e3,be,Kt,Se=0,Ct=0,Te=0,Qt=typeof performance=="object"&&performance.now?performance:Date,rr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function bn(){return Ct||(rr(rh),Ct=Qt.now()+Te)}function rh(){Ct=0}function Me(){this._call=this._time=this._next=null}Me.prototype=sr.prototype={constructor:Me,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?bn():+n)+(t==null?0:+t),!this._next&&Kt!==this&&(Kt?Kt._next=this:be=this,Kt=this),this._call=e,this._time=n,Sn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Sn())}};function sr(e,t,n){var i=new Me;return i.restart(e,t,n),i}function sh(){bn(),++$t;for(var e=be,t;e;)(t=Ct-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$t}function or(){Ct=(Se=Qt.now())+Te,$t=qt=0;try{sh()}finally{$t=0,ah(),Ct=0}}function oh(){var e=Qt.now(),t=e-Se;t>ir&&(Te-=t,Se=e)}function ah(){for(var e,t=be,n,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:be=n);Kt=e,Sn(i)}function Sn(e){if(!$t){qt&&(qt=clearTimeout(qt));var t=e-Ct;t>24?(e<1/0&&(qt=setTimeout(or,e-Qt.now()-Te)),Zt&&(Zt=clearInterval(Zt))):(Zt||(Se=Qt.now(),Zt=setInterval(oh,ir)),$t=1,rr(or))}}function ar(e,t,n){var i=new Me;return t=t==null?0:+t,i.restart(r=>{i.stop(),e(r+t)},t,n),i}var ch=vn("start","end","cancel","interrupt"),hh=[],cr=0,hr=1,Tn=2,Ae=3,lr=4,Mn=5,Pe=6;function Ce(e,t,n,i,r,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;lh(e,n,{name:t,index:i,group:r,on:ch,tween:hh,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:cr})}function An(e,t){var n=nt(e,t);if(n.state>cr)throw new Error("too late; already scheduled");return n}function ct(e,t){var n=nt(e,t);if(n.state>Ae)throw new Error("too late; already running");return n}function nt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function lh(e,t,n){var i=e.__transition,r;i[t]=n,n.timer=sr(s,0,n.time);function s(h){n.state=hr,n.timer.restart(o,n.delay,n.time),n.delay<=h&&o(h-n.delay)}function o(h){var l,u,f,p;if(n.state!==hr)return c();for(l in i)if(p=i[l],p.name===n.name){if(p.state===Ae)return ar(o);p.state===lr?(p.state=Pe,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[l]):+l<t&&(p.state=Pe,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[l])}if(ar(function(){n.state===Ae&&(n.state=lr,n.timer.restart(a,n.delay,n.time),a(h))}),n.state=Tn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Tn){for(n.state=Ae,r=new Array(f=n.tween.length),l=0,u=-1;l<f;++l)(p=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=p);r.length=u+1}}function a(h){for(var l=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(c),n.state=Mn,1),u=-1,f=r.length;++u<f;)r[u].call(e,l);n.state===Mn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Pe,n.timer.stop(),delete i[t];for(var h in i)return;delete e.__transition}}function Le(e,t){var n=e.__transition,i,r,s=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((i=n[o]).name!==t){s=!1;continue}r=i.state>Tn&&i.state<Mn,i.state=Pe,i.timer.stop(),i.on.call(r?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete n[o]}s&&delete e.__transition}}function uh(e){return this.each(function(){Le(this,e)})}function fh(e,t){var n,i;return function(){var r=ct(this,e),s=r.tween;if(s!==n){i=n=s;for(var o=0,a=i.length;o<a;++o)if(i[o].name===t){i=i.slice(),i.splice(o,1);break}}r.tween=i}}function dh(e,t,n){var i,r;if(typeof n!="function")throw new Error;return function(){var s=ct(this,e),o=s.tween;if(o!==i){r=(i=o).slice();for(var a={name:t,value:n},c=0,h=r.length;c<h;++c)if(r[c].name===t){r[c]=a;break}c===h&&r.push(a)}s.tween=r}}function ph(e,t){var n=this._id;if(e+="",arguments.length<2){for(var i=nt(this.node(),n).tween,r=0,s=i.length,o;r<s;++r)if((o=i[r]).name===e)return o.value;return null}return this.each((t==null?fh:dh)(n,e,t))}function Pn(e,t,n){var i=e._id;return e.each(function(){var r=ct(this,i);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return nt(r,i).value[t]}}function ur(e,t){var n;return(typeof t=="number"?tt:t instanceof lt?Ut:(n=lt(t))?(t=n,Ut):pi)(e,t)}function gh(e){return function(){this.removeAttribute(e)}}function mh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function yh(e,t,n){var i,r=n+"",s;return function(){var o=this.getAttribute(e);return o===r?null:o===i?s:s=t(i=o,n)}}function _h(e,t,n){var i,r=n+"",s;return function(){var o=this.getAttributeNS(e.space,e.local);return o===r?null:o===i?s:s=t(i=o,n)}}function vh(e,t,n){var i,r,s;return function(){var o,a=n(this),c;return a==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=a+"",o===c?null:o===i&&c===r?s:(r=c,s=t(i=o,a)))}}function xh(e,t,n){var i,r,s;return function(){var o,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=a+"",o===c?null:o===i&&c===r?s:(r=c,s=t(i=o,a)))}}function wh(e,t){var n=ve(e),i=n==="transform"?vo:ur;return this.attrTween(e,typeof t=="function"?(n.local?xh:vh)(n,i,Pn(this,"attr."+e,t)):t==null?(n.local?mh:gh)(n):(n.local?_h:yh)(n,i,t))}function bh(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Sh(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Th(e,t){var n,i;function r(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&Sh(e,s)),n}return r._value=t,r}function Mh(e,t){var n,i;function r(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&bh(e,s)),n}return r._value=t,r}function Ah(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var i=ve(e);return this.tween(n,(i.local?Th:Mh)(i,t))}function Ph(e,t){return function(){An(this,e).delay=+t.apply(this,arguments)}}function Ch(e,t){return t=+t,function(){An(this,e).delay=t}}function Lh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ph:Ch)(t,e)):nt(this.node(),t).delay}function kh(e,t){return function(){ct(this,e).duration=+t.apply(this,arguments)}}function Eh(e,t){return t=+t,function(){ct(this,e).duration=t}}function Fh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kh:Eh)(t,e)):nt(this.node(),t).duration}function Rh(e,t){if(typeof t!="function")throw new Error;return function(){ct(this,e).ease=t}}function Oh(e){var t=this._id;return arguments.length?this.each(Rh(t,e)):nt(this.node(),t).ease}function zh(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ct(this,e).ease=n}}function Dh(e){if(typeof e!="function")throw new Error;return this.each(zh(this._id,e))}function Nh(e){typeof e!="function"&&(e=Gi(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s=t[r],o=s.length,a=i[r]=[],c,h=0;h<o;++h)(c=s[h])&&e.call(c,c.__data__,h,s)&&a.push(c);return new ut(i,this._parents,this._name,this._id)}function $h(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,i=t.length,r=n.length,s=Math.min(i,r),o=new Array(i),a=0;a<s;++a)for(var c=t[a],h=n[a],l=c.length,u=o[a]=new Array(l),f,p=0;p<l;++p)(f=c[p]||h[p])&&(u[p]=f);for(;a<i;++a)o[a]=t[a];return new ut(o,this._parents,this._name,this._id)}function Ih(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Bh(e,t,n){var i,r,s=Ih(t)?An:ct;return function(){var o=s(this,e),a=o.on;a!==i&&(r=(i=a).copy()).on(t,n),o.on=r}}function Hh(e,t){var n=this._id;return arguments.length<2?nt(this.node(),n).on.on(e):this.each(Bh(n,e,t))}function Vh(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Uh(){return this.on("end.remove",Vh(this._id))}function Yh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yn(e));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o<r;++o)for(var a=i[o],c=a.length,h=s[o]=new Array(c),l,u,f=0;f<c;++f)(l=a[f])&&(u=e.call(l,l.__data__,f,a))&&("__data__"in l&&(u.__data__=l.__data__),h[f]=u,Ce(h[f],t,n,f,h,nt(l,n)));return new ut(s,this._parents,t,n)}function Wh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wi(e));for(var i=this._groups,r=i.length,s=[],o=[],a=0;a<r;++a)for(var c=i[a],h=c.length,l,u=0;u<h;++u)if(l=c[u]){for(var f=e.call(l,l.__data__,u,c),p,d=nt(l,n),g=0,y=f.length;g<y;++g)(p=f[g])&&Ce(p,t,n,g,f,d);s.push(f),o.push(l)}return new ut(s,o,t,n)}var Gh=jt.prototype.constructor;function Xh(){return new Gh(this._groups,this._parents)}function jh(e,t){var n,i,r;return function(){var s=Nt(this,e),o=(this.style.removeProperty(e),Nt(this,e));return s===o?null:s===n&&o===i?r:r=t(n=s,i=o)}}function fr(e){return function(){this.style.removeProperty(e)}}function qh(e,t,n){var i,r=n+"",s;return function(){var o=Nt(this,e);return o===r?null:o===i?s:s=t(i=o,n)}}function Zh(e,t,n){var i,r,s;return function(){var o=Nt(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Nt(this,e))),o===c?null:o===i&&c===r?s:(r=c,s=t(i=o,a))}}function Kh(e,t){var n,i,r,s="style."+t,o="end."+s,a;return function(){var c=ct(this,e),h=c.on,l=c.value[s]==null?a||(a=fr(t)):void 0;(h!==n||r!==l)&&(i=(n=h).copy()).on(o,r=l),c.on=i}}function Qh(e,t,n){var i=(e+="")=="transform"?_o:ur;return t==null?this.styleTween(e,jh(e,i)).on("end.style."+e,fr(e)):typeof t=="function"?this.styleTween(e,Zh(e,i,Pn(this,"style."+e,t))).each(Kh(this._id,e)):this.styleTween(e,qh(e,i,t),n).on("end.style."+e,null)}function Jh(e,t,n){return function(i){this.style.setProperty(e,t.call(this,i),n)}}function tl(e,t,n){var i,r;function s(){var o=t.apply(this,arguments);return o!==r&&(i=(r=o)&&Jh(e,o,n)),i}return s._value=t,s}function el(e,t,n){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,tl(e,t,n??""))}function nl(e){return function(){this.textContent=e}}function il(e){return function(){var t=e(this);this.textContent=t??""}}function rl(e){return this.tween("text",typeof e=="function"?il(Pn(this,"text",e)):nl(e==null?"":e+""))}function sl(e){return function(t){this.textContent=e.call(this,t)}}function ol(e){var t,n;function i(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&sl(r)),t}return i._value=e,i}function al(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,ol(e))}function cl(){for(var e=this._name,t=this._id,n=dr(),i=this._groups,r=i.length,s=0;s<r;++s)for(var o=i[s],a=o.length,c,h=0;h<a;++h)if(c=o[h]){var l=nt(c,t);Ce(c,e,n,h,o,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new ut(i,this._parents,e,n)}function hl(){var e,t,n=this,i=n._id,r=n.size();return new Promise(function(s,o){var a={value:o},c={value:function(){--r===0&&s()}};n.each(function(){var h=ct(this,i),l=h.on;l!==e&&(t=(e=l).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),h.on=t}),r===0&&s()})}var ll=0;function ut(e,t,n,i){this._groups=e,this._parents=t,this._name=n,this._id=i}function dr(){return++ll}var ft=jt.prototype;ut.prototype={constructor:ut,select:Yh,selectAll:Wh,selectChild:ft.selectChild,selectChildren:ft.selectChildren,filter:Nh,merge:$h,selection:Xh,transition:cl,call:ft.call,nodes:ft.nodes,node:ft.node,size:ft.size,empty:ft.empty,each:ft.each,on:Hh,attr:wh,attrTween:Ah,style:Qh,styleTween:el,text:rl,textTween:al,remove:Uh,tween:ph,delay:Lh,duration:Fh,ease:Oh,easeVarying:Dh,end:hl,[Symbol.iterator]:ft[Symbol.iterator]};function ul(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fl={time:null,delay:0,duration:250,ease:ul};function dl(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function pl(e){var t,n;e instanceof ut?(t=e._id,e=e._name):(t=dr(),(n=fl).time=bn(),e=e==null?null:e+"");for(var i=this._groups,r=i.length,s=0;s<r;++s)for(var o=i[s],a=o.length,c,h=0;h<a;++h)(c=o[h])&&Ce(c,e,t,h,o,n||dl(c,t));return new ut(i,this._parents,e,t)}jt.prototype.interrupt=uh,jt.prototype.transition=pl;const ke=e=>()=>e;function gl(e,{sourceEvent:t,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function dt(e,t,n){this.k=e,this.x=t,this.y=n}dt.prototype={constructor:dt,scale:function(e){return e===1?this:new dt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new dt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Cn=new dt(1,0,0);dt.prototype;function Ln(e){e.stopImmediatePropagation()}function Jt(e){e.preventDefault(),e.stopImmediatePropagation()}function ml(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function yl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function pr(){return this.__zoom||Cn}function _l(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function vl(){return navigator.maxTouchPoints||"ontouchstart"in this}function xl(e,t,n){var i=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function wl(){var e=ml,t=yl,n=xl,i=_l,r=vl,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,c=So,h=vn("start","zoom","end"),l,u,f,p=500,d=150,g=0,y=10;function _(m){m.property("__zoom",pr).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",I).filter(r).on("touchstart.zoom",L).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(m,M,w,C){var F=m.selection?m.selection():m;F.property("__zoom",pr),m!==F?b(m,M,w,C):F.interrupt().each(function(){S(this,arguments).event(C).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},_.scaleBy=function(m,M,w,C){_.scaleTo(m,function(){var F=this.__zoom.k,R=typeof M=="function"?M.apply(this,arguments):M;return F*R},w,C)},_.scaleTo=function(m,M,w,C){_.transform(m,function(){var F=t.apply(this,arguments),R=this.__zoom,z=w==null?P(F):typeof w=="function"?w.apply(this,arguments):w,$=R.invert(z),H=typeof M=="function"?M.apply(this,arguments):M;return n(x(v(R,H),z,$),F,o)},w,C)},_.translateBy=function(m,M,w,C){_.transform(m,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof w=="function"?w.apply(this,arguments):w),t.apply(this,arguments),o)},null,C)},_.translateTo=function(m,M,w,C,F){_.transform(m,function(){var R=t.apply(this,arguments),z=this.__zoom,$=C==null?P(R):typeof C=="function"?C.apply(this,arguments):C;return n(Cn.translate($[0],$[1]).scale(z.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof w=="function"?-w.apply(this,arguments):-w),R,o)},C,F)};function v(m,M){return M=Math.max(s[0],Math.min(s[1],M)),M===m.k?m:new dt(M,m.x,m.y)}function x(m,M,w){var C=M[0]-w[0]*m.k,F=M[1]-w[1]*m.k;return C===m.x&&F===m.y?m:new dt(m.k,C,F)}function P(m){return[(+m[0][0]+ +m[1][0])/2,(+m[0][1]+ +m[1][1])/2]}function b(m,M,w,C){m.on("start.zoom",function(){S(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(C).end()}).tween("zoom",function(){var F=this,R=arguments,z=S(F,R).event(C),$=t.apply(F,R),H=w==null?P($):typeof w=="function"?w.apply(F,R):w,Y=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),V=F.__zoom,K=typeof M=="function"?M.apply(F,R):M,rt=c(V.invert(H).concat(Y/V.k),K.invert(H).concat(Y/K.k));return function(G){if(G===1)G=K;else{var st=rt(G),ne=Y/st[2];G=new dt(ne,H[0]-st[0]*ne,H[1]-st[1]*ne)}z.zoom(null,G)}})}function S(m,M,w){return!w&&m.__zooming||new T(m,M)}function T(m,M){this.that=m,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(m,M),this.taps=0}T.prototype={event:function(m){return m&&(this.sourceEvent=m),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(m,M){return this.mouse&&m!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&m!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&m!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(m){var M=j(this.that).datum();h.call(m,this.that,new gl(m,{sourceEvent:this.sourceEvent,target:_,type:m,transform:this.that.__zoom,dispatch:h}),M)}};function O(m,...M){if(!e.apply(this,arguments))return;var w=S(this,M).event(m),C=this.__zoom,F=Math.max(s[0],Math.min(s[1],C.k*Math.pow(2,i.apply(this,arguments)))),R=yt(m);if(w.wheel)(w.mouse[0][0]!==R[0]||w.mouse[0][1]!==R[1])&&(w.mouse[1]=C.invert(w.mouse[0]=R)),clearTimeout(w.wheel);else{if(C.k===F)return;w.mouse=[R,C.invert(R)],Le(this),w.start()}Jt(m),w.wheel=setTimeout(z,d),w.zoom("mouse",n(x(v(C,F),w.mouse[0],w.mouse[1]),w.extent,o));function z(){w.wheel=null,w.end()}}function E(m,...M){if(f||!e.apply(this,arguments))return;var w=m.currentTarget,C=S(this,M,!0).event(m),F=j(m.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",Y,!0),R=yt(m,w),z=m.clientX,$=m.clientY;nh(m.view),Ln(m),C.mouse=[R,this.__zoom.invert(R)],Le(this),C.start();function H(V){if(Jt(V),!C.moved){var K=V.clientX-z,rt=V.clientY-$;C.moved=K*K+rt*rt>g}C.event(V).zoom("mouse",n(x(C.that.__zoom,C.mouse[0]=yt(V,w),C.mouse[1]),C.extent,o))}function Y(V){F.on("mousemove.zoom mouseup.zoom",null),ih(V.view,C.moved),Jt(V),C.event(V).end()}}function I(m,...M){if(e.apply(this,arguments)){var w=this.__zoom,C=yt(m.changedTouches?m.changedTouches[0]:m,this),F=w.invert(C),R=w.k*(m.shiftKey?.5:2),z=n(x(v(w,R),C,F),t.apply(this,M),o);Jt(m),a>0?j(this).transition().duration(a).call(b,z,C,m):j(this).call(_.transform,z,C,m)}}function L(m,...M){if(e.apply(this,arguments)){var w=m.touches,C=w.length,F=S(this,M,m.changedTouches.length===C).event(m),R,z,$,H;for(Ln(m),z=0;z<C;++z)$=w[z],H=yt($,this),H=[H,this.__zoom.invert(H),$.identifier],F.touch0?!F.touch1&&F.touch0[2]!==H[2]&&(F.touch1=H,F.taps=0):(F.touch0=H,R=!0,F.taps=1+!!l);l&&(l=clearTimeout(l)),R&&(F.taps<2&&(u=H[0],l=setTimeout(function(){l=null},p)),Le(this),F.start())}}function D(m,...M){if(this.__zooming){var w=S(this,M).event(m),C=m.changedTouches,F=C.length,R,z,$,H;for(Jt(m),R=0;R<F;++R)z=C[R],$=yt(z,this),w.touch0&&w.touch0[2]===z.identifier?w.touch0[0]=$:w.touch1&&w.touch1[2]===z.identifier&&(w.touch1[0]=$);if(z=w.that.__zoom,w.touch1){var Y=w.touch0[0],V=w.touch0[1],K=w.touch1[0],rt=w.touch1[1],G=(G=K[0]-Y[0])*G+(G=K[1]-Y[1])*G,st=(st=rt[0]-V[0])*st+(st=rt[1]-V[1])*st;z=v(z,Math.sqrt(G/st)),$=[(Y[0]+K[0])/2,(Y[1]+K[1])/2],H=[(V[0]+rt[0])/2,(V[1]+rt[1])/2]}else if(w.touch0)$=w.touch0[0],H=w.touch0[1];else return;w.zoom("touch",n(x(z,$,H),w.extent,o))}}function B(m,...M){if(this.__zooming){var w=S(this,M).event(m),C=m.changedTouches,F=C.length,R,z;for(Ln(m),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),R=0;R<F;++R)z=C[R],w.touch0&&w.touch0[2]===z.identifier?delete w.touch0:w.touch1&&w.touch1[2]===z.identifier&&delete w.touch1;if(w.touch1&&!w.touch0&&(w.touch0=w.touch1,delete w.touch1),w.touch0)w.touch0[1]=this.__zoom.invert(w.touch0[0]);else if(w.end(),w.taps===2&&(z=yt(z,this),Math.hypot(u[0]-z[0],u[1]-z[1])<y)){var $=j(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return _.wheelDelta=function(m){return arguments.length?(i=typeof m=="function"?m:ke(+m),_):i},_.filter=function(m){return arguments.length?(e=typeof m=="function"?m:ke(!!m),_):e},_.touchable=function(m){return arguments.length?(r=typeof m=="function"?m:ke(!!m),_):r},_.extent=function(m){return arguments.length?(t=typeof m=="function"?m:ke([[+m[0][0],+m[0][1]],[+m[1][0],+m[1][1]]]),_):t},_.scaleExtent=function(m){return arguments.length?(s[0]=+m[0],s[1]=+m[1],_):[s[0],s[1]]},_.translateExtent=function(m){return arguments.length?(o[0][0]=+m[0][0],o[1][0]=+m[1][0],o[0][1]=+m[0][1],o[1][1]=+m[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(m){return arguments.length?(n=m,_):n},_.duration=function(m){return arguments.length?(a=+m,_):a},_.interpolate=function(m){return arguments.length?(c=m,_):c},_.on=function(){var m=h.on.apply(h,arguments);return m===h?_:m},_.clickDistance=function(m){return arguments.length?(g=(m=+m)*m,_):Math.sqrt(g)},_.tapDistance=function(m){return arguments.length?(y=+m,_):y},_}const bl=.1,Sl=256;class gr{constructor(t,n,i={maxZoomLevel:Sl,minZoomLevel:bl}){this.zoom=null,this.elm=null,this.container=null,this.onRescale=null,this.options=null,this.xBounds=[0,1],this.yBounds=[0,1],this.translateBoundsX=[0,1],this.translateBoundsY=[0,1],this.scaleX=null,this.scaleY=null,this._zFactor=1,this.container=j(t),this.options=i,this.onRescale=n,this.onZoom=this.onZoom.bind(this),this.calculateTransform=this.calculateTransform.bind(this),this.applyTransform=this.applyTransform.bind(this),this.recalculateZoomTransform=this.recalculateZoomTransform.bind(this),this.rescale=this.rescale.bind(this),this.adjustToSize=this.adjustToSize.bind(this),this.setViewport=this.setViewport.bind(this),this.currentStateAsEvent=this.currentStateAsEvent.bind(this),this.updateTranslateExtent=this.updateTranslateExtent.bind(this),this.scaleX=At().domain(this.xBounds).range([0,1]),this.scaleY=At().domain(this.yBounds).range([0,1]),this.init()}get width(){return this.scaleX.range()[1]}get height(){return this.scaleY.range()[1]}get xSpan(){const{xBounds:t}=this;return Math.abs(t[1]-t[0])}get ySpan(){const{yBounds:t}=this;return Math.abs(t[1]-t[0])}get viewportRatio(){return this.width/(this.height||1)}get xRatio(){const t=this.scaleX.domain();return Math.abs(this.width/(t[1]-t[0]))}get yRatio(){const t=this.scaleY.domain();return Math.abs(this.height/(t[1]-t[0]))}get zFactor(){return this._zFactor}set zFactor(t){this._zFactor=t,this.recalculateZoomTransform()}get isXInverted(){return this.xBounds[1]<this.xBounds[0]}get isYInverted(){return this.yBounds[1]<this.yBounds[0]}get enableTranslateExtent(){return this._enableTranslateExtent}set enableTranslateExtent(t){this._enableTranslateExtent=t,this.updateTranslateExtent()}updateTranslateExtent(){const{width:t,xSpan:n,zFactor:i,enableTranslateExtent:r,translateBoundsX:s,translateBoundsY:o}=this;let a=-1/0,c=-1/0,h=1/0,l=1/0;if(r){const u=t/n;a=s[0]*u,h=s[1]*u,c=o[0]*u*i,l=o[1]*u*i}this.zoom.translateExtent([[a,c],[h,l]])}currentStateAsEvent(){const{scaleX:t,scaleY:n,xBounds:i,yBounds:r,zFactor:s,viewportRatio:o,currentTransform:a,xRatio:c,yRatio:h,width:l,height:u}=this;return{xScale:t.copy(),yScale:n.copy(),xBounds:i,yBounds:r,zFactor:s,viewportRatio:o,xRatio:c,yRatio:h,width:l,height:u,transform:Object.assign({},a)}}rescale(){const{currentStateAsEvent:t}=this;this.onRescale(t())}init(){this.zoom=wl().scaleExtent([this.options.minZoomLevel,this.options.maxZoomLevel]).on("zoom",this.onZoom),this.container.call(this.zoom)}onZoom(t){const{transform:n}=t;n&&(this.applyTransform(n),this.rescale())}applyTransform(t){const{width:n,scaleX:i,scaleY:r,xSpan:s,xBounds:o,yBounds:a,zFactor:c}=this,{viewportRatio:h,isXInverted:l,isYInverted:u}=this,f=n*t.k,p=s/f,d=s/t.k,g=d/c/h,y=p*t.x,_=p/c*t.y,v=o[0]-(l?-y:y),x=a[0]-(u?-_:_);i.domain([v,v+(l?-d:d)]),r.domain([x,x+(u?-g:g)]),this.currentTransform=t}setViewport(t,n,i,r){const{zoom:s,container:o,calculateTransform:a,scaleX:c,scaleY:h,isXInverted:l}=this;if(isNaN(t)||isNaN(i)){const g=c.domain(),y=g[1]-g[0];isNaN(t)&&(t=g[0]+y/2||0),isNaN(i)&&(i=Math.abs(y)||1)}if(isNaN(n)){const g=h.domain();n=g[0]+(g[1]-g[0])/2||0}const u=l?-i:i,f=t-u/2,p=f+u,d=a(f,p,n);Number.isFinite(r)&&r>0?s.transform(o.transition().duration(r),d):s.transform(o,d)}setBounds(t,n){this.xBounds=t,this.yBounds=n,this.recalculateZoomTransform()}setTranslateBounds(t,n){this.translateBoundsX=t,this.translateBoundsY=n,this.updateTranslateExtent()}adjustToSize(t,n,i=!1){const{width:r,height:s,scaleX:o,scaleY:a,recalculateZoomTransform:c}=this;let h=0,l=0;if(typeof t>"u"||typeof t=="boolean"){const{width:p,height:d}=this.container.node().getBoundingClientRect();h=p,l=d}else h=t,l=n;const u=Math.max(1,h),f=Math.max(1,l);!i&&r===u&&s===f||(o.range([0,u]),a.range([0,f]),c(),this.onRescale(this.currentStateAsEvent()))}calculateTransform(t,n,i){const{scaleX:r,xSpan:s,xBounds:o,yBounds:a,zFactor:c,viewportRatio:h,isXInverted:l,isYInverted:u}=this,[f,p]=r.range(),d=Math.abs(n-t),g=s/d,y=d/(p-f),_=i-(u?-d:d)/c/h/2,v=(o[0]-t)/(l?-y:y),x=(a[0]-_)/((u?-y:y)/c);return Cn.translate(v,x).scale(g)}recalculateZoomTransform(){const{scaleX:t,scaleY:n,container:i,calculateTransform:r,updateTranslateExtent:s}=this,[o,a]=t.domain(),[c,h]=n.domain(),l=c+(h-c)/2,u=r(o,a,l);s(),this.zoom.transform(i,u)}setZoomLevelBoundary(t){return this.zoom.scaleExtent(t),this}setMaxZoomLevel(t){const n=this.zoom.scaleExtent();return this.zoom.scaleExtent([n[0],t]),this}setMinZoomLevel(t){const n=this.zoom.scaleExtent();return this.zoom.scaleExtent([t,n[1]]),this}}const Tl={order:1,layerOpacity:1,interactive:!1};class te{constructor(t,n){this._referenceSystem=null,this._interactive=!1,this._id=t||`layer-${Math.floor(Math.random()*1e3)}`;const i=n||Tl;this._order=i.order||1,this._options={...i},this.loading=!1,this._element=null,this._opacity=i.layerOpacity||1,this._visible=!0,this._interactive=i.interactive||!1,n&&n.data&&this.setData(n.data),this._referenceSystem=n&&n.referenceSystem,this.onMount=this.onMount.bind(this),this.onUnmount=this.onUnmount.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onRescale=this.onRescale.bind(this),this.onResize=this.onResize.bind(this),this.onOrderChanged=this.onOrderChanged.bind(this),this.onOpacityChanged=this.onOpacityChanged.bind(this),this.setVisibility=this.setVisibility.bind(this)}get id(){return this._id}get element(){return this._element}get options(){return this._options}set options(t){this._options=t}set isLoading(t){this.loading=t}get isLoading(){return this.loading}set opacity(t){this._opacity=t,this.onOpacityChanged(t)}get opacity(){return this._opacity}set order(t){this._order=t,this.onOrderChanged(t)}get order(){return this._order}set interactive(t){this._interactive=t,this.onInteractivityChanged(t)}get interactive(){return this._interactive}get referenceSystem(){return this._referenceSystem}set referenceSystem(t){this._referenceSystem=t}get data(){return this.getData()}set data(t){this.setData(t)}get isVisible(){return this._visible}getData(){return this._data}setData(t){this._data=t,this.element&&this.onUpdate({data:t})}clearData(t=!0){this._data=null,t&&(this.referenceSystem=null),this.onUpdate({})}setVisibility(t,n){this._visible=t}onMount(t){this._element=t.elm,this._options.onMount&&this._options.onMount(t,this)}onUnmount(t){this._options.onUnmount&&this._options.onUnmount(t,this)}onResize(t){this._options.onResize&&this._options.onResize(t,this)}onUpdate(t){t.data&&(this._data=t.data),this._options.onUpdate&&this._options.onUpdate(t,this)}onRescale(t){this.optionsRescale(t)}optionsRescale(t){this._options.onRescale&&this._options.onRescale(t,this)}getInternalLayerIds(){return[]}}const Ee=200,Fe=300,mr=40,yr=30,Ml=100,Al=.6,Pl=.3,Cl=8,Ll=16,_t=64,_r=1;class vt extends te{onOpacityChanged(t){this.canvas&&this.updateStyle()}onOrderChanged(t){this.canvas&&this.updateStyle()}onInteractivityChanged(t){this.canvas&&this.updateStyle()}setVisibility(t){super.setVisibility(t),this.canvas&&this.updateStyle(t)}updateStyle(t){const i=t||this.isVisible?"visible":"hidden",r=this.interactive?"auto":"none";this.canvas.setAttribute("style",`position:absolute;pointer-events:${r};z-index:${this.order};opacity:${this.opacity};visibility:${i}`)}onMount(t){super.onMount(t);const{elm:n}=t,i=t.width||parseInt(n.getAttribute("width"),10)||Ee,r=t.height||parseInt(n.getAttribute("height"),10)||Fe;this.elm=n;let s;this.canvas||(s=document.createElement("canvas"),this.canvas=s,t.elm.appendChild(s)),this.canvas.setAttribute("id",`${this.id}`),this.canvas.setAttribute("width",`${i}px`),this.canvas.setAttribute("height",`${r}px`),this.canvas.setAttribute("class","canvas-layer"),this.updateStyle(),this.ctx=this.canvas.getContext("2d")}onUnmount(){super.onUnmount(),this.canvas.remove(),this.canvas=null}onResize(t){const{ctx:n}=this,{width:i,height:r}=t;n.canvas.setAttribute("width",`${i}px`),n.canvas.setAttribute("height",`${r}px`)}onUpdate(t){super.onUpdate(t)}resetTransform(){this.ctx.resetTransform()}setTransform(t){this.resetTransform();const n=t.xBounds[0]>t.xBounds[1],i=t.yBounds[0]>t.yBounds[1];this.ctx.translate(t.xScale(0),t.yScale(0)),this.ctx.scale(t.xRatio*(n?-1:1),t.yRatio*(i?-1:1))}clearCanvas(){const{ctx:t,canvas:n}=this;t.save(),t.resetTransform(),t.clearRect(0,0,n.width,n.height),t.restore()}}class kl extends te{onMount(t){super.onMount(t);const{elm:n}=t,i=t.width||parseInt(n.getAttribute("width"),10)||Ee,r=t.height||parseInt(n.getAttribute("height"),10)||Fe;this.elm||(this.elm=j(n).append("div"),this.elm.attr("id",`${this.id}`),this.elm.attr("class","html-layer"));const s=this.interactive?"auto":"none";this.elm.style("position","absolute").style("height",`${r}px`).style("width",`${i}px`).style("opacity",this.opacity).style("overflow","hidden").style("pointer-events",s).style("z-index",this.order)}onUnmount(){super.onUnmount(),this.elm.remove(),this.elm=null}onResize(t){this.elm&&(super.onResize(t),this.elm.style("height",`${t.height}px`).style("width",`${t.width}px`))}setVisibility(t){super.setVisibility(t),this.elm&&this.elm.attr("visibility",t?"visible":"hidden")}onOpacityChanged(t){this.elm&&this.elm.style("opacity",t)}onOrderChanged(t){this.elm&&this.elm.style("z-index",t)}onInteractivityChanged(t){if(this.elm){const n=t?"auto":"none";this.elm.style("pointer-events",n)}}}class vr extends te{onMount(t){super.onMount(t);const{elm:n}=t,i=t.width||parseInt(n.getAttribute("width"),10)||Ee,r=t.height||parseInt(n.getAttribute("height"),10)||Fe;this.elm||(this.elm=j(n).append("svg"),this.elm.attr("id",`${this.id}`),this.elm.attr("class","svg-layer")),this.elm.attr("height",r).attr("width",i);const s=this.interactive?"auto":"none";this.elm.style("position","absolute").style("pointer-events",s).style("opacity",this.opacity).style("z-index",this.order)}onUnmount(){super.onUnmount(),this.elm.remove(),this.elm=null}onResize(t){this.elm&&(super.onResize(t),this.elm.attr("height",t.height).attr("width",t.width))}setVisibility(t){super.setVisibility(t),this.elm&&this.elm.attr("visibility",t?"visible":"hidden")}onOpacityChanged(t){this.elm&&this.elm.style("opacity",t)}onOrderChanged(t){this.elm&&this.elm.style("z-index",t)}onInteractivityChanged(t){if(this.elm){const n=t?"auto":"none";this.elm.style("pointer-events",n)}}}class El{constructor(t){const n={width:Ee,height:Fe,antialias:!0,backgroundAlpha:0,clearBeforeRender:!0,preserveDrawingBuffer:!0,...t};this.renderer=k.autoDetectRenderer(n),this.stage=new k.Container}destroy(){var i,r;this.stage.destroy({children:!0,texture:!0,baseTexture:!0}),this.stage=null;const t=this.renderer.type,n=this.renderer instanceof k.Renderer?(i=this.renderer)==null?void 0:i.gl:void 0;t===k.RENDERER_TYPE.WEBGL&&n&&((r=n==null?void 0:n.getExtension("WEBGL_lose_context"))==null||r.loseContext()),this.renderer.destroy(!0),this.renderer=null}get view(){return this.renderer.view}render(){this.renderer.render(this.stage)}}class kn extends te{constructor(t,n,i){super(n,i),this.ctx=t,this.container=new k.Container,this.ctx.stage.addChild(this.container)}render(){this.ctx.render()}addChild(t){this.container.addChild(t)}clearLayer(){this.container.removeChildren().forEach(n=>{n.destroy()})}onMount(t){super.onMount(t),this.pixiViewContainer=this.element.querySelector("#webgl-layer"),this.pixiViewContainer||(this.pixiViewContainer=document.createElement("div"),this.pixiViewContainer.setAttribute("id",`${this.id}`),this.pixiViewContainer.setAttribute("class","webgl-layer"),this.pixiViewContainer.appendChild(this.ctx.view),this.element.appendChild(this.pixiViewContainer),this.updateStyle())}onUnmount(t){super.onUnmount(t),this.clearLayer(),this.ctx.stage.removeChild(this.container),this.container.destroy(),this.pixiViewContainer.remove(),this.pixiViewContainer=void 0}onResize(t){super.onResize(t),this.ctx.renderer.resize(t.width,t.height)}onRescale(t){super.onRescale(t);const n=t.xBounds[0]>t.xBounds[1],i=t.yBounds[0]>t.yBounds[1];this.setContainerPosition(t.xScale(0),t.yScale(0)),this.setContainerScale(t.xRatio*(n?-1:1),t.yRatio*(i?-1:1))}setContainerPosition(t,n){this.container.position.set(t,n)}setContainerScale(t,n){this.container.scale.set(t,n)}updateStyle(t){const n=t||this.isVisible,i=this.interactive?"auto":"none";this.container.visible=n;const r=[["position","absolute"],["pointer-events",`${i}`],["z-index",`${this.order}`],["opacity",`${this.opacity}`]].map(s=>s.join(":")).join(";");this.pixiViewContainer.setAttribute("style",r)}setVisibility(t,n){super.setVisibility(t,n),this.pixiViewContainer&&this.updateStyle(t)}onOpacityChanged(t){this.pixiViewContainer&&this.updateStyle()}onOrderChanged(t){this.pixiViewContainer&&this.updateStyle()}onInteractivityChanged(t){this.pixiViewContainer&&this.updateStyle()}renderType(){return this.ctx.renderer.type}}function ee(e){throw new Error(`Unexpected object: ${JSON.stringify(e)}`)}const xr=e=>e.kind==="pAndASymbol",wr=e=>e.kind==="cementSqueeze",br=e=>e.kind==="cementPlug",Sr=(e,t,n)=>i=>{switch(i.kind){case"screen":return e(i);case"tubing":return t(i);case"completionSymbol":return n(i);default:return ee(i)}},q=(e,t)=>{switch(t){case"Perforation":return e.Perforation(t);case"Open hole gravel pack":return e.OpenHoleGravelPack(t);case"Open hole frac pack":return e.OpenHoleFracPack(t);case"Cased hole fracturation":return e.CasedHoleFracturation(t);case"Cased hole frac pack":return e.CasedHoleFracPack(t);case"Cased hole gravel pack":return e.CasedHoleGravelPack(t);default:return ee(t)}},Fl=e=>q({Perforation:()=>!0,OpenHoleGravelPack:()=>!0,OpenHoleFracPack:()=>!1,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!1},e.subKind),Rl=e=>q({Perforation:()=>!1,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!0,CasedHoleFracturation:()=>!0,CasedHoleGravelPack:()=>!0,CasedHoleFracPack:()=>!0},e.subKind),Tr=e=>q({Perforation:()=>!1,OpenHoleGravelPack:()=>!0,OpenHoleFracPack:()=>!0,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!0,CasedHoleFracPack:()=>!0},e.subKind);function Mr(e){return q({Perforation:()=>!1,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!0,CasedHoleFracturation:()=>!0,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!0},e.subKind)}function Ar(e){return q({Perforation:()=>!0,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!1,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!1},e.subKind)}function Pr(e){return q({Perforation:()=>!1,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!1,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!0,CasedHoleFracPack:()=>!1},e.subKind)}function Ol(e){return q({Perforation:()=>!0,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!1,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!1},e.subKind)}function Cr(e){return q({Perforation:()=>!1,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!1,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!0},e.subKind)}function zl(e){return q({Perforation:()=>!1,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!0,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!1},e.subKind)}const Lr=e=>e.subKind==="Cased hole fracturation",kr=(e,t)=>e.start<t.end&&e.end>t.start,Er=e=>({holeLayerId:`${e}-hole`,casingLayerId:`${e}-casing`,completionLayerId:`${e}-completion`,cementLayerId:`${e}-cement`,pAndALayerId:`${e}-pAndA`,perforationLayerId:`${e}-perforation`}),Fr={firstColor:"#8c541d",secondColor:"#eee3d8",lineColor:"#8b4513"},Rr={solidColor:"#dcdcdc",lineColor:"#575757",shoeSize:{width:Cl,length:Ll},windowOptions:{dashColor:"#dc0000",dashLength:5,spaceLength:3}},Or={stroke:"rgba(0, 0, 0, 0.25)",yellow:"#FFFC00",grey:"gray",red:"#FF5050",outline:"black",transparent:"rgba(255, 255, 255, 0)",spikeWidth:50,spikeLength:50,packingOpacity:.7,fracLineCurve:10,fracLineLength:25,scalingFactor:25},zr={firstColor:"#c7b9ab",secondColor:"#5b5b5b",scalingFactor:4},Dr={firstColor:"#8b6713",secondColor:"#000000",scalingFactor:4},Nr={scalingFactor:4,lineColor:"#63666a"},$r={scalingFactor:1,innerColor:"#eeeeff",outerColor:"#777788"},Ir={firstColor:"#c7b9ab",secondColor:"#000000",scalingFactor:4},Br=4,Hr=2;function Vr(e){const[t]=e.domain();return Math.abs(e(t+1))}function Re(e,t,n,i){return gt(Vr(i)*e,t,n)}function Dl(e,t){const n=e.x+e.width,i=t.x+t.width;return!(t.x>n||i<e.x)}function Ur(e,t,n=Br,i=Hr){const r=e.x+e.width+n,s=t.x+t.width+n,o=e.y+e.height+i,a=t.y+t.height+i;return!(t.x-n>r||t.y-i>o||s+n<e.x||a+i<e.y)}function Nl(e,t){const n=e.x+e.width,i=t.x+t.width,r=e.y+e.height,s=t.y+t.height;if(t.x>n||t.y>r||i<e.x||s<e.y)return null;const o=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),a=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return{dx:o,dy:a}}function En(e,t,n=Br,i=Hr){const r=e.x+e.width,s=t.x+t.width,o=e.y+e.height,a=t.y+t.height;if(t.x-n>r||t.y-i>o||s+n<e.x||a+i<e.y)return null;const c=e.x+e.width-t.x+n,h=e.y+e.height-t.y+i;return{dx:c,dy:h}}const $l=7,Il=11,Bl=7,Hl=20,Vl=120,Ul=19,it={topleft:"topleft",topright:"topright",bottomleft:"bottomleft",bottomright:"bottomright"};class Yl extends vt{constructor(t,n){super(t,n),this.groupFilter=null,this.renderAnnotation=(i,r,s,o,a,c)=>{this.renderText(i,s,o-a,a,c,"arial","bold"),this.renderText(r,s,o,a,c)},this.renderLine=(i,r,s,o,a,c,h=!0)=>{const{ctx:l}=this,u=h?i:i+s,f=h?i+s:i,p=r+2;l.strokeStyle=c,l.lineWidth=1,l.beginPath(),l.moveTo(o,a),l.lineTo(u,p),l.lineTo(f,p),l.stroke()},this.minFontSize=n.minFontSize||$l,this.maxFontSize=n.maxFontSize||Il,this.fontSizeFactor=n.fontSizeFactor||Bl,this.offsetMin=n.offsetMin||Hl,this.offsetMax=n.offsetMax||Vl,this.offsetFactor=n.offsetFactor||Ul}setGroupFilter(t){this.groupFilter=t,this.callouts=void 0,this.render()}onUpdate(t){super.onUpdate(t),this.callouts=void 0,this.render()}onRescale(t){super.onRescale(t);const n=this.rescaleEvent&&this.rescaleEvent.xRatio===t.xRatio;this.rescaleEvent=t,this.render(n)}render(t=!1){requestAnimationFrame(()=>{if(this.clearCanvas(),!this.data||!this.rescaleEvent||!this.referenceSystem)return;const{xScale:n,yScale:i,xBounds:r}=this.rescaleEvent,s=Re(this.fontSizeFactor,this.minFontSize,this.maxFontSize,n);if(!t||!this.callouts){const{data:o,ctx:a,groupFilter:c}=this,{calculateDisplacementFromBottom:h}=this.referenceSystem.options,l=h?r[0]<r[1]:r[0]>r[1],u=0;a.font=`bold ${s}px arial`;const f=o.filter(d=>!c||c.includes(d.group)),p=Re(this.offsetFactor,this.offsetMin,this.offsetMax,n);this.callouts=this.positionCallouts(f,l,n,i,u,s,p)}this.callouts.forEach(o=>{const{pos:a,title:c,color:h}=o,l=n(a.x),u=i(a.y),f={x:l,y:u,width:o.boundingBox.width,height:s,offsetX:o.dx,offsetY:o.dy};this.renderCallout(c,o.label,f,h,o.alignment)})})}renderText(t,n,i,r,s,o="arial",a="normal"){const{ctx:c}=this;c.font=`${a} ${r}px ${o}`,c.fillStyle=s,c.fillText(t,n,i)}renderPoint(t,n,i=3){const{ctx:r}=this;r.beginPath(),r.moveTo(t,n),r.arc(t,n,i,0,Math.PI*2),r.fill()}renderCallout(t,n,i,r,s){const o=this.getPosition(i,s),{x:a,y:c}=o,{height:h,width:l,x:u,y:f}=i,p=s===it.topright||s===it.bottomright;this.renderAnnotation(t,n,a,c,h,r),this.renderPoint(u,f),this.renderLine(a,c,l,u,f,r,p)}getPosition(t,n){const{x:i,y:r,offsetX:s,offsetY:o,width:a}=t;switch(n){case it.topleft:return{x:i-a-s,y:r-o};case it.topright:return{x:i+s,y:r-o};case it.bottomleft:return{x:i-a-s,y:r+o};case it.bottomright:return{x:i+s,y:r+o};default:return{x:i,y:r}}}positionCallouts(t,n,i,r,s,o,a=20){if(t.length===0)return[];const c=n?it.topleft:it.topright,h=t.map(f=>{const p=f.pos?f.pos:this.referenceSystem.project(f.md);return{title:f.title,label:f.label,color:f.color,pos:{x:p[0],y:p[1]},group:f.group,alignment:c,boundingBox:this.getAnnotationBoundingBox(f.title,f.label,p,i,r,o),dx:a,dy:a}}),l=[h[h.length-1]],u=[];return this.chooseTopOrBottomPosition(h,u,l),this.adjustTopPositions(l),this.adjustBottomPositions(u),h}getAnnotationBoundingBox(t,n,i,r,s,o){const{ctx:a}=this,c=r(i[0]),h=s(i[1]),l=a.measureText(n).width,u=a.measureText(t).width,f=Math.max(l,u);return{x:c,y:h,width:f,height:o*2+4}}chooseTopOrBottomPosition(t,n,i){for(let r=t.length-2;r>=0;--r){const s=t[r],o=i[0];Ur(s.boundingBox,o.boundingBox)?(s.alignment=s.alignment===it.topleft?it.bottomright:it.bottomleft,n.push(s),r>0&&i.unshift(t[--r])):i.unshift(s)}}adjustTopPositions(t){for(let n=t.length-2;n>=0;--n){const i=t[n];for(let r=t.length-1;r>n;--r){const s=t[r],o=En(i.boundingBox,s.boundingBox);o&&(i.dy+=o.dy,i.boundingBox.y-=o.dy)}}}adjustBottomPositions(t){for(let n=t.length-2;n>=0;--n){const i=t[n];for(let r=t.length-1;r>n;--r){const s=t[r],o=En(s.boundingBox,i.boundingBox);o&&(i.dy+=o.dy,i.boundingBox.y+=o.dy)}}}}const Wl=16,Gl=6;function pt(e){const n=lt(e).formatHex();return parseInt(n.replace("#","0x"))}function Xl(e){return typeof e=="string"?e:`#${e.toString(Wl).padStart(Gl,"0")}`}const jl=1e4;class ql extends vt{constructor(t,n){super(t,n),this.surfaceAreasPaths=[],this.surfaceLinesPaths=[],this.maxDepth=jl,this.drawPolygonPath=(i,r)=>{const{ctx:s}=this;s.fillStyle=i,s.fill(r)},this.drawLinePath=(i,r)=>{const{ctx:s}=this;s.strokeStyle=i,s.stroke(r)},this.createPolygons=i=>{const r=[];let s=null;for(let o=0;o<i.length;o++){const a=!!i[o][1];a&&(s===null&&(s=[]),s.push(i[o][0],i[o][1]));const c=o===i.length-1;if((!a||c)&&s){for(let h=a?o:o-1;h>=0&&i[h][1];h--)s.push(i[h][0],i[h][2]||this.maxDepth);r.push(s),s=null}}return r},this.generatePolygonPath=i=>{const r=new Path2D;r.moveTo(i[0],i[1]);for(let s=2;s<i.length;s+=2)r.lineTo(i[s],i[s+1]);return r.closePath(),r},this.generateLinePaths=i=>{const r=[],{data:s}=i;let o=!1,a=null;for(let c=0;c<s.length;c++)s[c][1]?o?a.lineTo(s[c][0],s[c][1]):(a=new Path2D,a.moveTo(s[c][0],s[c][1]),o=!0):o&&(r.push(a),o=!1);return o&&r.push(a),r},this.render=this.render.bind(this),this.generateSurfaceAreasPaths=this.generateSurfaceAreasPaths.bind(this),this.generateSurfaceLinesPaths=this.generateSurfaceLinesPaths.bind(this),this.drawPolygonPath=this.drawPolygonPath.bind(this),this.drawLinePath=this.drawLinePath.bind(this),this.updatePaths=this.updatePaths.bind(this)}onUpdate(t){super.onUpdate(t),this.updatePaths(),this.render()}onRescale(t){this.rescaleEvent=t,this.setTransform(this.rescaleEvent),this.render()}updatePaths(){this.data?(this.generateSurfaceAreasPaths(),this.generateSurfaceLinesPaths()):(this.surfaceAreasPaths=[],this.surfaceLinesPaths=[])}render(){!this.ctx||!this.rescaleEvent||requestAnimationFrame(()=>{this.clearCanvas(),this.surfaceAreasPaths.forEach(t=>this.drawPolygonPath(t.color,t.path)),this.surfaceLinesPaths.forEach(t=>this.drawLinePath(t.color,t.path))})}colorToCSSColor(t){return Xl(t)}generateSurfaceAreasPaths(){this.surfaceAreasPaths=this.data.areas.reduce((t,n)=>{const r=this.createPolygons(n.data).map(s=>({color:this.colorToCSSColor(n.color),path:this.generatePolygonPath(s)}));return t.push(...r),t},[])}generateSurfaceLinesPaths(){this.surfaceLinesPaths=this.data.lines.reduce((t,n)=>{const r=this.generateLinePaths(n).map(s=>({color:this.colorToCSSColor(n.color),path:s}));return t.push(...r),t},[])}}function Fn(e,t){var c,h,l,u,f,p,d,g,y;if(e.length<2)return-1;const n=20;let i=0,r=e.length-1,s=(c=e[i])==null?void 0:c[0],o=(h=e[r])==null?void 0:h[0];for(;r-i>n;){const _=Math.floor((r+i)/2),v=(l=e[_])==null?void 0:l[0];if(s==null||o==null||v==null)return-1;if(t>=s&&t<v)r=_,o=(u=e[r])==null?void 0:u[0];else if(t>=v&&t<=o)i=_,s=(f=e[i])==null?void 0:f[0];else if(t<=s&&t>v)r=_,o=(p=e[r])==null?void 0:p[0];else if(t<=v&&t>=o)i=_,s=(d=e[i])==null?void 0:d[0];else return-1}let a=-1;for(let _=i;_<r;_++){const v=(g=e[_])==null?void 0:g[0],x=(y=e[_+1])==null?void 0:y[0];if(v!=null&&x!=null&&Math.min(v,x)<=t&&t<=Math.max(v,x)){a=_;break}}return a}function xt(e,t,n=null,i=null){let r=null;const s=Fn(e,t);if(s!==-1){const o=e[s][1],a=e[s+1][1];if(a&&a){const c=e[s][0],l=e[s+1][0]-c,f=(t-c)/l;r=o*(1-f)+a*f,n&&n>r&&(r=n),i&&i<r&&(r=i)}}return r}const Rn=(e,t)=>({title:e.pickIdentifier||e.identifier,group:t,label:`${e.md} ${e.mdUnit} ${e.depthReferencePoint}`,color:t==="strat-picks"?"#227":"rgba(0,0,0,0.8)",md:e.md});function Zl(e){return e?e.map(t=>Rn(t,"ref-picks")):[]}function Kl(e){return e?e.filter(t=>t.entryPick.md===t.from).map(t=>Rn(t.entryPick,"strat-picks")):[]}function Ql(e){return e?e.filter(t=>e.findIndex(n=>Math.abs(n.entryPick.md-t.exitPick.md)<.5)===-1).map(t=>Rn(t.exitPick,"strat-picks")).filter((t,n,i)=>n===i.findIndex(r=>r.title===t.title&&r.md===t.md)):[]}const Jl=e=>[...Zl(e.nonUnitPicks),...Kl(e.unitPicks),...Ql(e.unitPicks)].sort((t,n)=>t.md-n.md),tu=e=>({unitName:e.identifier,topSurface:e.top,baseSurface:e.base,ageBase:e.baseAge,ageTop:e.topAge,color:{r:e.colorR===null?255:e.colorR,g:e.colorG===null?255:e.colorG,b:e.colorB===null?255:e.colorB},level:e.stratUnitLevel,lithType:e.lithologyType,parent:e.stratUnitParent});function eu(e,t,n){if(n.length===0)return[[e,t]];const i=[];let r=e,s=0;for(;r<t&&s<n.length;){const o=n[s];o.from>r&&i.push([r,Math.min(o.from,t)]),r=Math.min(t,Math.max(e,o.to)),s+=1}return r<t&&i.push([r,t]),i}const nu=e=>e.map(tu);function iu(e,t){const n=nu(t),i=[],r=[];return e.forEach(s=>{const o=n.filter(a=>s.pickIdentifier.search(new RegExp(`(${a.topSurface}|${a.baseSurface})`,"i"))!==-1);o.length>0?o.forEach(a=>r.push({md:s.md,tvd:s.tvd,identifier:s.pickIdentifier,confidence:s.confidence,mdUnit:s.mdUnit,depthReferencePoint:s.depthReferencePoint,...a})):i.push({identifier:s.pickIdentifier,...s})}),{joined:r,nonUnitPicks:i}}function ru(e){const t=[];let n=null;const i=e.filter(r=>r.level).sort((r,s)=>r.unitName.localeCompare(s.unitName)||r.md-s.md||r.ageTop-s.ageTop);for(;i.length>0;){n=i.shift();const r=n.identifier;let s;const o=r===n.topSurface,a=r===n.baseSurface;if(o)s=n.baseSurface;else if(a)s=n.topSurface;else{console.warn(`Unable to match ${r} with top or base surface, ignored`);continue}let c,h;const l=i.find(u=>u.identifier===s);if(l)c=o?n:l,h=o?l:n,c.md>h.md&&([c,h]=[h,c]),i.splice(i.indexOf(l),1);else if(console.warn(`Unable to find ${s} pick for ${r}`),o)if(c=n,h=e.filter(u=>u.level).sort((u,f)=>u.md-f.md).find(u=>u.md>c.md),h)console.warn(`Using ${h.identifier} as base for ${r}`);else{console.warn(`Unable to find a base pick for ${r} pick at ${c.md}, ignored`);continue}else if(a)if(h=n,c=e.filter(u=>u.level).sort((u,f)=>f.md-u.md).find(u=>u.md<h.md),c)console.warn(`Using ${c.identifier} as top for ${r}`);else{console.warn(`Unable to find a top pick for ${r} pick at ${h.md}, ignored`);continue}else{console.warn(`${r} ignored`);continue}t.push({name:c.unitName,mdEntry:c.md,tvdEntry:c.tvd,color:c.color,level:c.level,entryPick:c,mdExit:h.md,tvdExit:h.tvd,exitPick:h,confidenceEntry:c.confidence,confidenceExit:h.confidence})}return t}function su(e,t){const{joined:n,nonUnitPicks:i}=iu(e,t),s=ru(n).filter(a=>a.mdEntry<a.mdExit).sort((a,c)=>a.mdEntry-c.mdEntry||a.level-c.level).reverse(),o=[];for(;s.length>0;){const a=s.pop(),c=[];for(;s.length>0&&s[s.length-1].level>a.level;)c.push(s.pop());c.reverse(),c.push(a);const h=[];c.forEach(l=>{const u=eu(l.mdEntry,l.mdExit,h);h.push(...u.map(f=>({from:f[0],to:f[1],itm:l})))}),h.sort((l,u)=>l.from-u.from),o.push(...h.map(l=>({from:l.from,to:l.to,...l.itm})))}return{unitPicks:o,nonUnitPicks:i}}function ou(e,t){const n=e.map((s,o)=>o*t/e.length),i=At().domain(n).range(e);return Array.from(new Array(t).keys()).map(s=>{const o=lt(i(s)).rgb();return[o.r,o.g,o.b]})}const au=e=>e?{x:e.minX,y:e.minTvdMsl,width:e.maxX-e.minX,height:e.maxTvdMsl-e.minTvdMsl}:{x:0,y:0,width:0,height:0};function cu(e,t){if(!(e&&e.datapoints))return null;const n=t.reduce((p,d)=>Math.min(p,d[0]),0),i=t.reduce((p,d)=>Math.max(p,d[0]),0),r=e.yAxisValues&&e.yAxisValues[0],s=e.yAxisValues&&e.yAxisValues[e.yAxisValues.length-1],o=e.datapoints||[],a=-o.reduce((p,d)=>Math.min(...d,p),0),c=o.reduce((p,d)=>Math.max(...d,p),0),h=Math.max(Math.abs(a),Math.abs(c)),l=-h,u=h;return{minX:n,maxX:i,minTvdMsl:r,maxTvdMsl:s,domain:{min:l,max:u,difference:u-l}}}async function hu(e,t,n,i={isLeftToRight:!0}){if(!(e&&e.datapoints&&e.datapoints.length>0))return;const{datapoints:r}=e,s=(i==null?void 0:i.seismicMin)||(i==null?void 0:i.seismicRange)||r.reduce((m,M)=>Math.min(...M,m),0),o=(i==null?void 0:i.seismicMax)||(i==null?void 0:i.seismicRange)||r.reduce((m,M)=>Math.max(...M,m),0),a=Math.max(Math.abs(s),Math.abs(o)),c=-a,h=a,l={min:c,max:h,difference:h-c},u=t[0][0]-t[t.length-1][0],f=Math.abs(Math.floor(u/5)),p=e.yAxisValues.length,d=1e3,g=ou(n,d),y=new Uint8ClampedArray(f*p*4);let _=0;const v=(d-1)/l.difference;let x=i!=null&&i.isLeftToRight?t[0][0]:t[t.length-1][0];const P=u/f*(i!=null&&i.isLeftToRight?-1:1);let b,S,T,O,E;const I=[0,0,0];let L;for(let m=0;m<f;m++){_=m*4;const M=Fn(t,x),w=t[M][0],F=t[M+1][0]-w,z=(x-w)/F;for(let $=0;$<p;$++)b=r[$][M],S=r[$][M+1],b==null||S==null?(E=I,L=0):(T=b*(1-z)+S*z,O=(T-l.min)*v,O=gt(~~O,0,d-1),E=g[O],L=255),y.set([E[0],E[1],E[2],L],_),_+=f*4;x+=P}const D=new ImageData(y,f,p);return await createImageBitmap(D,0,0,f,p)}const lu=2147483648,uu=4294967295;function fu(e,t,n){const i=n.filter(p=>p.data.values),r=_u(i),s=new Map,o=mu(r,t,s);yu(o);const a=du(r,e),c=Su(e,o,t),h=gu(s,c),u=[...pu(h,e),...Object.values(c).flat().filter(p=>!p.exclude)];return{lines:a,areas:u}}function du(e,t){return e.filter(i=>i.visualization==="line").map(i=>({id:i.name,label:i.name,width:2,color:pt(i.color||"black"),data:t.map((r,s)=>[r[0],i.values[s]])}))}function pu(e,t){return e.map((i,r)=>{const s=r+1<e.length?e[r+1]:null;return{id:i.id,color:pt(i.color),data:t.map((o,a)=>[o[0],i.top[a],s?s.top[a]:null])}})}function gu(e,t){return Array.from(e.values()).sort((i,r)=>i.age-r.age).filter(i=>{const r=t[i.name],s=r&&r.length>0;return s||console.warn(`Intersection surface group '${i.name}' has no valid entries and will be discarded.`),s}).map((i,r)=>{const o=t[i.name][0];return{id:i.name,label:i.name,color:xu(r),top:o.data.map(a=>a[1])}})}function mu(e,t,n){const i=t&&t.find(o=>o.stratUnitLevel===1),r=i?i.identifier:"SEABED";return e.filter(o=>o.visualization==="interval"||o.visualization==="none").map(o=>{const a=[],c=Yr(t,o.name,a);c||console.warn(`No match for ${o.name} in strat column`);const h=a[0]||c,l=h&&h.identifier||r;return h&&!n.has(l)&&n.set(l,{age:h.topAge,name:h.identifier}),{...o,unit:c,group:l}})}function yu(e){e.sort((t,n)=>{if(!t.unit&&!n.unit)return 0;if(!t.unit)return-1;if(!n.unit)return 1;const i=t.isBase?t.unit.baseAge:t.unit.topAge,r=n.isBase?n.unit.baseAge:n.unit.topAge;return i!==r?i-r:t.isBase&&!n.isBase?1:!t.isBase&&n.isBase?-1:t.unit.stratUnitLevel-n.unit.stratUnitLevel})}function Yr(e,t,n=[]){const i=e.find(r=>r.identifier.toLowerCase()===t.toLowerCase());if(i){let r=i;do n.unshift(r),r=e.find(s=>s.identifier===r.stratUnitParent);while(r);return i}return null}function _u(e){return e.map(t=>{const n=t.visualSettings.displayName,i=n.replace(/\s(Base|Top)/gi,""),r=n.toLowerCase().endsWith("base");return{name:i,isBase:r,values:t.data.values,color:t.visualSettings.colors.crossSection,visualization:t.visualSettings.crossSection.toLowerCase()}})}function vu(e){return e.colorR===null||e.colorG===null||e.colorB===null?lu:e.colorR<<16|e.colorG<<8|e.colorB}const xu=ni().domain([0,100]).range(To(Ut("#e6f1cf","#85906d"),10));function wu(e,t,n,i){const r=t+1;if(!n||r>=n.length)return null;const s=n.findIndex(o=>o.isBase&&o.name===e.name);if(s!==-1)return s;for(let o=r;o<n.length;o++){const a=n[o];if(!a.isBase||bu(e,a,i))return o}return null}function bu(e,t,n){const i=[];return Yr(n,e.name,i),i.some(r=>t.name===r.identifier)}function Su(e,t,n){return t.reduce((r,s,o)=>{if(!s.isBase){r[s.group]||(r[s.group]=[]);const a=wu(s,o,t,n);r[s.group].push({id:s.name,label:s.name,color:s.unit&&vu(s.unit)||uu,exclude:s.visualization==="none"||!s.unit,data:e.map((c,h)=>{const l=s.values[h]!==null?Tu(a,t,h):null;return[c[0],s.values[h],l]})})}return r},{})}function Tu(e,t,n){if(!t||!e||e>=t.length)return null;for(let i=e;i<t.length;i++)if(t[i].values[n]!==null)return t[i].values[n];return null}const Wr=.1,On=1e3,Mu=150,Au=30,Pu=10;function Cu(e){if(!e||e.length===0)return[];const t=e?e.map(r=>[r.easting,r.northing,r.tvd,r.md]):[],n=Gr(Xr(t)),i=n[n.length-1][0];return n.forEach((r,s)=>{n[s][0]=i-r[0]}),n}function Lu(e,t){if(!e||e.length===0)return[];const n=e?e.map(v=>[v.easting,v.northing,v.tvd,v.md]):[],i=new pn(n,{tension:.75,arcDivisions:5e3}),r=i.length,s=Math.round(r*Pu);let o=null;s>0?o=Gr(i.getPoints(s),5e-4,10):o=[[n[0][0],n[0][1]]];const a=o[0],c=o[o.length-1],h=N.distance(a,c);let l=null;if(h<Mu){const x=t/180*Math.PI;l=new N(Math.cos(x),Math.sin(x)).mutable}else l=ku(o,Au);const u=Math.max(0,On-r),f=u+r,p=[];let d=[];const g=l.toArray();u>0&&(d=Li(Math.ceil(u*Wr)).map(v=>l.set(g).scale(u*(1-v)).subFrom(a).toArray()),d.pop(),p.push(...d)),p.push(...o);const y=Li(Math.ceil(On*Wr)).map(v=>l.set(g).scale(On*v).add(c).toArray()).splice(1);return p.push(...y),Xr(p,null,f)}function ku(e,t){const n=N.zero.mutable;let i=0;const r=N.zero.mutable;for(let s=0;s<e.length-1;s++){const o=e.length-1-s;if(r.set(e[o]).sub(e[o-1]),n.add(r),i=n.magnitude,i>t)break}return i===0?new N([0,0]):n.scale(1/i)}function Gr(e,t=.001,n=10){if(e.length<=4)return e;const[i,r]=e[0],s=e.map(l=>[l[0]-i,l[1]-r]);let[o,a]=s[0];const c=[e[0]];for(let l=1;l+1<s.length;l++){const[u,f]=s[l],[p,d]=s[l+1];if(p-u!==0||d-f!==0){const g=Math.abs(o*d-a*p+p*f-d*u+a*u-o*f)/Math.sqrt((p-o)**2+(d-a)**2),y=[o-u,a-f],_=Math.sqrt(y[0]**2+y[1]**2);(g>t||_>=n)&&(c.push([u+i,f+r]),[o,a]=[u,f])}}const h=s[s.length-1];return c.push([h[0]+i,h[1]+r]),c}function Xr(e,t=null,n=0){let i=t||e[0],r=0;return e.map(o=>{const a=o[0]-i[0],c=o[1]-i[1];return r+=Math.sqrt(a**2+c**2),i=o,[n>0?n-r:r,o[2]||0]})}const Eu=18,Fu=8,Ru=13,Ou="black",zu="Arial",Du=70;class Nu extends vt{constructor(t,n){super(t,n),this.defaultMargins=Eu,this.defaultMinFontSize=Fu,this.defaultMaxFontSize=Ru,this.defaultTextColor=Ou,this.defaultFont=zu,this.isLabelsOnLeftSide=!0,this.maxFontSizeInWorldCoordinates=Du,this.isXFlipped=!1,this.areasWithAvgTopDepth=null,this.drawAreaLabel=(i,r,s,o)=>{const{data:a}=i,{ctx:c,maxFontSizeInWorldCoordinates:h,isXFlipped:l}=this,{xScale:u,yScale:f,xRatio:p,yRatio:d,zFactor:g}=this.rescaleEvent;let y=this.checkDrawLabelsOnLeftSide();const v=(this.options.margins||this.defaultMargins)*(l?-1:1)/p,x=this.options.minFontSize||this.defaultMinFontSize;let b=(this.options.maxFontSize||this.defaultMaxFontSize)/d;b>h&&(b=h,b*d<x&&(b=x/d));const S=u.invert(u.range()[0])+v,T=u.invert(u.range()[1])-v,[O,E]=this.getSurfacesAreaEdges();c.save(),c.font=`${b*d}px ${this.options.font||this.defaultFont}`;let I=c.measureText(i.label),L=I.width/p;if(y){const U=S+(l?-L:L);(!l&&U>E||l&&U<E)&&(y=!1)}else{const U=T+(l?L:-L);(!l&&U<O||l&&U>O)&&(y=!0)}let D;const B=.07;y?D=l?Math.min(O,S):Math.max(O,S):D=l?Math.max(E,T):Math.min(E,T);const m=f.invert(f.range()[0]),M=f.invert(f.range()[1]),w=5,C=3,F=B*(L/C)*(y?1:-1)*(l?-1:1),R=L/w*(y?1:-1)*(l?-1:1),z=a.map(U=>[U[0],U[1]]),$=this.calcPos(z,D,C,F,m,M);if(!$)return;const H=a.map(U=>[U[0],U[2]]);let Y=this.calcPos(H,D,C,F,m,M,r?r.data.map(U=>[U[0],U[1]]):null,s,o);Y||(Y=new N($.x,M));const V=Y.y-$.y;if(V<b){if(V*d<x)return;b=V,c.font=`${b*d}px ${this.options.font||this.defaultFont}`,I=c.measureText(i.label),L=I.width/p}const K=y!==l?N.right:N.left,rt=this.calcAreaDir(z,H,D,w,R,K,m,M,0,Math.PI/4,4,r?r.data.map(U=>[U[0],U[1]]):null,s,o),G=Math.atan(Math.tan(rt)*g),st=D,ne=($.y+Y.y)/2,Z0=l?-G:G;c.textAlign=y?"left":"right",c.translate(u(st),f(ne)),c.rotate(Z0),c.fillStyle=this.options.textColor||this.defaultTextColor,c.font=`${b*d}px ${this.options.font||this.defaultFont}`,c.textBaseline="middle",c.fillText(i.label,0,0),c.restore()},this.drawLineLabel=i=>{const{ctx:r,isXFlipped:s}=this,{xScale:o,yScale:a,xRatio:c,yRatio:h,zFactor:l}=this.rescaleEvent,u=this.checkDrawLabelsOnLeftSide(),f=this.getMarginsInWorldCoordinates(),d=(this.options.maxFontSize||this.defaultMaxFontSize)/h;r.save(),r.font=`${d*h}px ${this.options.font||this.defaultFont}`;const y=r.measureText(i.label).width/c,_=o.invert(o.range()[0])+f,v=o.invert(o.range()[1])-f,[x,P]=this.getSurfacesAreaEdges();let b;const S=5;u?b=s?Math.max(P,v):Math.min(P,v):b=s?Math.min(x,_):Math.max(x,_);const T=y/S*(u?-1:1),{data:O}=i,E=this.calcPos(O,b,S,T),I=this.calcLineDir(O,b,S,T,l,u?N.left:N.right);if(!E||!I)return;const L=b,D=E.y-_r-d/2,B=N.angleRight(I)-(u?Math.PI:0);r.textAlign=u?"right":"left",r.translate(o(L),a(D)),r.rotate(B),r.fillStyle=this.colorToCSSColor(i.color),r.textBaseline="middle",r.fillText(i.label,0,0),r.restore()},this.render=this.render.bind(this),this.getMarginsInWorldCoordinates=this.getMarginsInWorldCoordinates.bind(this),this.getSurfacesAreaEdges=this.getSurfacesAreaEdges.bind(this),this.updateXFlipped=this.updateXFlipped.bind(this),this.generateSurfacesWithAvgDepth=this.generateSurfacesWithAvgDepth.bind(this)}get options(){return this._options}setData(t){super.setData(t),this.areasWithAvgTopDepth=null}generateSurfacesWithAvgDepth(){const{areas:t}=this.data;this.areasWithAvgTopDepth=t.reduce((n,i)=>{if(!i.label)return n;const r=i.data.reduce((o,a)=>(a[1]!=null&&(o.sum+=a[1],o.count++),o),{sum:0,count:0});if(r.count===0)return n;const s=r.sum/r.count;return n.push({...i,avgTopDepth:s}),n},[])}onMount(t){super.onMount(t)}onUpdate(t){super.onUpdate(t),this.render()}onRescale(t){this.rescaleEvent=t,this.updateXFlipped(),this.resetTransform(),this.render()}render(){this.rescaleEvent&&requestAnimationFrame(()=>{this.clearCanvas(),this.data&&(this.areasWithAvgTopDepth||this.generateSurfacesWithAvgDepth(),this.drawAreaLabels(),this.drawLineLabels())})}drawAreaLabels(){this.areasWithAvgTopDepth.forEach((t,n,i)=>{const r=i.reduce((s,o,a)=>(a>n&&(s==null||o.avgTopDepth<s.avgTopDepth)&&(s=o),s),null);this.drawAreaLabel(t,r,i,n)})}drawLineLabels(){this.data.lines.filter(t=>t.label).forEach(t=>this.drawLineLabel(t))}colorToCSSColor(t){if(typeof t=="string")return t;let n=t.toString(16);return n="000000".substr(0,6-n.length)+n,`#${n}`}calcPos(t,n,i,r,s=null,o=null,a=null,c=null,h=null){const l=N.zero.mutable;let u=0;for(let f=0;f<i;f++){const p=n+f*r,d=xt(t,p,s,o);if(d){const g=this.getAlternativeYValueIfAvailable(p,s,o,a,c,h),y=g?Math.min(d,g):d;l.add(p,y),u++}}return u===0?null:N.divide(l,u)}getAlternativeYValueIfAvailable(t,n,i,r,s,o){if(!r)return null;let a=xt(r,t,n,i);if(a==null&&s&&o!=null){let c=o+1;for(;a==null&&c<s.length;){const h=s[c++];a=xt(h.data.map(l=>[l[0],l[1]]),t,n,i)}}return a}calcLineDir(t,n,i,r,s,o=N.left,a=null,c=null){const h=o.mutable,l=xt(t,n,a,c);if(l===null)return h;const u=new N(n,l*s),f=N.zero.mutable;for(let p=1;p<=i;p++){const d=n+p*r,g=xt(t,n,a,c);g!==null&&(f.set(d,g*s),f.sub(u),h.add(f))}return h}calcAreaDir(t,n,i,r,s,o=N.left,a=null,c=null,h=0,l=Math.PI/4,u=4,f=null,p=null,d=null){const g=[],y=N.zero.mutable;let _;for(let T=0;T<=r;T++){const O=i+T*s,E=xt(t,O,a,c),I=xt(n,O,a,c)||c,L=this.getAlternativeYValueIfAvailable(O,a,c,f,p,d),D=L?Math.min(I,L):I;if(T===0){if(E===null)return N.angleRight(o);const B=(E+D)/2;_=new N(i,B)}else E!==null?(y.set(O,(E+D)/2),y.sub(_),g.push(N.angleRight(y))):g.push(N.angleRight(o))}const v=g[0],x=g.map(T=>T-v);let P=0;return x.reduce((T,O)=>{const E=(Math.abs(O)-h)/l,I=Math.pow(1-gt(E,0,1),u);return P+=I,T+O*I},0)/P+v}updateXFlipped(){const{xBounds:t}=this.rescaleEvent;this.isXFlipped=t[0]>t[1]}getMarginsInWorldCoordinates(){const{xRatio:t}=this.rescaleEvent;return(this.options.margins||this.defaultMargins)*(this.isXFlipped?-1:1)/t}getSurfacesAreaEdges(){const t=this.data.areas.reduce((c,h)=>{const{data:l}=h,u=l.find(f=>f[1]!=null);u&&c.push(u[0]);for(let f=l.length-1;f>=0;f--)if(l[f][1]!=null){c.push(l[f][0]);break}return c},[]);t.push(...this.data.lines.reduce((c,h)=>{const{data:l}=h,u=l.find(f=>f[1]!=null);u&&c.push(u[0]);for(let f=l.length-1;f>=0;f--)if(l[f][1]!=null){c.push(l[f][0]);break}return c},[]));const n=Math.min(...t),i=Math.max(...t),r=this.getMarginsInWorldCoordinates(),{isXFlipped:s}=this,o=s?i+r:n+r,a=s?n-r:i-r;return[o,a]}checkDrawLabelsOnLeftSide(){const{referenceSystem:t,isXFlipped:n}=this;if(!t)return!0;const{xScale:i,yScale:r,xRatio:s}=this.rescaleEvent,o=200,[a,c]=i.domain(),[h,l]=r.domain();let u=t.interpolators.curtain.getIntersects(h,1,0);u.length===0&&(u=[t.interpolators.curtain.getPointAt(0)]);let f=t.interpolators.curtain.getIntersects(l,1,0);f.length===0&&(f=[t.interpolators.curtain.getPointAt(1)]);const p=Math.max(u[0][0],f[0][0]),d=Math.min(u[0][0],f[0][0]),g={left:n?p:d,right:n?d:p},y=this.getMarginsInWorldCoordinates(),_=a+y,v=c-y,[x,P]=this.getSurfacesAreaEdges(),b=n?Math.min(_,x):Math.max(_,x),S=n?Math.max(v,P):Math.min(v,P),T=Math.max(n?b-g.left:g.left-b,0),O=Math.max(n?g.right-S:S-g.right,0),E=T*s,I=O*s;return T>O||E>o||E<o&&I<o&&n||f[0][1]<h}}const $u=1e4;class Iu extends kn{constructor(){super(...arguments),this.isPreRendered=!1,this.createPolygons=t=>{const n=[];let i=null;for(let r=0;r<t.length;r++){const s=!!t[r][1];s&&(i===null&&(i=[]),i.push(t[r][0],t[r][1]));const o=r===t.length-1;if((!s||o)&&i){for(let a=s?r:r-1;a>=0&&t[a][1];a--)i.push(t[a][0],t[a][2]||$u);n.push(i),i=null}}return n},this.generateAreaPolygon=t=>{const n=new k.Graphics;n.lineStyle(1,t.color,1),n.beginFill(t.color),this.createPolygons(t.data).forEach(r=>n.drawPolygon(r)),n.endFill(),this.addChild(n)},this.generateSurfaceLine=t=>{const n=new k.Graphics,{data:i}=t,r=.5;n.lineStyle(_r,t.color,1,r,!0);let s=!1;for(let o=0;o<i.length;o++){const a=i[o];a&&a[1]&&a[0]?s?n.lineTo(a[0],a[1]):(n.moveTo(a[0],a[1]),s=!0):s=!1}this.addChild(n)}}onRescale(t){super.onRescale(t),this.isPreRendered||(this.clearLayer(),this.preRender()),this.render()}onUpdate(t){super.onUpdate(t),this.isPreRendered=!1,this.clearLayer(),this.preRender(),this.render()}preRender(){const{data:t}=this;t&&(t.areas.forEach(n=>this.generateAreaPolygon(n)),t.lines.forEach(n=>this.generateSurfaceLine(n)),this.isPreRendered=!0)}}const jr="lightgray",qr="gray",Zr=.25,Kr=.75,Bu={minorColor:jr,majorColor:qr,minorWidth:Zr,majorWidth:Kr};class Oe extends vt{constructor(t,n){super(t,n),this._offsetX=0,this._offsetY=0,this.options={...this.options,...n||Bu},this.render=this.render.bind(this)}onUpdate(t){super.onUpdate(t),this.render(t)}onRescale(t){super.onRescale(t),this.render(t)}render(t){const{ctx:n}=this,{minorWidth:i,minorColor:r,majorWidth:s,majorColor:o}=this.options;if(!n||(this.clearCanvas(),!(t.xScale||t.yScale)))return;const a=t.xScale.copy(),c=t.yScale.copy(),h=a.domain(),l=c.domain(),u=this.offsetX,f=this.offsetY;a.domain([h[0]-u,h[1]-u]),c.domain([l[0]-f,l[1]-f]);const[p,d]=a.range(),[g,y]=c.range();n.lineWidth=i||Zr,n.strokeStyle=r||jr;const _=this.mapMinorTicks(a.ticks()),v=this.mapMinorTicks(c.ticks());this.renderTicksX(a,_,g,y),this.renderTicksY(c,v,p,d),n.lineWidth=s||Kr,n.strokeStyle=o||qr,this.renderTicksX(a,a.ticks(),g,y),this.renderTicksY(c,c.ticks(),p,d),n.restore()}renderTicksX(t,n,i,r){n.forEach(s=>{const o=t(s);this.ctx.beginPath(),this.ctx.moveTo(o,i),this.ctx.lineTo(o,r),this.ctx.stroke()})}renderTicksY(t,n,i,r){n.forEach(s=>{const o=t(s);this.ctx.beginPath(),this.ctx.moveTo(i,o),this.ctx.lineTo(r,o),this.ctx.stroke()})}mapMinorTicks(t){let n=[];return t.length>=2&&(n=t.map(i=>i+(t[1]-t[0])/2),n.pop()),n}get offsetX(){return this._offsetX}set offsetX(t){this._offsetX=t}get offsetY(){return this._offsetY}set offsetY(t){this._offsetY=t}}class Hu extends vt{onMount(t){super.onMount(t);const n=document.createElement("img");this.img=n,this.isLoading=!0}onUpdate(t){super.onUpdate(t),this.img.src=t.url,this.render(t)}onRescale(t){super.onRescale(t),this.setTransform(t),this.render(t)}render(t){const n=parseInt(this.elm.getAttribute("width"),10),i=parseInt(this.elm.getAttribute("height"),10),{xScale:r,yScale:s,xRatio:o,yRatio:a,x:c,y:h}=t,l=n*(o||1),u=i*(a||1);this.clearCanvas(),this.isLoading?this.img.onload=()=>{this.isLoading=!1,this.ctx.drawImage(this.img,r(c||0),s(h||0),l,u)}:this.ctx.drawImage(this.img,r(c||0),s(h||0),l,u)}}const Vu={dash:[10,5],width:1,color:16777215,alpha:1,scale:1,useTexture:!1,alignment:.5},wt=class{constructor(e,t={}){this.cursor=new ot.Point,this.scale=1,this.graphics=e,t={...Vu,...t},this.dash=t.dash,this.dashSize=this.dash.reduce((n,i)=>n+i),this.useTexture=t.useTexture,this.options=t,this.setLineStyle()}setLineStyle(){const e=this.options;if(this.useTexture){const t=wt.getTexture(e,this.dashSize);this.graphics.lineTextureStyle({width:e.width*e.scale,color:e.color,alpha:e.alpha,texture:t,alignment:e.alignment})}else this.graphics.lineStyle({width:e.width*e.scale,color:e.color,alpha:e.alpha,cap:e.cap,join:e.join,alignment:e.alignment});this.scale=e.scale}static distance(e,t,n,i){return Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2))}moveTo(e,t){return this.lineLength=0,this.cursor.set(e,t),this.start=new ot.Point(e,t),this.graphics.moveTo(this.cursor.x,this.cursor.y),this}lineTo(e,t,n){typeof this.lineLength===void 0&&this.moveTo(0,0);const i=wt.distance(this.cursor.x,this.cursor.y,e,t),r=Math.atan2(t-this.cursor.y,e-this.cursor.x),s=n&&e===this.start.x&&t===this.start.y;if(this.useTexture)if(this.graphics.moveTo(this.cursor.x,this.cursor.y),this.adjustLineStyle(r),s&&this.dash.length%2===0){const o=Math.min(this.dash[this.dash.length-1],i);this.graphics.lineTo(e-Math.cos(r)*o,t-Math.sin(r)*o),this.graphics.closePath()}else this.graphics.lineTo(e,t);else{const o=Math.cos(r),a=Math.sin(r);let c=this.cursor.x,h=this.cursor.y;const l=this.lineLength%(this.dashSize*this.scale);let u=0,f=0,p=0;for(let g=0;g<this.dash.length;g++){const y=this.dash[g]*this.scale;if(l<p+y){u=g,f=l-p;break}else p+=y}let d=i;for(;d>0;){const g=this.dash[u]*this.scale-f,y=d>g?g:d;if(s&&wt.distance(c+o*y,h+a*y,this.start.x,this.start.y)<=y){if(u%2===0){const v=wt.distance(c,h,this.start.x,this.start.y)-this.dash[this.dash.length-1]*this.scale;c+=o*v,h+=a*v,this.graphics.lineTo(c,h)}break}c+=o*y,h+=a*y,u%2?this.graphics.moveTo(c,h):this.graphics.lineTo(c,h),d-=y,u++,u=u===this.dash.length?0:u,f=0}}return this.lineLength+=i,this.cursor.set(e,t),this}closePath(){this.lineTo(this.start.x,this.start.y,!0)}drawCircle(e,t,n,i=80,r){const s=Math.PI*2/i;let o=0,a;r?(a=new ot.Point(e+Math.cos(o)*n,t+Math.sin(o)*n),r.apply(a,a),this.moveTo(a[0],a[1])):(a=new ot.Point(e+Math.cos(o)*n,t+Math.sin(o)*n),this.moveTo(a.x,a.y)),o+=s;for(let c=1;c<i+1;c++){const h=c===i?a:[e+Math.cos(o)*n,t+Math.sin(o)*n];this.lineTo(h[0],h[1]),o+=s}return this}drawEllipse(e,t,n,i,r=80,s){const o=Math.PI*2/r;let a;const c=new ot.Point;for(let h=0;h<Math.PI*2;h+=o){let l=e-n*Math.sin(h),u=t-i*Math.cos(h);s&&(c.set(l,u),s.apply(c,c),l=c.x,u=c.y),h===0?(this.moveTo(l,u),a={x:l,y:u}):this.lineTo(l,u)}return this.lineTo(a.x,a.y,!0),this}drawPolygon(e,t){const n=new ot.Point;if(typeof e[0]=="number")if(t){n.set(e[0],e[1]),t.apply(n,n),this.moveTo(n.x,n.y);for(let i=2;i<e.length;i+=2)n.set(e[i],e[i+1]),t.apply(n,n),this.lineTo(n.x,n.y,i===e.length-2)}else{this.moveTo(e[0],e[1]);for(let i=2;i<e.length;i+=2)this.lineTo(e[i],e[i+1],i===e.length-2)}else if(t){const i=e[0];n.copyFrom(i),t.apply(n,n),this.moveTo(n.x,n.y);for(let r=1;r<e.length;r++){const s=e[r];n.copyFrom(s),t.apply(n,n),this.lineTo(n.x,n.y,r===e.length-1)}}else{const i=e[0];this.moveTo(i.x,i.y);for(let r=1;r<e.length;r++){const s=e[r];this.lineTo(s.x,s.y,r===e.length-1)}}return this}drawRect(e,t,n,i,r){if(r){const s=new ot.Point;s.set(e,t),r.apply(s,s),this.moveTo(s.x,s.y),s.set(e+n,t),r.apply(s,s),this.lineTo(s.x,s.y),s.set(e+n,t+i),r.apply(s,s),this.lineTo(s.x,s.y),s.set(e,t+i),r.apply(s,s),this.lineTo(s.x,s.y),s.set(e,t),r.apply(s,s),this.lineTo(s.x,s.y,!0)}else this.moveTo(e,t).lineTo(e+n,t).lineTo(e+n,t+i).lineTo(e,t+i).lineTo(e,t,!0);return this}adjustLineStyle(e){const t=this.graphics.line;t.matrix=new ot.Matrix,e&&t.matrix.rotate(e),this.scale!==1&&t.matrix.scale(this.scale,this.scale);const n=-this.lineLength;t.matrix.translate(this.cursor.x+n*Math.cos(e),this.cursor.y+n*Math.sin(e)),this.graphics.lineStyle(t)}static getTexture(e,t){const n=e.dash.toString();if(wt.dashTextureCache[n])return wt.dashTextureCache[n];const i=document.createElement("canvas");i.width=t,i.height=Math.ceil(e.width);const r=i.getContext("2d");if(!r){console.warn("Did not get context from canvas");return}r.strokeStyle="white",r.globalAlpha=e.alpha,r.lineWidth=e.width;let s=0;const o=e.width/2;r.moveTo(s,o);for(let c=0;c<e.dash.length;c+=2)s+=e.dash[c],r.lineTo(s,o),e.dash.length!==c+1&&(s+=e.dash[c+1],r.moveTo(s,o));r.stroke();const a=wt.dashTextureCache[n]=ot.Texture.from(i);return a.baseTexture.scaleMode=ot.SCALE_MODES.NEAREST,a}};let Qr=wt;Qr.dashTextureCache={};const zn=e=>new N(e.x,e.y),Uu=e=>new k.Point(e[0],e[1]),Jr=e=>{if(e.length<2)return[new N(0)];let t;return e.map((n,i,r)=>{if(i<r.length-1){const s=zn(r[i]);return t=zn(r[i+1]).sub(s).rotate90().normalized(),t}return t})},ts=(e,t,n)=>{const i=zn(e);return Uu(i.add(t.scale(n)))},Dn=(e,t,n)=>{if(e.length!==t.length)throw new Error("Number of vectors does not match number of points");return e.map((i,r)=>{const s=t[r];return ts(i,s,n)})},es=(e,t,n,i)=>e<=i&&n<=t,Yu=(e,t,n,i)=>e<i&&n<t,Wu=e=>Array.from(new Set(e)),ze=(e,t,n,i)=>{const r=i.filter(o=>es(e,t,o.start,o.end)),s=n.filter(o=>es(e,t,o.start,o.end));return{overlappingHoles:r,overlappingOuterStrings:s}},De=([e,t],n)=>{const s=n.flatMap(a=>[a.start-1e-4,a.start,a.end,a.end+1e-4]).filter(a=>a>=e&&a<=t);return s.push(e),s.push(t),Wu(s).sort((a,c)=>a-c)},Z=e=>e.kind==="casing"?e.innerDiameter:e.diameter,ns=(e,t,n,i)=>{const s=e.find(h=>h.start<=i&&h.end>=i),o=s?s.diameter:0,a=t.filter(h=>Z(h)>o).sort((h,l)=>Z(h)-Z(l)).find(h=>h.start<=i&&h.end>=i),c=n.find(h=>h.start<=i&&h.end>=i&&h.diameter>o);return a?Z(a):c?c.diameter:100},Gu=(e,t,n,i)=>{const s=e.sort((a,c)=>c.diameter-a.diameter).find(a=>a.start<=n&&a.end>=n),o=t.find(a=>a.start<=n&&a.end>=n);return s&&i!=="Open hole frac pack"&&i!=="Open hole gravel pack"?Z(s):o?o.diameter:100},Xu=(e,t,n,i)=>{const s=e.sort((h,l)=>Z(h)-Z(l)).find(h=>h.start<=i&&h.end>=i);if(s)return Z(s);const o=e.length?Math.min(...e.map(h=>Z(h))):0,a=t.sort((h,l)=>Z(h)-Z(l)).find(h=>h.start<=i&&h.end>=i&&o<=Z(h));if(a)return Z(a);const c=n.find(h=>h.start<=i&&h.end>=i&&h.diameter);return c?c.diameter:100},ju=(e,t,n,i,r,s)=>{const{attachedStrings:o,nonAttachedStrings:a}=Nn(e.referenceIds,t,n);if(o.length===0)throw new Error(`Invalid cement data, can't find referenced casing/completion string for cement with id '${e.id}'`);o.sort((g,y)=>g.end-y.end);const c=o[o.length-1].end,{overlappingOuterStrings:h,overlappingHoles:l}=ze(e.toc,c,a,i),u=[...h,...l].map(g=>({start:g.start,end:g.end}));return De([e.toc,c],u).flatMap((g,y,_)=>{if(y===_.length-1)return[];const v=_[y+1],x=ns(o,h,l,g);return[{top:g,bottom:v,diameter:x*r}]}).map(g=>({diameter:g.diameter,points:s(g.top,g.bottom)}))},Nn=(e,t,n)=>[...t,...n].reduce((i,r)=>e.includes(r.id)?{...i,attachedStrings:[...i.attachedStrings,r]}:{...i,nonAttachedStrings:[...i.nonAttachedStrings,r]},{attachedStrings:[],nonAttachedStrings:[]}),qu=(e,t,n,i,r,s)=>{const{attachedStrings:o,nonAttachedStrings:a}=Nn(e.referenceIds,t,n);if(o.length===0)throw new Error(`Invalid cement squeeze data, can't find referenced casing/completion for squeeze with id '${e.id}'`);const{overlappingOuterStrings:c,overlappingHoles:h}=ze(e.start,e.end,a,i),l=[...c,...h].map(d=>({start:d.start,end:d.end}));return De([e.start,e.end],l).flatMap((d,g,y)=>{if(g===y.length-1)return[];const _=y[g+1],v=ns(o,c,h,d);return[{top:d,bottom:_,diameter:v*r}]}).map(d=>({diameter:d.diameter,points:s(d.top,d.bottom)}))},Zu=(e,t,n,i,r,s)=>{const{attachedStrings:o,nonAttachedStrings:a}=Nn(e.referenceIds,t,n),{overlappingHoles:c,overlappingOuterStrings:h}=ze(e.start,e.end,a,i),l=[...o,...c,...h].map(d=>({start:d.start,end:d.end}));return De([e.start,e.end],l).flatMap((d,g,y)=>{if(g===y.length-1)return[];const _=y[g+1],v=Xu(o,h,c,d);return[{top:d,bottom:_,diameter:v*r}]}).map(d=>({diameter:d.diameter,points:s(d.top,d.bottom)}))},Ku=(e,t,n,i,r)=>{const o=t.createLinearGradient(0,0,0,e.height);return o.addColorStop(0,n),o.addColorStop(.5-r,i),o.addColorStop(.5+r,i),o.addColorStop(1,n),o},Qu=({firstColor:e,secondColor:t},n,i)=>{const r=document.createElement("canvas");r.width=n,r.height=i;const s=r.getContext("2d");return s.fillStyle=Ku(r,s,e,t,0),s.fillRect(0,0,r.width,r.height),k.Texture.from(r)},Ju=({scalingFactor:e})=>{const t=document.createElement("canvas"),n=_t*e;t.width=n,t.height=n;const i=t.getContext("2d");i.fillStyle="white",i.fillRect(0,0,t.width,t.height);const r=n/10;i.strokeStyle="#AAAAAA",i.lineWidth=r,i.beginPath();const s=n/3;for(let o=-t.width;o<t.width;o++)i.moveTo(-t.width+s*o,-t.height),i.lineTo(t.width+s*o,t.height*2);return i.stroke(),k.Texture.from(t)},t0=({innerColor:e,outerColor:t,scalingFactor:n})=>{const i=_t*n,r=document.createElement("canvas");r.width=i,r.height=i;const s=r.getContext("2d"),o=s.createLinearGradient(0,0,0,i),a=.3,c=.7;return o.addColorStop(0,t),o.addColorStop(a,e),o.addColorStop(c,e),o.addColorStop(1,t),s.fillStyle=o,s.fillRect(0,0,r.width,r.height),k.Texture.from(r)},e0=({firstColor:e,secondColor:t,scalingFactor:n})=>{const i=document.createElement("canvas"),r=_t*n,s=n;i.width=r,i.height=r;const o=i.getContext("2d");o.fillStyle=e,o.fillRect(0,0,i.width,i.height),o.lineWidth=s,o.fillStyle=t,o.beginPath();const a=r/12;for(let c=-i.width;c<i.width;c++)o.moveTo(-i.width+a*c,-i.height),o.lineTo(i.width+a*c,i.height);return o.stroke(),k.Texture.from(i)},n0=({firstColor:e,secondColor:t,scalingFactor:n})=>{const i=document.createElement("canvas"),r=_t*n;i.width=r,i.height=r;const s=i.getContext("2d");s.fillStyle=e,s.fillRect(0,0,i.width,i.height),s.lineWidth=n,s.strokeStyle=t,s.beginPath(),s.setLineDash([20,10]);const o=r/12;for(let a=-i.width;a<i.width;a++)s.moveTo(-i.width+o*a,-i.height),s.lineTo(i.width+o*a,i.height*2);return s.stroke(),k.Texture.from(i)},i0=({firstColor:e,secondColor:t,scalingFactor:n})=>{const i=document.createElement("canvas"),r=_t*n,s=n;i.width=r,i.height=r;const o=i.getContext("2d");o.lineWidth=s,o.fillStyle=e,o.strokeStyle=t,o.fillRect(0,0,i.width,i.height),o.beginPath(),o.setLineDash([20,10]);const a=r/12;for(let c=-i.width;c<i.width;c++)o.moveTo(-i.width+a*c,-i.height),o.lineTo(i.width+a*c,i.height*2);return o.stroke(),k.Texture.from(i)},Ne=(e,t)=>{const n=Jr(t),i=Dn(t,n,e);return{leftPath:Dn(t,n,-e),rightPath:i}},$n=(e,t)=>({kind:"casing",start:e,end:t}),r0=(e,t)=>({kind:"casing-window",start:e,end:t}),s0=e=>{const t=(e.windows||[]).filter(n=>Yu(e.start,e.end,n.start,n.end)).reduce(({intervals:n,lastBottom:i},r,s,o)=>{const a=i<r.start?$n(i,r.start):null,c=a?a.end:i,h=Math.max(c,r.start),l=Math.min(e.end,r.end),u=r0(h,l),f=l,d=s===o.length-1&&f<e.end?$n(f,e.end):null,g=[a,u,d].filter(y=>y);return{intervals:[...n,...g],lastBottom:f}},{intervals:[],lastBottom:e.start});return t.intervals.length?t.intervals:[$n(e.start,e.end)]},o0=(e,t,n)=>{const i=t.diameter*e,r=i/2,o=t.innerDiameter*e/2,a=r-o,c=s0(t).map(h=>{const l=n(h.start,h.end),{leftPath:u,rightPath:f}=Ne(r,l);return{kind:h.kind,leftPath:u,rightPath:f,pathPoints:l}});return{kind:"casing",id:t.id,referenceDiameter:i,referenceRadius:r,sections:c,casingWallWidth:a,hasShoe:t.hasShoe,bottom:t.end}},a0=(e,t,n,i,r)=>{const{overlappingOuterStrings:s,overlappingHoles:o}=ze(e.start,e.end,t,n),a=[...s,...o].map(u=>({start:u.start,end:u.end}));return De([e.start,e.end],a).flatMap((u,f,p)=>{if(f===p.length-1)return[];const d=p[f+1],g=Gu(s,o,u,e.subKind);return[{top:u,bottom:d,diameter:g*i}]}).map(u=>{const f=r(u.top,u.bottom);return{diameter:u.diameter,points:f}})},$e=(e,t,n)=>{const{packingOpacity:i,yellow:r}=n;t.fillStyle=r,t.strokeStyle=r;const s=[0,0],o=[e.width,e.height];t.save(),t.globalAlpha=i,t.fillRect(...s,...o),t.restore()},In=(e,t,n,i,r)=>{const{fracLineCurve:s}=i,o=10,a=e.width/o,c=n/3*i.scalingFactor,h=c/4,l=c/2,u=0,f=r==="diameter"?0:l;t.globalAlpha=i.packingOpacity;const p=()=>{for(let d=-1;d<o;d++){const g=[d*a+u+a/2,e.height/2-h-f-h];t.beginPath();const y=[...g],_=[g[0]-s*2,g[1]-h/4],v=[g[0],g[1]-h/2],x=[g[0]+s*2,g[1]-h/2-h/4],P=[g[0],g[1]-h];t.bezierCurveTo(...y,..._,...v),t.bezierCurveTo(...v,...x,...P),t.stroke()}for(let d=-1;d<o;d++){const g=[d*a+a+u+a/2,e.height/2+c/2+f];t.beginPath();const y=[...g],_=[g[0]-s*2,g[1]+h/4],v=[g[0],g[1]+h/2],x=[g[0]+s*2,g[1]+h/2+h/4],P=[g[0],g[1]+h];t.bezierCurveTo(...y,..._,...v),t.bezierCurveTo(...v,...x,...P),t.stroke()}};t.strokeStyle=i.yellow,t.lineWidth=6,t.save(),p(),t.restore(),t.lineWidth=1,t.strokeStyle=i.outline,p(),t.closePath()},c0=(e,t,n,i)=>{const s=e.width/4;t.strokeStyle=i.outline;const o=n/3*i.scalingFactor;t.lineWidth=1;const a=o/2;for(let c=0;c<=4;c++){const h=[c*s,e.height/2-o/2],l=[h[0]-s/2,h[1]-a],u=[h[0]-s,h[1]];t.beginPath(),t.moveTo(...h),t.lineTo(...l),t.lineTo(...u),t.fill(),t.lineWidth=1,t.stroke()}for(let c=0;c<=4;c++){const h=[c*s,e.height/2+o/2],l=[h[0]-s/2,h[1]+a],u=[h[0]-s,h[1]];t.beginPath(),t.moveTo(...h),t.lineTo(...l),t.lineTo(...u),t.fill(),t.lineWidth=1,t.stroke()}t.closePath()},ht=(e="Error!",t)=>{console.error(`${e}`);const n=(t==null?void 0:t.canvas)||document.createElement("canvas"),i=_t;n.width=i/2,n.height=i;const r=(t==null?void 0:t.canvasCtx)||n.getContext("2d"),s=[0,0],o=[n.width,n.height];return r.fillStyle="#ff00ff",r.fillRect(...s,...o),new k.Texture(k.Texture.from(n,{wrapMode:k.WRAP_MODES.CLAMP}).baseTexture,null,new k.Rectangle(0,0,n.width,n.height),null,k.groupD8.MIRROR_HORIZONTAL)},bt=(e,t)=>{const n=document.createElement("canvas"),r=e.diameter*t.scalingFactor;n.width=r/2,n.height=r;const s=n.getContext("2d");return{canvas:n,ctx:s}},St=e=>new k.Texture(k.Texture.from(e,{wrapMode:k.WRAP_MODES.CLAMP}).baseTexture,null,new k.Rectangle(0,0,e.width,e.height),null,k.groupD8.MIRROR_HORIZONTAL),h0=(e,t)=>n=>t.some(i=>n(i)&&kr(e,i)),Bn={packing:()=>ht(),fracLines:()=>ht(),spikes:(e,t,n,i)=>{const{canvas:r,ctx:s}=bt(t,i),o=h0(e,n),a=o(Pr),c=o(Lr),h=o(Cr),u=a||c||h?i.yellow:i.red;return s.globalAlpha=i.packingOpacity,e.isOpen?(s.fillStyle=u,s.strokeStyle=u):(s.fillStyle=i.grey,s.strokeStyle=i.grey),c0(r,s,t.diameter,i),h&&In(r,s,t.diameter,i,"spike"),St(r)}},is={packing:()=>ht(),fracLines:(e,t)=>{const{canvas:n,ctx:i}=bt(e,t);return In(n,i,e.diameter,t,"diameter"),St(n)},spikes:()=>ht()},Ie={packing:(e,t)=>{const{canvas:n,ctx:i}=bt(e,t);return $e(n,i,t),St(n)},fracLines:(e,t)=>{const{canvas:n}=bt(e,t);return St(n)},spikes:()=>ht()},Hn={packing:(e,t)=>{const{canvas:n,ctx:i}=bt(e,t);return $e(n,i,t),St(n)},fracLines:()=>ht(),spikes:()=>ht()},Vn={packing:(e,t)=>{const{canvas:n,ctx:i}=bt(e,t);return $e(n,i,t),St(n)},fracLines:()=>ht(),spikes:()=>ht()},Un={packing:(e,t,n)=>{const{canvas:i,ctx:r}=bt(t,n);return $e(i,r,n),St(i)},fracLines:(e,t)=>{const{canvas:n,ctx:i}=bt(e,t);return In(n,i,e.diameter,t,"diameter"),St(n)},spikes:()=>ht()},l0=(e,t,n)=>q({Perforation:()=>Bn.packing(),CasedHoleFracturation:()=>Ie.packing(t,n),CasedHoleFracPack:()=>Ie.packing(t,n),OpenHoleGravelPack:()=>Vn.packing(t,n),OpenHoleFracPack:()=>Un.packing(e,t,n),CasedHoleGravelPack:()=>Hn.packing(t,n)},e.subKind),u0=(e,t,n)=>q({Perforation:()=>Bn.fracLines(),OpenHoleGravelPack:()=>Vn.fracLines(),OpenHoleFracPack:()=>Un.fracLines(t,n),CasedHoleFracturation:()=>is.fracLines(t,n),CasedHoleGravelPack:()=>Hn.fracLines(),CasedHoleFracPack:()=>Ie.fracLines(t,n)},e.subKind),f0=(e,t,n,i)=>q({Perforation:()=>Bn.spikes(e,n,t,i),OpenHoleGravelPack:()=>Vn.spikes(),OpenHoleFracPack:()=>Un.spikes(),CasedHoleFracturation:()=>is.spikes(),CasedHoleGravelPack:()=>Hn.spikes(),CasedHoleFracPack:()=>Ie.spikes()},e.subKind);class d0 extends k.MeshGeometry{constructor(t){const n=Xe(t,i=>i.points.length);super(new Float32Array(n*4),new Float32Array(n*4),new Uint16Array((n-1)*6)),this.segments=t,this.build()}get width(){return Ge(this.segments,t=>t.diameter)}build(){const t=this.segments;if(!t)return;const n=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex(),s=Xe(t,d=>d.points.length);if(s<1)return;n.data.length/4!==s&&(n.data=new Float32Array(s*4),i.data=new Float32Array(s*4),r.data=new Uint16Array((s-1)*6));const o=i.data,a=r.data;o[0]=0,o[1]=0,o[2]=0,o[3]=1;const c=t.length,h=Ge(t,d=>d.diameter);let l=0,u=0,f=0,p=0;for(let d=0;d<c;d++){let g=t[d].points[0];const y=h,_=t[d].diameter/h/2,v=t[d].points.length;for(let x=0;x<v;x++){const P=g.x-t[d].points[x].x,b=g.y-t[d].points[x].y,S=Math.sqrt(P*P+b*b);g=t[d].points[x],l+=S/y,o[u]=l,o[u+1]=.5-_,o[u+2]=l,o[u+3]=.5+_,u+=4}for(let x=0;x<v-1;x++)a[p++]=f,a[p++]=f+1,a[p++]=f+2,a[p++]=f+2,a[p++]=f+1,a[p++]=f+3,f+=2;f+=2}i.update(),r.update(),this.updateVertices()}updateVertices(){const t=this.segments;if(Xe(t,s=>s.points.length)<1)return;const i=t.length;let r=0;for(let s=0;s<i;s++){let o=t[s].points[0],a,c=0,h=0;const l=this.buffers[0].data,u=t[s].points.length;let f=0;for(let p=0;p<u;p++){const d=t[s].points[p];f=r+p*4,p<t[s].points.length-1?a=t[s].points[p+1]:a=d,h=-(a.x-o.x),c=a.y-o.y;const g=Math.sqrt(c*c+h*h),y=t[s].diameter/2;c/=g,h/=g,c*=y,h*=y,l[f]=d.x+c,l[f+1]=d.y+h,l[f+2]=d.x-c,l[f+3]=d.y-h,o=d}r=f+4}this.buffers[0].update()}update(){this.build()}}class p0 extends k.Mesh{constructor(t,n){const i=new d0(n),r=new k.MeshMaterial(t);t.baseTexture.wrapMode=k.WRAP_MODES.REPEAT,super(i,r),this.autoUpdate=!0}_render(t){const n=this.geometry;this.autoUpdate&&n.update(),super._render(t)}}class g0 extends k.MeshGeometry{constructor(t,n=200){super(new Float32Array(t.length*4),new Float32Array(t.length*4),new Uint16Array((t.length-1)*6)),this.points=t,this._width=n,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const n=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(t.length<1)return;n.data.length/4!==t.length&&(n.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),r.data=new Uint16Array((t.length-1)*6));const s=i.data,o=r.data;s[0]=0,s[1]=0,s[2]=0,s[3]=1;let a=0,c=t[0];const h=t.length;for(let u=0;u<h;u++){const f=u*4,p=c.x-t[u].x,d=c.y-t[u].y,g=Math.sqrt(p*p+d*d);c=t[u],a+=g/this._width,s[f]=a,s[f+1]=0,s[f+2]=a,s[f+3]=1}let l=0;for(let u=0;u<h-1;u++){const f=u*2;o[l++]=f,o[l++]=f+1,o[l++]=f+2,o[l++]=f+2,o[l++]=f+1,o[l++]=f+3}i.update(),r.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let n=t[0],i,r=0,s=0;const o=this.buffers[0].data,a=t.length;for(let c=0;c<a;c++){const h=t[c],l=c*4;c<t.length-1?i=t[c+1]:i=h,s=-(i.x-n.x),r=i.y-n.y;const u=Math.sqrt(r*r+s*s),f=this._width/2;r/=u,s/=u,r*=f,s*=f,o[l]=h.x+r,o[l+1]=h.y+s,o[l+2]=h.x-r,o[l+3]=h.y-s,n=h}this.buffers[0].update()}update(){this.build()}}class m0 extends k.Mesh{constructor(t,n,i){const r=new g0(n,i),s=new k.MeshMaterial(t);t.baseTexture.wrapMode=k.WRAP_MODES.REPEAT,super(r,s),this.autoUpdate=!0}_render(t){const n=this.geometry;this.autoUpdate&&n.update(),super._render(t)}}class y0 extends k.MeshGeometry{constructor(t,n=200){super(new Float32Array(t.length*4),new Float32Array(t.length*4),new Uint16Array((t.length-1)*6)),this.points=t,this._width=n,this.build()}build(){const t=this.points;if(!t)return;const n=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(t.length<1)return;n.data.length/4!==t.length&&(n.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),r.data=new Uint16Array((t.length-1)*6));const s=t.length;let o=0,a=t[0];for(let p=0;p<s;p++){const d=a.x-t[p].x,g=a.y-t[p].y,y=Math.sqrt(d*d+g*g);a=t[p],o+=y}const c=i.data,h=r.data;c[0]=0,c[1]=0,c[2]=0,c[3]=1;let l=0,u=t[0];for(let p=0;p<s;p++){const d=p*4,g=u.x-t[p].x,y=u.y-t[p].y,_=Math.sqrt(g*g+y*y);u=t[p],l+=_/o,c[d]=l,c[d+1]=0,c[d+2]=l,c[d+3]=1}let f=0;for(let p=0;p<s-1;p++){const d=p*2;h[f++]=d,h[f++]=d+1,h[f++]=d+2,h[f++]=d+2,h[f++]=d+1,h[f++]=d+3}i.update(),r.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let n=t[0],i,r=0,s=0;const o=this.buffers[0].data,a=t.length;for(let c=0;c<a;c++){const h=t[c],l=c*4;c<t.length-1?i=t[c+1]:i=h,s=-(i.x-n.x),r=i.y-n.y;const u=Math.sqrt(r*r+s*s),f=this._width/2;r/=u,s/=u,r*=f,s*=f,o[l]=h.x+r,o[l+1]=h.y+s,o[l+2]=h.x-r,o[l+3]=h.y-s,n=h}this.buffers[0].update()}update(){this.updateVertices()}}class _0 extends k.Mesh{constructor(t,n){const i=new y0(n,t.height),r=new k.MeshMaterial(t);super(i,r),this.autoUpdate=!0}_render(t){const n=this.geometry;(this.autoUpdate||n._width!==this.shader.texture.height)&&(n._width=this.shader.texture.height,n.update()),super._render(t)}}const v0=(e,t,n)=>i=>{switch(i.kind){case"casing":return e(i);case"cement":return t(i);case"cementSqueeze":return n(i);default:return ee(i)}},x0=e=>({exaggerationFactor:2,internalLayerOptions:Er(e),holeOptions:Fr,casingOptions:Rr,cementOptions:zr,cementSqueezeOptions:Dr,screenOptions:Nr,tubingOptions:$r,cementPlugOptions:Ir,perforationOptions:Or}),rs=class extends kn{constructor(e,t,n){super(e,t,n),this.internalLayerVisibility={holeLayerId:!0,casingLayerId:!0,completionLayerId:!0,cementLayerId:!0,pAndALayerId:!0,perforationLayerId:!0},this.scalingFactors={height:600,zFactor:1,yScale:At()},this.getZFactorScaledPathForPoints=(i,r)=>{const s=a=>a*this.scalingFactors.zFactor;return this.referenceSystem.getCurtainPath(i,r,!0).map(a=>new k.Point(a.point[0],s(a.point[1])))},this.drawBigPolygon=(i,r=0)=>{const s=new k.Graphics;s.beginFill(r),s.drawPolygon(i),s.endFill(),this.addChild(s)},this.perforationRopeAndTextureReferences=[],this.prepareSymbolRenderObject=i=>{const{exaggerationFactor:r}=this.options,s=i.diameter*r;return{pathPoints:this.getZFactorScaledPathForPoints(i.start,i.end),referenceDiameter:s,symbolKey:i.symbolKey}},this.drawSymbolComponent=({pathPoints:i,referenceDiameter:r,symbolKey:s})=>{const o=this.getSymbolTexture(s,r);this.drawSVGRope(i,o)},this.drawHoleSize=(i,r)=>{if(r==null)return;const s=this.getZFactorScaledPathForPoints(r.start,r.end);if(s.length===0)return;const{exaggerationFactor:o,holeOptions:a}=this.options,c=r.diameter*o,{rightPath:h,leftPath:l}=Ne(c/2,s),u=this.getHoleTexture(a,c,i);this.drawHoleRope(s,u,i),this.drawOutline(l,h,pt(a.lineColor),Al*o,"TopAndBottom",0)},this.drawCasing=i=>{const{casingOptions:r}=this.options,s=pt(r.solidColor),o=pt(r.lineColor);i.sections.forEach((a,c,h)=>{const l=rs.getOutlineClosureType(c,h.length-1),u=this.createCasingTexture(i.referenceDiameter);this.drawRope(a.pathPoints,u,s),a.kind==="casing-window"?this.drawCasingWindowOutline(a.leftPath,a.rightPath,r,i.casingWallWidth):this.drawOutline(a.leftPath,a.rightPath,o,i.casingWallWidth,l)})},this.generateShoe=(i,r,s,o)=>{const a=i-s,c=i,h=this.getZFactorScaledPathForPoints(a,c),l=Jr(h),u=Dn(h,l,r*(o<0?-1:1)),f=h[h.length-1],p=l[l.length-1],d=ts(f,p,o+r*(o<0?-1:1));return[...u,d]},this.createCementSqueezeShape=(i,r,s,o)=>{const{exaggerationFactor:a}=this.options;return qu(i,r,s,o,a,this.getZFactorScaledPathForPoints)},this.createPerforationShape=(i,r,s)=>{const{exaggerationFactor:o}=this.options;return a0(i,r,s,o,this.getZFactorScaledPathForPoints)},this.options={...this.options,...x0(this.id),...n}}onUnmount(e){super.onUnmount(e),this.scalingFactors=null,this.cementTextureCache=null,this.cementSqueezeTextureCache=null,this.holeTextureCache=null,this.screenTextureCache=null,this.tubingTextureCache=null,this.textureSymbolCacheArray=null,this.internalLayerVisibility=null}onUpdate(e){super.onUpdate(e),this.clearLayer(),this.preRender(),this.render()}onRescale(e){const t=this.scalingFactors.zFactor!==e.zFactor;this.scalingFactors={height:e.height,zFactor:e.zFactor,yScale:e.yScale},super.optionsRescale(e);const n=this.yRatio(),i=e.xBounds[0]>e.xBounds[1],r=e.yBounds[0]>e.yBounds[1];this.setContainerPosition(e.xScale(0),e.yScale(0)),this.setContainerScale(e.xRatio*(i?-1:1),n*(r?-1:1)),t&&(this.clearLayer(),this.preRender()),this.render()}setVisibility(e,t){if(t===this.id){super.setVisibility(e,t);return}const{internalLayerOptions:n}=this.options,[i]=Object.entries(n).find(([r,s])=>s===t);i&&(this.internalLayerVisibility[i]=e,this.clearLayer(),this.preRender(),this.render())}getInternalLayerIds(){const{internalLayerOptions:e}=this.options;return Object.values(e)}yRatio(){const e=this.scalingFactors.yScale.domain(),n=(e[1]-e[0])*this.scalingFactors.zFactor,i=[e[0],e[0]+n];return Math.abs(this.scalingFactors.height/(i[1]-i[0]))}drawRope(e,t,n){if(e.length===0)return null;const i=new k.SimpleRope(t,e,1);i.tint=n||i.tint,this.addChild(i)}drawOutline(e,t,n,i=1,r="None",s=1){const o=e.map(l=>l.clone()).reverse(),a=t[0],c=o[0],h=new k.Graphics;h.lineStyle(i,n,void 0,s),h.moveTo(a.x,a.y),t.forEach(l=>h.lineTo(l.x,l.y)),(r==="None"||r==="Top")&&h.moveTo(c.x,c.y),o.forEach(l=>h.lineTo(l.x,l.y)),(r==="TopAndBottom"||r==="Top")&&h.lineTo(a.x,a.y),this.addChild(h)}drawCasingWindowOutline(e,t,{lineColor:n,windowOptions:i},r=1){var d,g;const s=!!((g=(d=this.referenceSystem)==null?void 0:d.options)!=null&&g.calculateDisplacementFromBottom),[o,a]=s?[e,t]:[t,e],[c,h]=s?[1,0]:[0,1],l=new k.Graphics;l.lineStyle(r,pt(n),void 0,h);const u=o[0];l.moveTo(u.x,u.y),o.forEach(y=>l.lineTo(y.x,y.y));const f=new Qr(l,{dash:[i.dashLength,i.spaceLength],color:pt(i.dashColor),width:r,alignment:c}),p=a[0];f.moveTo(p.x,p.y),a.forEach(y=>{f.lineTo(y.x,y.y)}),this.addChild(l)}preRender(){if(!this.data||!this.referenceSystem)return;const{exaggerationFactor:e}=this.options,{holeSizes:t,casings:n,cements:i,completion:r,symbols:s,pAndA:o,perforations:a}=this.data;this.updateSymbolCache(s),t.sort((d,g)=>g.diameter-d.diameter);const c=t.length>0?Ge(t,d=>d.diameter)*e:Ml*e;this.internalLayerVisibility.holeLayerId&&t.forEach(d=>this.drawHoleSize(c,d)),n.sort((d,g)=>g.diameter-d.diameter);const h=n.map(d=>this.createCasingRenderObject(d)),l=i.map(d=>({kind:"cement",segments:ju(d,n,r,t,e,this.getZFactorScaledPathForPoints),casingIds:(d.referenceIds||[]).filter(g=>g)})),[u,f]=o.reduce(([d,g],y)=>wr(y)?[[y,...d],g]:[d,[y,...g]],[[],[]]),p=u.map(d=>({kind:"cementSqueeze",segments:this.createCementSqueezeShape(d,n,r,t),casingIds:d.referenceIds}));if(this.sortCementAndCasingRenderObjects(h,l,p).forEach(v0(d=>{this.internalLayerVisibility.casingLayerId&&(this.drawCasing(d),d.hasShoe&&this.drawShoe(d.bottom,d.referenceRadius))},d=>{this.internalLayerVisibility.cementLayerId&&this.drawComplexRope(d.segments,this.getCementTexture())},d=>{this.internalLayerVisibility.pAndALayerId&&this.drawComplexRope(d.segments,this.getCementSqueezeTexture())})),this.perforationRopeAndTextureReferences.forEach(({rope:d,texture:g})=>{d.destroy({children:!0,texture:!0,baseTexture:!0}),g.destroy(!0)}),this.perforationRopeAndTextureReferences=[],this.internalLayerVisibility.perforationLayerId){const{perforationOptions:d}=this.options,g=a.filter(Tr),y=a.filter(Mr),_=a.filter(Ar);g.forEach(v=>{const P=this.createPerforationShape(v,n,t).reduce((b,S)=>(b[S.diameter]||(b[S.diameter]=[]),b[S.diameter]=[...b[S.diameter],S],b),{});Object.values(P).forEach(b=>{const S=l0(v,b[0],d),T=this.drawComplexRope(b,S);this.perforationRopeAndTextureReferences.push({rope:T,texture:S})})}),_.forEach(v=>{const b=this.createPerforationShape(v,n,t).map(S=>({...S,diameter:S.diameter*3})).reduce((S,T)=>(S[T.diameter]||(S[T.diameter]=[]),S[T.diameter]=[...S[T.diameter],T],S),{});Object.values(b).forEach(S=>{S.forEach(T=>{const O=f0(v,a,T,d),E=this.drawComplexRope([T],O);this.perforationRopeAndTextureReferences.push({rope:E,texture:O})})})}),y.forEach(v=>{const b=this.createPerforationShape(v,n,t).map(S=>({...S,diameter:S.diameter*3})).reduce((S,T)=>(S[T.diameter]||(S[T.diameter]=[]),S[T.diameter]=[...S[T.diameter],T],S),{});Object.values(b).forEach(S=>{S.forEach(T=>{const O=u0(v,T,d),E=this.drawComplexRope([T],O);this.perforationRopeAndTextureReferences.push({rope:E,texture:O})})})})}this.internalLayerVisibility.completionLayerId&&r.forEach(Sr(d=>this.drawScreen(d),d=>this.drawTubing(d),d=>{const g=this.prepareSymbolRenderObject(d);this.drawSymbolComponent(g)})),this.internalLayerVisibility.pAndALayerId&&f.forEach(d=>{if(xr(d)){const g=this.prepareSymbolRenderObject(d);this.drawSymbolComponent(g)}br(d)&&this.drawCementPlug(d,n,r,t)})}updateSymbolCache(e){if(this.textureSymbolCacheArray||(this.textureSymbolCacheArray={}),!e)return;const t=Object.keys(this.textureSymbolCacheArray);Object.entries(e).forEach(([n,i])=>{t.includes(n)||(this.textureSymbolCacheArray[n]=k.Texture.from(i))})}drawCementPlug(e,t,n,i){const{exaggerationFactor:r,cementPlugOptions:s}=this.options,o=Zu(e,t,n,i,r,this.getZFactorScaledPathForPoints);this.drawComplexRope(o,this.getCementPlugTexture(s));const{rightPath:a,leftPath:c}=o.reduce((h,l)=>{const{leftPath:u,rightPath:f}=Ne(l.diameter/2,l.points);return{rightPath:[...h.rightPath,...f],leftPath:[...h.leftPath,...u]}},{rightPath:[],leftPath:[]});this.drawOutline(c,a,pt("black"),.25,"TopAndBottom")}createCasingRenderObject(e){const{exaggerationFactor:t}=this.options;return o0(t,e,this.getZFactorScaledPathForPoints)}getCementPlugTexture(e){return this.cementPlugTextureCache||(this.cementPlugTextureCache=n0(e)),this.cementPlugTextureCache}drawSVGRope(e,t){if(e.length===0)return null;const n=new _0(t,e);this.addChild(n)}getSymbolTexture(e,t){return new k.Texture(this.textureSymbolCacheArray[e].baseTexture,null,new k.Rectangle(0,0,0,t),null,k.groupD8.MAIN_DIAGONAL)}drawHoleRope(e,t,n){if(e.length===0)return null;const i=new k.SimpleRope(t,e,n/_t);this.addChild(i)}getHoleTexture(e,t,n){const i=_t,r=i,s=i,o=t/n*i;this.holeTextureCache||(this.holeTextureCache=Qu(e,s,r));const a=this.holeTextureCache.baseTexture,c=(r-o)/2,h=new k.Rectangle(0,c,s,o);return new k.Texture(a,h)}sortCementAndCasingRenderObjects(e,t,n){let i=0;const{result:r}=e.reduce((s,o)=>{const a=s.remainingCement.find(h=>h.casingIds.includes(o.id)),c=s.remainingCementSqueezes.filter(h=>h.casingIds.includes(o.id));return a&&(a.zIndex=i++),c.forEach(h=>h.zIndex=i++),o.zIndex=i++,{result:[...s.result,a,o,...c],remainingCement:s.remainingCement.filter(h=>h!==a),remainingCementSqueezes:s.remainingCementSqueezes.filter(h=>!c.includes(h))}},{result:[],remainingCement:t,remainingCementSqueezes:n});return r.filter(s=>s!==void 0).sort((s,o)=>s.zIndex-o.zIndex)}drawComplexRope(e,t){if(e.length===0)return null;const n=new p0(t,e);return this.addChild(n),n}createCasingTexture(e){return new k.Texture(k.Texture.WHITE.baseTexture,null,new k.Rectangle(0,0,16,e))}drawShoe(e,t){const{exaggerationFactor:n,casingOptions:i}=this.options,r=i.shoeSize.width*n,s=i.shoeSize.length*n,o=this.generateShoe(e,t,s,r),a=this.generateShoe(e,t,s,-r);this.drawBigPolygon(a),this.drawBigPolygon(o)}getCementTexture(){if(!this.cementTextureCache){const{cementOptions:e}=this.options;this.cementTextureCache=e0(e)}return this.cementTextureCache}getCementSqueezeTexture(){if(!this.cementSqueezeTextureCache){const{cementSqueezeOptions:e}=this.options;this.cementSqueezeTextureCache=i0(e)}return this.cementSqueezeTextureCache}drawScreen({start:e,end:t,diameter:n}){const{exaggerationFactor:i,screenOptions:r}=this.options,s=i*n,o=this.getZFactorScaledPathForPoints(e,t),{leftPath:a,rightPath:c}=Ne(s/2,o),h=this.getScreenTexture();this.drawCompletionRope(o,h,s),this.drawOutline(a,c,pt(r.lineColor),Pl*i,"TopAndBottom")}drawTubing({diameter:e,start:t,end:n}){const{exaggerationFactor:i,tubingOptions:r}=this.options,s=i*e,o=this.getZFactorScaledPathForPoints(t,n),a=this.getTubingTexture(r);this.drawCompletionRope(o,a,s)}getTubingTexture(e){return this.tubingTextureCache||(this.tubingTextureCache=t0(e)),this.tubingTextureCache}getScreenTexture(){if(!this.screenTextureCache){const{screenOptions:e}=this.options;this.screenTextureCache=Ju(e)}return this.screenTextureCache}drawCompletionRope(e,t,n){if(e.length===0)return;const i=new m0(t,e,n);this.addChild(i)}};let ss=rs;ss.getOutlineClosureType=(e,t)=>e===0?e===t?"TopAndBottom":"Top":e===t?"Bottom":"None";class w0 extends vt{onMount(t){super.onMount(t)}onUpdate(t){super.onUpdate(t),this.clearCanvas(),this.render()}onRescale(t){super.onRescale(t),this.setTransform(t),this.render()}render(){if(!this.data||!this.ctx||!this.data.image)return;const{ctx:t}=this,{options:n,image:i}=this.data;this.clearCanvas(),t.drawImage(i,n.x,n.y,n.width,n.height)}}function It(e){return function(){return e}}const os=1e-12,Yn=Math.PI,Wn=2*Yn,Lt=1e-6,b0=Wn-Lt;function as(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function S0(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return as;const n=10**t;return function(i){this._+=i[0];for(let r=1,s=i.length;r<s;++r)this._+=Math.round(arguments[r]*n)/n+i[r]}}class T0{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?as:S0(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,i,r){this._append`Q${+t},${+n},${this._x1=+i},${this._y1=+r}`}bezierCurveTo(t,n,i,r,s,o){this._append`C${+t},${+n},${+i},${+r},${this._x1=+s},${this._y1=+o}`}arcTo(t,n,i,r,s){if(t=+t,n=+n,i=+i,r=+r,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,a=this._y1,c=i-t,h=r-n,l=o-t,u=a-n,f=l*l+u*u;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(f>Lt)if(!(Math.abs(u*c-h*l)>Lt)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let p=i-o,d=r-a,g=c*c+h*h,y=p*p+d*d,_=Math.sqrt(g),v=Math.sqrt(f),x=s*Math.tan((Yn-Math.acos((g+f-y)/(2*_*v)))/2),P=x/v,b=x/_;Math.abs(P-1)>Lt&&this._append`L${t+P*l},${n+P*u}`,this._append`A${s},${s},0,0,${+(u*p>l*d)},${this._x1=t+b*c},${this._y1=n+b*h}`}}arc(t,n,i,r,s,o){if(t=+t,n=+n,i=+i,o=!!o,i<0)throw new Error(`negative radius: ${i}`);let a=i*Math.cos(r),c=i*Math.sin(r),h=t+a,l=n+c,u=1^o,f=o?r-s:s-r;this._x1===null?this._append`M${h},${l}`:(Math.abs(this._x1-h)>Lt||Math.abs(this._y1-l)>Lt)&&this._append`L${h},${l}`,i&&(f<0&&(f=f%Wn+Wn),f>b0?this._append`A${i},${i},0,1,${u},${t-a},${n-c}A${i},${i},0,1,${u},${this._x1=h},${this._y1=l}`:f>Lt&&this._append`A${i},${i},0,${+(f>=Yn)},${u},${this._x1=t+i*Math.cos(s)},${this._y1=n+i*Math.sin(s)}`)}rect(t,n,i,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${i=+i}v${+r}h${-i}Z`}toString(){return this._}}function M0(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const i=Math.floor(n);if(!(i>=0))throw new RangeError(`invalid digits: ${n}`);t=i}return e},()=>new T0(t)}function A0(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function cs(e){this._context=e}cs.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function hs(e){return new cs(e)}function P0(e){return e[0]}function C0(e){return e[1]}function L0(e,t){var n=It(!0),i=null,r=hs,s=null,o=M0(a);e=typeof e=="function"?e:e===void 0?P0:It(e),t=typeof t=="function"?t:t===void 0?C0:It(t);function a(c){var h,l=(c=A0(c)).length,u,f=!1,p;for(i==null&&(s=r(p=o())),h=0;h<=l;++h)!(h<l&&n(u=c[h],h,c))===f&&((f=!f)?s.lineStart():s.lineEnd()),f&&s.point(+e(u,h,c),+t(u,h,c));if(p)return s=null,p+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:It(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:It(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:It(!!c),a):n},a.curve=function(c){return arguments.length?(r=c,i!=null&&(s=r(i)),a):r},a.context=function(c){return arguments.length?(c==null?i=s=null:s=r(i=c),a):i},a}function ls(){}function Gn(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Be(e){this._context=e}Be.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Gn(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Gn(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function k0(e){return new Be(e)}function us(e){this._context=e}us.prototype={areaStart:ls,areaEnd:ls,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Gn(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function E0(e){return new us(e)}function fs(e,t){this._basis=new Be(e),this._beta=t}fs.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var i=e[0],r=t[0],s=e[n]-i,o=t[n]-r,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(i+c*s),this._beta*t[a]+(1-this._beta)*(r+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const F0=function e(t){function n(i){return t===1?new Be(i):new fs(i,t)}return n.beta=function(i){return e(+i)},n}(.85);function ds(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function Xn(e,t){this._context=e,this._k=(1-t)/6}Xn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ds(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:ds(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const R0=function e(t){function n(i){return new Xn(i,t)}return n.tension=function(i){return e(+i)},n}(0);function O0(e,t,n){var i=e._x1,r=e._y1,s=e._x2,o=e._y2;if(e._l01_a>os){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,r=(r*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>os){var h=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,l=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*h+e._x1*e._l23_2a-t*e._l12_2a)/l,o=(o*h+e._y1*e._l23_2a-n*e._l12_2a)/l}e._context.bezierCurveTo(i,r,s,o,e._x2,e._y2)}function ps(e,t){this._context=e,this._alpha=t}ps.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){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(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:O0(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const z0=function e(t){function n(i){return t?new ps(i,t):new Xn(i,0)}return n.alpha=function(i){return e(+i)},n}(.5);function gs(e){return e<0?-1:1}function ms(e,t,n){var i=e._x1-e._x0,r=t-e._x1,s=(e._y1-e._y0)/(i||r<0&&-0),o=(n-e._y1)/(r||i<0&&-0),a=(s*r+o*i)/(i+r);return(gs(s)+gs(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function ys(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function jn(e,t,n){var i=e._x0,r=e._y0,s=e._x1,o=e._y1,a=(s-i)/3;e._context.bezierCurveTo(i+a,r+a*t,s-a,o-a*n,s,o)}function He(e){this._context=e}He.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:jn(this,this._t0,ys(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,jn(this,ys(this,n=ms(this,e,t)),n);break;default:jn(this,this._t0,n=ms(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function _s(e){this._context=new vs(e)}(_s.prototype=Object.create(He.prototype)).point=function(e,t){He.prototype.point.call(this,t,e)};function vs(e){this._context=e}vs.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,i,r,s){this._context.bezierCurveTo(t,e,i,n,s,r)}};function D0(e){return new He(e)}function N0(e){return new _s(e)}function xs(e){this._context=e}xs.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var i=ws(e),r=ws(t),s=0,o=1;o<n;++s,++o)this._context.bezierCurveTo(i[0][s],r[0][s],i[1][s],r[1][s],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function ws(e){var t,n=e.length-1,i,r=new Array(n),s=new Array(n),o=new Array(n);for(r[0]=0,s[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)r[t]=1,s[t]=4,o[t]=4*e[t]+2*e[t+1];for(r[n-1]=2,s[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)i=r[t]/s[t-1],s[t]-=i,o[t]-=i*o[t-1];for(r[n-1]=o[n-1]/s[n-1],t=n-2;t>=0;--t)r[t]=(o[t]-r[t+1])/s[t];for(s[n-1]=(e[n]+r[n-1])/2,t=0;t<n-1;++t)s[t]=2*e[t+1]-r[t+1];return[r,s]}function $0(e){return new xs(e)}function Ve(e,t){this._context=e,this._t=t}Ve.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function I0(e){return new Ve(e,.5)}function B0(e){return new Ve(e,0)}function H0(e){return new Ve(e,1)}const V0=.7,U0=.9,Y0=1;class W0 extends vr{constructor(t,n){super(t,n),this.options={...this.options,...n},this.render=this.render.bind(this)}onUpdate(t){super.onUpdate(t),this.render()}onRescale(t){super.onRescale(t),this.elm&&(this.rescaleEvent=t,this.render())}render(){const{strokeWidth:t,stroke:n}=this.options;if(!this.elm)return;this.elm.select("g").remove();const i=this.data||this.referenceSystem&&this.referenceSystem.projectedPath;!i||!this.rescaleEvent||this.elm.append("g").attr("class","well-path").append("path").attr("d",this.renderWellborePath(i)).attr("stroke-width",t||"2px").attr("stroke",n||"red").attr("fill","none")}renderWellborePath(t){const{xScale:n,yScale:i}=this.rescaleEvent,r=t.map(c=>[n(c[0]),i(c[1])]);let s;const{curveType:o,tension:a}=this.options;switch(o){default:case"curveCatmullRom":s=z0.alpha(a||V0);break;case"curveLinear":s=hs;break;case"curveBasis":s=k0;break;case"curveBasisClosed":s=E0;break;case"curveBundle":s=F0.beta(a||Y0);break;case"curveCardinal":s=R0.tension(a||U0);break;case"curveMonotoneX":s=D0;break;case"curveMonotoneY":s=N0;break;case"curveNatural":s=$0;break;case"curveStep":s=I0;break;case"curveStepAfter":s=H0;break;case"curveStepBefore":s=B0;break}return L0().curve(s)(r)}}const bs=(e,t)=>{switch(t.lineType){case"wavy":return e.wavy(t);case"dashed":return e.dashed(t);case"solid":return e.solid(t);default:return ee(t.lineType)}};class G0 extends vt{constructor(){super(...arguments),this.yScale=null,this.xScale=null}onMount(t){super.onMount(t)}onUpdate(t){super.onUpdate(t),this.clearCanvas(),this.render()}onRescale(t){super.onRescale(t),this.yScale=t.yScale,this.xScale=t.xScale,this.resetTransform(),this.render()}drawDashed(t){const{ctx:n}=this,{canvas:i}=this,r=this.yScale(t.depth);n.save(),n.strokeStyle=t.color,this.setCtxLineStyle(n,t),this.setCtxLineWidth(n,t),n.beginPath(),n.moveTo(0,r),n.lineTo(i.width,r),n.stroke(),n.restore(),t.text&&this.drawText(n,t,n.canvas.width,r)}drawSolid(t){const{ctx:n}=this,{canvas:i}=this,r=this.yScale(t.depth);n.save(),n.strokeStyle=t.color,this.setCtxLineStyle(n,t),this.setCtxLineWidth(n,t),n.beginPath(),n.moveTo(0,r),n.lineTo(i.width,r),n.stroke(),n.restore(),t.text&&this.drawText(n,t,n.canvas.width,r)}drawWavy(t){const{ctx:s}=this,{canvas:o}=this,a=Re(4,2.5,500,this.yScale),c=a*2,h=this.yScale(t.depth)-a,l=Math.ceil(o.width/c)+1,u=this.xScale(0)%c;s.save(),s.strokeStyle=t.color,this.setCtxLineStyle(s,t),this.setCtxLineWidth(s,t);for(let f=-1;f<l;f++)s.beginPath(),s.arc(f*c+u+a,h,a,0,Math.PI),s.stroke();s.restore(),t.text&&this.drawText(s,t,s.canvas.width,h)}drawText(t,n,i,r){const s=n.textColor||"#000",o=n.fontSize||"10px sans-serif",a=10;t.save(),t.strokeStyle=s,t.font=o,t.textAlign="end",t.textBaseline="bottom",t.fillText(n.text,i-a,r),t.restore()}setCtxLineStyle(t,n){bs({solid:()=>{t.setLineDash([])},dashed:()=>{t.setLineDash([8,10])},wavy:()=>{t.setLineDash([])}},n)}setCtxLineWidth(t,n){t.lineWidth=n.lineWidth||1}render(){!this.ctx||!this.yScale||!this.xScale||requestAnimationFrame(()=>{var t;this.clearCanvas(),(t=this.data)==null||t.forEach(n=>{bs({solid:i=>this.drawSolid(i),dashed:i=>this.drawDashed(i),wavy:i=>this.drawWavy(i)},n)})})}}class Ss{constructor(t,n,i){if(this.layers=[],this.createAxis=r=>{const{container:s}=this;this._svgContainer=j(s).append("div").attr("class","axis").style("position","absolute").style("z-index","10").style("pointer-events","none");const o=this._svgContainer.append("svg").attr("height",`${s.offsetHeight}px`).attr("width",`${s.offsetWidth}px`),a=!0;return new Ci(o,a,r.xLabel,r.yLabel,r.unitOfMeasure)},this.container=t,this.layerContainer=document.createElement("div"),this.layerContainer.className="layer-container",this.container.appendChild(this.layerContainer),this.adjustToSize(+this.container.getAttribute("width"),+this.container.getAttribute("height")),this._zoomPanHandler=new gr(t,r=>this.rescale(r)),n){const{xMin:r,xMax:s,yMin:o,yMax:a,xBounds:c,yBounds:h}=n;r!==void 0&&s!==void 0&&o!==void 0&&a!==void 0&&this._zoomPanHandler.setBounds([r,s],[o,a]),c&&h&&this._zoomPanHandler.setBounds(c,h)}else this._zoomPanHandler.setBounds([0,1],[0,1]);i&&(this._axis=this.createAxis(i)),this.rescale=this.rescale.bind(this)}addLayers(t){return t.forEach(n=>this.addLayer(n)),this}getLayers(){return this.layers}clearAllData(t=!0){return this.layers.forEach(n=>n.clearData(t)),this}addLayer(t,n){return this.layers.push(t),this.initLayer(t,n),this}removeLayer(t){const n=this.layers.find(i=>i.id===t);return n&&(n.onUnmount(),this.layers=this.layers.filter(i=>i.id!==t)),this}removeAllLayers(){const{layers:t}=this;return t.forEach(n=>{this.removeLayer(n.id)}),this}getLayer(t){return this.layers.find(n=>n.id===t||n.getInternalLayerIds().includes(t))}initLayer(t,n){const i={elm:this.layerContainer};t.onMount(i);const r=this.zoomPanHandler.currentStateAsEvent();if(t.onUpdate({...r,...n}),t.onRescale(r),this._svgContainer){const s=this.layers.length>0?this.layers.reduce((o,a)=>o.order>a.order?o:a).order:1;this._svgContainer.style("z-index",`${s+1}`)}return this}showLayer(t){const n=this.getLayer(t);return n?(n.setVisibility(!0,t),n.onRescale(this.zoomPanHandler.currentStateAsEvent()),this):this}hideLayer(t){const n=this.getLayer(t);return n?(n.setVisibility(!1,t),n.onRescale(this.zoomPanHandler.currentStateAsEvent()),this):this}adjustToSize(t,n){const i=Math.max(this._axis?t-mr:t,0),r=Math.max(this._axis?n-yr:n,0);if(this._axis){const s={width:t,height:n};this._axis.onResize(s)}if(this.layers){const s={width:i,height:r};this.layers.forEach(o=>o.onResize(s))}this._zoomPanHandler&&this._zoomPanHandler.adjustToSize(i,r,!0)}setReferenceSystem(t){this.layers.forEach(n=>n.referenceSystem=t)}showAxis(){return this._axis.show(),this}hideAxis(){return this._axis.hide(),this}showAxisLabels(){return this._axis.showLabels(),this}hideAxisLabels(){return this._axis.hideLabels(),this}setAxisOffset(t,n){return this._axis.offsetX=t,this._axis.offsetY=n,this.layers.filter(r=>r instanceof Oe).forEach(r=>{r.offsetX=t,r.offsetY=n}),this}setXAxisOffset(t){return this._axis.offsetX=t,this.layers.filter(i=>i instanceof Oe).forEach(i=>{i.offsetX=t}),this}setYAxisOffset(t){return this._axis.offsetY=t,this.layers.filter(i=>i instanceof Oe).forEach(i=>{i.offsetY=t}),this}setZoomLevelBoundary(t){return this._zoomPanHandler.setZoomLevelBoundary(t),this}setMaxZoomLevel(t){return this._zoomPanHandler.setMaxZoomLevel(t),this}setMinZoomLevel(t){return this._zoomPanHandler.setMinZoomLevel(t),this}destroy(){return this.removeAllLayers(),this.layerContainer.remove(),this.layerContainer=void 0,this.container=void 0,this.layers=void 0,this._zoomPanHandler=void 0,this._axis=void 0,this._svgContainer=void 0,this}get zoomPanHandler(){return this._zoomPanHandler}get axis(){return this._axis}rescale(t){this._axis&&this._axis.onRescale(t),this.layers&&this.layers.forEach(n=>n.isVisible===!0?n.onRescale(t):{})}}class X0{constructor(t,n){this.elements={},this.listeners={},this.enabled=!0;const i=j(n);this.elm=i.append("div").attr("id","overlay").style("z-index","11").style("position","absolute"),this.source=this.elm.node();const{elm:r}=this;r.on("resize",s=>{const{width:o,height:a}=s.detail;r.style("width",`${o}px`).style("height",`${a}px`),this.enabled&&Object.keys(this.listeners).forEach(c=>{const h=this.elements[c]||null,l=this.listeners[c];l&&l.onResize&&requestAnimationFrame(()=>l.onResize({target:h,source:this.source,caller:t,width:o,height:a}))})}),r.on("mousemove",s=>{if(!this.enabled)return;const[o,a]=yt(s,this.elm.node());Object.keys(this.listeners).forEach(c=>{const h=this.elements[c]||null,l=this.listeners[c];l&&l.onMouseMove&&requestAnimationFrame(()=>l.onMouseMove({x:o,y:a,target:h,source:this.source,caller:t}))})}),r.on("mouseout",()=>{this.enabled&&Object.keys(this.listeners).forEach(s=>{const o=this.elements[s]||null,a=this.listeners[s];a&&a.onMouseExit&&requestAnimationFrame(()=>a.onMouseExit({target:o,source:this.source,caller:t}))})})}create(t,n){const i=this.elm.append("div").style("position","relative").style("pointer-events","none").node();return this.elements[t]=i,n&&(this.listeners[t]=n),i}register(t,n){this.listeners[t]=n}remove(t){const n=this.elements[t];n&&(j(n).remove(),delete this.elements[t]),delete this.listeners[t]}setZIndex(t){this.elm.style("z-index",t)}destroy(){this.source.remove()}}const j0=(e,t)=>new X0(e,t);class q0{constructor(t){const{container:n,axisOptions:i,scaleOptions:r,referenceSystem:s,layers:o,path:a}=t;this._referenceSystem=s||a&&new Dt(a),this._overlay=j0(this,n),this.layerManager=new Ss(this._overlay.elm.node(),r,i),o&&(this.layerManager.addLayers(o),this.setOverlayZIndex(o))}setReferenceSystem(t){return this._referenceSystem=t,this.layerManager.setReferenceSystem(t),this}updatePath(t,n){return this.setReferenceSystem(new Dt(t,n)),this}clearAllData(t=!0){return this.layerManager.clearAllData(t),this}addLayer(t,n){return this.layerManager.addLayer(t,n),this.setOverlayZIndex(this.layerManager.getLayers()),this}removeLayer(t){return this.layerManager.removeLayer(t),this}removeAllLayers(){return this.layerManager.removeAllLayers(),this}getLayer(t){return this.layerManager.getLayer(t)}showLayer(t){return this.layerManager.showLayer(t),this}hideLayer(t){return this.layerManager.hideLayer(t),this}adjustToSize(t,n){this.layerManager.adjustToSize(t,n);const i={width:Math.max(t-mr,0),height:Math.max(n-yr,0)};return this.overlay.elm.dispatch("resize",{detail:i,bubbles:!0,cancelable:!0}),this}setViewport(t,n,i,r){return this.zoomPanHandler.setViewport(t,n,i,r),this}setBounds(t,n){return this.zoomPanHandler.setBounds(t,n),this}showAxis(){return this.layerManager.showAxis(),this}hideAxis(){return this.layerManager.hideAxis(),this}showAxisLabels(){return this.layerManager.showAxisLabels(),this}hideAxisLabels(){return this.layerManager.hideAxisLabels(),this}setAxisOffset(t,n){return this.layerManager.setAxisOffset(t,n),this}setXAxisOffset(t){return this.layerManager.setXAxisOffset(t),this}setYAxisOffset(t){return this.layerManager.setYAxisOffset(t),this}setZoomLevelBoundary(t){return this.zoomPanHandler.setZoomLevelBoundary(t),this}setMaxZoomLevel(t){return this.zoomPanHandler.setMaxZoomLevel(t),this}setMinZoomLevel(t){return this.zoomPanHandler.setMinZoomLevel(t),this}destroy(){return this.layerManager.destroy(),this._overlay.destroy(),this._referenceSystem=void 0,this.layerManager=void 0,this._overlay=void 0,this}getHighestZIndex(t){return t.length>0?t.reduce((i,r)=>i.order>r.order?i:r).order:1}setOverlayZIndex(t){const n=this.getHighestZIndex(t);this.overlay.setZIndex(n+2)}get overlay(){return this._overlay}get referenceSystem(){return this._referenceSystem}get zoomPanHandler(){return this.layerManager.zoomPanHandler}get axis(){return this.layerManager.axis}get currentStateAsEvent(){return this.zoomPanHandler.currentStateAsEvent()}}A.Axis=Ci,A.CalloutCanvasLayer=Yl,A.CanvasLayer=vt,A.Controller=q0,A.GeomodelCanvasLayer=ql,A.GeomodelLabelsLayer=Nu,A.GeomodelLayerV2=Iu,A.GridLayer=Oe,A.HTMLLayer=kl,A.ImageLayer=Hu,A.IntersectionReferenceSystem=Dt,A.Layer=te,A.LayerManager=Ss,A.PixiLayer=kn,A.PixiRenderApplication=El,A.ReferenceLineLayer=G0,A.SVGLayer=vr,A.SchematicLayer=ss,A.SeismicCanvasLayer=w0,A.WellborepathLayer=W0,A.ZoomPanHandler=gr,A.assertNever=ee,A.calcSize=Re,A.defaultCasingOptions=Rr,A.defaultCementOptions=zr,A.defaultCementPlugOptions=Ir,A.defaultCementSqueezeOptions=Dr,A.defaultHoleOptions=Fr,A.defaultInternalLayerOptions=Er,A.defaultPerforationOptions=Or,A.defaultScreenOptions=Nr,A.defaultTubingOptions=$r,A.findIndexOfSample=Fn,A.findSampleAtPos=xt,A.foldCompletion=Sr,A.foldPerforationSubKind=q,A.generateProjectedTrajectory=Lu,A.generateProjectedWellborePath=Cu,A.generateSeismicSliceImage=hu,A.generateSurfaceData=fu,A.getOverlap=Nl,A.getOverlapOffset=En,A.getPicksData=Jl,A.getSeismicInfo=cu,A.getSeismicOptions=au,A.hasFracLines=Mr,A.hasPacking=Tr,A.hasSpikes=Ar,A.intersect=kr,A.isCementPlug=br,A.isCementSqueeze=wr,A.isOpenHoleFracPack=zl,A.isOverlapping=Ur,A.isOverlappingHorizontally=Dl,A.isPAndASymbol=xr,A.isSubKindCasedHoleFracPack=Cr,A.isSubKindCasedHoleFracturation=Lr,A.isSubKindPerforation=Ol,A.isSubkindCasedHoleGravelPack=Pr,A.pixelsPerUnit=Vr,A.shouldPerforationStartAtCasingDiameter=Rl,A.shouldPerforationStartAtHoleDiameter=Fl,A.transformFormationData=su,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
14
|
+
***************************************************************************** */var an=function(e,t){return an=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)i.hasOwnProperty(r)&&(n[r]=i[r])},an(e,t)};function cn(e,t){function n(){this.constructor=e}an(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var hn=function(){return hn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},hn.apply(this,arguments)};function Ri(e,t){for(var n=new Array(e.length),i=0;i<e.length;i++)n[i]=2*e[i]-t[i];return n}function ln(e,t,n){var i,r,s,o,a=t.length-1;if(n)i=t[e-1<0?a:e-1],r=t[e%t.length],s=t[(e+1)%t.length],o=t[(e+2)%t.length];else{if(e===a)throw Error("There is no spline segment at this index for a closed curve!");r=t[e],s=t[e+1],i=e>0?t[e-1]:Ri(r,s),o=e<a-1?t[e+2]:Ri(s,r)}return[i,r,s,o]}function ea(e,t,n){n===void 0&&(n=!1);var i=n?t.length:t.length-1;if(e===1)return{index:i-1,weight:1};var r=i*e,s=Math.floor(r);return{index:s,weight:r-s}}function na(e,t){for(var n=0;n<e.length;n++)e[n]=t;return e}function ia(e,t){for(var n=0;n<e.length;n++)e[n]=t(e[n],n);return e}function ra(e,t,n){n===void 0&&(n=0);for(var i=0;i<e.length;i++)n=t(n,e[i],i);return n}function pe(e,t){t=t||new Array(e.length);for(var n=0;n<e.length;n++)t[n]=e[n];return t}function tt(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e<t?t:e>n?n:e}function un(e,t){var n=t[0];if(e>=t[t.length-1])return t.length-1;if(e<=n)return 0;for(var i=0,r=t.length-1;i<=r;){var s=Math.floor((i+r)/2),o=t[s];if(o<e)i=s+1;else{if(!(o>e))return s;r=s-1}}return Math.max(0,r)}var it=Math.pow(2,-42);function Oi(e){var t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}function zi(e,t,n){if(Math.abs(e)<it)return Math.abs(t)<it?[]:[-n/t];var i=t*t-4*e*n;return Math.abs(i)<it?[-t/(2*e)]:i>0?[(-t+Math.sqrt(i))/(2*e),(-t-Math.sqrt(i))/(2*e)]:[]}function sa(e,t,n,i){if(Math.abs(e)<it)return zi(t,n,i);var r,s=(3*e*n-t*t)/(3*e*e),o=(2*t*t*t-9*e*t*n+27*e*e*i)/(27*e*e*e);if(Math.abs(s)<it)r=[Oi(-o)];else if(Math.abs(o)<it)r=[0].concat(s<0?[Math.sqrt(-s),-Math.sqrt(-s)]:[]);else{var a=o*o/4+s*s*s/27;if(Math.abs(a)<it)r=[-1.5*o/s,3*o/s];else if(a>0)r=[(c=Oi(-o/2-Math.sqrt(a)))-s/(3*c)];else{var c=2*Math.sqrt(-s/3),h=Math.acos(3*o/s/c)/3,l=2*Math.PI/3;r=[c*Math.cos(h),c*Math.cos(h-l),c*Math.cos(h-2*l)]}}for(var u=0;u<r.length;u++)r[u]-=t/(3*e);return r}function oa(e,t){if(e.length!==t.length)throw Error("Vectors must be of equal length!");for(var n=0,i=0;i<e.length;i++)n+=e[i]*t[i];return n}function me(e,t,n){if(!(e.length>3)){n=n||new Array(3);var i=e[0],r=e[1],s=e[2]||0,o=t[0],a=t[1],c=t[2]||0;return n[0]=r*c-s*a,n[1]=s*o-i*c,n[2]=i*a-r*o,n}}function Di(e,t){for(var n=0,i=0;i<e.length;i++)n+=(e[i]-t[i])*(e[i]-t[i]);return n}function Ot(e){for(var t=0,n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function ye(e,t){var n=Di(e,t);return n===0?0:Math.sqrt(n)}function yt(e,t){var n=t?pe(e,t):e,i=ra(n,function(s,o){return s+Math.pow(o,2)}),r=Math.sqrt(i);return r===0?na(n,0):ia(n,function(s){return s/r})}function aa(e,t){if(e.length>2)throw Error("Only supported for 2d vectors");var n=t?pe(e,t):e,i=-n[1];return n[1]=n[0],n[0]=i,n}function ca(e,t,n,i,r){if(r===void 0&&(r=0),r===0)return[0,1,2,3];var s=function(c,h){return Math.pow(Di(c,h),.5*r)},o=s(t,e),a=s(n,t)+o;return[0,o,a,s(i,n)+a]}function ha(e,t,n,i,r){for(var s=Number.isFinite(r.tension)?r.tension:.5,o=Number.isFinite(r.alpha)?r.alpha:null,a=o>0?ca(e,t,n,i,o):null,c=new Array(e.length),h=0;h<e.length;h++){var l=0,u=0,f=e[h],d=t[h],g=n[h],p=i[h];if(a){var y=a[0],m=a[1],_=a[2],x=a[3];m-_!=0&&(y-m!=0&&y-_!=0&&(l=(1-s)*(_-m)*((f-d)/(y-m)-(f-g)/(y-_)+(d-g)/(m-_))),m-x!=0&&_-x!=0&&(u=(1-s)*(_-m)*((d-g)/(m-_)-(d-p)/(m-x)+(g-p)/(_-x))))}else l=(1-s)*(g-f)*.5,u=(1-s)*(p-d)*.5;var M=2*d-2*g+l+u,S=-3*d+3*g-2*l-u,w=l,T=d;c[h]=[M,S,w,T]}return c}function zt(e,t){var n=e*e,i=e*n;return t[0]*i+t[1]*n+t[2]*e+t[3]}function Dt(e,t){var n=e*e;return 3*t[0]*n+2*t[1]*e+t[2]}function fn(e,t){return 6*t[0]*e+2*t[1]}function la(e,t){var n=t[0],i=t[1],r=t[2],s=t[3]-e;return n===0&&i===0&&r===0&&s===0?[0]:sa(n,i,r,s).filter(function(o){return o>-it&&o<=1+it}).map(function(o){return tt(o,0,1)})}function dn(e,t,n,i){i===void 0&&(i=null),i=i||new Array(n.length);for(var r=0;r<n.length;r++)i[r]=e(t,n[r]);return i}var Ni=function(){function e(t){t===void 0&&(t=null),this._alpha=0,this._tension=.5,this._closed=!1,this._onInvalidateCache=null,this._onInvalidateCache=t,this._cache={arcLengths:null,coefficients:null}}return e.prototype._invalidateCache=function(){this.points&&(this._cache={arcLengths:null,coefficients:null},this._onInvalidateCache&&this._onInvalidateCache())},Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){Number.isFinite(t)&&t!==this._alpha&&(this._invalidateCache(),this._alpha=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tension",{get:function(){return this._tension},set:function(t){Number.isFinite(t)&&t!==this._tension&&(this._invalidateCache(),this._tension=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"points",{get:function(){return this._points},set:function(t){if(!t||t.length<2)throw Error("At least 2 control points are required!");this._points=t,this._invalidateCache()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._closed},set:function(t){t=!!t,this._closed!==t&&(this._invalidateCache(),this._closed=t)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._invalidateCache()},e.prototype.evaluateForT=function(t,n,i){var r=ea(n,this.points,this.closed),s=r.index;return dn(t,r.weight,this.getCoefficients(s),i)},e.prototype.getCoefficients=function(t){if(this.points){if(this._cache.coefficients||(this._cache.coefficients=new Map),!this._cache.coefficients.has(t)){var n=ln(t,this.points,this.closed),i=ha(n[0],n[1],n[2],n[3],{tension:this.tension,alpha:this.alpha});this._cache.coefficients.set(t,i)}return this._cache.coefficients.get(t)}},e}(),ua=function(e){function t(n,i){n===void 0&&(n=300),i===void 0&&(i=null);var r=e.call(this,i)||this;return r._subDivisions=n,r}return cn(t,e),Object.defineProperty(t.prototype,"arcLengths",{get:function(){return this._cache.arcLengths||(this._cache.arcLengths=this.computeArcLengths()),this._cache.arcLengths},enumerable:!1,configurable:!0}),t.prototype._invalidateCache=function(){e.prototype._invalidateCache.call(this),this._cache.arcLengths=null},t.prototype.computeArcLengths=function(){var n,i=[],r=this.evaluateForT(zt,0),s=0;i.push(0);for(var o=1;o<=this._subDivisions;o++)s+=ye(n=this.evaluateForT(zt,o/this._subDivisions),r),i.push(s),r=n;return i},t.prototype.lengthAt=function(n){var i=this.arcLengths;return n*i[i.length-1]},t.prototype.getT=function(n){var i=this.arcLengths,r=i.length,s=n*i[r-1],o=un(s,i);if(i[o]===s)return o/(r-1);var a=i[o];return(o+(s-a)/(i[o+1]-a))/(r-1)},t.prototype.getU=function(n){if(n===0)return 0;if(n===1)return 1;var i=this.arcLengths,r=i.length-1,s=i[r],o=n*r,a=Math.floor(o),c=i[a];if(o===a)return c/s;var h=a/r;return(c+ye(this.evaluateForT(zt,h),this.evaluateForT(zt,n)))/s},t}(Ni),$i=[[[-.906179845938664,.23692688505618908],[-.5384693101056831,.47862867049936647],[0,.5688888888888889],[.5384693101056831,.47862867049936647],[.906179845938664,.23692688505618908]],[[-.932469514203152,.17132449237917036],[-.6612093864662645,.3607615730481386],[-.2386191860831969,.46791393457269104],[.2386191860831969,.46791393457269104],[.6612093864662645,.3607615730481386],[.932469514203152,.17132449237917036]],[[-.9491079123427585,.1294849661688697],[-.7415311855993945,.27970539148927664],[-.4058451513773972,.3818300505051189],[0,.4179591836734694],[.4058451513773972,.3818300505051189],[.7415311855993945,.27970539148927664],[.9491079123427585,.1294849661688697]],[[-.9602898564975363,.10122853629037626],[-.7966664774136267,.22238103445337448],[-.525532409916329,.31370664587788727],[-.1834346424956498,.362683783378362],[.1834346424956498,.362683783378362],[.525532409916329,.31370664587788727],[.7966664774136267,.22238103445337448],[.9602898564975363,.10122853629037626]],[[-.9681602395076261,.08127438836157441],[-.8360311073266358,.1806481606948574],[-.6133714327005904,.26061069640293544],[-.3242534234038089,.31234707704000286],[0,.3302393550012598],[.3242534234038089,.31234707704000286],[.6133714327005904,.26061069640293544],[.8360311073266358,.1806481606948574],[.9681602395076261,.08127438836157441]],[[-.9739065285171717,.06667134430868814],[-.8650633666889845,.1494513491505806],[-.6794095682990244,.21908636251598204],[-.4333953941292472,.26926671930999635],[-.14887433898163122,.29552422471475287],[.14887433898163122,.29552422471475287],[.4333953941292472,.26926671930999635],[.6794095682990244,.21908636251598204],[.8650633666889845,.1494513491505806],[.9739065285171717,.06667134430868814]],[[-.978228658146056,.0556685671161736],[-.887062599768095,.125580369464904],[-.730152005574049,.186290210927734],[-.519096129206811,.23319376459199],[-.269543155952344,.262804544510246],[0,.2729250867779],[.269543155952344,.262804544510246],[.519096129206811,.23319376459199],[.730152005574049,.186290210927734],[.887062599768095,.125580369464904],[.978228658146056,.0556685671161736]],[[-.981560634246719,.0471753363865118],[-.904117256370474,.106939325995318],[-.769902674194304,.160078328543346],[-.587317954286617,.203167426723065],[-.36783149899818,.233492536538354],[-.125233408511468,.249147045813402],[.125233408511468,.249147045813402],[.36783149899818,.233492536538354],[.587317954286617,.203167426723065],[.769902674194304,.160078328543346],[.904117256370474,.106939325995318],[.981560634246719,.0471753363865118]],[[-.984183054718588,.0404840047653158],[-.917598399222977,.0921214998377284],[-.801578090733309,.138873510219787],[-.64234933944034,.178145980761945],[-.448492751036446,.207816047536888],[-.230458315955134,.226283180262897],[0,.232551553230873],[.230458315955134,.226283180262897],[.448492751036446,.207816047536888],[.64234933944034,.178145980761945],[.801578090733309,.138873510219787],[.917598399222977,.0921214998377284],[.984183054718588,.0404840047653158]],[[-.986283808696812,.0351194603317518],[-.928434883663573,.0801580871597602],[-.827201315069764,.121518570687903],[-.687292904811685,.157203167158193],[-.515248636358154,.185538397477937],[-.319112368927889,.205198463721295],[-.108054948707343,.215263853463157],[.108054948707343,.215263853463157],[.319112368927889,.205198463721295],[.515248636358154,.185538397477937],[.687292904811685,.157203167158193],[.827201315069764,.121518570687903],[.928434883663573,.0801580871597602],[.986283808696812,.0351194603317518]],[[-.987992518020485,.0307532419961172],[-.937273392400705,.0703660474881081],[-.848206583410427,.107159220467171],[-.72441773136017,.139570677926154],[-.570972172608538,.166269205816993],[-.394151347077563,.186161000015562],[-.201194093997434,.198431485327111],[0,.202578241925561],[.201194093997434,.198431485327111],[.394151347077563,.186161000015562],[.570972172608538,.166269205816993],[.72441773136017,.139570677926154],[.848206583410427,.107159220467171],[.937273392400705,.0703660474881081],[.987992518020485,.0307532419961172]],[[-.989400934991649,.027152459411754],[-.944575023073232,.0622535239386478],[-.865631202387831,.0951585116824927],[-.755404408355003,.124628971255533],[-.617876244402643,.149595988816576],[-.458016777657227,.169156519395002],[-.281603550779258,.182603415044923],[-.0950125098376374,.189450610455068],[.0950125098376374,.189450610455068],[.281603550779258,.182603415044923],[.458016777657227,.169156519395002],[.617876244402643,.149595988816576],[.755404408355003,.124628971255533],[.865631202387831,.0951585116824927],[.944575023073232,.0622535239386478],[.989400934991649,.027152459411754]],[[-.990575475314417,.0241483028685479],[-.950675521768767,.0554595293739872],[-.880239153726985,.0850361483171791],[-.781514003896801,.111883847193403],[-.65767115921669,.135136368468525],[-.512690537086476,.15404576107681],[-.351231763453876,.16800410215645],[-.178484181495847,.176562705366992],[0,.179446470356206],[.178484181495847,.176562705366992],[.351231763453876,.16800410215645],[.512690537086476,.15404576107681],[.65767115921669,.135136368468525],[.781514003896801,.111883847193403],[.880239153726985,.0850361483171791],[.950675521768767,.0554595293739872],[.990575475314417,.0241483028685479]],[[-.99156516842093,.0216160135264833],[-.955823949571397,.0497145488949698],[-.892602466497555,.076425730254889],[-.803704958972523,.100942044106287],[-.691687043060353,.122555206711478],[-.559770831073947,.14064291467065],[-.411751161462842,.154684675126265],[-.251886225691505,.164276483745832],[-.0847750130417353,.169142382963143],[.0847750130417353,.169142382963143],[.251886225691505,.164276483745832],[.411751161462842,.154684675126265],[.559770831073947,.14064291467065],[.691687043060353,.122555206711478],[.803704958972523,.100942044106287],[.892602466497555,.076425730254889],[.955823949571397,.0497145488949697],[.99156516842093,.0216160135264833]],[[-.992406843843584,.0194617882297264],[-.96020815213483,.0448142267656996],[-.903155903614817,.0690445427376412],[-.822714656537142,.0914900216224499],[-.720966177335229,.111566645547333],[-.600545304661681,.128753962539336],[-.46457074137596,.142606702173606],[-.316564099963629,.152766042065859],[-.160358645640225,.158968843393954],[0,.161054449848783],[.160358645640225,.158968843393954],[.316564099963629,.152766042065859],[.46457074137596,.142606702173606],[.600545304661681,.128753962539336],[.720966177335229,.111566645547333],[.822714656537142,.0914900216224499],[.903155903614817,.0690445427376412],[.96020815213483,.0448142267656996],[.992406843843584,.0194617882297264]],[[-.993128599185094,.0176140071391521],[-.963971927277913,.0406014298003869],[-.912234428251325,.062672048334109],[-.839116971822218,.0832767415767047],[-.74633190646015,.10193011981724],[-.636053680726515,.118194531961518],[-.510867001950827,.131688638449176],[-.373706088715419,.142096109318382],[-.227785851141645,.149172986472603],[-.0765265211334973,.152753387130725],[.0765265211334973,.152753387130725],[.227785851141645,.149172986472603],[.373706088715419,.142096109318382],[.510867001950827,.131688638449176],[.636053680726515,.118194531961518],[.74633190646015,.10193011981724],[.839116971822218,.0832767415767047],[.912234428251325,.062672048334109],[.963971927277913,.0406014298003869],[.993128599185094,.0176140071391521]],[[-.993752170620389,.0160172282577743],[-.967226838566306,.0369537897708524],[-.9200993341504,.0571344254268572],[-.853363364583317,.0761001136283793],[-.768439963475677,.0934444234560338],[-.667138804197412,.108797299167148],[-.551618835887219,.121831416053728],[-.424342120207438,.132268938633337],[-.288021316802401,.139887394791073],[-.145561854160895,.14452440398997],[0,.14608113364969],[.145561854160895,.14452440398997],[.288021316802401,.139887394791073],[.424342120207438,.132268938633337],[.551618835887219,.121831416053728],[.667138804197412,.108797299167148],[.768439963475677,.0934444234560338],[.853363364583317,.0761001136283793],[.9200993341504,.0571344254268572],[.967226838566306,.0369537897708524],[.993752170620389,.0160172282577743]],[[-.994294585482399,.0146279952982722],[-.970060497835428,.0337749015848141],[-.926956772187174,.0522933351526832],[-.8658125777203,.0697964684245204],[-.787816805979208,.0859416062170677],[-.694487263186682,.10041414444288],[-.587640403506911,.112932296080539],[-.469355837986757,.123252376810512],[-.341935820892084,.131173504787062],[-.207860426688221,.136541498346015],[-.0697392733197222,.139251872855631],[.0697392733197222,.139251872855631],[.207860426688221,.136541498346015],[.341935820892084,.131173504787062],[.469355837986757,.123252376810512],[.587640403506911,.112932296080539],[.694487263186682,.10041414444288],[.787816805979208,.0859416062170677],[.8658125777203,.0697964684245204],[.926956772187174,.0522933351526832],[.970060497835428,.0337749015848141],[.994294585482399,.0146279952982722]],[[-.994769334997552,.0134118594871417],[-.972542471218115,.0309880058569794],[-.932971086826016,.0480376717310846],[-.876752358270441,.0642324214085258],[-.804888401618839,.0792814117767189],[-.71866136313195,.0929157660600351],[-.619609875763646,.104892091464541],[-.509501477846007,.114996640222411],[-.39030103803029,.123049084306729],[-.264135680970344,.128905722188082],[-.133256824298466,.132462039404696],[0,.133654572186106],[.133256824298466,.132462039404696],[.264135680970344,.128905722188082],[.39030103803029,.123049084306729],[.509501477846007,.114996640222411],[.619609875763646,.104892091464541],[.71866136313195,.0929157660600351],[.804888401618839,.0792814117767189],[.876752358270441,.0642324214085258],[.932971086826016,.0480376717310846],[.972542471218115,.0309880058569794],[.994769334997552,.0134118594871417]],[[-.995187219997021,.0123412297999872],[-.974728555971309,.0285313886289336],[-.938274552002732,.0442774388174198],[-.886415527004401,.0592985849154367],[-.820001985973902,.0733464814110803],[-.740124191578554,.0861901615319532],[-.648093651936975,.0976186521041138],[-.545421471388839,.107444270115965],[-.433793507626045,.115505668053725],[-.315042679696163,.121670472927803],[-.191118867473616,.125837456346828],[-.0640568928626056,.127938195346752],[.0640568928626056,.127938195346752],[.191118867473616,.125837456346828],[.315042679696163,.121670472927803],[.433793507626045,.115505668053725],[.545421471388839,.107444270115965],[.648093651936975,.0976186521041138],[.740124191578554,.0861901615319532],[.820001985973902,.0733464814110803],[.886415527004401,.0592985849154367],[.938274552002732,.0442774388174198],[.974728555971309,.0285313886289336],[.995187219997021,.0123412297999872]],[[-.995556969790498,.0113937985010262],[-.976663921459517,.0263549866150321],[-.942974571228974,.0409391567013063],[-.894991997878275,.0549046959758351],[-.833442628760834,.0680383338123569],[-.759259263037357,.080140700335001],[-.673566368473468,.0910282619829636],[-.577662930241222,.10053594906705],[-.473002731445714,.108519624474263],[-.361172305809387,.114858259145711],[-.243866883720988,.119455763535784],[-.12286469261071,.12224244299031],[0,.123176053726715],[.12286469261071,.12224244299031],[.243866883720988,.119455763535784],[.361172305809387,.114858259145711],[.473002731445714,.108519624474263],[.577662930241222,.10053594906705],[.673566368473468,.0910282619829636],[.759259263037357,.080140700335001],[.833442628760834,.0680383338123569],[.894991997878275,.0549046959758351],[.942974571228974,.0409391567013063],[.976663921459517,.0263549866150321],[.995556969790498,.0113937985010262]],[[-.995885701145616,.010551372617343],[-.97838544595647,.0244178510926319],[-.947159066661714,.0379623832943627],[-.902637861984307,.0509758252971478],[-.845445942788498,.0632740463295748],[-.776385948820678,.0746841497656597],[-.696427260419957,.0850458943134852],[-.606692293017618,.0942138003559141],[-.508440714824505,.102059161094425],[-.403051755123486,.108471840528576],[-.292004839485956,.113361816546319],[-.17685882035689,.116660443485296],[-.0592300934293132,.118321415279262],[.0592300934293132,.118321415279262],[.17685882035689,.116660443485296],[.292004839485956,.113361816546319],[.403051755123486,.108471840528576],[.508440714824505,.102059161094425],[.606692293017618,.0942138003559141],[.696427260419957,.0850458943134852],[.776385948820678,.0746841497656597],[.845445942788498,.0632740463295748],[.902637861984307,.0509758252971478],[.947159066661714,.0379623832943627],[.97838544595647,.0244178510926319],[.995885701145616,.010551372617343]],[[-.996179262888988,.00979899605129436],[-.979923475961501,.0226862315961806],[-.950900557814705,.0352970537574197],[-.909482320677491,.047449412520615],[-.856207908018294,.0589835368598335],[-.791771639070508,.0697488237662455],[-.717013473739423,.0796048677730577],[-.632907971946495,.0884231585437569],[-.540551564579456,.0960887273700285],[-.441148251750026,.102501637817745],[-.335993903638508,.107578285788533],[-.226459365439536,.111252488356845],[-.113972585609529,.113476346108965],[0,.114220867378956],[.113972585609529,.113476346108965],[.226459365439536,.111252488356845],[.335993903638508,.107578285788533],[.441148251750026,.102501637817745],[.540551564579456,.0960887273700285],[.632907971946495,.0884231585437569],[.717013473739423,.0796048677730577],[.791771639070508,.0697488237662455],[.856207908018294,.0589835368598336],[.909482320677491,.047449412520615],[.950900557814705,.0352970537574197],[.979923475961501,.0226862315961806],[.996179262888988,.00979899605129436]],[[-.996442497573954,.00912428259309452],[-.981303165370872,.0211321125927712],[-.954259280628938,.0329014277823043],[-.915633026392132,.0442729347590042],[-.865892522574395,.0551073456757167],[-.805641370917179,.0652729239669995],[-.735610878013631,.0746462142345687],[-.656651094038864,.0831134172289012],[-.569720471811401,.0905717443930328],[-.475874224955118,.0969306579979299],[-.376251516089078,.10211296757806],[-.272061627635178,.106055765922846],[-.16456928213338,.108711192258294],[-.0550792898840342,.110047013016475],[.0550792898840342,.110047013016475],[.16456928213338,.108711192258294],[.272061627635178,.106055765922846],[.376251516089078,.10211296757806],[.475874224955118,.0969306579979299],[.569720471811401,.0905717443930328],[.656651094038864,.0831134172289012],[.735610878013631,.0746462142345687],[.805641370917179,.0652729239669995],[.865892522574395,.0551073456757167],[.915633026392132,.0442729347590042],[.954259280628938,.0329014277823043],[.981303165370872,.0211321125927712],[.996442497573954,.00912428259309452]],[[-.996679442260596,.00851690387874641],[-.982545505261413,.0197320850561227],[-.957285595778087,.0307404922020936],[-.921180232953058,.0414020625186828],[-.874637804920102,.0515948269024979],[-.818185487615252,.0612030906570791],[-.752462851734477,.0701179332550512],[-.678214537602686,.0782383271357637],[-.596281797138227,.0854722573661725],[-.507592955124227,.0917377571392587],[-.413152888174008,.0969638340944086],[-.314031637867639,.101091273759914],[-.211352286166001,.104073310077729],[-.106278230132679,.10587615509732],[0,.106479381718314],[.106278230132679,.10587615509732],[.211352286166001,.104073310077729],[.314031637867639,.101091273759914],[.413152888174008,.0969638340944086],[.507592955124227,.0917377571392587],[.596281797138227,.0854722573661725],[.678214537602686,.0782383271357637],[.752462851734477,.0701179332550512],[.818185487615252,.0612030906570791],[.874637804920102,.0515948269024979],[.921180232953058,.0414020625186828],[.957285595778087,.0307404922020936],[.982545505261413,.0197320850561227],[.996679442260596,.00851690387874641]],[[-.996893484074649,.0079681924961666],[-.983668123279747,.0184664683110909],[-.960021864968307,.0287847078833233],[-.926200047429274,.038799192569627],[-.882560535792052,.048402672830594],[-.829565762382768,.057493156217619],[-.767777432104826,.0659742298821805],[-.697850494793315,.0737559747377052],[-.620526182989242,.0807558952294202],[-.536624148142019,.0868997872010829],[-.447033769538089,.0921225222377861],[-.352704725530878,.0963687371746442],[-.254636926167889,.0995934205867952],[-.153869913608583,.101762389748405],[-.0514718425553176,.102852652893558],[.0514718425553176,.102852652893558],[.153869913608583,.101762389748405],[.254636926167889,.0995934205867952],[.352704725530878,.0963687371746442],[.447033769538089,.0921225222377861],[.536624148142019,.0868997872010829],[.620526182989242,.0807558952294202],[.697850494793315,.0737559747377052],[.767777432104826,.0659742298821805],[.829565762382768,.057493156217619],[.882560535792052,.048402672830594],[.926200047429274,.038799192569627],[.960021864968307,.0287847078833233],[.983668123279747,.0184664683110909],[.996893484074649,.0079681924961666]]],Ii=$i.length+5,fa=function(e){function t(n,i,r){n===void 0&&(n=24),i===void 0&&(i=21);var s=e.call(this,r)||this;return s._nSamples=21,s._gauss=function(o){if(o<5||o>Ii)throw Error("Order for Gaussian Quadrature must be in the range of ".concat(5," and ").concat(Ii,"."));return $i[o-5]}(n),s._nSamples=i,s}return cn(t,e),t.prototype._invalidateCache=function(){e.prototype._invalidateCache.call(this),this._cache.arcLengths=null,this._cache.samples=null},Object.defineProperty(t.prototype,"arcLengths",{get:function(){return this._cache.arcLengths||(this._cache.arcLengths=this.computeArcLengths()),this._cache.arcLengths},enumerable:!1,configurable:!0}),t.prototype.getSamples=function(n){if(this.points){if(this._cache.samples||(this._cache.samples=new Map),!this._cache.samples.has(n)){for(var i=this._nSamples,r=[],s=[],o=this.getCoefficients(n),a=0;a<i;++a){var c=a/(i-1);r.push(this.computeArcLength(n,0,c));var h=Ot(dn(Dt,c,o)),l=h===0?0:1/h;this.tension>.95&&(l=tt(l,-1,1)),s.push(l)}var u=i-1,f=[],d=[],g=r[0],p=s[0],y=1/u;for(a=0;a<u;++a){var m=g,_=(g=r[a+1])-m,x=p,M=s[a+1];p=M;var S=y/_,w=(x+M-2*S)/(_*_),T=(3*S-2*x-M)/_;f.push(w),d.push(T)}this._cache.samples.set(n,[r,s,d,f])}return this._cache.samples.get(n)}},t.prototype.computeArcLength=function(n,i,r){if(i===void 0&&(i=0),r===void 0&&(r=1),i===r)return 0;for(var s=this.getCoefficients(n),o=.5*(r-i),a=0,c=0;c<this._gauss.length;c++){var h=this._gauss[c],l=h[0];a+=h[1]*Ot(dn(Dt,o*l+o+i,s))}return o*a},t.prototype.computeArcLengths=function(){if(this.points){var n=[];n.push(0);for(var i=this.closed?this.points.length:this.points.length-1,r=0,s=0;s<i;s++)r+=this.computeArcLength(s),n.push(r);return n}},t.prototype.inverse=function(n,i){var r=1/(this._nSamples-1),s=this.getSamples(n),o=s[0],a=s[1],c=s[2],h=s[3];if(i>=o[o.length-1])return 1;if(i<=0)return 0;var l=Math.max(0,un(i,o)),u=l*r;if(o[l]===i)return u;var f=a[l],d=h[l],g=c[l],p=i-o[l];return((d*p+g)*p+f)*p+u},t.prototype.lengthAt=function(n){return n*this.arcLengths[this.arcLengths.length-1]},t.prototype.getT=function(n){var i=this.arcLengths,r=i.length,s=n*i[r-1],o=un(s,i),a=o/(r-1);if(i[o]===s)return a;var c=s-i[o];return(o+this.inverse(o,c))/(r-1)},t.prototype.getU=function(n){if(n===0)return 0;if(n===1)return 1;var i=this.arcLengths,r=i.length-1,s=i[r],o=n*r,a=Math.floor(o),c=i[a];if(o===a)return c/s;var h=o-a;return(c+this.computeArcLength(a,0,h))/s},t}(Ni),gn=function(){function e(t,n){n===void 0&&(n={});var i=this;this._cache=new Map;var r=(n=hn({tension:.5,alpha:0,closed:!1},n)).arcDivisions?new ua(n.arcDivisions,function(){return i._invalidateCache()}):new fa(n.numericalApproximationOrder,n.numericalInverseSamples,function(){return i._invalidateCache()});r.alpha=n.alpha,r.tension=n.tension,r.closed=n.closed,r.points=t,this._lmargin=n.lmargin||1-r.tension,this._curveMapper=r}return e.prototype.getTimeFromPosition=function(t,n){return n===void 0&&(n=!1),this._curveMapper.getT(n?tt(t,0,1):t)},e.prototype.getPositionFromTime=function(t,n){return n===void 0&&(n=!1),this._curveMapper.getU(n?tt(t,0,1):t)},e.prototype.getPositionFromLength=function(t,n){n===void 0&&(n=!1);var i=n?tt(t,0,this.length):t;return this._curveMapper.getU(i/this.length)},e.prototype.getLengthAt=function(t,n){return t===void 0&&(t=1),n===void 0&&(n=!1),this._curveMapper.lengthAt(n?tt(t,0,1):t)},e.prototype.getTimeAtKnot=function(t){if(t<0||t>this.points.length-1)throw Error("Invalid index!");return t===0?0:this.closed||t!==this.points.length-1?t/(this.closed?this.points.length:this.points.length-1):1},e.prototype.getPositionAtKnot=function(t){return this.getPositionFromTime(this.getTimeAtKnot(t))},e.prototype.getPointAtTime=function(t,n){return(t=tt(t,0,1))===0?pe(this.points[0],n):t===1?pe(this.closed?this.points[0]:this.points[this.points.length-1],n):this._curveMapper.evaluateForT(zt,t,n)},e.prototype.getPointAt=function(t,n){return this.getPointAtTime(this.getTimeFromPosition(t),n)},e.prototype.getTangentAt=function(t,n){var i=tt(this.getTimeFromPosition(t),0,1);return this.getTangentAtTime(i,n)},e.prototype.getTangentAtTime=function(t,n){return yt(this._curveMapper.evaluateForT(Dt,t,n))},e.prototype.getNormalAt=function(t,n){var i=tt(this.getTimeFromPosition(t),0,1);return this.getNormalAtTime(i,n)},e.prototype.getNormalAtTime=function(t,n){var i=yt(this._curveMapper.evaluateForT(Dt,t));if(!(i.length<2||i.length>3)){var r=n||new Array(i.length);if(i.length===2)return r[0]=-i[1],r[1]=i[0],r;var s=yt(this._curveMapper.evaluateForT(fn,t));return yt(me(me(i,s),i),r)}},e.prototype.getCurvatureAt=function(t){var n=tt(this.getTimeFromPosition(t),0,1);return this.getCurvatureAtTime(n)},e.prototype.getCurvatureAtTime=function(t){var n=this._curveMapper.evaluateForT(Dt,t),i=this._curveMapper.evaluateForT(fn,t),r=yt(n,[]),s=0,o=void 0;if(n.length===2){if((u=Math.pow(n[0]*n[0]+n[1]*n[1],1.5))!==0){var a=(n[0]*i[1]-n[1]*i[0])/u;o=a<0?[r[1],-r[0]]:[-r[1],r[0]],s=Math.abs(a)}}else if(n.length===3){var c=Ot(n),h=me(n,i);o=yt(me(h,n)),c!==0&&(s=Ot(h)/Math.pow(c,3))}else{c=Ot(n);var l=Ot(i),u=Math.pow(c,3),f=oa(n,i);u!==0&&(s=Math.sqrt(Math.pow(c,2)*Math.pow(l,2)-Math.pow(f,2))/u)}return{curvature:s,radius:s!==0?1/s:0,tangent:r,direction:o}},e.prototype.getDerivativeAt=function(t,n){var i=tt(this.getTimeFromPosition(t),0,1);return this._curveMapper.evaluateForT(Dt,i,n)},e.prototype.getSecondDerivativeAt=function(t,n){var i=tt(this.getTimeFromPosition(t),0,1);return this._curveMapper.evaluateForT(fn,i,n)},e.prototype.getBoundingBox=function(t,n){if(t===void 0&&(t=0),n===void 0&&(n=1),t===0&&n===1&&this._cache.has("bbox"))return this._cache.get("bbox");for(var i=[],r=[],s=this.getTimeFromPosition(t),o=this.getTimeFromPosition(n),a=this.getPointAtTime(s),c=this.getPointAtTime(o),h=this.closed?this.points.length:this.points.length-1,l=Math.floor(h*s),u=Math.ceil(h*o),f=0;f<a.length;f++)i[f]=Math.min(a[f],c[f]),r[f]=Math.max(a[f],c[f]);for(var d=function(m){var _=ln(m-1,g.points,g.closed)[2];if(m<u)for(var x=0;x<_.length;x++)_[x]<i[x]&&(i[x]=_[x]),_[x]>r[x]&&(r[x]=_[x]);if(g.tension<1){var M=h*s-(m-1),S=h*o-(m-1),w=function(k){return k>-it&&k<=1+it&&(m-1!==l||k>M)&&(m!==u||k<S)},T=g._curveMapper.getCoefficients(m-1),F=function(k){var N=T[k];zi(3*N[0],2*N[1],N[2]).filter(w).forEach(function(P){var z=zt(P,T[k]);z<i[k]&&(i[k]=z),z>r[k]&&(r[k]=z)})};for(x=0;x<T.length;x++)F(x)}},g=this,p=l+1;p<=u;p++)d(p);var y={min:i,max:r};return t===0&&n===1&&this._cache.set("bbox",y),y},e.prototype.getPoints=function(t,n,i,r){if(t===void 0&&(t=100),i===void 0&&(i=0),r===void 0&&(r=1),!t||t<=0)throw Error("Invalid arguments passed to getPoints(). You must specify at least 1 sample/segment.");if(!(i<0||r>1||r<i)){for(var s=[],o=0;o<=t;o++){var a=i===0&&r===1?o/t:i+o/t*(r-i);s.push(this.getPointAt(a,n&&new n))}return s}},e.prototype.getNearestPosition=function(t,n){var i=this;if(n===void 0&&(n=1e-5),n<=0||!Number.isFinite(n))throw Error("Invalid threshold. Must be a number greater than zero!");var r=10*this.points.length-1,s=new Array(t.length),o=1/0,a=0,c=this.createLookupTable(r);Array.from(c.keys()).forEach(function(f){var d=c.get(f),g=ye(t,d);if(g<o)return o=g,a=f,!0});for(var h=this.getTimeFromPosition(a),l=function(f){if(f>=0&&f<=1){i.getPointAtTime(f,s);var d=ye(t,s);if(d<o)return o=d,h=f,!0}},u=.005;u>n;)l(h-u)||l(h+u)||(u/=2);return{u:a=this._curveMapper.getU(h),distance:o,point:s}},e.prototype.getIntersects=function(t,n,i,r){var s=this;n===void 0&&(n=0),i===void 0&&(i=0),r===void 0&&(r=this._lmargin);var o=this.getIntersectsAsTime(t,n,i,r).map(function(a){return s.getPointAtTime(a)});return Math.abs(i)===1?o.length===1?o[0]:null:o},e.prototype.getIntersectsAsPositions=function(t,n,i,r){var s=this;return n===void 0&&(n=0),i===void 0&&(i=0),r===void 0&&(r=this._lmargin),this.getIntersectsAsTime(t,n,i,r).map(function(o){return s.getPositionFromTime(o)})},e.prototype.getIntersectsAsTime=function(t,n,i,r){n===void 0&&(n=0),i===void 0&&(i=0),r===void 0&&(r=this._lmargin);for(var s=n,o=new Set,a=this.closed?this.points.length:this.points.length-1,c=0;c<a&&(i===0||o.size<Math.abs(i));c+=1){var h=i<0?a-(c+1):c,l=ln(h,this.points,this.closed),u=l[1],f=l[2],d=this._curveMapper.getCoefficients(h),g=void 0,p=void 0;if(u[s]<f[s]?(g=u[s],p=f[s]):(g=f[s],p=u[s]),t-r<=p&&t+r>=g){var y=la(t,d[s]);i<0?y.sort(function(x,M){return M-x}):i>=0&&y.sort(function(x,M){return x-M});for(var m=0;m<y.length;m++){var _=(y[m]+h)/a;if(o.add(_),i!==0&&o.size===Math.abs(i))break}}}return Array.from(o)},e.prototype.createLookupTable=function(t,n,i){if(n===void 0&&(n=0),i===void 0&&(i=1),!t||t<=1)throw Error("Invalid arguments passed to createLookupTable(). You must specify at least 2 samples.");if(!(n<0||i>1||i<n)){var r="lut_".concat(t,"_").concat(n,"_").concat(i);if(!this._cache.has(r)){for(var s=new Map,o=0;o<t;o++){var a=n===0&&i===1?o/(t-1):n+o/(t-1)*(i-n),c=this.getPointAt(a);s.set(a,c)}this._cache.set(r,s)}return this._cache.get(r)}},e.prototype.forEach=function(t,n,i,r){var s=this;i===void 0&&(i=0),r===void 0&&(r=1);var o=[];if(Number.isFinite(n)){if(n<=1)throw Error("Invalid arguments passed to forEach(). You must specify at least 2 samples.");for(var a=n,c=0;c<n;c++){var h=i===0&&r===1?c/(a-1):i+c/(a-1)*(r-i);o.push(h)}}else Array.isArray(n)&&(o=n);var l=null;o.forEach(function(u,f){if(!Number.isFinite(u)||u<0||u>1)throw Error("Invalid position (u) for sample in forEach!");var d=s.getTimeFromPosition(u),g=t({u,t:d,i:f,prev:l});l={u,t:d,i:f,value:g}})},e.prototype.map=function(t,n,i,r){var s=this;i===void 0&&(i=0),r===void 0&&(r=1);var o=[];if(Number.isFinite(n)){if(n<=1)throw Error("Invalid arguments passed to map(). You must specify at least 2 samples.");for(var a=n,c=0;c<n;c++){var h=i===0&&r===1?c/(a-1):i+c/(a-1)*(r-i);o.push(h)}}else Array.isArray(n)&&(o=n);var l=null;return o.map(function(u,f){if(!Number.isFinite(u)||u<0||u>1)throw Error("Invalid position (u) for sample in map()!");var d=s.getTimeFromPosition(u),g=t({u,t:d,i:f,prev:l});return l={u,t:d,i:f,value:g},g})},e.prototype.reduce=function(t,n,i,r,s){var o=this;r===void 0&&(r=0),s===void 0&&(s=1);var a=[];if(Number.isFinite(i)){if(i<=1)throw Error("Invalid arguments passed to map(). You must specify at least 2 samples.");for(var c=i,h=0;h<i;h++){var l=r===0&&s===1?h/(c-1):r+h/(c-1)*(s-r);a.push(l)}}else Array.isArray(i)&&(a=i);return a.reduce(function(u,f,d){if(!Number.isFinite(f)||f<0||f>1)throw Error("Invalid position (u) for sample in map()!");var g=o.getTimeFromPosition(f);return t({acc:u,u:f,t:g,i:d})},n)},e.prototype._invalidateCache=function(){return this._cache=new Map,this},e.prototype.reset=function(){this._curveMapper.reset()},Object.defineProperty(e.prototype,"points",{get:function(){return this._curveMapper.points},set:function(t){this._curveMapper.points=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tension",{get:function(){return this._curveMapper.tension},set:function(t){this._curveMapper.tension=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._curveMapper.alpha},set:function(t){this._curveMapper.alpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._curveMapper.closed},set:function(t){this._curveMapper.closed=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._curveMapper.lengthAt(1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minX",{get:function(){return this.getBoundingBox().min[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxX",{get:function(){return this.getBoundingBox().max[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minY",{get:function(){return this.getBoundingBox().min[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxY",{get:function(){return this.getBoundingBox().max[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minZ",{get:function(){return this.getBoundingBox().min[2]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxZ",{get:function(){return this.getBoundingBox().max[2]},enumerable:!1,configurable:!0}),e}();(function(e){function t(n,i,r,s,o){return i===void 0&&(i=.5),r===void 0&&(r=300),s===void 0&&(s=!1),o===void 0&&(o=0),e.call(this,n.map(function(a){return[a[0],a[1]]}),{tension:i,alpha:o,arcDivisions:r,closed:s})||this}return cn(t,e),t.prototype.x=function(n,i,r){i===void 0&&(i=0),r===void 0&&(r=this._lmargin);var s=this.getIntersects(n,1,i,r);return Math.abs(i)===1?s[0]:s.map(function(o){return o[0]})},t.prototype.y=function(n,i,r){i===void 0&&(i=0),r===void 0&&(r=this._lmargin);var s=this.getIntersects(n,0,i,r);return Math.abs(i)===1?s[1]:s.map(function(o){return o[1]})},t.prototype.getNormalAt=function(n,i){return yt(aa(this.getTangentAt(n,i)))},t.prototype.getAngleAt=function(n){var i=this.getTangentAt(n);return Math.atan2(i[1],i[0])},t.prototype.getBoundingBox=function(n,i){n===void 0&&(n=0),i===void 0&&(i=1);var r=e.prototype.getBoundingBox.call(this,n,i);return{x1:r.min[0],x2:r.max[0],y1:r.min[1],y2:r.max[1],min:r.min,max:r.max}},t})(gn);class _e{static newton(t,n=.01,i=1e3,r=.5,s=0,o=1){let c=r;for(let h=0;h<i;h++){const l=t(c);if(Math.abs(l)<n)return mt(c,s,o);const u=(t(c+1e-4)-l)/1e-4;c=c-l/u}}static bisect(t,n=.01,i=1e3,r=.5,s=0,o=1){let a=s,c=o,h=r,l,u;for(u=0;u<i;u++){if(l=t(h),Math.abs(l)<n)return h;l<0?c=h:a=h,h=(c+a)/2}return h}static findRoot(t,n=.01,i=1e3,r=.5,s=0,o=1){let a=_e.newton(t,n,i,r);return a==null&&(a=_e.bisect(t,n,i,r,s,o)),a}}class da{static bisect(t,n=0,i=1,r=.005,s=4,o=10){const a=(f,d,g,p,y,m,_=0)=>{const x=(f+d)/2,M=t(x),S=$.distance(g,M),w=$.distance(M,p),T=S+w;if(_>=s&&Math.abs(T-y)<m||_>=o)return T;const F=m/2,k=_+1;return a(f,x,g,M,S,F,k)+a(x,d,M,p,w,F,k)},c=t(n),h=t(i),l=$.distance(c,h);return a(n,i,c,h,l,r)}static trapezoid(t,n=0,i=1,r=1e3){let s=0,o=t(n);const a=(i-n)/(r-1);for(let c=1;c<r;c++){const h=t(n+c*a),l=$.distance(o,h);s+=l,o=h}return s}}class ga{static search(t,n){let i=0,r=t.length-1,s=Math.floor(i+r/2);for(;s>i&&s<r;){const o=t[s],a=t[s+1];if(o!=null&&a!=null&&o<=n&&a>=n)return s;o!=null&&n<o?r=s:i=s,s=Math.floor(i+r/2)}return s}}class pn extends gn{constructor(t,n){super(t,n),this.arcLengthLookup=[],this.findTForArcLength=this.findTForArcLength.bind(this),this.findTByRootForArcLength=this.findTByRootForArcLength.bind(this),this.findApproxTForArcLength=this.findApproxTForArcLength.bind(this),this.findTQuickForArcLength=this.findTQuickForArcLength.bind(this),this.generateArcLengthLookup=this.generateArcLengthLookup.bind(this),this.getArcLength=this.getArcLength.bind(this),this.getQuickArcLength=this.getQuickArcLength.bind(this),this.getPointAtArcLength=this.getPointAtArcLength.bind(this),this.getPointAt=this.getPointAt.bind(this)}findTForArcLength(t,n){let i;return n!=null&&n.approxT?i=this.findApproxTForArcLength(t,n==null?void 0:n.normalizedLength):n!=null&&n.quickT?i=this.findTQuickForArcLength(t):i=this.findTByRootForArcLength(t),i}findTByRootForArcLength(t,n=.01,i=100){return t<=0?0:t>=this.length?1:_e.findRoot(s=>t-this.getQuickArcLength(0,s),n,i,t/this.length)}findApproxTForArcLength(t,n){return t/(n||this.length)}findTQuickForArcLength(t){this.arcLengthLookup.length===0&&this.generateArcLengthLookup();const n=ga.search(this.arcLengthLookup,t),i=this.arcLengthLookup[n],r=this.arcLengthLookup[n+1];return(n+(t-i)/(r-i))/this.arcLengthLookup.length}generateArcLengthLookup(t=1e3){let n=this.getPointAt(0),i=0;for(let r=0;r<t;r++){const s=this.getPointAt(r/(t-1)),o=$.distance(n,s);i+=o,this.arcLengthLookup.push(i),n=s}}getArcLength(t=0,n=1){if(t===0&&n===1)return this.length;const i=.002;return da.bisect(r=>this.getPointAt(r),t,n,i)}getQuickArcLength(t=0,n=1){let i=0,r=this.length;if(this.arcLengthLookup.length===0&&this.generateArcLengthLookup(),t!==0){const o=Math.floor(t*this.arcLengthLookup.length),a=this.arcLengthLookup[o],c=this.arcLengthLookup[o+1];i=a+t*this.arcLengthLookup.length%this.arcLengthLookup.length*(c-a)}if(n!==1){const o=Math.floor(n*this.arcLengthLookup.length),a=this.arcLengthLookup[o],c=this.arcLengthLookup[o+1];r=a+t*this.arcLengthLookup.length%this.arcLengthLookup.length*(c-a)}return r-i}getPointAtArcLength(t,n){const i=this.findTForArcLength(t,n);return this.getPointAt(i)}getPointAt(t){const n=mt(t,0,1);return super.getPointAt(n)}}const Bi=.75,Hi=5e3,Vi=.001,pa=1e3,ma=1e3,ya=5e-4,_a=.1,va={approxT:!0};class Nt{constructor(t,n){if(this.path=[],this.projectedPath=[],this._offset=0,t.length<1)throw new Error("Missing coordinates");if(t[0]&&t[0].length!==3)throw new Error("Coordinates should be in 3d");this.setPath(t,n),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.getPosition=this.getPosition.bind(this),this.getProjectedLength=this.getProjectedLength.bind(this),this.getTrajectory=this.getTrajectory.bind(this)}setPath(t,n={}){this.options={...va,...n};const{arcDivisions:i,tension:r,calculateDisplacementFromBottom:s}=this.options;this.path=t,this.projectedPath=Nt.toDisplacement(t);const[o]=this.projectedPath[this.projectedPath.length-1];this.displacement=o,this.interpolators={curve:n.curveInterpolator||new pn(t),trajectory:n.trajectoryInterpolator||new pn(t.map(h=>[h[0],h[1]]),{tension:r||Bi,arcDivisions:i||Hi}),curtain:n.curtainInterpolator||new pn(this.projectedPath,{tension:r||Bi,arcDivisions:i||Hi})};const a=this.getTrajectoryVector(),c=a.map(h=>h*-1);s?(this.endVector=c,this.startVector=a):(this.endVector=a,this.startVector=c),this._curtainPathCache=void 0}project(t){const{curtain:n}=this.interpolators,{calculateDisplacementFromBottom:i}=this.options,r=mt(i?this.length-(t-this._offset):t-this._offset,0,this.length);return n.getPointAtArcLength(r,this.options)}curtainTangent(t){const{curtain:n}=this.interpolators,i=t-this._offset,r=n.findTForArcLength(i,this.options);return r&&n.getTangentAt(r)}getCurtainPath(t,n,i=!1){if(!this._curtainPathCache){const r=[];let s=Math.PI*2;for(let o=this._offset;o<=this.length+this._offset;o+=_a){const a=this.project(o),c=Math.atan2(a[1],a[0]);Math.abs(c-s)>ya&&(r.push({point:a,md:o}),s=c)}this._curtainPathCache=r}if(i){const r={point:this.project(t),md:t},s=this._curtainPathCache.filter(a=>a.md>t&&a.md<n),o={point:this.project(n),md:n};return[r,...s,o]}return this._curtainPathCache.filter(r=>r.md>=t&&r.md<=n)}unproject(t){const{normalizedLength:n,calculateDisplacementFromBottom:i}=this.options,r=i?this.displacement-t:t,s=n||this.length;if(r<0)return r;if(r>this.displacement)return s+(r-this.displacement);const o=this.interpolators.curtain.getIntersectsAsPositions(r,0,1);if(o&&o.length)return o[0]*s+this._offset}getProjectedLength(t){const{curtain:n}=this.interpolators,r=this.project(t)[0]/n.maxX;return Number.isFinite(r)?mt(r,0,1):0}getPosition(t){const{trajectory:n}=this.interpolators,i=this.getProjectedLength(t);return n.getPointAt(i)}getTrajectory(t,n=0,i=1){const r=n<0?-n:0,s=i>1?i-1:0,o=this.interpolators.trajectory.getPointAt(0),a=this.interpolators.trajectory.getPointAt(1);let c,h,l=0;const u=Math.max(0,n),f=Math.min(1,i),d=this.interpolators.trajectory.getPointAt(u),g=this.interpolators.trajectory.getPointAt(f);r?(c=[o[0]+this.startVector[0]*r*this.displacement,o[1]+this.startVector[1]*r*this.displacement],l=-$.distance(c,o)):n>0&&(l=$.distance(d,o)),s&&(h=[a[0]+this.endVector[0]*s*this.displacement,a[1]+this.endVector[1]*s*this.displacement]);const p=[],y=i-n,m=Math.floor(r/y*t),_=Math.ceil((f-u)/y*t),x=t-_-m;if(c){p.push(c);for(let S=1;S<m;S++){const w=S/m*r*this.displacement;p.push([c[0]-this.startVector[0]*w,c[1]-this.startVector[1]*w])}}const M=this.interpolators.trajectory.getPoints(_-1,null,u,f);if(p.push(...M),h){for(let S=1;S<x-1;S++){const w=S/x*s*this.displacement;p.push([g[0]+this.endVector[0]*w,g[1]+this.endVector[1]*w])}p.push(h)}return{points:p,offset:l}}getExtendedTrajectory(t,n=pa,i=ma){if(!isFinite(n)||n<0)throw new Error("Invalid parameter, getExtendedTrajectory() must be called with a valid and positive startExtensionLength parameter");if(!isFinite(i)||i<0)throw new Error("Invalid parameter, getExtendedTrajectory() must be called with a valid and positive endExtensionLength parameter");const r=this.displacement+n+i,s=Math.floor(n/r*t),o=Math.max(Math.ceil(this.displacement/r*t),1),a=t-o-s,c=[],h=new $(this.interpolators.trajectory.getPointAt(0)),l=new $(this.startVector),u=n/s;for(let _=s;_>0;_--){const x=_*u,M=h.add(l.scale(x));c.push(M.toArray())}const f=this.interpolators.trajectory.getPoints(o,null,0,1);c.push(...f);const d=new $(this.interpolators.trajectory.getPointAt(1)),g=new $(this.endVector),p=i/(a-1);for(let _=1;_<a;_++){const x=_*p,M=d.add(g.scale(x));c.push(M.toArray())}const y=-n;return{points:c,offset:y}}getTrajectoryVector(){const{trajectoryAngle:t,calculateDisplacementFromBottom:n}=this.options;if(t!=null&&isFinite(t)){const r=Xo(t);return new $(Math.cos(r),Math.sin(r)).toArray()}return Nt.getDirectionVector(this.interpolators.trajectory,n?Vi:1-Vi,n?0:1)}static toDisplacement(t,n=0){let i=t[0],r=0;return t.map(o=>{const a=o[0]-i[0],c=o[1]-i[1];return r+=Math.sqrt(a**2+c**2),i=o,[n>0?n-r:r,o[2]||0]})}static getDirectionVector(t,n,i){const r=t.getPointAt(i),s=t.getPointAt(n);return yt([r[0]-s[0],r[1]-s[1]])}get length(){var t;return((t=this.interpolators.curve)==null?void 0:t.length)??0}get offset(){return this._offset}set offset(t){this._curtainPathCache=void 0,this._offset=t}}var mn="http://www.w3.org/1999/xhtml";const Ui={svg:"http://www.w3.org/2000/svg",xhtml:mn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ve(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ui.hasOwnProperty(t)?{space:Ui[t],local:e}:e}function xa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===mn&&t.documentElement.namespaceURI===mn?t.createElement(e):t.createElementNS(n,e)}}function wa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Wi(e){var t=ve(e);return(t.local?wa:xa)(t)}function ba(){}function yn(e){return e==null?ba:function(){return this.querySelector(e)}}function Sa(e){typeof e!="function"&&(e=yn(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s=t[r],o=s.length,a=i[r]=new Array(o),c,h,l=0;l<o;++l)(c=s[l])&&(h=e.call(c,c.__data__,l,s))&&("__data__"in c&&(h.__data__=c.__data__),a[l]=h);return new j(i,this._parents)}function Ta(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ma(){return[]}function Yi(e){return e==null?Ma:function(){return this.querySelectorAll(e)}}function Aa(e){return function(){return Ta(e.apply(this,arguments))}}function Ca(e){typeof e=="function"?e=Aa(e):e=Yi(e);for(var t=this._groups,n=t.length,i=[],r=[],s=0;s<n;++s)for(var o=t[s],a=o.length,c,h=0;h<a;++h)(c=o[h])&&(i.push(e.call(c,c.__data__,h,o)),r.push(c));return new j(i,r)}function Gi(e){return function(){return this.matches(e)}}function Xi(e){return function(t){return t.matches(e)}}var Pa=Array.prototype.find;function La(e){return function(){return Pa.call(this.children,e)}}function ka(){return this.firstElementChild}function Ea(e){return this.select(e==null?ka:La(typeof e=="function"?e:Xi(e)))}var Fa=Array.prototype.filter;function Ra(){return Array.from(this.children)}function Oa(e){return function(){return Fa.call(this.children,e)}}function za(e){return this.selectAll(e==null?Ra:Oa(typeof e=="function"?e:Xi(e)))}function Da(e){typeof e!="function"&&(e=Gi(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s=t[r],o=s.length,a=i[r]=[],c,h=0;h<o;++h)(c=s[h])&&e.call(c,c.__data__,h,s)&&a.push(c);return new j(i,this._parents)}function qi(e){return new Array(e.length)}function Na(){return new j(this._enter||this._groups.map(qi),this._parents)}function xe(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xe.prototype={constructor:xe,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function $a(e){return function(){return e}}function Ia(e,t,n,i,r,s){for(var o=0,a,c=t.length,h=s.length;o<h;++o)(a=t[o])?(a.__data__=s[o],i[o]=a):n[o]=new xe(e,s[o]);for(;o<c;++o)(a=t[o])&&(r[o]=a)}function Ba(e,t,n,i,r,s,o){var a,c,h=new Map,l=t.length,u=s.length,f=new Array(l),d;for(a=0;a<l;++a)(c=t[a])&&(f[a]=d=o.call(c,c.__data__,a,t)+"",h.has(d)?r[a]=c:h.set(d,c));for(a=0;a<u;++a)d=o.call(e,s[a],a,s)+"",(c=h.get(d))?(i[a]=c,c.__data__=s[a],h.delete(d)):n[a]=new xe(e,s[a]);for(a=0;a<l;++a)(c=t[a])&&h.get(f[a])===c&&(r[a]=c)}function Ha(e){return e.__data__}function Va(e,t){if(!arguments.length)return Array.from(this,Ha);var n=t?Ba:Ia,i=this._parents,r=this._groups;typeof e!="function"&&(e=$a(e));for(var s=r.length,o=new Array(s),a=new Array(s),c=new Array(s),h=0;h<s;++h){var l=i[h],u=r[h],f=u.length,d=Ua(e.call(l,l&&l.__data__,h,i)),g=d.length,p=a[h]=new Array(g),y=o[h]=new Array(g),m=c[h]=new Array(f);n(l,u,p,y,m,d,t);for(var _=0,x=0,M,S;_<g;++_)if(M=p[_]){for(_>=x&&(x=_+1);!(S=y[x])&&++x<g;);M._next=S||null}}return o=new j(o,i),o._enter=a,o._exit=c,o}function Ua(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Wa(){return new j(this._exit||this._groups.map(qi),this._parents)}function Ya(e,t,n){var i=this.enter(),r=this,s=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),i&&r?i.merge(r).order():r}function Ga(e){for(var t=e.selection?e.selection():e,n=this._groups,i=t._groups,r=n.length,s=i.length,o=Math.min(r,s),a=new Array(r),c=0;c<o;++c)for(var h=n[c],l=i[c],u=h.length,f=a[c]=new Array(u),d,g=0;g<u;++g)(d=h[g]||l[g])&&(f[g]=d);for(;c<r;++c)a[c]=n[c];return new j(a,this._parents)}function Xa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var i=e[t],r=i.length-1,s=i[r],o;--r>=0;)(o=i[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function qa(e){e||(e=ja);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,i=n.length,r=new Array(i),s=0;s<i;++s){for(var o=n[s],a=o.length,c=r[s]=new Array(a),h,l=0;l<a;++l)(h=o[l])&&(c[l]=h);c.sort(t)}return new j(r,this._parents).order()}function ja(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Za(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ka(){return Array.from(this)}function Qa(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],r=0,s=i.length;r<s;++r){var o=i[r];if(o)return o}return null}function Ja(){let e=0;for(const t of this)++e;return e}function tc(){return!this.node()}function ec(e){for(var t=this._groups,n=0,i=t.length;n<i;++n)for(var r=t[n],s=0,o=r.length,a;s<o;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function nc(e){return function(){this.removeAttribute(e)}}function ic(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rc(e,t){return function(){this.setAttribute(e,t)}}function sc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function oc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ac(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function cc(e,t){var n=ve(e);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((t==null?n.local?ic:nc:typeof t=="function"?n.local?ac:oc:n.local?sc:rc)(n,t))}function ji(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hc(e){return function(){this.style.removeProperty(e)}}function lc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function uc(e,t,n){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,n)}}function fc(e,t,n){return arguments.length>1?this.each((t==null?hc:typeof t=="function"?uc:lc)(e,t,n??"")):$t(this.node(),e)}function $t(e,t){return e.style.getPropertyValue(t)||ji(e).getComputedStyle(e,null).getPropertyValue(t)}function dc(e){return function(){delete this[e]}}function gc(e,t){return function(){this[e]=t}}function pc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mc(e,t){return arguments.length>1?this.each((t==null?dc:typeof t=="function"?pc:gc)(e,t)):this.node()[e]}function Zi(e){return e.trim().split(/^|\s+/)}function _n(e){return e.classList||new Ki(e)}function Ki(e){this._node=e,this._names=Zi(e.getAttribute("class")||"")}Ki.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Qi(e,t){for(var n=_n(e),i=-1,r=t.length;++i<r;)n.add(t[i])}function Ji(e,t){for(var n=_n(e),i=-1,r=t.length;++i<r;)n.remove(t[i])}function yc(e){return function(){Qi(this,e)}}function _c(e){return function(){Ji(this,e)}}function vc(e,t){return function(){(t.apply(this,arguments)?Qi:Ji)(this,e)}}function xc(e,t){var n=Zi(e+"");if(arguments.length<2){for(var i=_n(this.node()),r=-1,s=n.length;++r<s;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?vc:t?yc:_c)(n,t))}function wc(){this.textContent=""}function bc(e){return function(){this.textContent=e}}function Sc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Tc(e){return arguments.length?this.each(e==null?wc:(typeof e=="function"?Sc:bc)(e)):this.node().textContent}function Mc(){this.innerHTML=""}function Ac(e){return function(){this.innerHTML=e}}function Cc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Pc(e){return arguments.length?this.each(e==null?Mc:(typeof e=="function"?Cc:Ac)(e)):this.node().innerHTML}function Lc(){this.nextSibling&&this.parentNode.appendChild(this)}function kc(){return this.each(Lc)}function Ec(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fc(){return this.each(Ec)}function Rc(e){var t=typeof e=="function"?e:Wi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Oc(){return null}function zc(e,t){var n=typeof e=="function"?e:Wi(e),i=t==null?Oc:typeof t=="function"?t:yn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function Dc(){var e=this.parentNode;e&&e.removeChild(this)}function Nc(){return this.each(Dc)}function $c(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ic(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bc(e){return this.select(e?Ic:$c)}function Hc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Vc(e){return function(t){e.call(this,t,this.__data__)}}function Uc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");return i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function Wc(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++i]=s;++i?t.length=i:delete this.__on}}}function Yc(e,t,n){return function(){var i=this.__on,r,s=Vc(t);if(i){for(var o=0,a=i.length;o<a;++o)if((r=i[o]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},i?i.push(r):this.__on=[r]}}function Gc(e,t,n){var i=Uc(e+""),r,s=i.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,h=a.length,l;c<h;++c)for(r=0,l=a[c];r<s;++r)if((o=i[r]).type===l.type&&o.name===l.name)return l.value}return}for(a=t?Yc:Wc,r=0;r<s;++r)this.each(a(i[r],t,n));return this}function tr(e,t,n){var i=ji(e),r=i.CustomEvent;typeof r=="function"?r=new r(t,n):(r=i.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Xc(e,t){return function(){return tr(this,e,t)}}function qc(e,t){return function(){return tr(this,e,t.apply(this,arguments))}}function jc(e,t){return this.each((typeof t=="function"?qc:Xc)(e,t))}function*Zc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],r=0,s=i.length,o;r<s;++r)(o=i[r])&&(yield o)}var er=[null];function j(e,t){this._groups=e,this._parents=t}function jt(){return new j([[document.documentElement]],er)}function Kc(){return this}j.prototype=jt.prototype={constructor:j,select:Sa,selectAll:Ca,selectChild:Ea,selectChildren:za,filter:Da,data:Va,enter:Na,exit:Wa,join:Ya,merge:Ga,selection:Kc,order:Xa,sort:qa,call:Za,nodes:Ka,node:Qa,size:Ja,empty:tc,each:ec,attr:cc,style:fc,property:mc,classed:xc,text:Tc,html:Pc,raise:kc,lower:Fc,append:Rc,insert:zc,remove:Nc,clone:Bc,datum:Hc,on:Gc,dispatch:jc,[Symbol.iterator]:Zc};function Z(e){return typeof e=="string"?new j([[document.querySelector(e)]],[document.documentElement]):new j([[e]],er)}function Qc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _t(e,t){if(e=Qc(e),t===void 0&&(t=e.currentTarget),t){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()),[i.x,i.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}var Jc={value:()=>{}};function vn(){for(var e=0,t=arguments.length,n={},i;e<t;++e){if(!(i=arguments[e]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new we(n)}function we(e){this._=e}function th(e,t){return e.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}we.prototype=vn.prototype={constructor:we,on:function(e,t){var n=this._,i=th(e+"",n),r,s=-1,o=i.length;if(arguments.length<2){for(;++s<o;)if((r=(e=i[s]).type)&&(r=eh(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<o;)if(r=(e=i[s]).type)n[r]=nr(n[r],e.name,t);else if(t==null)for(r in n)n[r]=nr(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new we(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,s;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],i=0,r=s.length;i<r;++i)s[i].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)}};function eh(e,t){for(var n=0,i=e.length,r;n<i;++n)if((r=e[n]).name===t)return r.value}function nr(e,t,n){for(var i=0,r=e.length;i<r;++i)if(e[i].name===t){e[i]=Jc,e=e.slice(0,i).concat(e.slice(i+1));break}return n!=null&&e.push({name:t,value:n}),e}const xn={capture:!0,passive:!1};function wn(e){e.preventDefault(),e.stopImmediatePropagation()}function nh(e){var t=e.document.documentElement,n=Z(e).on("dragstart.drag",wn,xn);"onselectstart"in t?n.on("selectstart.drag",wn,xn):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ih(e,t){var n=e.document.documentElement,i=Z(e).on("dragstart.drag",null);t&&(i.on("click.drag",wn,xn),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var It=0,Zt=0,Kt=0,ir=1e3,be,Qt,Se=0,Lt=0,Te=0,Jt=typeof performance=="object"&&performance.now?performance:Date,rr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function bn(){return Lt||(rr(rh),Lt=Jt.now()+Te)}function rh(){Lt=0}function Me(){this._call=this._time=this._next=null}Me.prototype=sr.prototype={constructor:Me,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?bn():+n)+(t==null?0:+t),!this._next&&Qt!==this&&(Qt?Qt._next=this:be=this,Qt=this),this._call=e,this._time=n,Sn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Sn())}};function sr(e,t,n){var i=new Me;return i.restart(e,t,n),i}function sh(){bn(),++It;for(var e=be,t;e;)(t=Lt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--It}function or(){Lt=(Se=Jt.now())+Te,It=Zt=0;try{sh()}finally{It=0,ah(),Lt=0}}function oh(){var e=Jt.now(),t=e-Se;t>ir&&(Te-=t,Se=e)}function ah(){for(var e,t=be,n,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:be=n);Qt=e,Sn(i)}function Sn(e){if(!It){Zt&&(Zt=clearTimeout(Zt));var t=e-Lt;t>24?(e<1/0&&(Zt=setTimeout(or,e-Jt.now()-Te)),Kt&&(Kt=clearInterval(Kt))):(Kt||(Se=Jt.now(),Kt=setInterval(oh,ir)),It=1,rr(or))}}function ar(e,t,n){var i=new Me;return t=t==null?0:+t,i.restart(r=>{i.stop(),e(r+t)},t,n),i}var ch=vn("start","end","cancel","interrupt"),hh=[],cr=0,hr=1,Tn=2,Ae=3,lr=4,Mn=5,Ce=6;function Pe(e,t,n,i,r,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;lh(e,n,{name:t,index:i,group:r,on:ch,tween:hh,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:cr})}function An(e,t){var n=rt(e,t);if(n.state>cr)throw new Error("too late; already scheduled");return n}function ct(e,t){var n=rt(e,t);if(n.state>Ae)throw new Error("too late; already running");return n}function rt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function lh(e,t,n){var i=e.__transition,r;i[t]=n,n.timer=sr(s,0,n.time);function s(h){n.state=hr,n.timer.restart(o,n.delay,n.time),n.delay<=h&&o(h-n.delay)}function o(h){var l,u,f,d;if(n.state!==hr)return c();for(l in i)if(d=i[l],d.name===n.name){if(d.state===Ae)return ar(o);d.state===lr?(d.state=Ce,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete i[l]):+l<t&&(d.state=Ce,d.timer.stop(),d.on.call("cancel",e,e.__data__,d.index,d.group),delete i[l])}if(ar(function(){n.state===Ae&&(n.state=lr,n.timer.restart(a,n.delay,n.time),a(h))}),n.state=Tn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Tn){for(n.state=Ae,r=new Array(f=n.tween.length),l=0,u=-1;l<f;++l)(d=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=d);r.length=u+1}}function a(h){for(var l=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(c),n.state=Mn,1),u=-1,f=r.length;++u<f;)r[u].call(e,l);n.state===Mn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Ce,n.timer.stop(),delete i[t];for(var h in i)return;delete e.__transition}}function Le(e,t){var n=e.__transition,i,r,s=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((i=n[o]).name!==t){s=!1;continue}r=i.state>Tn&&i.state<Mn,i.state=Ce,i.timer.stop(),i.on.call(r?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete n[o]}s&&delete e.__transition}}function uh(e){return this.each(function(){Le(this,e)})}function fh(e,t){var n,i;return function(){var r=ct(this,e),s=r.tween;if(s!==n){i=n=s;for(var o=0,a=i.length;o<a;++o)if(i[o].name===t){i=i.slice(),i.splice(o,1);break}}r.tween=i}}function dh(e,t,n){var i,r;if(typeof n!="function")throw new Error;return function(){var s=ct(this,e),o=s.tween;if(o!==i){r=(i=o).slice();for(var a={name:t,value:n},c=0,h=r.length;c<h;++c)if(r[c].name===t){r[c]=a;break}c===h&&r.push(a)}s.tween=r}}function gh(e,t){var n=this._id;if(e+="",arguments.length<2){for(var i=rt(this.node(),n).tween,r=0,s=i.length,o;r<s;++r)if((o=i[r]).name===e)return o.value;return null}return this.each((t==null?fh:dh)(n,e,t))}function Cn(e,t,n){var i=e._id;return e.each(function(){var r=ct(this,i);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return rt(r,i).value[t]}}function ur(e,t){var n;return(typeof t=="number"?nt:t instanceof ut?Wt:(n=ut(t))?(t=n,Wt):gi)(e,t)}function ph(e){return function(){this.removeAttribute(e)}}function mh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function yh(e,t,n){var i,r=n+"",s;return function(){var o=this.getAttribute(e);return o===r?null:o===i?s:s=t(i=o,n)}}function _h(e,t,n){var i,r=n+"",s;return function(){var o=this.getAttributeNS(e.space,e.local);return o===r?null:o===i?s:s=t(i=o,n)}}function vh(e,t,n){var i,r,s;return function(){var o,a=n(this),c;return a==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=a+"",o===c?null:o===i&&c===r?s:(r=c,s=t(i=o,a)))}}function xh(e,t,n){var i,r,s;return function(){var o,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=a+"",o===c?null:o===i&&c===r?s:(r=c,s=t(i=o,a)))}}function wh(e,t){var n=ve(e),i=n==="transform"?vo:ur;return this.attrTween(e,typeof t=="function"?(n.local?xh:vh)(n,i,Cn(this,"attr."+e,t)):t==null?(n.local?mh:ph)(n):(n.local?_h:yh)(n,i,t))}function bh(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Sh(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Th(e,t){var n,i;function r(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&Sh(e,s)),n}return r._value=t,r}function Mh(e,t){var n,i;function r(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&bh(e,s)),n}return r._value=t,r}function Ah(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var i=ve(e);return this.tween(n,(i.local?Th:Mh)(i,t))}function Ch(e,t){return function(){An(this,e).delay=+t.apply(this,arguments)}}function Ph(e,t){return t=+t,function(){An(this,e).delay=t}}function Lh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ch:Ph)(t,e)):rt(this.node(),t).delay}function kh(e,t){return function(){ct(this,e).duration=+t.apply(this,arguments)}}function Eh(e,t){return t=+t,function(){ct(this,e).duration=t}}function Fh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kh:Eh)(t,e)):rt(this.node(),t).duration}function Rh(e,t){if(typeof t!="function")throw new Error;return function(){ct(this,e).ease=t}}function Oh(e){var t=this._id;return arguments.length?this.each(Rh(t,e)):rt(this.node(),t).ease}function zh(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ct(this,e).ease=n}}function Dh(e){if(typeof e!="function")throw new Error;return this.each(zh(this._id,e))}function Nh(e){typeof e!="function"&&(e=Gi(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s=t[r],o=s.length,a=i[r]=[],c,h=0;h<o;++h)(c=s[h])&&e.call(c,c.__data__,h,s)&&a.push(c);return new ft(i,this._parents,this._name,this._id)}function $h(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,i=t.length,r=n.length,s=Math.min(i,r),o=new Array(i),a=0;a<s;++a)for(var c=t[a],h=n[a],l=c.length,u=o[a]=new Array(l),f,d=0;d<l;++d)(f=c[d]||h[d])&&(u[d]=f);for(;a<i;++a)o[a]=t[a];return new ft(o,this._parents,this._name,this._id)}function Ih(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Bh(e,t,n){var i,r,s=Ih(t)?An:ct;return function(){var o=s(this,e),a=o.on;a!==i&&(r=(i=a).copy()).on(t,n),o.on=r}}function Hh(e,t){var n=this._id;return arguments.length<2?rt(this.node(),n).on.on(e):this.each(Bh(n,e,t))}function Vh(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Uh(){return this.on("end.remove",Vh(this._id))}function Wh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yn(e));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o<r;++o)for(var a=i[o],c=a.length,h=s[o]=new Array(c),l,u,f=0;f<c;++f)(l=a[f])&&(u=e.call(l,l.__data__,f,a))&&("__data__"in l&&(u.__data__=l.__data__),h[f]=u,Pe(h[f],t,n,f,h,rt(l,n)));return new ft(s,this._parents,t,n)}function Yh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Yi(e));for(var i=this._groups,r=i.length,s=[],o=[],a=0;a<r;++a)for(var c=i[a],h=c.length,l,u=0;u<h;++u)if(l=c[u]){for(var f=e.call(l,l.__data__,u,c),d,g=rt(l,n),p=0,y=f.length;p<y;++p)(d=f[p])&&Pe(d,t,n,p,f,g);s.push(f),o.push(l)}return new ft(s,o,t,n)}var Gh=jt.prototype.constructor;function Xh(){return new Gh(this._groups,this._parents)}function qh(e,t){var n,i,r;return function(){var s=$t(this,e),o=(this.style.removeProperty(e),$t(this,e));return s===o?null:s===n&&o===i?r:r=t(n=s,i=o)}}function fr(e){return function(){this.style.removeProperty(e)}}function jh(e,t,n){var i,r=n+"",s;return function(){var o=$t(this,e);return o===r?null:o===i?s:s=t(i=o,n)}}function Zh(e,t,n){var i,r,s;return function(){var o=$t(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),$t(this,e))),o===c?null:o===i&&c===r?s:(r=c,s=t(i=o,a))}}function Kh(e,t){var n,i,r,s="style."+t,o="end."+s,a;return function(){var c=ct(this,e),h=c.on,l=c.value[s]==null?a||(a=fr(t)):void 0;(h!==n||r!==l)&&(i=(n=h).copy()).on(o,r=l),c.on=i}}function Qh(e,t,n){var i=(e+="")=="transform"?_o:ur;return t==null?this.styleTween(e,qh(e,i)).on("end.style."+e,fr(e)):typeof t=="function"?this.styleTween(e,Zh(e,i,Cn(this,"style."+e,t))).each(Kh(this._id,e)):this.styleTween(e,jh(e,i,t),n).on("end.style."+e,null)}function Jh(e,t,n){return function(i){this.style.setProperty(e,t.call(this,i),n)}}function tl(e,t,n){var i,r;function s(){var o=t.apply(this,arguments);return o!==r&&(i=(r=o)&&Jh(e,o,n)),i}return s._value=t,s}function el(e,t,n){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,tl(e,t,n??""))}function nl(e){return function(){this.textContent=e}}function il(e){return function(){var t=e(this);this.textContent=t??""}}function rl(e){return this.tween("text",typeof e=="function"?il(Cn(this,"text",e)):nl(e==null?"":e+""))}function sl(e){return function(t){this.textContent=e.call(this,t)}}function ol(e){var t,n;function i(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&sl(r)),t}return i._value=e,i}function al(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,ol(e))}function cl(){for(var e=this._name,t=this._id,n=dr(),i=this._groups,r=i.length,s=0;s<r;++s)for(var o=i[s],a=o.length,c,h=0;h<a;++h)if(c=o[h]){var l=rt(c,t);Pe(c,e,n,h,o,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new ft(i,this._parents,e,n)}function hl(){var e,t,n=this,i=n._id,r=n.size();return new Promise(function(s,o){var a={value:o},c={value:function(){--r===0&&s()}};n.each(function(){var h=ct(this,i),l=h.on;l!==e&&(t=(e=l).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),h.on=t}),r===0&&s()})}var ll=0;function ft(e,t,n,i){this._groups=e,this._parents=t,this._name=n,this._id=i}function dr(){return++ll}var dt=jt.prototype;ft.prototype={constructor:ft,select:Wh,selectAll:Yh,selectChild:dt.selectChild,selectChildren:dt.selectChildren,filter:Nh,merge:$h,selection:Xh,transition:cl,call:dt.call,nodes:dt.nodes,node:dt.node,size:dt.size,empty:dt.empty,each:dt.each,on:Hh,attr:wh,attrTween:Ah,style:Qh,styleTween:el,text:rl,textTween:al,remove:Uh,tween:gh,delay:Lh,duration:Fh,ease:Oh,easeVarying:Dh,end:hl,[Symbol.iterator]:dt[Symbol.iterator]};function ul(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fl={time:null,delay:0,duration:250,ease:ul};function dl(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function gl(e){var t,n;e instanceof ft?(t=e._id,e=e._name):(t=dr(),(n=fl).time=bn(),e=e==null?null:e+"");for(var i=this._groups,r=i.length,s=0;s<r;++s)for(var o=i[s],a=o.length,c,h=0;h<a;++h)(c=o[h])&&Pe(c,e,t,h,o,n||dl(c,t));return new ft(i,this._parents,e,t)}jt.prototype.interrupt=uh,jt.prototype.transition=gl;const ke=e=>()=>e;function pl(e,{sourceEvent:t,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function gt(e,t,n){this.k=e,this.x=t,this.y=n}gt.prototype={constructor:gt,scale:function(e){return e===1?this:new gt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new gt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Pn=new gt(1,0,0);gt.prototype;function Ln(e){e.stopImmediatePropagation()}function te(e){e.preventDefault(),e.stopImmediatePropagation()}function ml(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function yl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function gr(){return this.__zoom||Pn}function _l(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function vl(){return navigator.maxTouchPoints||"ontouchstart"in this}function xl(e,t,n){var i=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function wl(){var e=ml,t=yl,n=xl,i=_l,r=vl,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,c=So,h=vn("start","zoom","end"),l,u,f,d=500,g=150,p=0,y=10;function m(v){v.property("__zoom",gr).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",N).filter(r).on("touchstart.zoom",P).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,A,b,L){var R=v.selection?v.selection():v;R.property("__zoom",gr),v!==R?S(v,A,b,L):R.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(v,A,b,L){m.scaleTo(v,function(){var R=this.__zoom.k,O=typeof A=="function"?A.apply(this,arguments):A;return R*O},b,L)},m.scaleTo=function(v,A,b,L){m.transform(v,function(){var R=t.apply(this,arguments),O=this.__zoom,D=b==null?M(R):typeof b=="function"?b.apply(this,arguments):b,I=O.invert(D),H=typeof A=="function"?A.apply(this,arguments):A;return n(x(_(O,H),D,I),R,o)},b,L)},m.translateBy=function(v,A,b,L){m.transform(v,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof b=="function"?b.apply(this,arguments):b),t.apply(this,arguments),o)},null,L)},m.translateTo=function(v,A,b,L,R){m.transform(v,function(){var O=t.apply(this,arguments),D=this.__zoom,I=L==null?M(O):typeof L=="function"?L.apply(this,arguments):L;return n(Pn.translate(I[0],I[1]).scale(D.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof b=="function"?-b.apply(this,arguments):-b),O,o)},L,R)};function _(v,A){return A=Math.max(s[0],Math.min(s[1],A)),A===v.k?v:new gt(A,v.x,v.y)}function x(v,A,b){var L=A[0]-b[0]*v.k,R=A[1]-b[1]*v.k;return L===v.x&&R===v.y?v:new gt(v.k,L,R)}function M(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function S(v,A,b,L){v.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var R=this,O=arguments,D=w(R,O).event(L),I=t.apply(R,O),H=b==null?M(I):typeof b=="function"?b.apply(R,O):b,V=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),U=R.__zoom,X=typeof A=="function"?A.apply(R,O):A,J=c(U.invert(H).concat(V/U.k),X.invert(H).concat(V/X.k));return function(Y){if(Y===1)Y=X;else{var q=J(Y),lt=V/q[2];Y=new gt(lt,H[0]-q[0]*lt,H[1]-q[1]*lt)}D.zoom(null,Y)}})}function w(v,A,b){return!b&&v.__zooming||new T(v,A)}function T(v,A){this.that=v,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,A),this.taps=0}T.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,A){return this.mouse&&v!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var A=Z(this.that).datum();h.call(v,this.that,new pl(v,{sourceEvent:this.sourceEvent,target:m,type:v,transform:this.that.__zoom,dispatch:h}),A)}};function F(v,...A){if(!e.apply(this,arguments))return;var b=w(this,A).event(v),L=this.__zoom,R=Math.max(s[0],Math.min(s[1],L.k*Math.pow(2,i.apply(this,arguments)))),O=_t(v);if(b.wheel)(b.mouse[0][0]!==O[0]||b.mouse[0][1]!==O[1])&&(b.mouse[1]=L.invert(b.mouse[0]=O)),clearTimeout(b.wheel);else{if(L.k===R)return;b.mouse=[O,L.invert(O)],Le(this),b.start()}te(v),b.wheel=setTimeout(D,g),b.zoom("mouse",n(x(_(L,R),b.mouse[0],b.mouse[1]),b.extent,o));function D(){b.wheel=null,b.end()}}function k(v,...A){if(f||!e.apply(this,arguments))return;var b=v.currentTarget,L=w(this,A,!0).event(v),R=Z(v.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",V,!0),O=_t(v,b),D=v.clientX,I=v.clientY;nh(v.view),Ln(v),L.mouse=[O,this.__zoom.invert(O)],Le(this),L.start();function H(U){if(te(U),!L.moved){var X=U.clientX-D,J=U.clientY-I;L.moved=X*X+J*J>p}L.event(U).zoom("mouse",n(x(L.that.__zoom,L.mouse[0]=_t(U,b),L.mouse[1]),L.extent,o))}function V(U){R.on("mousemove.zoom mouseup.zoom",null),ih(U.view,L.moved),te(U),L.event(U).end()}}function N(v,...A){if(e.apply(this,arguments)){var b=this.__zoom,L=_t(v.changedTouches?v.changedTouches[0]:v,this),R=b.invert(L),O=b.k*(v.shiftKey?.5:2),D=n(x(_(b,O),L,R),t.apply(this,A),o);te(v),a>0?Z(this).transition().duration(a).call(S,D,L,v):Z(this).call(m.transform,D,L,v)}}function P(v,...A){if(e.apply(this,arguments)){var b=v.touches,L=b.length,R=w(this,A,v.changedTouches.length===L).event(v),O,D,I,H;for(Ln(v),D=0;D<L;++D)I=b[D],H=_t(I,this),H=[H,this.__zoom.invert(H),I.identifier],R.touch0?!R.touch1&&R.touch0[2]!==H[2]&&(R.touch1=H,R.taps=0):(R.touch0=H,O=!0,R.taps=1+!!l);l&&(l=clearTimeout(l)),O&&(R.taps<2&&(u=H[0],l=setTimeout(function(){l=null},d)),Le(this),R.start())}}function z(v,...A){if(this.__zooming){var b=w(this,A).event(v),L=v.changedTouches,R=L.length,O,D,I,H;for(te(v),O=0;O<R;++O)D=L[O],I=_t(D,this),b.touch0&&b.touch0[2]===D.identifier?b.touch0[0]=I:b.touch1&&b.touch1[2]===D.identifier&&(b.touch1[0]=I);if(D=b.that.__zoom,b.touch1){var V=b.touch0[0],U=b.touch0[1],X=b.touch1[0],J=b.touch1[1],Y=(Y=X[0]-V[0])*Y+(Y=X[1]-V[1])*Y,q=(q=J[0]-U[0])*q+(q=J[1]-U[1])*q;D=_(D,Math.sqrt(Y/q)),I=[(V[0]+X[0])/2,(V[1]+X[1])/2],H=[(U[0]+J[0])/2,(U[1]+J[1])/2]}else if(b.touch0)I=b.touch0[0],H=b.touch0[1];else return;b.zoom("touch",n(x(D,I,H),b.extent,o))}}function B(v,...A){if(this.__zooming){var b=w(this,A).event(v),L=v.changedTouches,R=L.length,O,D;for(Ln(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},d),O=0;O<R;++O)D=L[O],b.touch0&&b.touch0[2]===D.identifier?delete b.touch0:b.touch1&&b.touch1[2]===D.identifier&&delete b.touch1;if(b.touch1&&!b.touch0&&(b.touch0=b.touch1,delete b.touch1),b.touch0)b.touch0[1]=this.__zoom.invert(b.touch0[0]);else if(b.end(),b.taps===2&&(D=_t(D,this),Math.hypot(u[0]-D[0],u[1]-D[1])<y)){var I=Z(this).on("dblclick.zoom");I&&I.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(i=typeof v=="function"?v:ke(+v),m):i},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:ke(!!v),m):e},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:ke(!!v),m):r},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:ke([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):t},m.scaleExtent=function(v){return arguments.length?(s[0]=+v[0],s[1]=+v[1],m):[s[0],s[1]]},m.translateExtent=function(v){return arguments.length?(o[0][0]=+v[0][0],o[1][0]=+v[1][0],o[0][1]=+v[0][1],o[1][1]=+v[1][1],m):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=h.on.apply(h,arguments);return v===h?m:v},m.clickDistance=function(v){return arguments.length?(p=(v=+v)*v,m):Math.sqrt(p)},m.tapDistance=function(v){return arguments.length?(y=+v,m):y},m}const bl=.1,Sl=256;class pr{constructor(t,n,i={maxZoomLevel:Sl,minZoomLevel:bl}){this.xBounds=[0,1],this.yBounds=[0,1],this.translateBoundsX=[0,1],this.translateBoundsY=[0,1],this._zFactor=1,this._enableTranslateExtent=!1,this.container=Z(t),this.options=i,this.onRescale=n,this.onZoom=this.onZoom.bind(this),this.calculateTransform=this.calculateTransform.bind(this),this.applyTransform=this.applyTransform.bind(this),this.recalculateZoomTransform=this.recalculateZoomTransform.bind(this),this.rescale=this.rescale.bind(this),this.adjustToSize=this.adjustToSize.bind(this),this.setViewport=this.setViewport.bind(this),this.currentStateAsEvent=this.currentStateAsEvent.bind(this),this.updateTranslateExtent=this.updateTranslateExtent.bind(this),this.scaleX=Ct().domain(this.xBounds).range([0,1]),this.scaleY=Ct().domain(this.yBounds).range([0,1]),this.init()}get width(){return this.scaleX.range()[1]??0}get height(){return this.scaleY.range()[1]??0}get xSpan(){const{xBounds:t}=this;return Math.abs(t[1]-t[0])}get ySpan(){const{yBounds:t}=this;return Math.abs(t[1]-t[0])}get viewportRatio(){return this.width/(this.height||1)}get xRatio(){const t=this.scaleX.domain();return Math.abs(this.width/(t[1]-t[0]))}get yRatio(){const t=this.scaleY.domain();return Math.abs(this.height/(t[1]-t[0]))}get zFactor(){return this._zFactor}set zFactor(t){this._zFactor=t,this.recalculateZoomTransform()}get isXInverted(){return this.xBounds[1]<this.xBounds[0]}get isYInverted(){return this.yBounds[1]<this.yBounds[0]}get enableTranslateExtent(){return this._enableTranslateExtent}set enableTranslateExtent(t){this._enableTranslateExtent=t,this.updateTranslateExtent()}updateTranslateExtent(){const{width:t,xSpan:n,zFactor:i,enableTranslateExtent:r,translateBoundsX:s,translateBoundsY:o}=this;let a=-1/0,c=-1/0,h=1/0,l=1/0;if(r){const u=t/n;a=s[0]*u,h=s[1]*u,c=o[0]*u*i,l=o[1]*u*i}this.zoom.translateExtent([[a,c],[h,l]])}currentStateAsEvent(){const{scaleX:t,scaleY:n,xBounds:i,yBounds:r,zFactor:s,viewportRatio:o,currentTransform:a,xRatio:c,yRatio:h,width:l,height:u}=this;return{xScale:t.copy(),yScale:n.copy(),xBounds:i,yBounds:r,zFactor:s,viewportRatio:o,xRatio:c,yRatio:h,width:l,height:u,transform:Object.assign({},a)}}rescale(){const{currentStateAsEvent:t}=this;this.onRescale(t())}init(){this.zoom=wl().scaleExtent([this.options.minZoomLevel,this.options.maxZoomLevel]).on("zoom",this.onZoom),this.container.call(this.zoom)}onZoom(t){const{transform:n}=t;n&&(this.applyTransform(n),this.rescale())}applyTransform(t){const{width:n,scaleX:i,scaleY:r,xSpan:s,xBounds:o,yBounds:a,zFactor:c}=this,{viewportRatio:h,isXInverted:l,isYInverted:u}=this,f=n*t.k,d=s/f,g=s/t.k,p=g/c/h,y=d*t.x,m=d/c*t.y,_=o[0]-(l?-y:y),x=a[0]-(u?-m:m);i.domain([_,_+(l?-g:g)]),r.domain([x,x+(u?-p:p)]),this.currentTransform=t}setViewport(t,n,i,r){const{zoom:s,container:o,calculateTransform:a,scaleX:c,scaleY:h,isXInverted:l}=this;if(t==null||i==null||isNaN(t)||isNaN(i)){const p=c.domain(),y=p[1]-p[0];(t==null||isNaN(t))&&(t=p[0]+y/2||0),(i==null||isNaN(i))&&(i=Math.abs(y)||1)}if(n==null||isNaN(n)){const p=h.domain();n=p[0]+(p[1]-p[0])/2||0}const u=l?-i:i,f=t-u/2,d=f+u,g=a(f,d,n);r!=null&&Number.isFinite(r)&&r>0?s.transform(o.transition().duration(r),g):s.transform(o,g)}setBounds(t,n){this.xBounds=t,this.yBounds=n,this.recalculateZoomTransform()}setTranslateBounds(t,n){this.translateBoundsX=t,this.translateBoundsY=n,this.updateTranslateExtent()}adjustToSize(t,n,i=!1){const{width:r,height:s,scaleX:o,scaleY:a,recalculateZoomTransform:c}=this;let h=0,l=0;if(typeof t=="number"&&typeof n=="number")l=n,h=t;else{const d=this.container.node();if(d){const{width:g,height:p}=d.getBoundingClientRect();h=g,l=p}}const u=Math.max(1,h),f=Math.max(1,l);!i&&r===u&&s===f||(o.range([0,u]),a.range([0,f]),c(),this.onRescale(this.currentStateAsEvent()))}calculateTransform(t,n,i){const{scaleX:r,xSpan:s,xBounds:o,yBounds:a,zFactor:c,viewportRatio:h,isXInverted:l,isYInverted:u}=this,[f,d]=r.range(),g=Math.abs(n-t),p=s/g,y=g/(d-f),m=i-(u?-g:g)/c/h/2,_=(o[0]-t)/(l?-y:y),x=(a[0]-m)/((u?-y:y)/c);return Pn.translate(_,x).scale(p)}recalculateZoomTransform(){const{scaleX:t,scaleY:n,container:i,calculateTransform:r,updateTranslateExtent:s}=this,[o,a]=t.domain(),[c,h]=n.domain(),l=c+(h-c)/2,u=r(o,a,l);s(),this.zoom.transform(i,u)}setZoomLevelBoundary(t){return this.zoom.scaleExtent(t),this}setMaxZoomLevel(t){const n=this.zoom.scaleExtent();return this.zoom.scaleExtent([n[0],t]),this}setMinZoomLevel(t){const n=this.zoom.scaleExtent();return this.zoom.scaleExtent([t,n[1]]),this}}const Tl={order:1,layerOpacity:1,interactive:!1};class ee{constructor(t,n){this._interactive=!1,this._id=t||`layer-${Math.floor(Math.random()*1e3)}`;const i=n||Tl;this._order=i.order||1,this._options={...i},this.loading=!1,this._element=void 0,this._opacity=i.layerOpacity||1,this._visible=!0,this._interactive=i.interactive||!1,n&&n.data&&this.setData(n.data),this._referenceSystem=n==null?void 0:n.referenceSystem,this.onMount=this.onMount.bind(this),this.onUnmount=this.onUnmount.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onRescale=this.onRescale.bind(this),this.onResize=this.onResize.bind(this),this.onOrderChanged=this.onOrderChanged.bind(this),this.onOpacityChanged=this.onOpacityChanged.bind(this),this.setVisibility=this.setVisibility.bind(this)}get id(){return this._id}get element(){return this._element}get options(){return this._options}set options(t){this._options=t}set isLoading(t){this.loading=t}get isLoading(){return this.loading}set opacity(t){this._opacity=t,this.onOpacityChanged(t)}get opacity(){return this._opacity}set order(t){this._order=t,this.onOrderChanged(t)}get order(){return this._order}set interactive(t){this._interactive=t,this.onInteractivityChanged(t)}get interactive(){return this._interactive}get referenceSystem(){return this._referenceSystem}set referenceSystem(t){this._referenceSystem=t}get data(){return this.getData()}set data(t){this.setData(t)}get isVisible(){return this._visible}getData(){return this._data}setData(t){this._data=t,this.element&&t!=null&&this.onUpdate({data:t})}clearData(t=!0){this._data=void 0,t&&(this.referenceSystem=void 0),this.onUpdate({})}setVisibility(t,n){this._visible=t}onMount(t){this._element=t.elm,this._options.onMount&&this._options.onMount(t,this)}onUnmount(t){this._options.onUnmount&&t!=null&&this._options.onUnmount(t,this)}onResize(t){this._options.onResize&&this._options.onResize(t,this)}onUpdate(t){t.data&&(this._data=t.data),this._options.onUpdate&&this._options.onUpdate(t,this)}onRescale(t){this.optionsRescale(t)}optionsRescale(t){this._options.onRescale&&this._options.onRescale(t,this)}getInternalLayerIds(){return[]}}const Ee=200,Fe=300,mr=40,yr=30,Ml=100,Al=.6,Cl=.3,Pl=8,Ll=16,vt=64,_r=1;class xt extends ee{onOpacityChanged(t){this.canvas&&this.updateStyle()}onOrderChanged(t){this.canvas&&this.updateStyle()}onInteractivityChanged(t){this.canvas&&this.updateStyle()}setVisibility(t){super.setVisibility(t),this.canvas&&this.updateStyle(t)}updateStyle(t){var s;const i=t||this.isVisible?"visible":"hidden",r=this.interactive?"auto":"none";(s=this.canvas)==null||s.setAttribute("style",`position:absolute;pointer-events:${r};z-index:${this.order};opacity:${this.opacity};visibility:${i}`)}onMount(t){super.onMount(t);const{elm:n}=t,i=t.width||parseInt((n==null?void 0:n.getAttribute("width"))??"",10)||Ee,r=t.height||parseInt((n==null?void 0:n.getAttribute("height"))??"",10)||Fe;this.elm=n;let s;this.canvas||(s=document.createElement("canvas"),this.canvas=s,t.elm.appendChild(s)),this.canvas.setAttribute("id",`${this.id}`),this.canvas.setAttribute("width",`${i}px`),this.canvas.setAttribute("height",`${r}px`),this.canvas.setAttribute("class","canvas-layer"),this.updateStyle(),this.ctx=this.canvas.getContext("2d")??void 0}onUnmount(){var t;super.onUnmount(),(t=this.canvas)==null||t.remove(),this.canvas=void 0}onResize(t){const{ctx:n}=this,{width:i,height:r}=t;n==null||n.canvas.setAttribute("width",`${i}px`),n==null||n.canvas.setAttribute("height",`${r}px`)}onUpdate(t){super.onUpdate(t)}resetTransform(){var t;(t=this.ctx)==null||t.resetTransform()}setTransform(t){var r,s;this.resetTransform();const n=t.xBounds[0]>t.xBounds[1],i=t.yBounds[0]>t.yBounds[1];(r=this.ctx)==null||r.translate(t.xScale(0),t.yScale(0)),(s=this.ctx)==null||s.scale(t.xRatio*(n?-1:1),t.yRatio*(i?-1:1))}clearCanvas(){const{ctx:t,canvas:n}=this;t==null||t.save(),t==null||t.resetTransform(),t==null||t.clearRect(0,0,(n==null?void 0:n.width)??0,(n==null?void 0:n.height)??0),t==null||t.restore()}}class kl extends ee{onMount(t){super.onMount(t);const{elm:n}=t,i=t.width||parseInt((n==null?void 0:n.getAttribute("width"))??"",10)||Ee,r=t.height||parseInt((n==null?void 0:n.getAttribute("height"))??"",10)||Fe;this.elm||(this.elm=Z(n).append("div"),this.elm.attr("id",`${this.id}`),this.elm.attr("class","html-layer"));const s=this.interactive?"auto":"none";this.elm.style("position","absolute").style("height",`${r}px`).style("width",`${i}px`).style("opacity",this.opacity).style("overflow","hidden").style("pointer-events",s).style("z-index",this.order)}onUnmount(){var t;super.onUnmount(),(t=this.elm)==null||t.remove(),this.elm=void 0}onResize(t){this.elm&&(super.onResize(t),this.elm.style("height",`${t.height}px`).style("width",`${t.width}px`))}setVisibility(t){super.setVisibility(t),this.elm&&this.elm.attr("visibility",t?"visible":"hidden")}onOpacityChanged(t){this.elm&&this.elm.style("opacity",t)}onOrderChanged(t){this.elm&&this.elm.style("z-index",t)}onInteractivityChanged(t){if(this.elm){const n=t?"auto":"none";this.elm.style("pointer-events",n)}}}class vr extends ee{onMount(t){super.onMount(t);const{elm:n}=t,i=t.width||parseInt(n.getAttribute("width")??"",10)||Ee,r=t.height||parseInt(n.getAttribute("height")??"",10)||Fe;this.elm||(this.elm=Z(n).append("svg"),this.elm.attr("id",`${this.id}`),this.elm.attr("class","svg-layer")),this.elm.attr("height",r).attr("width",i);const s=this.interactive?"auto":"none";this.elm.style("position","absolute").style("pointer-events",s).style("opacity",this.opacity).style("z-index",this.order)}onUnmount(){var t;super.onUnmount(),(t=this.elm)==null||t.remove(),this.elm=void 0}onResize(t){this.elm&&(super.onResize(t),this.elm.attr("height",t.height).attr("width",t.width))}setVisibility(t){super.setVisibility(t),this.elm&&this.elm.attr("visibility",t?"visible":"hidden")}onOpacityChanged(t){this.elm&&this.elm.style("opacity",t)}onOrderChanged(t){this.elm&&this.elm.style("z-index",t)}onInteractivityChanged(t){if(this.elm){const n=t?"auto":"none";this.elm.style("pointer-events",n)}}}class El{constructor(t){const n={width:Ee,height:Fe,antialias:!0,backgroundAlpha:0,clearBeforeRender:!0,preserveDrawingBuffer:!0,...t};this.renderer=E.autoDetectRenderer(n),this.stage=new E.Container}destroy(){var i,r,s,o,a;(i=this.stage)==null||i.destroy({children:!0,texture:!0,baseTexture:!0}),this.stage=void 0;const t=(r=this.renderer)==null?void 0:r.type,n=this.renderer instanceof E.Renderer?(s=this.renderer)==null?void 0:s.gl:void 0;t===E.RENDERER_TYPE.WEBGL&&n&&((o=n==null?void 0:n.getExtension("WEBGL_lose_context"))==null||o.loseContext()),(a=this.renderer)==null||a.destroy(!0),this.renderer=void 0}get view(){var t;return(t=this.renderer)==null?void 0:t.view}render(){var t;this.stage!=null&&((t=this.renderer)==null||t.render(this.stage))}}class kn extends ee{constructor(t,n,i){var r;super(n,i),this.ctx=t,this.container=new E.Container,(r=this.ctx.stage)==null||r.addChild(this.container)}render(){this.ctx.render()}addChild(t){this.container.addChild(t)}clearLayer(){this.container.removeChildren().forEach(n=>{n.destroy()})}onMount(t){var n,i;super.onMount(t),this.pixiViewContainer=((n=this.element)==null?void 0:n.querySelector("#webgl-layer"))??void 0,this.pixiViewContainer||(this.pixiViewContainer=document.createElement("div"),this.pixiViewContainer.setAttribute("id",`${this.id}`),this.pixiViewContainer.setAttribute("class","webgl-layer"),this.ctx.view!=null&&this.pixiViewContainer.appendChild(this.ctx.view),(i=this.element)==null||i.appendChild(this.pixiViewContainer),this.updateStyle())}onUnmount(t){var n,i;super.onUnmount(t),this.clearLayer(),(n=this.ctx.stage)==null||n.removeChild(this.container),this.container.destroy(),(i=this.pixiViewContainer)==null||i.remove(),this.pixiViewContainer=void 0}onResize(t){var n;super.onResize(t),(n=this.ctx.renderer)==null||n.resize(t.width,t.height)}onRescale(t){super.onRescale(t);const n=t.xBounds[0]>t.xBounds[1],i=t.yBounds[0]>t.yBounds[1];this.setContainerPosition(t.xScale(0),t.yScale(0)),this.setContainerScale(t.xRatio*(n?-1:1),t.yRatio*(i?-1:1))}setContainerPosition(t,n){this.container.position.set(t,n)}setContainerScale(t,n){this.container.scale.set(t,n)}updateStyle(t){var s;const n=t||this.isVisible,i=this.interactive?"auto":"none";this.container.visible=n;const r=[["position","absolute"],["pointer-events",`${i}`],["z-index",`${this.order}`],["opacity",`${this.opacity}`]].map(o=>o.join(":")).join(";");(s=this.pixiViewContainer)==null||s.setAttribute("style",r)}setVisibility(t,n){super.setVisibility(t,n),this.pixiViewContainer&&this.updateStyle(t)}onOpacityChanged(t){this.pixiViewContainer&&this.updateStyle()}onOrderChanged(t){this.pixiViewContainer&&this.updateStyle()}onInteractivityChanged(t){this.pixiViewContainer&&this.updateStyle()}renderType(){var t;return(t=this.ctx.renderer)==null?void 0:t.type}}function ne(e){throw new Error(`Unexpected object: ${JSON.stringify(e)}`)}const xr=e=>e.kind==="pAndASymbol",wr=e=>e.kind==="cementSqueeze",br=e=>e.kind==="cementPlug",Sr=(e,t,n)=>i=>{switch(i.kind){case"screen":return e(i);case"tubing":return t(i);case"completionSymbol":return n(i);default:return ne(i)}},K=(e,t)=>{switch(t){case"Perforation":return e.Perforation(t);case"Open hole gravel pack":return e.OpenHoleGravelPack(t);case"Open hole frac pack":return e.OpenHoleFracPack(t);case"Cased hole fracturation":return e.CasedHoleFracturation(t);case"Cased hole frac pack":return e.CasedHoleFracPack(t);case"Cased hole gravel pack":return e.CasedHoleGravelPack(t);default:return ne(t)}},Fl=e=>K({Perforation:()=>!0,OpenHoleGravelPack:()=>!0,OpenHoleFracPack:()=>!1,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!1},e.subKind),Rl=e=>K({Perforation:()=>!1,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!0,CasedHoleFracturation:()=>!0,CasedHoleGravelPack:()=>!0,CasedHoleFracPack:()=>!0},e.subKind),Tr=e=>K({Perforation:()=>!1,OpenHoleGravelPack:()=>!0,OpenHoleFracPack:()=>!0,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!0,CasedHoleFracPack:()=>!0},e.subKind);function Mr(e){return K({Perforation:()=>!1,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!0,CasedHoleFracturation:()=>!0,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!0},e.subKind)}function Ar(e){return K({Perforation:()=>!0,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!1,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!1},e.subKind)}function Cr(e){return K({Perforation:()=>!1,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!1,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!0,CasedHoleFracPack:()=>!1},e.subKind)}function Ol(e){return K({Perforation:()=>!0,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!1,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!1},e.subKind)}function Pr(e){return K({Perforation:()=>!1,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!1,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!0},e.subKind)}function zl(e){return K({Perforation:()=>!1,OpenHoleGravelPack:()=>!1,OpenHoleFracPack:()=>!0,CasedHoleFracturation:()=>!1,CasedHoleGravelPack:()=>!1,CasedHoleFracPack:()=>!1},e.subKind)}const Lr=e=>e.subKind==="Cased hole fracturation",kr=(e,t)=>e.start<t.end&&e.end>t.start,Er=e=>({holeLayerId:`${e}-hole`,casingLayerId:`${e}-casing`,completionLayerId:`${e}-completion`,cementLayerId:`${e}-cement`,pAndALayerId:`${e}-pAndA`,perforationLayerId:`${e}-perforation`}),Fr={firstColor:"#8c541d",secondColor:"#eee3d8",lineColor:"#8b4513"},Rr={solidColor:"#dcdcdc",lineColor:"#575757",shoeSize:{width:Pl,length:Ll},windowOptions:{dashColor:"#dc0000",dashLength:5,spaceLength:3}},Or={stroke:"rgba(0, 0, 0, 0.25)",yellow:"#FFFC00",grey:"gray",red:"#FF5050",outline:"black",transparent:"rgba(255, 255, 255, 0)",spikeWidth:50,spikeLength:50,packingOpacity:.7,fracLineCurve:10,fracLineLength:25,scalingFactor:25},zr={firstColor:"#c7b9ab",secondColor:"#5b5b5b",scalingFactor:4},Dr={firstColor:"#8b6713",secondColor:"#000000",scalingFactor:4},Nr={scalingFactor:4,lineColor:"#63666a"},$r={scalingFactor:1,innerColor:"#eeeeff",outerColor:"#777788"},Ir={firstColor:"#c7b9ab",secondColor:"#000000",scalingFactor:4},Br=4,Hr=2;function Vr(e){const[t]=e.domain();return Math.abs(e(t+1))}function Re(e,t,n,i){return mt(Vr(i)*e,t,n)}function Dl(e,t){const n=e.x+e.width,i=t.x+t.width;return!(t.x>n||i<e.x)}function Ur(e,t,n=Br,i=Hr){const r=e.x+e.width+n,s=t.x+t.width+n,o=e.y+e.height+i,a=t.y+t.height+i;return!(t.x-n>r||t.y-i>o||s+n<e.x||a+i<e.y)}function Nl(e,t){const n=e.x+e.width,i=t.x+t.width,r=e.y+e.height,s=t.y+t.height;if(t.x>n||t.y>r||i<e.x||s<e.y)return;const o=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),a=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return{dx:o,dy:a}}function En(e,t,n=Br,i=Hr){const r=e.x+e.width,s=t.x+t.width,o=e.y+e.height,a=t.y+t.height;if(t.x-n>r||t.y-i>o||s+n<e.x||a+i<e.y)return;const c=e.x+e.width-t.x+n,h=e.y+e.height-t.y+i;return{dx:c,dy:h}}const $l=7,Il=11,Bl=7,Hl=20,Vl=120,Ul=19,st={topleft:"topleft",topright:"topright",bottomleft:"bottomleft",bottomright:"bottomright"};class Wl extends xt{constructor(t,n){super(t,n),this.callouts=[],this.groupFilter=[],this.renderAnnotation=(i,r,s,o,a,c)=>{this.renderText(i,s,o-a,a,c,"arial","bold"),this.renderText(r,s,o,a,c)},this.renderLine=(i,r,s,o,a,c,h=!0)=>{const{ctx:l}=this,u=h?i:i+s,f=h?i+s:i,d=r+2;l!=null&&(l.strokeStyle=c,l.lineWidth=1,l.beginPath(),l.moveTo(o,a),l.lineTo(u,d),l.lineTo(f,d),l.stroke())},this.minFontSize=(n==null?void 0:n.minFontSize)||$l,this.maxFontSize=(n==null?void 0:n.maxFontSize)||Il,this.fontSizeFactor=(n==null?void 0:n.fontSizeFactor)||Bl,this.offsetMin=(n==null?void 0:n.offsetMin)||Hl,this.offsetMax=(n==null?void 0:n.offsetMax)||Vl,this.offsetFactor=(n==null?void 0:n.offsetFactor)||Ul}setGroupFilter(t){this.groupFilter=t,this.callouts=[],this.render()}onUpdate(t){super.onUpdate(t),this.callouts=[],this.render()}onRescale(t){super.onRescale(t);const n=this.rescaleEvent&&this.rescaleEvent.xRatio===t.xRatio;this.rescaleEvent=t,this.render(n)}render(t=!1){requestAnimationFrame(()=>{if(this.clearCanvas(),!this.data||!this.rescaleEvent||!this.referenceSystem)return;const{xScale:n,yScale:i,xBounds:r}=this.rescaleEvent,s=Re(this.fontSizeFactor,this.minFontSize,this.maxFontSize,n);if(!t||this.callouts.length<=0){const{data:o,ctx:a,groupFilter:c}=this,{calculateDisplacementFromBottom:h}=this.referenceSystem.options,l=h?r[0]<r[1]:r[0]>r[1],u=0;a!=null&&(a.font=`bold ${s}px arial`);const f=o.filter(g=>c.length<=0||c.includes(g.group)),d=Re(this.offsetFactor,this.offsetMin,this.offsetMax,n);this.callouts=this.positionCallouts(f,l,n,i,u,s,d)}this.callouts.forEach(o=>{const{pos:a,title:c,color:h}=o,l=n(a.x),u=i(a.y),f={x:l,y:u,width:o.boundingBox.width,height:s,offsetX:o.dx,offsetY:o.dy};this.renderCallout(c,o.label,f,h,o.alignment)})})}renderText(t,n,i,r,s,o="arial",a="normal"){const{ctx:c}=this;c!=null&&(c.font=`${a} ${r}px ${o}`,c.fillStyle=s,c.fillText(t,n,i))}renderPoint(t,n,i=3){const{ctx:r}=this;r!=null&&(r.beginPath(),r.moveTo(t,n),r.arc(t,n,i,0,Math.PI*2),r.fill())}renderCallout(t,n,i,r,s){const o=this.getPosition(i,s),{x:a,y:c}=o,{height:h,width:l,x:u,y:f}=i,d=s===st.topright||s===st.bottomright;this.renderAnnotation(t,n,a,c,h,r),this.renderPoint(u,f),this.renderLine(a,c,l,u,f,r,d)}getPosition(t,n){const{x:i,y:r,offsetX:s=0,offsetY:o=0,width:a}=t;switch(n){case st.topleft:return{x:i-a-s,y:r-o};case st.topright:return{x:i+s,y:r-o};case st.bottomleft:return{x:i-a-s,y:r+o};case st.bottomright:return{x:i+s,y:r+o};default:return{x:i,y:r}}}positionCallouts(t,n,i,r,s,o,a=20){if(t.length===0)return[];const c=n?st.topleft:st.topright,h=t.map(f=>{var g;const d=f.pos?f.pos:(g=this.referenceSystem)==null?void 0:g.project(f.md);return{title:f.title,label:f.label,color:f.color,pos:{x:d==null?void 0:d[0],y:d==null?void 0:d[1]},group:f.group,alignment:c,boundingBox:this.getAnnotationBoundingBox(f.title,f.label,d,i,r,o),dx:a,dy:a}}),l=[h[h.length-1]],u=[];return this.chooseTopOrBottomPosition(h,u,l),this.adjustTopPositions(l),this.adjustBottomPositions(u),h}getAnnotationBoundingBox(t,n,i,r,s,o){const{ctx:a}=this,c=r(i[0]),h=s(i[1]),l=(a==null?void 0:a.measureText(n).width)??0,u=(a==null?void 0:a.measureText(t).width)??0,f=Math.max(l,u);return{x:c,y:h,width:f,height:o*2+4}}chooseTopOrBottomPosition(t,n,i){for(let r=t.length-2;r>=0;--r){const s=t[r],o=i[0];Ur(s.boundingBox,o.boundingBox)?(s.alignment=s.alignment===st.topleft?st.bottomright:st.bottomleft,n.push(s),r>0&&i.unshift(t[--r])):i.unshift(s)}}adjustTopPositions(t){for(let n=t.length-2;n>=0;--n){const i=t[n];for(let r=t.length-1;r>n;--r){const s=t[r],o=En(i.boundingBox,s.boundingBox);o&&(i.dy+=o.dy,i.boundingBox.y-=o.dy)}}}adjustBottomPositions(t){for(let n=t.length-2;n>=0;--n){const i=t[n];for(let r=t.length-1;r>n;--r){const s=t[r],o=En(s.boundingBox,i.boundingBox);o&&(i.dy+=o.dy,i.boundingBox.y+=o.dy)}}}}const Yl=16,Gl=6;function pt(e){const t=ut(e);if(t!=null){const n=t==null?void 0:t.formatHex();return parseInt(n.replace("#","0x"))}else throw Error(`Could not format string ${e} to hex code.`)}function Xl(e){return typeof e=="string"?e:`#${e.toString(Yl).padStart(Gl,"0")}`}const ql=1e4;class jl extends xt{constructor(t,n){super(t,n),this.surfaceAreasPaths=[],this.surfaceLinesPaths=[],this.maxDepth=ql,this.drawPolygonPath=(i,r)=>{const{ctx:s}=this;s!=null&&(s.fillStyle=i,s.fill(r))},this.drawLinePath=(i,r)=>{const{ctx:s}=this;s!=null&&(s.strokeStyle=i,s.stroke(r))},this.createPolygons=i=>{var o,a,c,h,l,u;const r=[];let s=[];for(let f=0;f<i.length;f++){const d=!!((o=i[f])!=null&&o[1]);d&&(s===null&&(s=[]),s.push((a=i[f])==null?void 0:a[0],(c=i[f])==null?void 0:c[1]));const g=f===i.length-1;if((!d||g)&&s.length>0){for(let p=d?f:f-1;p>=0&&((h=i[p])!=null&&h[1]);p--)s.push((l=i[p])==null?void 0:l[0],((u=i[p])==null?void 0:u[2])||this.maxDepth);r.push(s),s=[]}}return r},this.generatePolygonPath=i=>{const r=new Path2D;r.moveTo(i[0],i[1]);for(let s=2;s<i.length;s+=2)r.lineTo(i[s],i[s+1]);return r.closePath(),r},this.generateLinePaths=i=>{var c,h,l,u,f;const r=[],{data:s}=i;let o=!1,a;for(let d=0;d<s.length;d++)(c=s[d])!=null&&c[1]?o&&a?a.lineTo((h=s[d])==null?void 0:h[0],(l=s[d])==null?void 0:l[1]):(a=new Path2D,a.moveTo((u=s[d])==null?void 0:u[0],(f=s[d])==null?void 0:f[1]),o=!0):o&&a&&(r.push(a),o=!1);return o&&a&&r.push(a),r},this.render=this.render.bind(this),this.generateSurfaceAreasPaths=this.generateSurfaceAreasPaths.bind(this),this.generateSurfaceLinesPaths=this.generateSurfaceLinesPaths.bind(this),this.drawPolygonPath=this.drawPolygonPath.bind(this),this.drawLinePath=this.drawLinePath.bind(this),this.updatePaths=this.updatePaths.bind(this)}onUpdate(t){super.onUpdate(t),this.updatePaths(),this.render()}onRescale(t){this.rescaleEvent=t,this.setTransform(this.rescaleEvent),this.render()}updatePaths(){this.data?(this.generateSurfaceAreasPaths(),this.generateSurfaceLinesPaths()):(this.surfaceAreasPaths=[],this.surfaceLinesPaths=[])}render(){!this.ctx||!this.rescaleEvent||requestAnimationFrame(()=>{this.clearCanvas(),this.surfaceAreasPaths.forEach(t=>this.drawPolygonPath(t.color,t.path)),this.surfaceLinesPaths.forEach(t=>this.drawLinePath(t.color,t.path))})}colorToCSSColor(t){return Xl(t)}generateSurfaceAreasPaths(){var t;this.surfaceAreasPaths=((t=this.data)==null?void 0:t.areas.reduce((n,i)=>{const s=this.createPolygons(i.data).map(o=>({color:this.colorToCSSColor(i.color),path:this.generatePolygonPath(o)}));return n.push(...s),n},[]))??[]}generateSurfaceLinesPaths(){var t;this.surfaceLinesPaths=((t=this.data)==null?void 0:t.lines.reduce((n,i)=>{const s=this.generateLinePaths(i).map(o=>({color:this.colorToCSSColor(i.color),path:o}));return n.push(...s),n},[]))??[]}}function Fn(e,t){var c,h,l,u,f,d,g,p,y;if(e.length<2)return-1;const n=20;let i=0,r=e.length-1,s=(c=e[i])==null?void 0:c[0],o=(h=e[r])==null?void 0:h[0];for(;r-i>n;){const m=Math.floor((r+i)/2),_=(l=e[m])==null?void 0:l[0];if(s==null||o==null||_==null)return-1;if(t>=s&&t<_)r=m,o=(u=e[r])==null?void 0:u[0];else if(t>=_&&t<=o)i=m,s=(f=e[i])==null?void 0:f[0];else if(t<=s&&t>_)r=m,o=(d=e[r])==null?void 0:d[0];else if(t<=_&&t>=o)i=m,s=(g=e[i])==null?void 0:g[0];else return-1}let a=-1;for(let m=i;m<r;m++){const _=(p=e[m])==null?void 0:p[0],x=(y=e[m+1])==null?void 0:y[0];if(_!=null&&x!=null&&Math.min(_,x)<=t&&t<=Math.max(_,x)){a=m;break}}return a}function wt(e,t,n=0,i=0){var o,a,c,h;let r=0;const s=Fn(e,t);if(s!==-1){const l=(o=e[s])==null?void 0:o[1],u=(a=e[s+1])==null?void 0:a[1];if(l&&u){const f=((c=e[s])==null?void 0:c[0])??0,g=(((h=e[s+1])==null?void 0:h[0])??0)-f,y=(t-f)/g;r=l*(1-y)+u*y,n&&n>r&&(r=n),i&&i<r&&(r=i)}}return r}const Rn=(e,t)=>({title:e.pickIdentifier||e.identifier,group:t,label:`${e.md} ${e.mdUnit} ${e.depthReferencePoint}`,color:t==="strat-picks"?"#227":"rgba(0,0,0,0.8)",md:e.md});function Zl(e){return e?e.map(t=>Rn(t,"ref-picks")):[]}function Kl(e){return e?e.filter(t=>t.entryPick.md===t.from).map(t=>Rn(t.entryPick,"strat-picks")):[]}function Ql(e){return e?e.filter(t=>e.findIndex(n=>Math.abs(n.entryPick.md-t.exitPick.md)<.5)===-1).map(t=>Rn(t.exitPick,"strat-picks")).filter((t,n,i)=>n===i.findIndex(r=>r.title===t.title&&r.md===t.md)):[]}const Jl=e=>[...Zl(e.nonUnitPicks),...Kl(e.unitPicks),...Ql(e.unitPicks)].sort((t,n)=>t.md-n.md),tu=e=>({unitName:e.identifier,topSurface:e.top,baseSurface:e.base,ageBase:e.baseAge,ageTop:e.topAge,color:{r:e.colorR===null?255:e.colorR,g:e.colorG===null?255:e.colorG,b:e.colorB===null?255:e.colorB},level:e.stratUnitLevel,lithType:e.lithologyType,parent:e.stratUnitParent});function eu(e,t,n){if(n.length===0)return[[e,t]];const i=[];let r=e,s=0;for(;r<t&&s<n.length;){const o=n[s];o.from>r&&i.push([r,Math.min(o.from,t)]),r=Math.min(t,Math.max(e,o.to)),s+=1}return r<t&&i.push([r,t]),i}const nu=e=>e.map(tu);function iu(e,t){const n=nu(t),i=[],r=[];return e.forEach(s=>{const o=n.filter(a=>{var c;return((c=s.pickIdentifier)==null?void 0:c.search(new RegExp(`(${a.topSurface}|${a.baseSurface})`,"i")))!==-1});o.length>0?o.forEach(a=>r.push({md:s.md,tvd:s.tvd,identifier:s.pickIdentifier,confidence:s.confidence,mdUnit:s.mdUnit,depthReferencePoint:s.depthReferencePoint,...a})):i.push({identifier:s.pickIdentifier,...s})}),{joined:r,nonUnitPicks:i}}function ru(e){const t=[];let n=null;const i=e.filter(r=>r.level).sort((r,s)=>r.unitName.localeCompare(s.unitName)||r.md-s.md||r.ageTop-s.ageTop);for(;i.length>0;){n=i.shift();const r=n.identifier;let s;const o=r===n.topSurface,a=r===n.baseSurface;if(o)s=n.baseSurface;else if(a)s=n.topSurface;else{console.warn(`Unable to match ${r} with top or base surface, ignored`);continue}let c,h;const l=i.find(u=>u.identifier===s);if(l)c=o?n:l,h=o?l:n,c.md>h.md&&([c,h]=[h,c]),i.splice(i.indexOf(l),1);else if(console.warn(`Unable to find ${s} pick for ${r}`),o)if(c=n,h=e.filter(u=>u.level).sort((u,f)=>u.md-f.md).find(u=>u.md>c.md),h)console.warn(`Using ${h.identifier} as base for ${r}`);else{console.warn(`Unable to find a base pick for ${r} pick at ${c.md}, ignored`);continue}else if(a)if(h=n,c=e.filter(u=>u.level).sort((u,f)=>f.md-u.md).find(u=>u.md<h.md),c)console.warn(`Using ${c.identifier} as top for ${r}`);else{console.warn(`Unable to find a top pick for ${r} pick at ${h.md}, ignored`);continue}else{console.warn(`${r} ignored`);continue}t.push({name:c.unitName,mdEntry:c.md,tvdEntry:c.tvd,color:c.color,level:c.level,entryPick:c,mdExit:h.md,tvdExit:h.tvd,exitPick:h,confidenceEntry:c.confidence,confidenceExit:h.confidence})}return t}function su(e,t){var a;const{joined:n,nonUnitPicks:i}=iu(e,t),s=ru(n).filter(c=>c.mdEntry<c.mdExit).sort((c,h)=>c.mdEntry-h.mdEntry||c.level-h.level).reverse(),o=[];for(;s.length>0;){const c=s.pop(),h=[];for(;s.length>0&&((a=s[s.length-1])==null?void 0:a.level)>c.level;)h.push(s.pop());h.reverse(),h.push(c);const l=[];h.forEach(u=>{const f=eu(u.mdEntry,u.mdExit,l);l.push(...f.map(d=>({from:d[0],to:d[1],itm:u})))}),l.sort((u,f)=>u.from-f.from),o.push(...l.map(u=>({from:u.from,to:u.to,...u.itm})))}return{unitPicks:o,nonUnitPicks:i}}function ou(e,t){const n=e.map((s,o)=>o*t/e.length),i=Ct().domain(n).range(e);return Array.from(new Array(t).keys()).map(s=>{var a;const o=(a=ut(i(s)))==null?void 0:a.rgb();return o!=null?[o.r,o.g,o.b]:[0,0,0]})}const au=e=>e?{x:e.minX,y:e.minTvdMsl,width:e.maxX-e.minX,height:e.maxTvdMsl-e.minTvdMsl}:{x:0,y:0,width:0,height:0};function cu(e,t){if(!(e&&e.datapoints))return null;const n=t.reduce((d,g)=>Math.min(d,g[0]),0),i=t.reduce((d,g)=>Math.max(d,g[0]),0),r=e.yAxisValues&&e.yAxisValues[0],s=e.yAxisValues&&e.yAxisValues[e.yAxisValues.length-1],o=e.datapoints||[],a=-o.reduce((d,g)=>Math.min(...g,d),0),c=o.reduce((d,g)=>Math.max(...g,d),0),h=Math.max(Math.abs(a),Math.abs(c)),l=-h,u=h;return{minX:n,maxX:i,minTvdMsl:r,maxTvdMsl:s,domain:{min:l,max:u,difference:u-l}}}async function hu(e,t,n,i={isLeftToRight:!0}){var v,A,b,L,R,O,D,I;if(!(e&&e.datapoints&&e.datapoints.length>0))return;const{datapoints:r}=e,s=(i==null?void 0:i.seismicMin)||(i==null?void 0:i.seismicRange)||r.reduce((H,V)=>Math.min(...V,H),0),o=(i==null?void 0:i.seismicMax)||(i==null?void 0:i.seismicRange)||r.reduce((H,V)=>Math.max(...V,H),0),a=Math.max(Math.abs(s),Math.abs(o)),c=-a,h=a,l={min:c,max:h,difference:h-c},u=((v=t[0])==null?void 0:v[0])-((A=t[t.length-1])==null?void 0:A[0]),f=Math.abs(Math.floor(u/5)),d=e.yAxisValues.length,g=1e3,p=ou(n,g),y=new Uint8ClampedArray(f*d*4);let m=0;const _=(g-1)/l.difference;let x=i!=null&&i.isLeftToRight?(b=t[0])==null?void 0:b[0]:(L=t[t.length-1])==null?void 0:L[0];const M=u/f*(i!=null&&i.isLeftToRight?-1:1);let S,w,T,F,k;const N=[0,0,0];let P;for(let H=0;H<f;H++){m=H*4;const V=Fn(t,x),U=(R=t[V])==null?void 0:R[0],J=((O=t[V+1])==null?void 0:O[0])-U,q=(x-U)/J;for(let lt=0;lt<d;lt++)S=(D=r[lt])==null?void 0:D[V],w=(I=r[lt])==null?void 0:I[V+1],S==null||w==null?(k=N,P=0):(T=S*(1-q)+w*q,F=(T-l.min)*_,F=mt(~~F,0,g-1),k=p[F],P=255),y.set([k[0],k[1],k[2],P],m),m+=f*4;x+=M}const z=new ImageData(y,f,d);return await createImageBitmap(z,0,0,f,d)}const lu=2147483648,uu=4294967295;function fu(e,t,n){const i=n.filter(d=>d.data.values),r=_u(i),s=new Map,o=mu(r,t,s);yu(o);const a=du(r,e),c=Su(e,o,t),h=pu(s,c),u=[...gu(h,e),...Object.values(c).flat().filter(d=>!d.exclude)];return{lines:a,areas:u}}function du(e,t){return e.filter(i=>i.visualization==="line").map(i=>({id:i.name,label:i.name,width:2,color:pt(i.color||"black"),data:t.map((r,s)=>[r[0],i.values[s]])}))}function gu(e,t){return e.map((i,r)=>{const s=r+1<e.length?e[r+1]:null;return{id:i.id,color:pt(i.color),data:t.map((o,a)=>[o[0],i.top[a],...s?[s.top[a]]:[]])}})}function pu(e,t){return Array.from(e.values()).sort((i,r)=>i.age-r.age).filter(i=>{const r=t[i.name],s=r&&r.length>0;return s||console.warn(`Intersection surface group '${i.name}' has no valid entries and will be discarded.`),s}).map((i,r)=>{const o=t[i.name][0];return{id:i.name,label:i.name,color:xu(r),top:o.data.map(a=>a[1])}})}function mu(e,t,n){const i=t&&t.find(o=>o.stratUnitLevel===1),r=i?i.identifier:"SEABED";return e.filter(o=>o.visualization==="interval"||o.visualization==="none").map(o=>{const a=[],c=Wr(t,o.name,a);c||console.warn(`No match for ${o.name} in strat column`);const h=a[0]||c,l=h&&h.identifier||r;return h&&!n.has(l)&&n.set(l,{age:h.topAge,name:h.identifier}),{...o,unit:c,group:l}})}function yu(e){e.sort((t,n)=>{if(!t.unit&&!n.unit)return 0;if(!t.unit)return-1;if(!n.unit)return 1;const i=t.isBase?t.unit.baseAge:t.unit.topAge,r=n.isBase?n.unit.baseAge:n.unit.topAge;return i!==r?i-r:t.isBase&&!n.isBase?1:!t.isBase&&n.isBase?-1:t.unit.stratUnitLevel-n.unit.stratUnitLevel})}function Wr(e,t,n=[]){const i=e.find(r=>r.identifier.toLowerCase()===t.toLowerCase());if(i){let r=i;do n.unshift(r),r=e.find(s=>s.identifier===r.stratUnitParent);while(r);return i}return null}function _u(e){return e.map(t=>{const n=t.visualSettings.displayName,i=n.replace(/\s(Base|Top)/gi,""),r=n.toLowerCase().endsWith("base");return{name:i,isBase:r,values:t.data.values,color:t.visualSettings.colors.crossSection,visualization:t.visualSettings.crossSection.toLowerCase()}})}function vu(e){return e.colorR===null||e.colorG===null||e.colorB===null?lu:e.colorR<<16|e.colorG<<8|e.colorB}const xu=ni().domain([0,100]).range(To(Wt("#e6f1cf","#85906d"),10));function wu(e,t,n,i){const r=t+1;if(!n||r>=n.length)return;const s=n.findIndex(o=>o.isBase&&o.name===e.name);if(s!==-1)return s;for(let o=r;o<n.length;o++){const a=n[o];if(!(a!=null&&a.isBase)||bu(e,a,i))return o}}function bu(e,t,n){const i=[];return Wr(n,e.name,i),i.some(r=>t.name===r.identifier)}function Su(e,t,n){return t.reduce((r,s,o)=>{var a;if(!s.isBase){r[s.group]||(r[s.group]=[]);const c=wu(s,o,t,n);(a=r[s.group])==null||a.push({id:s.name,label:s.name,color:s.unit&&vu(s.unit)||uu,exclude:s.visualization==="none"||!s.unit,data:e.map((h,l)=>{const u=s.values[l]!=null?Tu(c,t,l):void 0;return[h[0],s.values[l],u]})})}return r},{})}function Tu(e,t,n){var i,r;if(!(!t||!e||e>=t.length)){for(let s=e;s<t.length;s++)if(((i=t[s])==null?void 0:i.values[n])!=null)return(r=t[s])==null?void 0:r.values[n]}}const Yr=.1,On=1e3,Mu=150,Au=30,Cu=10;function Pu(e){var r;if(!e||e.length===0)return[];const t=e?e.map(s=>[s.easting,s.northing,s.tvd,s.md]):[],n=Gr(Xr(t)),i=(r=n[n.length-1])==null?void 0:r[0];return i!=null&&n.forEach((s,o)=>{n[o][0]=i-s[0]}),n}function Lu(e,t){if(!e||e.length===0)return[];const n=e?e.map(_=>[_.easting,_.northing,_.tvd,_.md]):[],i=new gn(n,{tension:.75,arcDivisions:5e3}),r=i.length,s=Math.round(r*Cu);let o;s>0?o=Gr(i.getPoints(s),5e-4,10):o=[[n[0][0],n[0][1]]];const a=o[0],c=o[o.length-1],h=$.distance(a,c);let l;if(h<Mu){const x=t/180*Math.PI;l=new $(Math.cos(x),Math.sin(x)).mutable}else l=ku(o,Au);const u=Math.max(0,On-r),f=u+r,d=[];let g=[];const p=l.toArray();u>0&&(g=Li(Math.ceil(u*Yr)).map(_=>l.set(p).scale(u*(1-_)).subFrom(a).toArray()),g.pop(),d.push(...g)),d.push(...o);const y=Li(Math.ceil(On*Yr)).map(_=>l.set(p).scale(On*_).add(c).toArray()).splice(1);return d.push(...y),Xr(d,void 0,f)}function ku(e,t){const n=$.zero.mutable;let i=0;const r=$.zero.mutable;for(let s=0;s<e.length-1;s++){const o=e.length-1-s;if(r.set(e[o]).sub(e[o-1]),n.add(r),i=n.magnitude,i>t)break}return i===0?new $([0,0]):n.scale(1/i)}function Gr(e,t=.001,n=10){if(e.length<=4)return e;const[i,r]=e[0],s=e.map(l=>[l[0]-i,l[1]-r]);let[o,a]=s[0];const c=[e[0]];for(let l=1;l+1<s.length;l++){const[u,f]=s[l]??[],[d,g]=s[l+1]??[];if(u!=null&&f!=null&&d!=null&&g!=null&&(d-u!==0||g-f!==0)){const p=Math.abs(o*g-a*d+d*f-g*u+a*u-o*f)/Math.sqrt((d-o)**2+(g-a)**2),y=[o-u,a-f],m=Math.sqrt(y[0]**2+y[1]**2);(p>t||m>=n)&&(c.push([u+i,f+r]),[o,a]=[u,f])}}const h=s[s.length-1];return c.push([h[0]+i,h[1]+r]),c}function Xr(e,t,n=0){let i=t||e[0],r=0;return e.map(o=>{const a=o[0]-i[0],c=o[1]-i[1];return r+=Math.sqrt(a**2+c**2),i=o,[n>0?n-r:r,o[2]??0]})}const Eu=18,Fu=8,Ru=13,Ou="black",zu="Arial",Du=70;class Nu extends xt{constructor(t,n){super(t,n),this.defaultMargins=Eu,this.defaultMinFontSize=Fu,this.defaultMaxFontSize=Ru,this.defaultTextColor=Ou,this.defaultFont=zu,this.isLabelsOnLeftSide=!0,this.maxFontSizeInWorldCoordinates=Du,this.isXFlipped=!1,this.areasWithAvgTopDepth=[],this.drawAreaLabel=(i,r,s,o)=>{const{data:a}=i,{ctx:c,maxFontSizeInWorldCoordinates:h,isXFlipped:l}=this,{xScale:u,yScale:f,xRatio:d,yRatio:g,zFactor:p}=this.rescaleEvent;if(c==null)return;let y=this.checkDrawLabelsOnLeftSide();const _=(this.options.margins||this.defaultMargins)*(l?-1:1)/d,x=this.options.minFontSize||this.defaultMinFontSize;let S=(this.options.maxFontSize||this.defaultMaxFontSize)/g;S>h&&(S=h,S*g<x&&(S=x/g));const w=u.invert(u.range()[0])+_,T=u.invert(u.range()[1])-_,[F,k]=this.getSurfacesAreaEdges();c.save(),c.font=`${S*g}px ${this.options.font||this.defaultFont}`;let N=c.measureText(i.label??""),P=N.width/d;if(y){const W=w+(l?-P:P);(!l&&W>k||l&&W<k)&&(y=!1)}else{const W=T+(l?P:-P);(!l&&W<F||l&&W>F)&&(y=!0)}let z;const B=.07;y?z=l?Math.min(F,w):Math.max(F,w):z=l?Math.max(k,T):Math.min(k,T);const v=f.invert(f.range()[0]),A=f.invert(f.range()[1]),b=5,L=3,R=B*(P/L)*(y?1:-1)*(l?-1:1),O=P/b*(y?1:-1)*(l?-1:1),D=a.map(W=>[W[0],W[1]]),I=this.calcPos(D,z,L,R,v,A);if(!I)return;const H=a.map(W=>[W[0],W[2]]);let V=this.calcPos(H,z,L,R,v,A,(r==null?void 0:r.data.map(W=>[W[0],W[1]]))??[],s,o);V||(V=new $(I.x,A));const U=V.y-I.y;if(U<S){if(U*g<x)return;S=U,c.font=`${S*g}px ${this.options.font||this.defaultFont}`,N=c.measureText(i.label??""),P=N.width/d}const X=y!==l?$.right:$.left,J=this.calcAreaDir(D,H,z,b,O,X,v,A,0,Math.PI/4,4,(r==null?void 0:r.data.map(W=>[W[0],W[1]]))??[],s,o),Y=Math.atan(Math.tan(J)*p),q=z,lt=(I.y+V.y)/2,Z0=l?-Y:Y;c&&(c.textAlign=y?"left":"right",c.translate(u(q),f(lt)),c.rotate(Z0),c.fillStyle=this.options.textColor||this.defaultTextColor,c.font=`${S*g}px ${this.options.font||this.defaultFont}`,c.textBaseline="middle",c.fillText(i.label??"",0,0),c.restore())},this.drawLineLabel=i=>{const{ctx:r,isXFlipped:s}=this,{xScale:o,yScale:a,xRatio:c,yRatio:h,zFactor:l}=this.rescaleEvent;if(r==null)return;const u=this.checkDrawLabelsOnLeftSide(),f=this.getMarginsInWorldCoordinates(),g=(this.options.maxFontSize||this.defaultMaxFontSize)/h;r.save(),r.font=`${g*h}px ${this.options.font||this.defaultFont}`;const y=r.measureText(i.label).width/c,m=o.invert(o.range()[0])+f,_=o.invert(o.range()[1])-f,[x,M]=this.getSurfacesAreaEdges();let S;const w=5;u?S=s?Math.max(M,_):Math.min(M,_):S=s?Math.min(x,m):Math.max(x,m);const T=y/w*(u?-1:1),{data:F}=i,k=this.calcPos(F,S,w,T),N=this.calcLineDir(F,S,w,T,l,u?$.left:$.right);if(!k||!N)return;const P=S,z=k.y-_r-g/2,B=$.angleRight(N)-(u?Math.PI:0);r&&(r.textAlign=u?"right":"left",r.translate(o(P),a(z)),r.rotate(B),r.fillStyle=this.colorToCSSColor(i.color),r.textBaseline="middle",r.fillText(i.label,0,0),r.restore())},this.render=this.render.bind(this),this.getMarginsInWorldCoordinates=this.getMarginsInWorldCoordinates.bind(this),this.getSurfacesAreaEdges=this.getSurfacesAreaEdges.bind(this),this.updateXFlipped=this.updateXFlipped.bind(this),this.generateSurfacesWithAvgDepth=this.generateSurfacesWithAvgDepth.bind(this)}get options(){return this._options}setData(t){super.setData(t),this.areasWithAvgTopDepth=[]}generateSurfacesWithAvgDepth(){var n;const t=((n=this.data)==null?void 0:n.areas)??[];this.areasWithAvgTopDepth=t.reduce((i,r)=>{if(!r.label)return i;const s=r.data.reduce((a,c)=>(c[1]!=null&&(a.sum+=c[1],a.count++),a),{sum:0,count:0});if(s.count===0)return i;const o=s.sum/s.count;return i.push({...r,avgTopDepth:o}),i},[])}onMount(t){super.onMount(t)}onUpdate(t){super.onUpdate(t),this.render()}onRescale(t){this.rescaleEvent=t,this.updateXFlipped(),this.resetTransform(),this.render()}render(){this.rescaleEvent&&requestAnimationFrame(()=>{this.clearCanvas(),this.data&&(this.areasWithAvgTopDepth.length<=0&&this.generateSurfacesWithAvgDepth(),this.drawAreaLabels(),this.drawLineLabels())})}drawAreaLabels(){this.areasWithAvgTopDepth.forEach((t,n,i)=>{const r=i.reduce((s,o,a)=>(a>n&&(s==null||o.avgTopDepth<s.avgTopDepth)&&(s=o),s),null);this.drawAreaLabel(t,r,i,n)})}drawLineLabels(){var t;(t=this.data)==null||t.lines.filter(n=>n.label).forEach(n=>this.drawLineLabel(n))}colorToCSSColor(t){if(typeof t=="string")return t;let n=t.toString(16);return n="000000".substr(0,6-n.length)+n,`#${n}`}calcPos(t,n,i,r,s,o,a,c=null,h){const l=$.zero.mutable;let u=0;for(let f=0;f<i;f++){const d=n+f*r,g=wt(t,d,s,o);if(g){const p=this.getAlternativeYValueIfAvailable(d,s,o,a,c,h),y=p?Math.min(g,p):g;l.add(d,y),u++}}return u===0?null:$.divide(l,u)}getAlternativeYValueIfAvailable(t,n,i,r,s=null,o){if(!r)return null;let a=wt(r,t,n,i);if(a==null&&s&&o!=null){let c=o+1;for(;a==null&&c<s.length;){const h=s[c++];a=wt((h==null?void 0:h.data.map(l=>[l[0],l[1]]))??[],t,n,i)}}return a}calcLineDir(t,n,i,r,s,o=$.left,a,c){const h=o.mutable,l=wt(t,n,a,c);if(l===null)return h;const u=new $(n,l*s),f=$.zero.mutable;for(let d=1;d<=i;d++){const g=n+d*r,p=wt(t,n,a,c);p!==null&&(f.set(g,p*s),f.sub(u),h.add(f))}return h}calcAreaDir(t,n,i,r,s,o=$.left,a,c,h=0,l=Math.PI/4,u=4,f,d=null,g){const p=[],y=$.zero.mutable;let m;for(let T=0;T<=r;T++){const F=i+T*s,k=wt(t,F,a,c),N=wt(n,F,a,c)||c,P=this.getAlternativeYValueIfAvailable(F,a,c,f,d,g),z=P?Math.min(N,P):N;if(T===0){if(k===null)return $.angleRight(o);const B=(k+z)/2;m=new $(i,B)}else k!==null?(y.set(F,(k+z)/2),y.sub(m),p.push($.angleRight(y))):p.push($.angleRight(o))}const _=p[0],x=p.map(T=>T-_);let M=0;return x.reduce((T,F)=>{const k=(Math.abs(F)-h)/l,N=Math.pow(1-mt(k,0,1),u);return M+=N,T+F*N},0)/M+_}updateXFlipped(){const{xBounds:t}=this.rescaleEvent;this.isXFlipped=t[0]>t[1]}getMarginsInWorldCoordinates(){const{xRatio:t}=this.rescaleEvent;return(this.options.margins||this.defaultMargins)*(this.isXFlipped?-1:1)/t}getSurfacesAreaEdges(){var c,h;const t=((c=this.data)==null?void 0:c.areas.reduce((l,u)=>{var g,p;const{data:f}=u,d=f.find(y=>y[1]!=null);d&&l.push(d[0]);for(let y=f.length-1;y>=0;y--)if(((g=f[y])==null?void 0:g[1])!=null){l.push((p=f[y])==null?void 0:p[0]);break}return l},[]))??[];t.push(...((h=this.data)==null?void 0:h.lines.reduce((l,u)=>{var g,p;const{data:f}=u,d=f.find(y=>y[1]!=null);d&&l.push(d[0]);for(let y=f.length-1;y>=0;y--)if(((g=f[y])==null?void 0:g[1])!=null){l.push((p=f[y])==null?void 0:p[0]);break}return l},[]))??[]);const n=Math.min(...t),i=Math.max(...t),r=this.getMarginsInWorldCoordinates(),{isXFlipped:s}=this,o=s?i+r:n+r,a=s?n-r:i-r;return[o,a]}checkDrawLabelsOnLeftSide(){var z,B,v,A,b;const{referenceSystem:t,isXFlipped:n}=this;if(!t)return!0;const{xScale:i,yScale:r,xRatio:s}=this.rescaleEvent,o=200,[a,c]=i.domain(),[h,l]=r.domain();let u=t.interpolators.curtain.getIntersects(h,1,0);u.length===0&&(u=[t.interpolators.curtain.getPointAt(0)]);let f=t.interpolators.curtain.getIntersects(l,1,0);f.length===0&&(f=[t.interpolators.curtain.getPointAt(1)]);const d=Math.max((z=u[0])==null?void 0:z[0],(B=f[0])==null?void 0:B[0]),g=Math.min((v=u[0])==null?void 0:v[0],(A=f[0])==null?void 0:A[0]),p={left:n?d:g,right:n?g:d},y=this.getMarginsInWorldCoordinates(),m=a+y,_=c-y,[x,M]=this.getSurfacesAreaEdges(),S=n?Math.min(m,x):Math.max(m,x),w=n?Math.max(_,M):Math.min(_,M),T=Math.max(n?S-p.left:p.left-S,0),F=Math.max(n?p.right-w:w-p.right,0),k=T*s,N=F*s;return T>F||k>o||k<o&&N<o&&n||((b=f[0])==null?void 0:b[1])<h}}const $u=1e4;class Iu extends kn{constructor(){super(...arguments),this.isPreRendered=!1,this.createPolygons=t=>{var r,s,o,a,c,h;const n=[];let i;for(let l=0;l<t.length;l++){const u=!!((r=t[l])!=null&&r[1]);u&&(i==null&&(i=[]),i.push((s=t[l])==null?void 0:s[0],(o=t[l])==null?void 0:o[1]));const f=l===t.length-1;if((!u||f)&&i){for(let d=u?l:l-1;d>=0&&((a=t[d])!=null&&a[1]);d--)i.push((c=t[d])==null?void 0:c[0],((h=t[d])==null?void 0:h[2])||$u);n.push(i),i=void 0}}return n},this.generateAreaPolygon=t=>{const n=new E.Graphics;n.lineStyle(1,t.color,1),n.beginFill(t.color),this.createPolygons(t.data).forEach(r=>n.drawPolygon(r)),n.endFill(),this.addChild(n)},this.generateSurfaceLine=t=>{const n=new E.Graphics,{data:i}=t,r=.5;n.lineStyle(_r,t.color,1,r,!0);let s=!1;for(let o=0;o<i.length;o++){const a=i[o];a&&a[1]&&a[0]?s?n.lineTo(a[0],a[1]):(n.moveTo(a[0],a[1]),s=!0):s=!1}this.addChild(n)}}onRescale(t){super.onRescale(t),this.isPreRendered||(this.clearLayer(),this.preRender()),this.render()}onUpdate(t){super.onUpdate(t),this.isPreRendered=!1,this.clearLayer(),this.preRender(),this.render()}preRender(){const{data:t}=this;t&&(t.areas.forEach(n=>this.generateAreaPolygon(n)),t.lines.forEach(n=>this.generateSurfaceLine(n)),this.isPreRendered=!0)}}const qr="lightgray",jr="gray",Zr=.25,Kr=.75,Bu={minorColor:qr,majorColor:jr,minorWidth:Zr,majorWidth:Kr};class Oe extends xt{constructor(t,n){super(t,n),this._offsetX=0,this._offsetY=0,this.options={...this.options,...n||Bu},this.render=this.render.bind(this)}onUpdate(t){super.onUpdate(t),this.render(t)}onRescale(t){super.onRescale(t),this.render(t)}render(t){const{ctx:n}=this,{minorWidth:i,minorColor:r,majorWidth:s,majorColor:o}=this.options;if(!n||(this.clearCanvas(),!(t.xScale||t.yScale)))return;const a=t.xScale.copy(),c=t.yScale.copy(),h=a.domain(),l=c.domain(),u=this.offsetX,f=this.offsetY;a.domain([h[0]-u,h[1]-u]),c.domain([l[0]-f,l[1]-f]);const[d,g]=a.range(),[p,y]=c.range();n.lineWidth=i||Zr,n.strokeStyle=r||qr;const m=this.mapMinorTicks(a.ticks()),_=this.mapMinorTicks(c.ticks());this.renderTicksX(a,m,p,y),this.renderTicksY(c,_,d,g),n.lineWidth=s||Kr,n.strokeStyle=o||jr,this.renderTicksX(a,a.ticks(),p,y),this.renderTicksY(c,c.ticks(),d,g),n.restore()}renderTicksX(t,n,i,r){n.forEach(s=>{const o=t(s);this.ctx!=null&&(this.ctx.beginPath(),this.ctx.moveTo(o,i),this.ctx.lineTo(o,r),this.ctx.stroke())})}renderTicksY(t,n,i,r){n.forEach(s=>{const o=t(s);this.ctx!=null&&(this.ctx.beginPath(),this.ctx.moveTo(i,o),this.ctx.lineTo(r,o),this.ctx.stroke())})}mapMinorTicks(t){let n=[];return t.length>=2&&(n=t.map(i=>i+(t[1]-t[0])/2),n.pop()),n}get offsetX(){return this._offsetX}set offsetX(t){this._offsetX=t}get offsetY(){return this._offsetY}set offsetY(t){this._offsetY=t}}class Hu extends xt{onMount(t){super.onMount(t);const n=document.createElement("img");this.img=n,this.isLoading=!0}onUpdate(t){super.onUpdate(t),this.img!=null&&(this.img.src=t.url),this.render(t)}onRescale(t){super.onRescale(t),this.setTransform(t),this.render(t)}render(t){var f,d,g;const n=parseInt(((f=this.elm)==null?void 0:f.getAttribute("width"))??"0",10),i=parseInt(((d=this.elm)==null?void 0:d.getAttribute("height"))??"0",10),{xScale:r,yScale:s,xRatio:o,yRatio:a,x:c,y:h}=t,l=n*(o||1),u=i*(a||1);this.clearCanvas(),this.img!=null&&(this.isLoading?this.img.onload=()=>{var p;this.isLoading=!1,this.img!=null&&((p=this.ctx)==null||p.drawImage(this.img,r(c||0),s(h||0),l,u))}:(g=this.ctx)==null||g.drawImage(this.img,r(c||0),s(h||0),l,u))}}const Vu={dash:[10,5],width:1,color:16777215,alpha:1,scale:1,useTexture:!1,alignment:.5},bt=class{constructor(e,t={}){this.cursor=new ot.Point,this.scale=1,this.graphics=e,t={...Vu,...t},this.dash=t.dash,this.dashSize=this.dash.reduce((n,i)=>n+i),this.useTexture=t.useTexture,this.options=t,this.setLineStyle()}setLineStyle(){const e=this.options;if(this.useTexture){const t=bt.getTexture(e,this.dashSize);this.graphics.lineTextureStyle({width:e.width*e.scale,color:e.color,alpha:e.alpha,texture:t,alignment:e.alignment})}else this.graphics.lineStyle({width:e.width*e.scale,color:e.color,alpha:e.alpha,cap:e.cap,join:e.join,alignment:e.alignment});this.scale=e.scale}static distance(e,t,n,i){return Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2))}moveTo(e,t){return this.lineLength=0,this.cursor.set(e,t),this.start=new ot.Point(e,t),this.graphics.moveTo(this.cursor.x,this.cursor.y),this}lineTo(e,t,n){typeof this.lineLength===void 0&&this.moveTo(0,0);const i=bt.distance(this.cursor.x,this.cursor.y,e,t),r=Math.atan2(t-this.cursor.y,e-this.cursor.x),s=n&&e===this.start.x&&t===this.start.y;if(this.useTexture)if(this.graphics.moveTo(this.cursor.x,this.cursor.y),this.adjustLineStyle(r),s&&this.dash.length%2===0){const o=Math.min(this.dash[this.dash.length-1],i);this.graphics.lineTo(e-Math.cos(r)*o,t-Math.sin(r)*o),this.graphics.closePath()}else this.graphics.lineTo(e,t);else{const o=Math.cos(r),a=Math.sin(r);let c=this.cursor.x,h=this.cursor.y;const l=this.lineLength%(this.dashSize*this.scale);let u=0,f=0,d=0;for(let p=0;p<this.dash.length;p++){const y=this.dash[p]*this.scale;if(l<d+y){u=p,f=l-d;break}else d+=y}let g=i;for(;g>0;){const p=this.dash[u]*this.scale-f,y=g>p?p:g;if(s&&bt.distance(c+o*y,h+a*y,this.start.x,this.start.y)<=y){if(u%2===0){const _=bt.distance(c,h,this.start.x,this.start.y)-this.dash[this.dash.length-1]*this.scale;c+=o*_,h+=a*_,this.graphics.lineTo(c,h)}break}c+=o*y,h+=a*y,u%2?this.graphics.moveTo(c,h):this.graphics.lineTo(c,h),g-=y,u++,u=u===this.dash.length?0:u,f=0}}return this.lineLength+=i,this.cursor.set(e,t),this}closePath(){this.lineTo(this.start.x,this.start.y,!0)}drawCircle(e,t,n,i=80,r){const s=Math.PI*2/i;let o=0,a;r?(a=new ot.Point(e+Math.cos(o)*n,t+Math.sin(o)*n),r.apply(a,a),this.moveTo(a[0],a[1])):(a=new ot.Point(e+Math.cos(o)*n,t+Math.sin(o)*n),this.moveTo(a.x,a.y)),o+=s;for(let c=1;c<i+1;c++){const h=c===i?a:[e+Math.cos(o)*n,t+Math.sin(o)*n];this.lineTo(h[0],h[1]),o+=s}return this}drawEllipse(e,t,n,i,r=80,s){const o=Math.PI*2/r;let a;const c=new ot.Point;for(let h=0;h<Math.PI*2;h+=o){let l=e-n*Math.sin(h),u=t-i*Math.cos(h);s&&(c.set(l,u),s.apply(c,c),l=c.x,u=c.y),h===0?(this.moveTo(l,u),a={x:l,y:u}):this.lineTo(l,u)}return this.lineTo(a.x,a.y,!0),this}drawPolygon(e,t){const n=new ot.Point;if(typeof e[0]=="number")if(t){n.set(e[0],e[1]),t.apply(n,n),this.moveTo(n.x,n.y);for(let i=2;i<e.length;i+=2)n.set(e[i],e[i+1]),t.apply(n,n),this.lineTo(n.x,n.y,i===e.length-2)}else{this.moveTo(e[0],e[1]);for(let i=2;i<e.length;i+=2)this.lineTo(e[i],e[i+1],i===e.length-2)}else if(t){const i=e[0];n.copyFrom(i),t.apply(n,n),this.moveTo(n.x,n.y);for(let r=1;r<e.length;r++){const s=e[r];n.copyFrom(s),t.apply(n,n),this.lineTo(n.x,n.y,r===e.length-1)}}else{const i=e[0];this.moveTo(i.x,i.y);for(let r=1;r<e.length;r++){const s=e[r];this.lineTo(s.x,s.y,r===e.length-1)}}return this}drawRect(e,t,n,i,r){if(r){const s=new ot.Point;s.set(e,t),r.apply(s,s),this.moveTo(s.x,s.y),s.set(e+n,t),r.apply(s,s),this.lineTo(s.x,s.y),s.set(e+n,t+i),r.apply(s,s),this.lineTo(s.x,s.y),s.set(e,t+i),r.apply(s,s),this.lineTo(s.x,s.y),s.set(e,t),r.apply(s,s),this.lineTo(s.x,s.y,!0)}else this.moveTo(e,t).lineTo(e+n,t).lineTo(e+n,t+i).lineTo(e,t+i).lineTo(e,t,!0);return this}adjustLineStyle(e){const t=this.graphics.line;t.matrix=new ot.Matrix,e&&t.matrix.rotate(e),this.scale!==1&&t.matrix.scale(this.scale,this.scale);const n=-this.lineLength;t.matrix.translate(this.cursor.x+n*Math.cos(e),this.cursor.y+n*Math.sin(e)),this.graphics.lineStyle(t)}static getTexture(e,t){const n=e.dash.toString();if(bt.dashTextureCache[n])return bt.dashTextureCache[n];const i=document.createElement("canvas");i.width=t,i.height=Math.ceil(e.width);const r=i.getContext("2d");if(!r){console.warn("Did not get context from canvas");return}r.strokeStyle="white",r.globalAlpha=e.alpha,r.lineWidth=e.width;let s=0;const o=e.width/2;r.moveTo(s,o);for(let c=0;c<e.dash.length;c+=2)s+=e.dash[c],r.lineTo(s,o),e.dash.length!==c+1&&(s+=e.dash[c+1],r.moveTo(s,o));r.stroke();const a=bt.dashTextureCache[n]=ot.Texture.from(i);return a.baseTexture.scaleMode=ot.SCALE_MODES.NEAREST,a}};let Qr=bt;Qr.dashTextureCache={};const zn=e=>new $(e.x,e.y),Uu=e=>new E.Point(e[0],e[1]),Jr=e=>{if(e.length<2)return[new $(0)];let t;return e.map((n,i,r)=>{const s=r[i],o=r[i+1];if(i<r.length-1&&s!=null&&o!=null){const a=zn(s);return t=zn(o).sub(a).rotate90().normalized(),t}return t})},ts=(e,t,n)=>{const i=zn(e);return Uu(i.add(t.scale(n)))},Dn=(e,t,n)=>{if(e.length!==t.length)throw new Error("Number of vectors does not match number of points");return e.map((i,r)=>{const s=t[r];if(s!=null)return ts(i,s,n);throw new Error(`Trying to read index ${r} of point ${i}, but no such vector was found!`)})},es=(e,t,n,i)=>e<=i&&n<=t,Wu=(e,t,n,i)=>e<i&&n<t,Yu=e=>Array.from(new Set(e)),ze=(e,t,n,i)=>{const r=i.filter(o=>es(e,t,o.start,o.end)),s=n.filter(o=>es(e,t,o.start,o.end));return{overlappingHoles:r,overlappingOuterStrings:s}},De=([e,t],n)=>{const s=n.flatMap(a=>[a.start-1e-4,a.start,a.end,a.end+1e-4]).filter(a=>a>=e&&a<=t);return s.push(e),s.push(t),Yu(s).sort((a,c)=>a-c)},Q=e=>e.kind==="casing"?e.innerDiameter:e.diameter,ns=(e,t,n,i)=>{const s=e.find(h=>h.start<=i&&h.end>=i),o=s?s.diameter:0,a=t.filter(h=>Q(h)>o).sort((h,l)=>Q(h)-Q(l)).find(h=>h.start<=i&&h.end>=i),c=n.find(h=>h.start<=i&&h.end>=i&&h.diameter>o);return a?Q(a):c?c.diameter:100},Gu=(e,t,n,i)=>{const s=e.sort((a,c)=>c.diameter-a.diameter).find(a=>a.start<=n&&a.end>=n),o=t.find(a=>a.start<=n&&a.end>=n);return s&&i!=="Open hole frac pack"&&i!=="Open hole gravel pack"?Q(s):o?o.diameter:100},Xu=(e,t,n,i)=>{const s=e.sort((h,l)=>Q(h)-Q(l)).find(h=>h.start<=i&&h.end>=i);if(s)return Q(s);const o=e.length?Math.min(...e.map(h=>Q(h))):0,a=t.sort((h,l)=>Q(h)-Q(l)).find(h=>h.start<=i&&h.end>=i&&o<=Q(h));if(a)return Q(a);const c=n.find(h=>h.start<=i&&h.end>=i&&h.diameter);return c?c.diameter:100},qu=(e,t,n,i,r,s)=>{const{attachedStrings:o,nonAttachedStrings:a}=Nn(e.referenceIds,t,n);if(o.length===0)throw new Error(`Invalid cement data, can't find referenced casing/completion string for cement with id '${e.id}'`);o.sort((p,y)=>p.end-y.end);const c=o[o.length-1].end,{overlappingOuterStrings:h,overlappingHoles:l}=ze(e.toc,c,a,i),u=[...h,...l].map(p=>({start:p.start,end:p.end}));return De([e.toc,c],u).flatMap((p,y,m)=>{if(y===m.length-1)return[];const _=m[y+1],x=ns(o,h,l,p);return[{top:p,bottom:_,diameter:x*r}]}).map(p=>({diameter:p.diameter,points:s(p.top,p.bottom)}))},Nn=(e,t,n)=>[...t,...n].reduce((i,r)=>e.includes(r.id)?{...i,attachedStrings:[...i.attachedStrings,r]}:{...i,nonAttachedStrings:[...i.nonAttachedStrings,r]},{attachedStrings:[],nonAttachedStrings:[]}),ju=(e,t,n,i,r,s)=>{const{attachedStrings:o,nonAttachedStrings:a}=Nn(e.referenceIds,t,n);if(o.length===0)throw new Error(`Invalid cement squeeze data, can't find referenced casing/completion for squeeze with id '${e.id}'`);const{overlappingOuterStrings:c,overlappingHoles:h}=ze(e.start,e.end,a,i),l=[...c,...h].map(g=>({start:g.start,end:g.end}));return De([e.start,e.end],l).flatMap((g,p,y)=>{if(p===y.length-1)return[];const m=y[p+1],_=ns(o,c,h,g);return[{top:g,bottom:m,diameter:_*r}]}).map(g=>({diameter:g.diameter,points:s(g.top,g.bottom)}))},Zu=(e,t,n,i,r,s)=>{const{attachedStrings:o,nonAttachedStrings:a}=Nn(e.referenceIds,t,n),{overlappingHoles:c,overlappingOuterStrings:h}=ze(e.start,e.end,a,i),l=[...o,...c,...h].map(g=>({start:g.start,end:g.end}));return De([e.start,e.end],l).flatMap((g,p,y)=>{if(p===y.length-1)return[];const m=y[p+1],_=Xu(o,h,c,g);return[{top:g,bottom:m,diameter:_*r}]}).map(g=>({diameter:g.diameter,points:s(g.top,g.bottom)}))},Ku=(e,t,n,i,r)=>{const o=t.createLinearGradient(0,0,0,e.height);return o.addColorStop(0,n),o.addColorStop(.5-r,i),o.addColorStop(.5+r,i),o.addColorStop(1,n),o},Qu=({firstColor:e,secondColor:t},n,i)=>{const r=document.createElement("canvas");r.width=n,r.height=i;const s=r.getContext("2d");if(s==null)throw Error("Could not get canvas context!");return s.fillStyle=Ku(r,s,e,t,0),s.fillRect(0,0,r.width,r.height),E.Texture.from(r)},Ju=({scalingFactor:e})=>{const t=document.createElement("canvas"),n=vt*e;t.width=n,t.height=n;const i=t.getContext("2d");if(i==null)throw Error("Could not get canvas context!");i.fillStyle="white",i.fillRect(0,0,t.width,t.height);const r=n/10;i.strokeStyle="#AAAAAA",i.lineWidth=r,i.beginPath();const s=n/3;for(let o=-t.width;o<t.width;o++)i.moveTo(-t.width+s*o,-t.height),i.lineTo(t.width+s*o,t.height*2);return i.stroke(),E.Texture.from(t)},t0=({innerColor:e,outerColor:t,scalingFactor:n})=>{const i=vt*n,r=document.createElement("canvas");r.width=i,r.height=i;const s=r.getContext("2d");if(s==null)throw Error("Could not get canvas context!");const o=s.createLinearGradient(0,0,0,i),a=.3,c=.7;return o.addColorStop(0,t),o.addColorStop(a,e),o.addColorStop(c,e),o.addColorStop(1,t),s.fillStyle=o,s.fillRect(0,0,r.width,r.height),E.Texture.from(r)},e0=({firstColor:e,secondColor:t,scalingFactor:n})=>{const i=document.createElement("canvas"),r=vt*n,s=n;i.width=r,i.height=r;const o=i.getContext("2d");if(o==null)throw Error("Could not get canvas context!");o.fillStyle=e,o.fillRect(0,0,i.width,i.height),o.lineWidth=s,o.fillStyle=t,o.beginPath();const a=r/12;for(let c=-i.width;c<i.width;c++)o.moveTo(-i.width+a*c,-i.height),o.lineTo(i.width+a*c,i.height);return o.stroke(),E.Texture.from(i)},n0=({firstColor:e,secondColor:t,scalingFactor:n})=>{const i=document.createElement("canvas"),r=vt*n;i.width=r,i.height=r;const s=i.getContext("2d");if(s==null)throw Error("Could not get canvas context!");s.fillStyle=e,s.fillRect(0,0,i.width,i.height),s.lineWidth=n,s.strokeStyle=t,s.beginPath(),s.setLineDash([20,10]);const o=r/12;for(let a=-i.width;a<i.width;a++)s.moveTo(-i.width+o*a,-i.height),s.lineTo(i.width+o*a,i.height*2);return s.stroke(),E.Texture.from(i)},i0=({firstColor:e,secondColor:t,scalingFactor:n})=>{const i=document.createElement("canvas"),r=vt*n,s=n;i.width=r,i.height=r;const o=i.getContext("2d");if(o==null)throw Error("Could not get canvas context!");o.lineWidth=s,o.fillStyle=e,o.strokeStyle=t,o.fillRect(0,0,i.width,i.height),o.beginPath(),o.setLineDash([20,10]);const a=r/12;for(let c=-i.width;c<i.width;c++)o.moveTo(-i.width+a*c,-i.height),o.lineTo(i.width+a*c,i.height*2);return o.stroke(),E.Texture.from(i)},Ne=(e,t)=>{const n=Jr(t),i=Dn(t,n,e);return{leftPath:Dn(t,n,-e),rightPath:i}},$n=(e,t)=>({kind:"casing",start:e,end:t}),r0=(e,t)=>({kind:"casing-window",start:e,end:t}),s0=e=>{const t=(e.windows||[]).filter(n=>Wu(e.start,e.end,n.start,n.end)).reduce(({intervals:n,lastBottom:i},r,s,o)=>{const a=i<r.start?$n(i,r.start):null,c=a?a.end:i,h=Math.max(c,r.start),l=Math.min(e.end,r.end),u=r0(h,l),f=l,g=s===o.length-1&&f<e.end?$n(f,e.end):null,p=[a,u,g].filter(y=>y!=null);return{intervals:[...n,...p],lastBottom:f}},{intervals:[],lastBottom:e.start});return t.intervals.length?t.intervals:[$n(e.start,e.end)]},o0=(e,t,n)=>{const i=t.diameter*e,r=i/2,o=t.innerDiameter*e/2,a=r-o,c=s0(t).map(h=>{const l=n(h.start,h.end),{leftPath:u,rightPath:f}=Ne(r,l);return{kind:h.kind,leftPath:u,rightPath:f,pathPoints:l}});return{kind:"casing",id:t.id,referenceDiameter:i,referenceRadius:r,sections:c,casingWallWidth:a,hasShoe:t.hasShoe,bottom:t.end}},a0=(e,t,n,i,r)=>{const{overlappingOuterStrings:s,overlappingHoles:o}=ze(e.start,e.end,t,n),a=[...s,...o].map(u=>({start:u.start,end:u.end}));return De([e.start,e.end],a).flatMap((u,f,d)=>{if(f===d.length-1)return[];const g=d[f+1],p=Gu(s,o,u,e.subKind);return[{top:u,bottom:g,diameter:p*i}]}).map(u=>{const f=r(u.top,u.bottom);return{diameter:u.diameter,points:f}})},$e=(e,t,n)=>{const{packingOpacity:i,yellow:r}=n;t.fillStyle=r,t.strokeStyle=r;const s=[0,0],o=[e.width,e.height];t.save(),t.globalAlpha=i,t.fillRect(...s,...o),t.restore()},In=(e,t,n,i,r)=>{const{fracLineCurve:s}=i,o=10,a=e.width/o,c=n/3*i.scalingFactor,h=c/4,l=c/2,u=0,f=r==="diameter"?0:l;t.globalAlpha=i.packingOpacity;const d=()=>{for(let g=-1;g<o;g++){const p=[g*a+u+a/2,e.height/2-h-f-h];t.beginPath();const y=[...p],m=[p[0]-s*2,p[1]-h/4],_=[p[0],p[1]-h/2],x=[p[0]+s*2,p[1]-h/2-h/4],M=[p[0],p[1]-h];t.bezierCurveTo(...y,...m,..._),t.bezierCurveTo(..._,...x,...M),t.stroke()}for(let g=-1;g<o;g++){const p=[g*a+a+u+a/2,e.height/2+c/2+f];t.beginPath();const y=[...p],m=[p[0]-s*2,p[1]+h/4],_=[p[0],p[1]+h/2],x=[p[0]+s*2,p[1]+h/2+h/4],M=[p[0],p[1]+h];t.bezierCurveTo(...y,...m,..._),t.bezierCurveTo(..._,...x,...M),t.stroke()}};t.strokeStyle=i.yellow,t.lineWidth=6,t.save(),d(),t.restore(),t.lineWidth=1,t.strokeStyle=i.outline,d(),t.closePath()},c0=(e,t,n,i)=>{const s=e.width/4;t.strokeStyle=i.outline;const o=n/3*i.scalingFactor;t.lineWidth=1;const a=o/2;for(let c=0;c<=4;c++){const h=[c*s,e.height/2-o/2],l=[h[0]-s/2,h[1]-a],u=[h[0]-s,h[1]];t.beginPath(),t.moveTo(...h),t.lineTo(...l),t.lineTo(...u),t.fill(),t.lineWidth=1,t.stroke()}for(let c=0;c<=4;c++){const h=[c*s,e.height/2+o/2],l=[h[0]-s/2,h[1]+a],u=[h[0]-s,h[1]];t.beginPath(),t.moveTo(...h),t.lineTo(...l),t.lineTo(...u),t.fill(),t.lineWidth=1,t.stroke()}t.closePath()},ht=(e="Error!",t)=>{console.error(`${e}`);const n=(t==null?void 0:t.canvas)||document.createElement("canvas"),i=vt;n.width=i/2,n.height=i;const r=(t==null?void 0:t.canvasCtx)||n.getContext("2d"),s=[0,0],o=[n.width,n.height];if(r==null)throw Error("Could not get canvas context!");return r.fillStyle="#ff00ff",r.fillRect(...s,...o),new E.Texture(E.Texture.from(n,{wrapMode:E.WRAP_MODES.CLAMP}).baseTexture,void 0,new E.Rectangle(0,0,n.width,n.height),void 0,E.groupD8.MIRROR_HORIZONTAL)},St=(e,t)=>{const n=document.createElement("canvas"),r=e.diameter*t.scalingFactor;n.width=r/2,n.height=r;const s=n.getContext("2d");if(s==null)throw Error("Could not get canvas context!");return{canvas:n,ctx:s}},Tt=e=>new E.Texture(E.Texture.from(e,{wrapMode:E.WRAP_MODES.CLAMP}).baseTexture,void 0,new E.Rectangle(0,0,e.width,e.height),void 0,E.groupD8.MIRROR_HORIZONTAL),h0=(e,t)=>n=>t.some(i=>n(i)&&kr(e,i)),Bn={packing:()=>ht(),fracLines:()=>ht(),spikes:(e,t,n,i)=>{const{canvas:r,ctx:s}=St(t,i),o=h0(e,n),a=o(Cr),c=o(Lr),h=o(Pr),u=a||c||h?i.yellow:i.red;return s.globalAlpha=i.packingOpacity,e.isOpen?(s.fillStyle=u,s.strokeStyle=u):(s.fillStyle=i.grey,s.strokeStyle=i.grey),c0(r,s,t.diameter,i),h&&In(r,s,t.diameter,i,"spike"),Tt(r)}},is={packing:()=>ht(),fracLines:(e,t)=>{const{canvas:n,ctx:i}=St(e,t);return In(n,i,e.diameter,t,"diameter"),Tt(n)},spikes:()=>ht()},Ie={packing:(e,t)=>{const{canvas:n,ctx:i}=St(e,t);return $e(n,i,t),Tt(n)},fracLines:(e,t)=>{const{canvas:n}=St(e,t);return Tt(n)},spikes:()=>ht()},Hn={packing:(e,t)=>{const{canvas:n,ctx:i}=St(e,t);return $e(n,i,t),Tt(n)},fracLines:()=>ht(),spikes:()=>ht()},Vn={packing:(e,t)=>{const{canvas:n,ctx:i}=St(e,t);return $e(n,i,t),Tt(n)},fracLines:()=>ht(),spikes:()=>ht()},Un={packing:(e,t,n)=>{const{canvas:i,ctx:r}=St(t,n);return $e(i,r,n),Tt(i)},fracLines:(e,t)=>{const{canvas:n,ctx:i}=St(e,t);return In(n,i,e.diameter,t,"diameter"),Tt(n)},spikes:()=>ht()},l0=(e,t,n)=>K({Perforation:()=>Bn.packing(),CasedHoleFracturation:()=>Ie.packing(t,n),CasedHoleFracPack:()=>Ie.packing(t,n),OpenHoleGravelPack:()=>Vn.packing(t,n),OpenHoleFracPack:()=>Un.packing(e,t,n),CasedHoleGravelPack:()=>Hn.packing(t,n)},e.subKind),u0=(e,t,n)=>K({Perforation:()=>Bn.fracLines(),OpenHoleGravelPack:()=>Vn.fracLines(),OpenHoleFracPack:()=>Un.fracLines(t,n),CasedHoleFracturation:()=>is.fracLines(t,n),CasedHoleGravelPack:()=>Hn.fracLines(),CasedHoleFracPack:()=>Ie.fracLines(t,n)},e.subKind),f0=(e,t,n,i)=>K({Perforation:()=>Bn.spikes(e,n,t,i),OpenHoleGravelPack:()=>Vn.spikes(),OpenHoleFracPack:()=>Un.spikes(),CasedHoleFracturation:()=>is.spikes(),CasedHoleGravelPack:()=>Hn.spikes(),CasedHoleFracPack:()=>Ie.spikes()},e.subKind);class d0 extends E.MeshGeometry{constructor(t){const n=Xe(t,i=>i.points.length);super(new Float32Array(n*4),new Float32Array(n*4),new Uint16Array((n-1)*6)),this.segments=t,this.build()}get width(){return Ge(this.segments,t=>t.diameter)}build(){var g,p,y,m,_,x,M,S;const t=this.segments;if(!t)return;const n=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex(),s=Xe(t,w=>w.points.length);if(s<1)return;n.data.length/4!==s&&(n.data=new Float32Array(s*4),i.data=new Float32Array(s*4),r.data=new Uint16Array((s-1)*6));const o=i.data,a=r.data;o[0]=0,o[1]=0,o[2]=0,o[3]=1;const c=t.length,h=Ge(t,w=>w.diameter);let l=0,u=0,f=0,d=0;for(let w=0;w<c;w++){let T=(g=t[w])==null?void 0:g.points[0];const F=h,k=((p=t[w])==null?void 0:p.diameter)/h/2,N=(y=t[w])==null?void 0:y.points.length;for(let P=0;P<N;P++){const z=T.x-((_=(m=t[w])==null?void 0:m.points[P])==null?void 0:_.x),B=T.y-((M=(x=t[w])==null?void 0:x.points[P])==null?void 0:M.y),v=Math.sqrt(z*z+B*B);T=(S=t[w])==null?void 0:S.points[P],l+=v/F,o[u]=l,o[u+1]=.5-k,o[u+2]=l,o[u+3]=.5+k,u+=4}for(let P=0;P<N-1;P++)a[d++]=f,a[d++]=f+1,a[d++]=f+2,a[d++]=f+2,a[d++]=f+1,a[d++]=f+3,f+=2;f+=2}i.update(),r.update(),this.updateVertices()}updateVertices(){var s,o,a,c,h,l,u,f;const t=this.segments;if(Xe(t,d=>d.points.length)<1)return;const i=t.length;let r=0;for(let d=0;d<i;d++){let g=(s=t[d])==null?void 0:s.points[0],p,y=0,m=0;const _=(o=this.buffers[0])==null?void 0:o.data,x=(a=t[d])==null?void 0:a.points.length;let M=0;for(let S=0;S<x;S++){const w=(c=t[d])==null?void 0:c.points[S];M=r+S*4,S<((h=t[d])==null?void 0:h.points.length)-1?p=(l=t[d])==null?void 0:l.points[S+1]:p=w,m=-(p.x-g.x),y=p.y-g.y;const T=Math.sqrt(y*y+m*m),F=((u=t[d])==null?void 0:u.diameter)/2;y/=T,m/=T,y*=F,m*=F,_!=null&&(_[M]=w.x+y,_[M+1]=w.y+m,_[M+2]=w.x-y,_[M+3]=w.y-m),g=w}r=M+4}(f=this.buffers[0])==null||f.update()}update(){this.build()}}class g0 extends E.Mesh{constructor(t,n){const i=new d0(n),r=new E.MeshMaterial(t);t.baseTexture.wrapMode=E.WRAP_MODES.REPEAT,super(i,r),this.autoUpdate=!0}_render(t){const n=this.geometry;this.autoUpdate&&n.update(),super._render(t)}}class p0 extends E.MeshGeometry{constructor(t,n=200){super(new Float32Array(t.length*4),new Float32Array(t.length*4),new Uint16Array((t.length-1)*6)),this.points=t,this._width=n,this.build()}get width(){return this._width}build(){var u,f;const t=this.points;if(!t)return;const n=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(t.length<1)return;n.data.length/4!==t.length&&(n.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),r.data=new Uint16Array((t.length-1)*6));const s=i.data,o=r.data;s[0]=0,s[1]=0,s[2]=0,s[3]=1;let a=0,c=t[0];const h=t.length;for(let d=0;d<h;d++){const g=d*4,p=c.x-((u=t[d])==null?void 0:u.x),y=c.y-((f=t[d])==null?void 0:f.y),m=Math.sqrt(p*p+y*y);c=t[d],a+=m/this._width,s[g]=a,s[g+1]=0,s[g+2]=a,s[g+3]=1}let l=0;for(let d=0;d<h-1;d++){const g=d*2;o[l++]=g,o[l++]=g+1,o[l++]=g+2,o[l++]=g+2,o[l++]=g+1,o[l++]=g+3}i.update(),r.update(),this.updateVertices()}updateVertices(){var c,h;const t=this.points;if(t.length<1)return;let n=t[0],i,r=0,s=0;const o=(c=this.buffers[0])==null?void 0:c.data,a=t.length;for(let l=0;l<a;l++){const u=t[l],f=l*4;l<t.length-1?i=t[l+1]:i=u,s=-(i.x-n.x),r=i.y-n.y;const d=Math.sqrt(r*r+s*s),g=this._width/2;r/=d,s/=d,r*=g,s*=g,o[f]=u.x+r,o[f+1]=u.y+s,o[f+2]=u.x-r,o[f+3]=u.y-s,n=u}(h=this.buffers[0])==null||h.update()}update(){this.build()}}class m0 extends E.Mesh{constructor(t,n,i){const r=new p0(n,i),s=new E.MeshMaterial(t);t.baseTexture.wrapMode=E.WRAP_MODES.REPEAT,super(r,s),this.autoUpdate=!0}_render(t){const n=this.geometry;this.autoUpdate&&n.update(),super._render(t)}}class y0 extends E.MeshGeometry{constructor(t,n=200){super(new Float32Array(t.length*4),new Float32Array(t.length*4),new Uint16Array((t.length-1)*6)),this.points=t,this._width=n,this.build()}build(){var d,g,p,y;const t=this.points;if(!t)return;const n=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(t.length<1)return;n.data.length/4!==t.length&&(n.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),r.data=new Uint16Array((t.length-1)*6));const s=t.length;let o=0,a=t[0];for(let m=0;m<s;m++){const _=a.x-((d=t[m])==null?void 0:d.x),x=a.y-((g=t[m])==null?void 0:g.y),M=Math.sqrt(_*_+x*x);a=t[m],o+=M}const c=i.data,h=r.data;c[0]=0,c[1]=0,c[2]=0,c[3]=1;let l=0,u=t[0];for(let m=0;m<s;m++){const _=m*4,x=u.x-((p=t[m])==null?void 0:p.x),M=u.y-((y=t[m])==null?void 0:y.y),S=Math.sqrt(x*x+M*M);u=t[m],l+=S/o,c[_]=l,c[_+1]=0,c[_+2]=l,c[_+3]=1}let f=0;for(let m=0;m<s-1;m++){const _=m*2;h[f++]=_,h[f++]=_+1,h[f++]=_+2,h[f++]=_+2,h[f++]=_+1,h[f++]=_+3}i.update(),r.update(),this.updateVertices()}updateVertices(){var c,h;const t=this.points;if(t.length<1)return;let n=t[0],i,r=0,s=0;const o=(c=this.buffers[0])==null?void 0:c.data,a=t.length;for(let l=0;l<a;l++){const u=t[l],f=l*4;l<t.length-1?i=t[l+1]:i=u,s=-(i.x-n.x),r=i.y-n.y;const d=Math.sqrt(r*r+s*s),g=this._width/2;r/=d,s/=d,r*=g,s*=g,o[f]=u.x+r,o[f+1]=u.y+s,o[f+2]=u.x-r,o[f+3]=u.y-s,n=u}(h=this.buffers[0])==null||h.update()}update(){this.updateVertices()}}class _0 extends E.Mesh{constructor(t,n){const i=new y0(n,t.height),r=new E.MeshMaterial(t);super(i,r),this.autoUpdate=!0}_render(t){const n=this.geometry;(this.autoUpdate||n._width!==this.shader.texture.height)&&(n._width=this.shader.texture.height,n.update()),super._render(t)}}const v0=(e,t,n)=>i=>{switch(i.kind){case"casing":return e(i);case"cement":return t(i);case"cementSqueeze":return n(i);default:return ne(i)}},x0=e=>({exaggerationFactor:2,internalLayerOptions:Er(e),holeOptions:Fr,casingOptions:Rr,cementOptions:zr,cementSqueezeOptions:Dr,screenOptions:Nr,tubingOptions:$r,cementPlugOptions:Ir,perforationOptions:Or}),rs=class extends kn{constructor(e,t,n){super(e,t,n),this.internalLayerVisibility={holeLayerId:!0,casingLayerId:!0,completionLayerId:!0,cementLayerId:!0,pAndALayerId:!0,perforationLayerId:!0},this.cementTextureCache=null,this.cementSqueezeTextureCache=null,this.cementPlugTextureCache=null,this.holeTextureCache=null,this.screenTextureCache=null,this.tubingTextureCache=null,this.textureSymbolCacheArray=null,this.scalingFactors={height:600,zFactor:1,yScale:Ct()},this.getZFactorScaledPathForPoints=(i,r)=>{var a;const s=c=>c*this.scalingFactors.zFactor;return(((a=this.referenceSystem)==null?void 0:a.getCurtainPath(i,r,!0))??[]).map(c=>new E.Point(c.point[0],s(c.point[1])))},this.drawBigPolygon=(i,r=0)=>{const s=new E.Graphics;s.beginFill(r),s.drawPolygon(i),s.endFill(),this.addChild(s)},this.perforationRopeAndTextureReferences=[],this.prepareSymbolRenderObject=i=>{const{exaggerationFactor:r=1}=this.options,s=i.diameter*r;return{pathPoints:this.getZFactorScaledPathForPoints(i.start,i.end),referenceDiameter:s,symbolKey:i.symbolKey}},this.drawSymbolComponent=({pathPoints:i,referenceDiameter:r,symbolKey:s})=>{const o=this.getSymbolTexture(s,r);this.drawSVGRope(i,o)},this.drawHoleSize=(i,r)=>{if(r==null)return;const s=this.getZFactorScaledPathForPoints(r.start,r.end);if(s.length===0)return;const{exaggerationFactor:o=1,holeOptions:a}=this.options,c=r.diameter*o,{rightPath:h,leftPath:l}=Ne(c/2,s),u=this.getHoleTexture(a,c,i);this.drawHoleRope(s,u,i),this.drawOutline(l,h,pt(a.lineColor),Al*o,"TopAndBottom",0)},this.drawCasing=i=>{const{casingOptions:r}=this.options,s=pt(r.solidColor),o=pt(r.lineColor);i.sections.forEach((a,c,h)=>{const l=rs.getOutlineClosureType(c,h.length-1),u=this.createCasingTexture(i.referenceDiameter);this.drawRope(a.pathPoints,u,s),a.kind==="casing-window"?this.drawCasingWindowOutline(a.leftPath,a.rightPath,r,i.casingWallWidth):this.drawOutline(a.leftPath,a.rightPath,o,i.casingWallWidth,l)})},this.generateShoe=(i,r,s,o)=>{const a=i-s,c=i,h=this.getZFactorScaledPathForPoints(a,c),l=Jr(h),u=Dn(h,l,r*(o<0?-1:1)),f=h[h.length-1],d=l[l.length-1],g=ts(f,d,o+r*(o<0?-1:1));return[...u,g]},this.createCementSqueezeShape=(i,r,s,o)=>{const{exaggerationFactor:a=1}=this.options;return ju(i,r,s,o,a,this.getZFactorScaledPathForPoints)},this.createPerforationShape=(i,r,s)=>{const{exaggerationFactor:o=1}=this.options;return a0(i,r,s,o,this.getZFactorScaledPathForPoints)},this.options={...this.options,...x0(this.id),...n}}onUnmount(e){super.onUnmount(e),this.cementTextureCache=null,this.cementSqueezeTextureCache=null,this.holeTextureCache=null,this.screenTextureCache=null,this.tubingTextureCache=null,this.textureSymbolCacheArray=null}onUpdate(e){super.onUpdate(e),this.clearLayer(),this.preRender(),this.render()}onRescale(e){const t=this.scalingFactors.zFactor!==e.zFactor;this.scalingFactors={height:e.height,zFactor:e.zFactor,yScale:e.yScale},super.optionsRescale(e);const n=this.yRatio(),i=e.xBounds[0]>e.xBounds[1],r=e.yBounds[0]>e.yBounds[1];this.setContainerPosition(e.xScale(0),e.yScale(0)),this.setContainerScale(e.xRatio*(i?-1:1),n*(r?-1:1)),t&&(this.clearLayer(),this.preRender()),this.render()}setVisibility(e,t){if(t===this.id){super.setVisibility(e,t);return}const{internalLayerOptions:n}=this.options,r=(n?Object.entries(n):[]).find(([o,a])=>a===t),s=r==null?void 0:r[0];s&&(this.internalLayerVisibility[s]=e,this.clearLayer(),this.preRender(),this.render())}getInternalLayerIds(){const{internalLayerOptions:e}=this.options;return e?Object.values(e):[]}yRatio(){const e=this.scalingFactors.yScale.domain(),n=(e[1]-e[0])*this.scalingFactors.zFactor,i=[e[0],e[0]+n];return Math.abs(this.scalingFactors.height/(i[1]-i[0]))}drawRope(e,t,n){if(e.length===0)return;const i=new E.SimpleRope(t,e,1);i.tint=n||i.tint,this.addChild(i)}drawOutline(e,t,n,i=1,r="None",s=1){const o=e.map(l=>l.clone()).reverse(),a=t[0],c=o[0],h=new E.Graphics;h.lineStyle(i,n,void 0,s),h.moveTo(a.x,a.y),t.forEach(l=>h.lineTo(l.x,l.y)),(r==="None"||r==="Top")&&h.moveTo(c.x,c.y),o.forEach(l=>h.lineTo(l.x,l.y)),(r==="TopAndBottom"||r==="Top")&&h.lineTo(a.x,a.y),this.addChild(h)}drawCasingWindowOutline(e,t,{lineColor:n,windowOptions:i},r=1){var g,p;const s=!!((p=(g=this.referenceSystem)==null?void 0:g.options)!=null&&p.calculateDisplacementFromBottom),[o,a]=s?[e,t]:[t,e],[c,h]=s?[1,0]:[0,1],l=new E.Graphics;l.lineStyle(r,pt(n),void 0,h);const u=o[0];l.moveTo(u.x,u.y),o.forEach(y=>l.lineTo(y.x,y.y));const f=new Qr(l,{dash:[i.dashLength,i.spaceLength],color:pt(i.dashColor),width:r,alignment:c}),d=a[0];f.moveTo(d.x,d.y),a.forEach(y=>{f.lineTo(y.x,y.y)}),this.addChild(l)}preRender(){if(!this.data||!this.referenceSystem)return;const{exaggerationFactor:e=1}=this.options,{holeSizes:t,casings:n,cements:i,completion:r,symbols:s,pAndA:o,perforations:a}=this.data;this.updateSymbolCache(s),t.sort((g,p)=>p.diameter-g.diameter);const c=t.length>0?(Ge(t,g=>g.diameter)??0)*e:Ml*e;this.internalLayerVisibility.holeLayerId&&t.forEach(g=>this.drawHoleSize(c,g)),n.sort((g,p)=>p.diameter-g.diameter);const h=n.map(g=>this.createCasingRenderObject(g)),l=i.map(g=>({kind:"cement",segments:qu(g,n,r,t,e,this.getZFactorScaledPathForPoints),casingIds:(g.referenceIds||[]).filter(p=>p)})),[u,f]=o.reduce(([g,p],y)=>wr(y)?[[y,...g],p]:[g,[y,...p]],[[],[]]),d=u.map(g=>({kind:"cementSqueeze",segments:this.createCementSqueezeShape(g,n,r,t),casingIds:g.referenceIds}));if(this.sortCementAndCasingRenderObjects(h,l,d).forEach(v0(g=>{this.internalLayerVisibility.casingLayerId&&(this.drawCasing(g),g.hasShoe&&this.drawShoe(g.bottom,g.referenceRadius))},g=>{if(this.internalLayerVisibility.cementLayerId){const p=this.getCementTexture();p&&this.drawComplexRope(g.segments,p)}},g=>{if(this.internalLayerVisibility.pAndALayerId){const p=this.getCementSqueezeTexture();p&&this.drawComplexRope(g.segments,p)}})),this.perforationRopeAndTextureReferences.forEach(({rope:g,texture:p})=>{g.destroy({children:!0,texture:!0,baseTexture:!0}),p.destroy(!0)}),this.perforationRopeAndTextureReferences=[],this.internalLayerVisibility.perforationLayerId){const{perforationOptions:g}=this.options,p=a.filter(Tr),y=a.filter(Mr),m=a.filter(Ar);p.forEach(_=>{const M=this.createPerforationShape(_,n,t).reduce((S,w)=>(S[w.diameter]||(S[w.diameter]=[]),S[w.diameter]=[...S[w.diameter]??[],w],S),{});Object.values(M).forEach(S=>{const w=l0(_,S[0],g),T=this.drawComplexRope(S,w);T&&this.perforationRopeAndTextureReferences.push({rope:T,texture:w})})}),m.forEach(_=>{const S=this.createPerforationShape(_,n,t).map(w=>({...w,diameter:w.diameter*3})).reduce((w,T)=>(w[T.diameter]||(w[T.diameter]=[]),w[T.diameter]=[...w[T.diameter]??[],T],w),{});Object.values(S).forEach(w=>{w.forEach(T=>{const F=f0(_,a,T,g),k=this.drawComplexRope([T],F);k&&this.perforationRopeAndTextureReferences.push({rope:k,texture:F})})})}),y.forEach(_=>{const S=this.createPerforationShape(_,n,t).map(w=>({...w,diameter:w.diameter*3})).reduce((w,T)=>(w[T.diameter]||(w[T.diameter]=[]),w[T.diameter]=[...w[T.diameter]??[],T],w),{});Object.values(S).forEach(w=>{w.forEach(T=>{const F=u0(_,T,g),k=this.drawComplexRope([T],F);k&&this.perforationRopeAndTextureReferences.push({rope:k,texture:F})})})})}this.internalLayerVisibility.completionLayerId&&r.forEach(Sr(g=>this.drawScreen(g),g=>this.drawTubing(g),g=>{const p=this.prepareSymbolRenderObject(g);this.drawSymbolComponent(p)})),this.internalLayerVisibility.pAndALayerId&&f.forEach(g=>{if(xr(g)){const p=this.prepareSymbolRenderObject(g);this.drawSymbolComponent(p)}br(g)&&this.drawCementPlug(g,n,r,t)})}updateSymbolCache(e){if(this.textureSymbolCacheArray||(this.textureSymbolCacheArray={}),!e)return;const t=Object.keys(this.textureSymbolCacheArray);Object.entries(e).forEach(([n,i])=>{!t.includes(n)&&this.textureSymbolCacheArray&&(this.textureSymbolCacheArray[n]=E.Texture.from(i))})}drawCementPlug(e,t,n,i){const{exaggerationFactor:r=1,cementPlugOptions:s}=this.options,o=Zu(e,t,n,i,r,this.getZFactorScaledPathForPoints);s&&this.drawComplexRope(o,this.getCementPlugTexture(s));const{rightPath:a,leftPath:c}=o.reduce((h,l)=>{const{leftPath:u,rightPath:f}=Ne(l.diameter/2,l.points);return{rightPath:[...h.rightPath,...f],leftPath:[...h.leftPath,...u]}},{rightPath:[],leftPath:[]});this.drawOutline(c,a,pt("black"),.25,"TopAndBottom")}createCasingRenderObject(e){const{exaggerationFactor:t=1}=this.options;return o0(t,e,this.getZFactorScaledPathForPoints)}getCementPlugTexture(e){return this.cementPlugTextureCache||(this.cementPlugTextureCache=n0(e)),this.cementPlugTextureCache}drawSVGRope(e,t){if(e.length===0)return;const n=new _0(t,e);this.addChild(n)}getSymbolTexture(e,t){var i,r;const n=(r=(i=this.textureSymbolCacheArray)==null?void 0:i[e])==null?void 0:r.baseTexture;return n?new E.Texture(n,void 0,new E.Rectangle(0,0,0,t),void 0,E.groupD8.MAIN_DIAGONAL):void 0}drawHoleRope(e,t,n){if(e.length===0)return;const i=new E.SimpleRope(t,e,n/vt);this.addChild(i)}getHoleTexture(e,t,n){const i=vt,r=i,s=i,o=t/n*i;this.holeTextureCache||(this.holeTextureCache=Qu(e,s,r));const a=this.holeTextureCache.baseTexture,c=(r-o)/2,h=new E.Rectangle(0,c,s,o);return new E.Texture(a,h)}sortCementAndCasingRenderObjects(e,t,n){let i=0;const{result:r}=e.reduce((s,o)=>{const a=s.remainingCement.find(h=>h.casingIds.includes(o.id)),c=s.remainingCementSqueezes.filter(h=>h.casingIds.includes(o.id));return a&&(a.zIndex=i++),c.forEach(h=>h.zIndex=i++),o.zIndex=i++,{result:[...s.result,a,o,...c],remainingCement:s.remainingCement.filter(h=>h!==a),remainingCementSqueezes:s.remainingCementSqueezes.filter(h=>!c.includes(h))}},{result:[],remainingCement:t,remainingCementSqueezes:n});return r.filter(s=>s!=null).sort((s,o)=>s.zIndex-o.zIndex)}drawComplexRope(e,t){if(e.length===0)return;const n=new g0(t,e);return this.addChild(n),n}createCasingTexture(e){return new E.Texture(E.Texture.WHITE.baseTexture,void 0,new E.Rectangle(0,0,16,e))}drawShoe(e,t){const{exaggerationFactor:n=1,casingOptions:i}=this.options,r=i.shoeSize.width*n,s=i.shoeSize.length*n,o=this.generateShoe(e,t,s,r),a=this.generateShoe(e,t,s,-r);this.drawBigPolygon(a),this.drawBigPolygon(o)}getCementTexture(){if(!this.cementTextureCache){const{cementOptions:e}=this.options;e&&(this.cementTextureCache=e0(e))}return this.cementTextureCache}getCementSqueezeTexture(){if(!this.cementSqueezeTextureCache){const{cementSqueezeOptions:e}=this.options;e&&(this.cementSqueezeTextureCache=i0(e))}return this.cementSqueezeTextureCache}drawScreen({start:e,end:t,diameter:n}){const{exaggerationFactor:i=1,screenOptions:r}=this.options,s=i*n,o=this.getZFactorScaledPathForPoints(e,t),{leftPath:a,rightPath:c}=Ne(s/2,o),h=this.getScreenTexture();h&&(this.drawCompletionRope(o,h,s),this.drawOutline(a,c,pt(r.lineColor),Cl*i,"TopAndBottom"))}drawTubing({diameter:e,start:t,end:n}){const{exaggerationFactor:i=1,tubingOptions:r}=this.options,s=i*e,o=this.getZFactorScaledPathForPoints(t,n),a=this.getTubingTexture(r);this.drawCompletionRope(o,a,s)}getTubingTexture(e){return this.tubingTextureCache||(this.tubingTextureCache=t0(e)),this.tubingTextureCache}getScreenTexture(){if(!this.screenTextureCache){const{screenOptions:e}=this.options;e&&(this.screenTextureCache=Ju(e))}return this.screenTextureCache}drawCompletionRope(e,t,n){if(e.length===0)return;const i=new m0(t,e,n);this.addChild(i)}};let ss=rs;ss.getOutlineClosureType=(e,t)=>e===0?e===t?"TopAndBottom":"Top":e===t?"Bottom":"None";class w0 extends xt{onMount(t){super.onMount(t)}onUpdate(t){super.onUpdate(t),this.clearCanvas(),this.render()}onRescale(t){super.onRescale(t),this.setTransform(t),this.render()}render(){if(!this.data||!this.ctx||!this.data.image)return;const{ctx:t}=this,{options:n,image:i}=this.data;this.clearCanvas(),t.drawImage(i,n.x,n.y,n.width,n.height)}}function Bt(e){return function(){return e}}const os=1e-12,Wn=Math.PI,Yn=2*Wn,kt=1e-6,b0=Yn-kt;function as(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function S0(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return as;const n=10**t;return function(i){this._+=i[0];for(let r=1,s=i.length;r<s;++r)this._+=Math.round(arguments[r]*n)/n+i[r]}}class T0{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?as:S0(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,i,r){this._append`Q${+t},${+n},${this._x1=+i},${this._y1=+r}`}bezierCurveTo(t,n,i,r,s,o){this._append`C${+t},${+n},${+i},${+r},${this._x1=+s},${this._y1=+o}`}arcTo(t,n,i,r,s){if(t=+t,n=+n,i=+i,r=+r,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,a=this._y1,c=i-t,h=r-n,l=o-t,u=a-n,f=l*l+u*u;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(f>kt)if(!(Math.abs(u*c-h*l)>kt)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let d=i-o,g=r-a,p=c*c+h*h,y=d*d+g*g,m=Math.sqrt(p),_=Math.sqrt(f),x=s*Math.tan((Wn-Math.acos((p+f-y)/(2*m*_)))/2),M=x/_,S=x/m;Math.abs(M-1)>kt&&this._append`L${t+M*l},${n+M*u}`,this._append`A${s},${s},0,0,${+(u*d>l*g)},${this._x1=t+S*c},${this._y1=n+S*h}`}}arc(t,n,i,r,s,o){if(t=+t,n=+n,i=+i,o=!!o,i<0)throw new Error(`negative radius: ${i}`);let a=i*Math.cos(r),c=i*Math.sin(r),h=t+a,l=n+c,u=1^o,f=o?r-s:s-r;this._x1===null?this._append`M${h},${l}`:(Math.abs(this._x1-h)>kt||Math.abs(this._y1-l)>kt)&&this._append`L${h},${l}`,i&&(f<0&&(f=f%Yn+Yn),f>b0?this._append`A${i},${i},0,1,${u},${t-a},${n-c}A${i},${i},0,1,${u},${this._x1=h},${this._y1=l}`:f>kt&&this._append`A${i},${i},0,${+(f>=Wn)},${u},${this._x1=t+i*Math.cos(s)},${this._y1=n+i*Math.sin(s)}`)}rect(t,n,i,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${i=+i}v${+r}h${-i}Z`}toString(){return this._}}function M0(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const i=Math.floor(n);if(!(i>=0))throw new RangeError(`invalid digits: ${n}`);t=i}return e},()=>new T0(t)}function A0(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function cs(e){this._context=e}cs.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function hs(e){return new cs(e)}function C0(e){return e[0]}function P0(e){return e[1]}function L0(e,t){var n=Bt(!0),i=null,r=hs,s=null,o=M0(a);e=typeof e=="function"?e:e===void 0?C0:Bt(e),t=typeof t=="function"?t:t===void 0?P0:Bt(t);function a(c){var h,l=(c=A0(c)).length,u,f=!1,d;for(i==null&&(s=r(d=o())),h=0;h<=l;++h)!(h<l&&n(u=c[h],h,c))===f&&((f=!f)?s.lineStart():s.lineEnd()),f&&s.point(+e(u,h,c),+t(u,h,c));if(d)return s=null,d+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:Bt(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Bt(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Bt(!!c),a):n},a.curve=function(c){return arguments.length?(r=c,i!=null&&(s=r(i)),a):r},a.context=function(c){return arguments.length?(c==null?i=s=null:s=r(i=c),a):i},a}function ls(){}function Gn(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Be(e){this._context=e}Be.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Gn(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Gn(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function k0(e){return new Be(e)}function us(e){this._context=e}us.prototype={areaStart:ls,areaEnd:ls,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Gn(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function E0(e){return new us(e)}function fs(e,t){this._basis=new Be(e),this._beta=t}fs.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var i=e[0],r=t[0],s=e[n]-i,o=t[n]-r,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(i+c*s),this._beta*t[a]+(1-this._beta)*(r+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const F0=function e(t){function n(i){return t===1?new Be(i):new fs(i,t)}return n.beta=function(i){return e(+i)},n}(.85);function ds(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function Xn(e,t){this._context=e,this._k=(1-t)/6}Xn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ds(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:ds(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const R0=function e(t){function n(i){return new Xn(i,t)}return n.tension=function(i){return e(+i)},n}(0);function O0(e,t,n){var i=e._x1,r=e._y1,s=e._x2,o=e._y2;if(e._l01_a>os){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,r=(r*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>os){var h=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,l=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*h+e._x1*e._l23_2a-t*e._l12_2a)/l,o=(o*h+e._y1*e._l23_2a-n*e._l12_2a)/l}e._context.bezierCurveTo(i,r,s,o,e._x2,e._y2)}function gs(e,t){this._context=e,this._alpha=t}gs.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){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(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:O0(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const z0=function e(t){function n(i){return t?new gs(i,t):new Xn(i,0)}return n.alpha=function(i){return e(+i)},n}(.5);function ps(e){return e<0?-1:1}function ms(e,t,n){var i=e._x1-e._x0,r=t-e._x1,s=(e._y1-e._y0)/(i||r<0&&-0),o=(n-e._y1)/(r||i<0&&-0),a=(s*r+o*i)/(i+r);return(ps(s)+ps(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function ys(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function qn(e,t,n){var i=e._x0,r=e._y0,s=e._x1,o=e._y1,a=(s-i)/3;e._context.bezierCurveTo(i+a,r+a*t,s-a,o-a*n,s,o)}function He(e){this._context=e}He.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qn(this,this._t0,ys(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,qn(this,ys(this,n=ms(this,e,t)),n);break;default:qn(this,this._t0,n=ms(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function _s(e){this._context=new vs(e)}(_s.prototype=Object.create(He.prototype)).point=function(e,t){He.prototype.point.call(this,t,e)};function vs(e){this._context=e}vs.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,i,r,s){this._context.bezierCurveTo(t,e,i,n,s,r)}};function D0(e){return new He(e)}function N0(e){return new _s(e)}function xs(e){this._context=e}xs.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var i=ws(e),r=ws(t),s=0,o=1;o<n;++s,++o)this._context.bezierCurveTo(i[0][s],r[0][s],i[1][s],r[1][s],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function ws(e){var t,n=e.length-1,i,r=new Array(n),s=new Array(n),o=new Array(n);for(r[0]=0,s[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)r[t]=1,s[t]=4,o[t]=4*e[t]+2*e[t+1];for(r[n-1]=2,s[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)i=r[t]/s[t-1],s[t]-=i,o[t]-=i*o[t-1];for(r[n-1]=o[n-1]/s[n-1],t=n-2;t>=0;--t)r[t]=(o[t]-r[t+1])/s[t];for(s[n-1]=(e[n]+r[n-1])/2,t=0;t<n-1;++t)s[t]=2*e[t+1]-r[t+1];return[r,s]}function $0(e){return new xs(e)}function Ve(e,t){this._context=e,this._t=t}Ve.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function I0(e){return new Ve(e,.5)}function B0(e){return new Ve(e,0)}function H0(e){return new Ve(e,1)}const V0=.7,U0=.9,W0=1;class Y0 extends vr{constructor(t,n){super(t,n),this.options={...this.options,...n},this.render=this.render.bind(this)}onUpdate(t){super.onUpdate(t),this.render()}onRescale(t){super.onRescale(t),this.elm&&(this.rescaleEvent=t,this.render())}render(){const{strokeWidth:t,stroke:n}=this.options;if(!this.elm)return;this.elm.select("g").remove();const i=this.data||this.referenceSystem&&this.referenceSystem.projectedPath;!i||!this.rescaleEvent||this.elm.append("g").attr("class","well-path").append("path").attr("d",this.renderWellborePath(i)).attr("stroke-width",t||"2px").attr("stroke",n||"red").attr("fill","none")}renderWellborePath(t){if(this.rescaleEvent!=null){const{xScale:n,yScale:i}=this.rescaleEvent,r=t.map(c=>[n(c[0]),i(c[1])]);let s;const{curveType:o,tension:a}=this.options;switch(o){default:case"curveCatmullRom":s=z0.alpha(a||V0);break;case"curveLinear":s=hs;break;case"curveBasis":s=k0;break;case"curveBasisClosed":s=E0;break;case"curveBundle":s=F0.beta(a||W0);break;case"curveCardinal":s=R0.tension(a||U0);break;case"curveMonotoneX":s=D0;break;case"curveMonotoneY":s=N0;break;case"curveNatural":s=$0;break;case"curveStep":s=I0;break;case"curveStepAfter":s=H0;break;case"curveStepBefore":s=B0;break}return L0().curve(s)(r)??""}return""}}const bs=(e,t)=>{switch(t.lineType){case"wavy":return e.wavy(t);case"dashed":return e.dashed(t);case"solid":return e.solid(t);default:return ne(t.lineType)}};class G0 extends xt{constructor(){super(...arguments),this.yScale=null,this.xScale=null}onMount(t){super.onMount(t)}onUpdate(t){super.onUpdate(t),this.clearCanvas(),this.render()}onRescale(t){super.onRescale(t),this.yScale=t.yScale,this.xScale=t.xScale,this.resetTransform(),this.render()}drawDashed(t){var r;const{ctx:n}=this,{canvas:i}=this;if(n!=null&&i!=null){const s=(r=this.yScale)==null?void 0:r.call(this,t.depth);n.save(),n.strokeStyle=t.color,this.setCtxLineStyle(n,t),this.setCtxLineWidth(n,t),n.beginPath(),n.moveTo(0,s),n.lineTo(i.width,s),n.stroke(),n.restore(),t.text&&this.drawText(n,t,n.canvas.width,s)}}drawSolid(t){const{ctx:n}=this,{canvas:i}=this,r=this.yScale(t.depth);n!=null&&i!=null&&(n.save(),n.strokeStyle=t.color,this.setCtxLineStyle(n,t),this.setCtxLineWidth(n,t),n.beginPath(),n.moveTo(0,r),n.lineTo(i.width,r),n.stroke(),n.restore(),t.text&&this.drawText(n,t,n.canvas.width,r))}drawWavy(t){const{ctx:s,canvas:o}=this;if(this.xScale!=null&&this.yScale!=null&&o!=null&&s!=null){const a=Re(4,2.5,500,this.yScale),c=a*2,h=this.yScale(t.depth)-a,l=Math.ceil(o.width/c)+1,u=this.xScale(0)%c;s.save(),s.strokeStyle=t.color,this.setCtxLineStyle(s,t),this.setCtxLineWidth(s,t);for(let f=-1;f<l;f++)s.beginPath(),s.arc(f*c+u+a,h,a,0,Math.PI),s.stroke();s.restore(),t.text&&this.drawText(s,t,s.canvas.width,h)}}drawText(t,n,i,r){const s=n.textColor||"#000",o=n.fontSize||"10px sans-serif",a=10;t.save(),t.strokeStyle=s,t.font=o,t.textAlign="end",t.textBaseline="bottom",t.fillText(n.text??"",i-a,r),t.restore()}setCtxLineStyle(t,n){bs({solid:()=>{t.setLineDash([])},dashed:()=>{t.setLineDash([8,10])},wavy:()=>{t.setLineDash([])}},n)}setCtxLineWidth(t,n){t.lineWidth=n.lineWidth||1}render(){!this.ctx||!this.yScale||!this.xScale||requestAnimationFrame(()=>{var t;this.clearCanvas(),(t=this.data)==null||t.forEach(n=>{bs({solid:i=>this.drawSolid(i),dashed:i=>this.drawDashed(i),wavy:i=>this.drawWavy(i)},n)})})}}class Ss{constructor(t,n,i){if(this.layers=[],this.createAxis=r=>{const{container:s}=this;this._svgContainer=Z(s).append("div").attr("class","axis").style("position","absolute").style("z-index","10").style("pointer-events","none");const o=this._svgContainer.append("svg").attr("height",`${s.offsetHeight}px`).attr("width",`${s.offsetWidth}px`),a=!0;return new Pi(o,a,r.xLabel,r.yLabel,r.unitOfMeasure)},this.container=t,this.layerContainer=document.createElement("div"),this.layerContainer.className="layer-container",this.container.appendChild(this.layerContainer),this.adjustToSize(+(this.container.getAttribute("width")??0),+(this.container.getAttribute("height")??0)),this._zoomPanHandler=new pr(t,r=>this.rescale(r)),n){const{xMin:r,xMax:s,yMin:o,yMax:a,xBounds:c,yBounds:h}=n;r!==void 0&&s!==void 0&&o!==void 0&&a!==void 0&&this._zoomPanHandler.setBounds([r,s],[o,a]),c&&h&&this._zoomPanHandler.setBounds(c,h)}else this._zoomPanHandler.setBounds([0,1],[0,1]);i&&(this._axis=this.createAxis(i)),this.rescale=this.rescale.bind(this)}addLayers(t){return t.forEach(n=>this.addLayer(n)),this}getLayers(){return this.layers}clearAllData(t=!0){return this.layers.forEach(n=>n.clearData(t)),this}addLayer(t,n){return this.layers.push(t),this.initLayer(t,n),this}removeLayer(t){const n=this.layers.find(i=>i.id===t);return n&&(n.onUnmount(),this.layers=this.layers.filter(i=>i.id!==t)),this}removeAllLayers(){const{layers:t}=this;return t.forEach(n=>{this.removeLayer(n.id)}),this}getLayer(t){return this.layers.find(n=>n.id===t||n.getInternalLayerIds().includes(t))}initLayer(t,n){const i={elm:this.layerContainer};t.onMount(i);const r=this.zoomPanHandler.currentStateAsEvent();if(t.onUpdate({...r,...n}),t.onRescale(r),this._svgContainer){const s=this.layers.length>0?this.layers.reduce((o,a)=>o.order>a.order?o:a).order:1;this._svgContainer.style("z-index",`${s+1}`)}return this}showLayer(t){const n=this.getLayer(t);return n?(n.setVisibility(!0,t),n.onRescale(this.zoomPanHandler.currentStateAsEvent()),this):this}hideLayer(t){const n=this.getLayer(t);return n?(n.setVisibility(!1,t),n.onRescale(this.zoomPanHandler.currentStateAsEvent()),this):this}adjustToSize(t,n){const i=Math.max(this._axis?t-mr:t,0),r=Math.max(this._axis?n-yr:n,0);if(this._axis){const s={width:t,height:n};this._axis.onResize(s)}if(this.layers){const s={width:i,height:r};this.layers.forEach(o=>o.onResize(s))}this._zoomPanHandler&&this._zoomPanHandler.adjustToSize(i,r,!0)}setReferenceSystem(t){this.layers.forEach(n=>n.referenceSystem=t)}showAxis(){var t;return(t=this._axis)==null||t.show(),this}hideAxis(){var t;return(t=this._axis)==null||t.hide(),this}showAxisLabels(){var t;return(t=this._axis)==null||t.showLabels(),this}hideAxisLabels(){var t;return(t=this._axis)==null||t.hideLabels(),this}setAxisOffset(t,n){return this._axis&&(this._axis.offsetX=t,this._axis.offsetY=n,this.layers.filter(r=>r instanceof Oe).forEach(r=>{r.offsetX=t,r.offsetY=n})),this}setXAxisOffset(t){return this._axis&&(this._axis.offsetX=t,this.layers.filter(i=>i instanceof Oe).forEach(i=>{i.offsetX=t})),this}setYAxisOffset(t){return this._axis&&(this._axis.offsetY=t,this.layers.filter(i=>i instanceof Oe).forEach(i=>{i.offsetY=t})),this}setZoomLevelBoundary(t){return this._zoomPanHandler.setZoomLevelBoundary(t),this}setMaxZoomLevel(t){return this._zoomPanHandler.setMaxZoomLevel(t),this}setMinZoomLevel(t){return this._zoomPanHandler.setMinZoomLevel(t),this}destroy(){return this.removeAllLayers(),this.layerContainer.remove(),this._axis=void 0,this._svgContainer=void 0,this}get zoomPanHandler(){return this._zoomPanHandler}get axis(){return this._axis}rescale(t){this._axis&&this._axis.onRescale(t),this.layers&&this.layers.forEach(n=>n.isVisible===!0?n.onRescale(t):{})}}class X0{constructor(t,n){this.elements={},this.listeners={},this.enabled=!0;const i=Z(n);this.elm=i.append("div").attr("id","overlay").style("z-index","11").style("position","absolute"),this.source=this.elm.node()??void 0;const{elm:r}=this;r.on("resize",s=>{const{width:o,height:a}=s.detail;r.style("width",`${o}px`).style("height",`${a}px`),this.enabled&&Object.keys(this.listeners).forEach(c=>{const h=this.elements[c]??void 0,l=this.listeners[c];l&&l.onResize&&requestAnimationFrame(()=>{var u;return(u=l.onResize)==null?void 0:u.call(l,{target:h,source:this.source,caller:t,width:o,height:a})})})}),r.on("mousemove",s=>{if(!this.enabled)return;const[o,a]=_t(s,this.elm.node());Object.keys(this.listeners).forEach(c=>{const h=this.elements[c]??void 0,l=this.listeners[c];l&&l.onMouseMove&&requestAnimationFrame(()=>{var u;return(u=l.onMouseMove)==null?void 0:u.call(l,{x:o,y:a,target:h,source:this.source,caller:t})})})}),r.on("mouseout",()=>{this.enabled&&Object.keys(this.listeners).forEach(s=>{const o=this.elements[s]||void 0,a=this.listeners[s];a&&a.onMouseExit&&requestAnimationFrame(()=>{var c;return(c=a.onMouseExit)==null?void 0:c.call(a,{target:o,source:this.source,caller:t})})})})}create(t,n){const i=this.elm.append("div").style("position","relative").style("pointer-events","none").node();if(i!=null)return this.elements[t]=i,n&&(this.listeners[t]=n),i}register(t,n){this.listeners[t]=n}remove(t){const n=this.elements[t];n&&(Z(n).remove(),delete this.elements[t]),delete this.listeners[t]}setZIndex(t){this.elm.style("z-index",t)}destroy(){var t;(t=this.source)==null||t.remove()}}const q0=(e,t)=>new X0(e,t);class j0{constructor(t){const{container:n,axisOptions:i,scaleOptions:r,referenceSystem:s,layers:o,path:a}=t;this._referenceSystem=s||a&&new Nt(a),this._overlay=q0(this,n),this.layerManager=new Ss(this._overlay.elm.node(),r,i),o&&(this.layerManager.addLayers(o),this.setOverlayZIndex(o))}setReferenceSystem(t){return this._referenceSystem=t,this.layerManager.setReferenceSystem(t),this}updatePath(t,n){return this.setReferenceSystem(new Nt(t,n)),this}clearAllData(t=!0){return this.layerManager.clearAllData(t),this}addLayer(t,n){return this.layerManager.addLayer(t,n),this.setOverlayZIndex(this.layerManager.getLayers()),this}removeLayer(t){return this.layerManager.removeLayer(t),this}removeAllLayers(){return this.layerManager.removeAllLayers(),this}getLayer(t){return this.layerManager.getLayer(t)}showLayer(t){return this.layerManager.showLayer(t),this}hideLayer(t){return this.layerManager.hideLayer(t),this}adjustToSize(t,n){this.layerManager.adjustToSize(t,n);const i={width:Math.max(t-mr,0),height:Math.max(n-yr,0)};return this.overlay.elm.dispatch("resize",{detail:i,bubbles:!0,cancelable:!0}),this}setViewport(t,n,i,r){return this.zoomPanHandler.setViewport(t,n,i,r),this}setBounds(t,n){return this.zoomPanHandler.setBounds(t,n),this}showAxis(){return this.layerManager.showAxis(),this}hideAxis(){return this.layerManager.hideAxis(),this}showAxisLabels(){return this.layerManager.showAxisLabels(),this}hideAxisLabels(){return this.layerManager.hideAxisLabels(),this}setAxisOffset(t,n){return this.layerManager.setAxisOffset(t,n),this}setXAxisOffset(t){return this.layerManager.setXAxisOffset(t),this}setYAxisOffset(t){return this.layerManager.setYAxisOffset(t),this}setZoomLevelBoundary(t){return this.zoomPanHandler.setZoomLevelBoundary(t),this}setMaxZoomLevel(t){return this.zoomPanHandler.setMaxZoomLevel(t),this}setMinZoomLevel(t){return this.zoomPanHandler.setMinZoomLevel(t),this}destroy(){return this.layerManager.destroy(),this._overlay.destroy(),this._referenceSystem=void 0,this}getHighestZIndex(t){return t.length>0?t.reduce((i,r)=>i.order>r.order?i:r).order:1}setOverlayZIndex(t){const n=this.getHighestZIndex(t);this.overlay.setZIndex(n+2)}get overlay(){return this._overlay}get referenceSystem(){return this._referenceSystem}get zoomPanHandler(){return this.layerManager.zoomPanHandler}get axis(){return this.layerManager.axis}get currentStateAsEvent(){return this.zoomPanHandler.currentStateAsEvent()}}C.Axis=Pi,C.CalloutCanvasLayer=Wl,C.CanvasLayer=xt,C.Controller=j0,C.GeomodelCanvasLayer=jl,C.GeomodelLabelsLayer=Nu,C.GeomodelLayerV2=Iu,C.GridLayer=Oe,C.HTMLLayer=kl,C.ImageLayer=Hu,C.IntersectionReferenceSystem=Nt,C.Layer=ee,C.LayerManager=Ss,C.PixiLayer=kn,C.PixiRenderApplication=El,C.ReferenceLineLayer=G0,C.SVGLayer=vr,C.SchematicLayer=ss,C.SeismicCanvasLayer=w0,C.WellborepathLayer=Y0,C.ZoomPanHandler=pr,C.assertNever=ne,C.calcSize=Re,C.defaultCasingOptions=Rr,C.defaultCementOptions=zr,C.defaultCementPlugOptions=Ir,C.defaultCementSqueezeOptions=Dr,C.defaultHoleOptions=Fr,C.defaultInternalLayerOptions=Er,C.defaultPerforationOptions=Or,C.defaultScreenOptions=Nr,C.defaultTubingOptions=$r,C.findIndexOfSample=Fn,C.findSampleAtPos=wt,C.foldCompletion=Sr,C.foldPerforationSubKind=K,C.generateProjectedTrajectory=Lu,C.generateProjectedWellborePath=Pu,C.generateSeismicSliceImage=hu,C.generateSurfaceData=fu,C.getOverlap=Nl,C.getOverlapOffset=En,C.getPicksData=Jl,C.getSeismicInfo=cu,C.getSeismicOptions=au,C.hasFracLines=Mr,C.hasPacking=Tr,C.hasSpikes=Ar,C.intersect=kr,C.isCementPlug=br,C.isCementSqueeze=wr,C.isOpenHoleFracPack=zl,C.isOverlapping=Ur,C.isOverlappingHorizontally=Dl,C.isPAndASymbol=xr,C.isSubKindCasedHoleFracPack=Pr,C.isSubKindCasedHoleFracturation=Lr,C.isSubKindPerforation=Ol,C.isSubkindCasedHoleGravelPack=Cr,C.pixelsPerUnit=Vr,C.shouldPerforationStartAtCasingDiameter=Rl,C.shouldPerforationStartAtHoleDiameter=Fl,C.transformFormationData=su,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
|
15
15
|
//# sourceMappingURL=index.umd.js.map
|