@equinor/esv-intersection 3.1.1 → 3.1.3

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.
Files changed (115) hide show
  1. package/package.json +11 -12
  2. package/dist/components/axis.d.ts +0 -47
  3. package/dist/components/axis.d.ts.map +0 -1
  4. package/dist/components/index.d.ts +0 -2
  5. package/dist/components/index.d.ts.map +0 -1
  6. package/dist/constants.d.ts +0 -12
  7. package/dist/constants.d.ts.map +0 -1
  8. package/dist/control/ExtendedCurveInterpolator.d.ts +0 -59
  9. package/dist/control/ExtendedCurveInterpolator.d.ts.map +0 -1
  10. package/dist/control/IntersectionReferenceSystem.d.ts +0 -93
  11. package/dist/control/IntersectionReferenceSystem.d.ts.map +0 -1
  12. package/dist/control/LayerManager.d.ts +0 -77
  13. package/dist/control/LayerManager.d.ts.map +0 -1
  14. package/dist/control/MainController.d.ts +0 -155
  15. package/dist/control/MainController.d.ts.map +0 -1
  16. package/dist/control/ZoomPanHandler.d.ts +0 -160
  17. package/dist/control/ZoomPanHandler.d.ts.map +0 -1
  18. package/dist/control/index.d.ts +0 -6
  19. package/dist/control/index.d.ts.map +0 -1
  20. package/dist/control/interfaces.d.ts +0 -37
  21. package/dist/control/interfaces.d.ts.map +0 -1
  22. package/dist/control/overlay.d.ts +0 -21
  23. package/dist/control/overlay.d.ts.map +0 -1
  24. package/dist/datautils/colortable.d.ts +0 -2
  25. package/dist/datautils/colortable.d.ts.map +0 -1
  26. package/dist/datautils/findsample.d.ts +0 -3
  27. package/dist/datautils/findsample.d.ts.map +0 -1
  28. package/dist/datautils/index.d.ts +0 -7
  29. package/dist/datautils/index.d.ts.map +0 -1
  30. package/dist/datautils/interfaces.d.ts +0 -64
  31. package/dist/datautils/interfaces.d.ts.map +0 -1
  32. package/dist/datautils/picks.d.ts +0 -75
  33. package/dist/datautils/picks.d.ts.map +0 -1
  34. package/dist/datautils/schematicShapeGenerator.d.ts +0 -60
  35. package/dist/datautils/schematicShapeGenerator.d.ts.map +0 -1
  36. package/dist/datautils/seismicimage.d.ts +0 -46
  37. package/dist/datautils/seismicimage.d.ts.map +0 -1
  38. package/dist/datautils/surfacedata.d.ts +0 -11
  39. package/dist/datautils/surfacedata.d.ts.map +0 -1
  40. package/dist/datautils/trajectory.d.ts +0 -15
  41. package/dist/datautils/trajectory.d.ts.map +0 -1
  42. package/dist/index.cjs +0 -15
  43. package/dist/index.cjs.map +0 -1
  44. package/dist/index.d.ts +0 -7
  45. package/dist/index.d.ts.map +0 -1
  46. package/dist/index.mjs +0 -8380
  47. package/dist/index.mjs.map +0 -1
  48. package/dist/index.umd.js +0 -15
  49. package/dist/index.umd.js.map +0 -1
  50. package/dist/interfaces.d.ts +0 -86
  51. package/dist/interfaces.d.ts.map +0 -1
  52. package/dist/layers/CalloutCanvasLayer.d.ts +0 -72
  53. package/dist/layers/CalloutCanvasLayer.d.ts.map +0 -1
  54. package/dist/layers/CustomDisplayObjects/ComplexRope.d.ts +0 -22
  55. package/dist/layers/CustomDisplayObjects/ComplexRope.d.ts.map +0 -1
  56. package/dist/layers/CustomDisplayObjects/ComplexRopeGeometry.d.ts +0 -24
  57. package/dist/layers/CustomDisplayObjects/ComplexRopeGeometry.d.ts.map +0 -1
  58. package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRope.d.ts +0 -21
  59. package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRope.d.ts.map +0 -1
  60. package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRopeGeometry.d.ts +0 -27
  61. package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRopeGeometry.d.ts.map +0 -1
  62. package/dist/layers/CustomDisplayObjects/UniformTextureStretchRope.d.ts +0 -18
  63. package/dist/layers/CustomDisplayObjects/UniformTextureStretchRope.d.ts.map +0 -1
  64. package/dist/layers/CustomDisplayObjects/UniformTextureStretchRopeGeometry.d.ts +0 -25
  65. package/dist/layers/CustomDisplayObjects/UniformTextureStretchRopeGeometry.d.ts.map +0 -1
  66. package/dist/layers/GeomodelCanvasLayer.d.ts +0 -29
  67. package/dist/layers/GeomodelCanvasLayer.d.ts.map +0 -1
  68. package/dist/layers/GeomodelLabelsLayer.d.ts +0 -50
  69. package/dist/layers/GeomodelLabelsLayer.d.ts.map +0 -1
  70. package/dist/layers/GeomodelLayerV2.d.ts +0 -13
  71. package/dist/layers/GeomodelLayerV2.d.ts.map +0 -1
  72. package/dist/layers/GridLayer.d.ts +0 -30
  73. package/dist/layers/GridLayer.d.ts.map +0 -1
  74. package/dist/layers/ImageCanvasLayer.d.ts +0 -21
  75. package/dist/layers/ImageCanvasLayer.d.ts.map +0 -1
  76. package/dist/layers/ReferenceLineLayer.d.ts +0 -29
  77. package/dist/layers/ReferenceLineLayer.d.ts.map +0 -1
  78. package/dist/layers/SchematicLayer.d.ts +0 -114
  79. package/dist/layers/SchematicLayer.d.ts.map +0 -1
  80. package/dist/layers/SeismicCanvasLayer.d.ts +0 -19
  81. package/dist/layers/SeismicCanvasLayer.d.ts.map +0 -1
  82. package/dist/layers/WellborePathLayer.d.ts +0 -18
  83. package/dist/layers/WellborePathLayer.d.ts.map +0 -1
  84. package/dist/layers/base/CanvasLayer.d.ts +0 -20
  85. package/dist/layers/base/CanvasLayer.d.ts.map +0 -1
  86. package/dist/layers/base/HTMLLayer.d.ts +0 -14
  87. package/dist/layers/base/HTMLLayer.d.ts.map +0 -1
  88. package/dist/layers/base/Layer.d.ts +0 -70
  89. package/dist/layers/base/Layer.d.ts.map +0 -1
  90. package/dist/layers/base/PixiLayer.d.ts +0 -33
  91. package/dist/layers/base/PixiLayer.d.ts.map +0 -1
  92. package/dist/layers/base/SVGLayer.d.ts +0 -14
  93. package/dist/layers/base/SVGLayer.d.ts.map +0 -1
  94. package/dist/layers/base/index.d.ts +0 -6
  95. package/dist/layers/base/index.d.ts.map +0 -1
  96. package/dist/layers/index.d.ts +0 -17
  97. package/dist/layers/index.d.ts.map +0 -1
  98. package/dist/layers/schematicInterfaces.d.ts +0 -210
  99. package/dist/layers/schematicInterfaces.d.ts.map +0 -1
  100. package/dist/utils/arc-length.d.ts +0 -24
  101. package/dist/utils/arc-length.d.ts.map +0 -1
  102. package/dist/utils/binary-search.d.ts +0 -9
  103. package/dist/utils/binary-search.d.ts.map +0 -1
  104. package/dist/utils/color.d.ts +0 -6
  105. package/dist/utils/color.d.ts.map +0 -1
  106. package/dist/utils/index.d.ts +0 -2
  107. package/dist/utils/index.d.ts.map +0 -1
  108. package/dist/utils/root-finder.d.ts +0 -35
  109. package/dist/utils/root-finder.d.ts.map +0 -1
  110. package/dist/utils/text.d.ts +0 -15
  111. package/dist/utils/text.d.ts.map +0 -1
  112. package/dist/utils/vectorUtils.d.ts +0 -16
  113. package/dist/utils/vectorUtils.d.ts.map +0 -1
  114. package/dist/vendor/pixi-dashed-line/index.d.ts +0 -57
  115. package/dist/vendor/pixi-dashed-line/index.d.ts.map +0 -1
package/dist/index.umd.js DELETED
@@ -1,15 +0,0 @@
1
- (function(C,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("pixi.js")):typeof define=="function"&&define.amd?define(["exports","pixi.js"],F):(C=typeof globalThis<"u"?globalThis:C||self,F(C.esvintersection={},C.PIXI))})(this,function(C,F){"use strict";function Ss(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=Ss(F);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(),v=+m[0]+c,x=+m[m.length-1]+c,M=(t.bandwidth?Ls:Ps)(t.copy(),c),b=d.selection?d.selection():d,S=b.selectAll(".domain").data([null]),T=b.selectAll(".tick").data(g,t).order(),L=T.exit(),E=T.enter().append("g").attr("class","tick"),D=T.select("line"),P=T.select("text");S=S.merge(S.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(E),D=D.merge(E.append("line").attr("stroke","currentColor").attr(l+"2",h*s)),P=P.merge(E.append("text").attr("fill","currentColor").attr(l,h*y).attr("dy",e===Ue?"0em":e===We?"0.71em":"0.32em")),d!==b&&(S=S.transition(d),T=T.transition(d),D=D.transition(d),P=P.transition(d),L=L.transition(d).attr("opacity",jn).attr("transform",function(z){return isFinite(z=M(z))?u(z+c):this.getAttribute("transform")}),E.attr("opacity",jn).attr("transform",function(z){var I=this.parentNode.__axis;return u((I&&isFinite(I=I(z))?I:M(z))+c)})),L.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(z){return u(M(z)+c)}),D.attr(l+"2",h*s),P.attr(l,h*y).text(p),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=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 Ds(e){return e===null?NaN:+e}const zs=Kn(se).right;Kn(Ds).center;const Ns=zs;class Qn extends Map{constructor(t,n=Is){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(Bs(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 Bs({_intern:e,_key:t},n){const i=t(n);return e.has(i)&&(n=e.get(n),e.delete(i)),n}function Is(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 To=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 v=Math.sqrt(p),x=(f*f-h*h+i*p)/(2*h*n*v),M=(f*f-h*h-i*p)/(2*f*n*v),b=Math.log(Math.sqrt(x*x+1)-x),S=Math.log(Math.sqrt(M*M+1)-M);m=(S-b)/t,y=function(T){var L=T*m,E=_i(b),D=h/(n*v)*(E*bo(t*L+b)-wo(b));return[a+D*d,c+D*g,h*E/_i(t*L+b)]}}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 So(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 Do(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var zo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function de(e){if(!(t=zo.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 Ti(e){return e}var Si=Array.prototype.map,Mi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Bo(e){var t=e.grouping===void 0||e.thousands===void 0?Ti:Oo(Si.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?Ti:Do(Si.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,v=u.comma,x=u.precision,M=u.trim,b=u.type;b==="n"?(v=!0,b="g"):bi[b]||(x===void 0&&(x=12),M=!0,b="g"),(y||f==="0"&&d==="=")&&(y=!0,f="0",d="=");var S=p==="$"?n:p==="#"&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",T=p==="$"?i:/[%p]/.test(b)?o:"",L=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 D(P){var z=S,I=T,_,A,w;if(b==="c")I=L(P)+I,P="";else{P=+P;var k=P<0||1/P<0;if(P=isNaN(P)?c:L(Math.abs(P),x),M&&(P=No(P)),k&&+P==0&&g!=="+"&&(k=!1),z=(k?g==="("?g:a:g==="-"||g==="("?"":g)+z,I=(b==="s"?Mi[8+xi/3]:"")+I+(k&&g==="("?")":""),E){for(_=-1,A=P.length;++_<A;)if(w=P.charCodeAt(_),48>w||w>57){I=(w===46?r+P.slice(_+1):P.slice(_))+I,P=P.slice(0,_);break}}}v&&!y&&(P=t(P,1/0));var R=z.length+P.length+I.length,O=R<m?new Array(m-R+1).join(f):"";switch(v&&y&&(P=t(O+P,O.length?m-I.length:1/0),O=""),d){case"<":P=z+P+I+O;break;case"=":P=z+O+P+I;break;case"^":P=O.slice(0,R=O.length>>1)+z+P+I+O.slice(R);break;default:P=O+z+P+I;break}return s(P)}return D.toString=function(){return u+""},D}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;Io({thousands:",",grouping:[3],currency:["$",""]});function Io(e){return ge=Bo(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
- Copyright (c) Microsoft Corporation. All rights reserved.
3
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
- this file except in compliance with the License. You may obtain a copy of the
5
- License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
- MERCHANTABLITY OR NON-INFRINGEMENT.
11
-
12
- See the Apache Version 2.0 License for specific language governing permissions
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 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 Di(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 Di(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 zi(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=zi(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(zi(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],v=a[2],x=a[3];m-v!=0&&(y-m!=0&&y-v!=0&&(l=(1-s)*(v-m)*((f-d)/(y-m)-(f-g)/(y-v)+(d-g)/(m-v))),m-x!=0&&v-x!=0&&(u=(1-s)*(v-m)*((d-g)/(m-v)-(d-p)/(m-x)+(g-p)/(v-x))))}else l=(1-s)*(g-f)*.5,u=(1-s)*(p-d)*.5;var M=2*d-2*g+l+u,b=-3*d+3*g-2*l-u,S=l,T=d;c[h]=[M,b,S,T]}return c}function Dt(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>-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(Dt,0),s=0;i.push(0);for(var o=1;o<=this._subDivisions;o++)s+=ye(n=this.evaluateForT(Dt,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(Dt,h),this.evaluateForT(Dt,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]]],Bi=$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>Bi)throw Error("Order for Gaussian Quadrature must be in the range of ".concat(5," and ").concat(Bi,"."));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(zt,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,v=(g=r[a+1])-m,x=p,M=s[a+1];p=M;var b=y/v,S=(x+M-2*b)/(v*v),T=(3*b-2*x-M)/v;f.push(S),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(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],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(Dt,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(zt,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(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=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(zt,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(zt,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 v=ln(m-1,g.points,g.closed)[2];if(m<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(g.tension<1){var M=h*s-(m-1),b=h*o-(m-1),S=function(E){return E>-it&&E<=1+it&&(m-1!==l||E>M)&&(m!==u||E<b)},T=g._curveMapper.getCoefficients(m-1),L=function(E){var D=T[E];Di(3*D[0],2*D[1],D[2]).filter(S).forEach(function(P){var z=Dt(P,T[E]);z<i[E]&&(i[E]=z),z>r[E]&&(r[E]=z)})};for(x=0;x<T.length;x++)L(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 v=(y[m]+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 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,v=0)=>{const x=(f+d)/2,M=t(x),b=$.distance(g,M),S=$.distance(M,p),T=b+S;if(v>=s&&Math.abs(T-y)<m||v>=o)return T;const L=m/2,E=v+1;return a(f,x,g,M,b,L,E)+a(x,d,M,p,S,L,E)},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 Ii=.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||Ii,arcDivisions:i||Hi}),curtain:n.curtainInterpolator||new pn(this.projectedPath,{tension:r||Ii,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),v=Math.ceil((f-u)/y*t),x=t-v-m;if(c){p.push(c);for(let b=1;b<m;b++){const S=b/m*r*this.displacement;p.push([c[0]-this.startVector[0]*S,c[1]-this.startVector[1]*S])}}const M=this.interpolators.trajectory.getPoints(v-1,null,u,f);if(p.push(...M),h){for(let b=1;b<x-1;b++){const S=b/x*s*this.displacement;p.push([g[0]+this.endVector[0]*S,g[1]+this.endVector[1]*S])}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 v=s;v>0;v--){const x=v*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 v=1;v<a;v++){const x=v*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 Ta(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 Sa(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 Sa(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 Da(e){return this.selectAll(e==null?Ra:Oa(typeof e=="function"?e:Xi(e)))}function za(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 Ba(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 Ia(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?Ia:Ba,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 v=0,x=0,M,b;v<g;++v)if(M=p[v]){for(v>=x&&(x=v+1);!(b=y[x])&&++x<g;);M._next=b||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 Tc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Sc(e){return arguments.length?this.each(e==null?wc:(typeof e=="function"?Tc: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 Dc(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 zc(){var e=this.parentNode;e&&e.removeChild(this)}function Nc(){return this.each(zc)}function $c(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ic(e){return this.select(e?Bc:$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:Ta,selectAll:Ca,selectChild:Ea,selectChildren:Da,filter:za,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:Sc,html:Pc,raise:kc,lower:Fc,append:Rc,insert:Dc,remove:Nc,clone:Ic,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 Bt=0,Zt=0,Kt=0,ir=1e3,be,Qt,Te=0,Lt=0,Se=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()+Se)}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,Tn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tn())}};function sr(e,t,n){var i=new Me;return i.restart(e,t,n),i}function sh(){bn(),++Bt;for(var e=be,t;e;)(t=Lt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Bt}function or(){Lt=(Te=Jt.now())+Se,Bt=Zt=0;try{sh()}finally{Bt=0,ah(),Lt=0}}function oh(){var e=Jt.now(),t=e-Te;t>ir&&(Se-=t,Te=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,Tn(i)}function Tn(e){if(!Bt){Zt&&(Zt=clearTimeout(Zt));var t=e-Lt;t>24?(e<1/0&&(Zt=setTimeout(or,e-Jt.now()-Se)),Kt&&(Kt=clearInterval(Kt))):(Kt||(Te=Jt.now(),Kt=setInterval(oh,ir)),Bt=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,Sn=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=Sn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Sn){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>Sn&&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 Th(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Sh(e,t){var n,i;function r(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&Th(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?Sh: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 Dh(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ct(this,e).ease=n}}function zh(e){if(typeof e!="function")throw new Error;return this.each(Dh(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 Bh(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 Ih(e,t,n){var i,r,s=Bh(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(Ih(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:zh,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=To,h=vn("start","zoom","end"),l,u,f,d=500,g=150,p=0,y=10;function m(_){_.property("__zoom",gr).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",D).filter(r).on("touchstart.zoom",P).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",I).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(_,A,w,k){var R=_.selection?_.selection():_;R.property("__zoom",gr),_!==R?b(_,A,w,k):R.interrupt().each(function(){S(this,arguments).event(k).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(_,A,w,k){m.scaleTo(_,function(){var R=this.__zoom.k,O=typeof A=="function"?A.apply(this,arguments):A;return R*O},w,k)},m.scaleTo=function(_,A,w,k){m.transform(_,function(){var R=t.apply(this,arguments),O=this.__zoom,N=w==null?M(R):typeof w=="function"?w.apply(this,arguments):w,B=O.invert(N),H=typeof A=="function"?A.apply(this,arguments):A;return n(x(v(O,H),N,B),R,o)},w,k)},m.translateBy=function(_,A,w,k){m.transform(_,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof w=="function"?w.apply(this,arguments):w),t.apply(this,arguments),o)},null,k)},m.translateTo=function(_,A,w,k,R){m.transform(_,function(){var O=t.apply(this,arguments),N=this.__zoom,B=k==null?M(O):typeof k=="function"?k.apply(this,arguments):k;return n(Pn.translate(B[0],B[1]).scale(N.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof w=="function"?-w.apply(this,arguments):-w),O,o)},k,R)};function v(_,A){return A=Math.max(s[0],Math.min(s[1],A)),A===_.k?_:new gt(A,_.x,_.y)}function x(_,A,w){var k=A[0]-w[0]*_.k,R=A[1]-w[1]*_.k;return k===_.x&&R===_.y?_:new gt(_.k,k,R)}function M(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function b(_,A,w,k){_.on("start.zoom",function(){S(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(k).end()}).tween("zoom",function(){var R=this,O=arguments,N=S(R,O).event(k),B=t.apply(R,O),H=w==null?M(B):typeof w=="function"?w.apply(R,O):w,V=Math.max(B[1][0]-B[0][0],B[1][1]-B[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)}N.zoom(null,Y)}})}function S(_,A,w){return!w&&_.__zooming||new T(_,A)}function T(_,A){this.that=_,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,A),this.taps=0}T.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,A){return this.mouse&&_!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&_!=="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(_){var A=Z(this.that).datum();h.call(_,this.that,new pl(_,{sourceEvent:this.sourceEvent,target:m,type:_,transform:this.that.__zoom,dispatch:h}),A)}};function L(_,...A){if(!e.apply(this,arguments))return;var w=S(this,A).event(_),k=this.__zoom,R=Math.max(s[0],Math.min(s[1],k.k*Math.pow(2,i.apply(this,arguments)))),O=_t(_);if(w.wheel)(w.mouse[0][0]!==O[0]||w.mouse[0][1]!==O[1])&&(w.mouse[1]=k.invert(w.mouse[0]=O)),clearTimeout(w.wheel);else{if(k.k===R)return;w.mouse=[O,k.invert(O)],Le(this),w.start()}te(_),w.wheel=setTimeout(N,g),w.zoom("mouse",n(x(v(k,R),w.mouse[0],w.mouse[1]),w.extent,o));function N(){w.wheel=null,w.end()}}function E(_,...A){if(f||!e.apply(this,arguments))return;var w=_.currentTarget,k=S(this,A,!0).event(_),R=Z(_.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",V,!0),O=_t(_,w),N=_.clientX,B=_.clientY;nh(_.view),Ln(_),k.mouse=[O,this.__zoom.invert(O)],Le(this),k.start();function H(U){if(te(U),!k.moved){var X=U.clientX-N,J=U.clientY-B;k.moved=X*X+J*J>p}k.event(U).zoom("mouse",n(x(k.that.__zoom,k.mouse[0]=_t(U,w),k.mouse[1]),k.extent,o))}function V(U){R.on("mousemove.zoom mouseup.zoom",null),ih(U.view,k.moved),te(U),k.event(U).end()}}function D(_,...A){if(e.apply(this,arguments)){var w=this.__zoom,k=_t(_.changedTouches?_.changedTouches[0]:_,this),R=w.invert(k),O=w.k*(_.shiftKey?.5:2),N=n(x(v(w,O),k,R),t.apply(this,A),o);te(_),a>0?Z(this).transition().duration(a).call(b,N,k,_):Z(this).call(m.transform,N,k,_)}}function P(_,...A){if(e.apply(this,arguments)){var w=_.touches,k=w.length,R=S(this,A,_.changedTouches.length===k).event(_),O,N,B,H;for(Ln(_),N=0;N<k;++N)B=w[N],H=_t(B,this),H=[H,this.__zoom.invert(H),B.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(_,...A){if(this.__zooming){var w=S(this,A).event(_),k=_.changedTouches,R=k.length,O,N,B,H;for(te(_),O=0;O<R;++O)N=k[O],B=_t(N,this),w.touch0&&w.touch0[2]===N.identifier?w.touch0[0]=B:w.touch1&&w.touch1[2]===N.identifier&&(w.touch1[0]=B);if(N=w.that.__zoom,w.touch1){var V=w.touch0[0],U=w.touch0[1],X=w.touch1[0],J=w.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;N=v(N,Math.sqrt(Y/q)),B=[(V[0]+X[0])/2,(V[1]+X[1])/2],H=[(U[0]+J[0])/2,(U[1]+J[1])/2]}else if(w.touch0)B=w.touch0[0],H=w.touch0[1];else return;w.zoom("touch",n(x(N,B,H),w.extent,o))}}function I(_,...A){if(this.__zooming){var w=S(this,A).event(_),k=_.changedTouches,R=k.length,O,N;for(Ln(_),f&&clearTimeout(f),f=setTimeout(function(){f=null},d),O=0;O<R;++O)N=k[O],w.touch0&&w.touch0[2]===N.identifier?delete w.touch0:w.touch1&&w.touch1[2]===N.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&&(N=_t(N,this),Math.hypot(u[0]-N[0],u[1]-N[1])<y)){var B=Z(this).on("dblclick.zoom");B&&B.apply(this,arguments)}}}return m.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:ke(+_),m):i},m.filter=function(_){return arguments.length?(e=typeof _=="function"?_:ke(!!_),m):e},m.touchable=function(_){return arguments.length?(r=typeof _=="function"?_:ke(!!_),m):r},m.extent=function(_){return arguments.length?(t=typeof _=="function"?_:ke([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),m):t},m.scaleExtent=function(_){return arguments.length?(s[0]=+_[0],s[1]=+_[1],m):[s[0],s[1]]},m.translateExtent=function(_){return arguments.length?(o[0][0]=+_[0][0],o[1][0]=+_[1][0],o[0][1]=+_[0][1],o[1][1]=+_[1][1],m):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},m.constrain=function(_){return arguments.length?(n=_,m):n},m.duration=function(_){return arguments.length?(a=+_,m):a},m.interpolate=function(_){return arguments.length?(c=_,m):c},m.on=function(){var _=h.on.apply(h,arguments);return _===h?m:_},m.clickDistance=function(_){return arguments.length?(p=(_=+_)*_,m):Math.sqrt(p)},m.tapDistance=function(_){return arguments.length?(y=+_,m):y},m}const bl=.1,Tl=256;class pr{constructor(t,n,i={maxZoomLevel:Tl,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,v=o[0]-(l?-y:y),x=a[0]-(u?-m:m);i.domain([v,v+(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,v=(o[0]-t)/(l?-y:y),x=(a[0]-m)/((u?-y:y)/c);return Pn.translate(v,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 Sl={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||Sl;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=F.autoDetectRenderer(n),this.stage=new F.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 F.Renderer?(s=this.renderer)==null?void 0:s.gl:void 0;t===F.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 F.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",Tr=(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),Sr=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 Dl(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},Dr={firstColor:"#c7b9ab",secondColor:"#5b5b5b",scalingFactor:4},zr={firstColor:"#8b6713",secondColor:"#000000",scalingFactor:4},Nr={scalingFactor:4,lineColor:"#63666a"},$r={scalingFactor:1,innerColor:"#eeeeff",outerColor:"#777788"},Br={firstColor:"#c7b9ab",secondColor:"#000000",scalingFactor:4},Ir=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 zl(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=Ir,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=Ir,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,Bl=11,Il=7,Hl=20,Vl=120,Ul=19,Wl="rgba(0, 0, 0, 0.5)",Yl=5,Gl=5;function Xl(e,t){return e??t}const st={topleft:"topleft",topright:"topright",bottomleft:"bottomleft",bottomright:"bottomright"};class ql 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)||Bl,this.fontSizeFactor=(n==null?void 0:n.fontSizeFactor)||Il,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,this.fontColor=n==null?void 0:n.fontColor,n!=null&&n.backgroundColor?(this.backgroundActive=!0,this.backgroundColor=n.backgroundColor):(this.backgroundActive=!1,this.backgroundColor=Wl),this.backgroundPadding=(n==null?void 0:n.backgroundPadding)||Yl,this.backgroundBorderRadius=Xl(n==null?void 0:n.backgroundBorderRadius,Gl)}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)})})}renderBackground(t,n,i,r,s){const{ctx:o}=this;if(o==null)return;const a=this.backgroundPadding,c=this.backgroundBorderRadius,h=this.measureTextWidth(t,s,"arial","bold"),l=this.measureTextWidth(n,s),u=Math.max(h,l)+a*2,f=(s+a)*2,d=i-a,g=r-2*s-a;if(o.fillStyle=this.backgroundColor,c>0){const p=d+u,y=g+f;o.beginPath(),o.moveTo(d+c,g),o.lineTo(p-c,g),o.quadraticCurveTo(p,g,p,g+c),o.lineTo(p,y-c),o.quadraticCurveTo(p,y,p-c,y),o.lineTo(d+c,y),o.quadraticCurveTo(d,y,d,y-c),o.lineTo(d,g+c),o.quadraticCurveTo(d,g,d+c,g),o.fill()}else o.fillRect(d,g,u,f)}renderText(t,n,i,r,s,o="arial",a="normal"){const{ctx:c}=this;c!=null&&(c.font=`${a} ${r}px ${o}`,c.fillStyle=this.fontColor||s,c.fillText(t,n,i))}measureTextWidth(t,n,i="arial",r="normal"){const{ctx:s}=this;return s==null?0:(s.font=`${r} ${n}px ${i}`,s.measureText(t).width)}renderPoint(t,n,i,r=3){const{ctx:s}=this;s!=null&&(s.fillStyle=i,s.beginPath(),s.moveTo(t,n),s.arc(t,n,r,0,Math.PI*2),s.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.backgroundActive&&this.renderBackground(t,n,a,c,h),this.renderAnnotation(t,n,a,c,h,r),this.renderPoint(u,f,r),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 jl=16,Zl=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 Kl(e){return typeof e=="string"?e:`#${e.toString(jl).padStart(Zl,"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 Kl(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),v=(l=e[m])==null?void 0:l[0];if(s==null||o==null||v==null)return-1;if(t>=s&&t<v)r=m,o=(u=e[r])==null?void 0:u[0];else if(t>=v&&t<=o)i=m,s=(f=e[i])==null?void 0:f[0];else if(t<=s&&t>v)r=m,o=(d=e[r])==null?void 0:d[0];else if(t<=v&&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 v=(p=e[m])==null?void 0:p[0],x=(y=e[m+1])==null?void 0:y[0];if(v!=null&&x!=null&&Math.min(v,x)<=t&&t<=Math.max(v,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 tu(e){return e?e.map(t=>Rn(t,"ref-picks")):[]}function eu(e){return e?e.filter(t=>t.entryPick.md===t.from).map(t=>Rn(t.entryPick,"strat-picks")):[]}function nu(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 iu=e=>[...tu(e.nonUnitPicks),...eu(e.unitPicks),...nu(e.unitPicks)].sort((t,n)=>t.md-n.md),ru=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 su(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 ou=e=>e.map(ru);function au(e,t){const n=ou(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 cu(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 hu(e,t){var a;const{joined:n,nonUnitPicks:i}=au(e,t),s=cu(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=su(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 lu(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 uu=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 fu(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 du(e,t,n,i={isLeftToRight:!0}){var _,A,w,k,R,O,N,B;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=((_=t[0])==null?void 0:_[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=lu(n,g),y=new Uint8ClampedArray(f*d*4);let m=0;const v=(g-1)/l.difference;let x=i!=null&&i.isLeftToRight?(w=t[0])==null?void 0:w[0]:(k=t[t.length-1])==null?void 0:k[0];const M=u/f*(i!=null&&i.isLeftToRight?-1:1);let b,S,T,L,E;const D=[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++)b=(N=r[lt])==null?void 0:N[V],S=(B=r[lt])==null?void 0:B[V+1],b==null||S==null?(E=D,P=0):(T=b*(1-q)+S*q,L=(T-l.min)*v,L=mt(~~L,0,g-1),E=p[L],P=255),y.set([E[0],E[1],E[2],P],m),m+=f*4;x+=M}const z=new ImageData(y,f,d);return await createImageBitmap(z,0,0,f,d)}const gu=2147483648,pu=4294967295;function mu(e,t,n){const i=n.filter(d=>d.data.values),r=bu(i),s=new Map,o=xu(r,t,s);wu(o);const a=yu(r,e),c=Cu(e,o,t),h=vu(s,c),u=[..._u(h,e),...Object.values(c).flat().filter(d=>!d.exclude)];return{lines:a,areas:u}}function yu(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 _u(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 vu(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:Su(r),top:o.data.map(a=>a[1])}})}function xu(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 wu(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 bu(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 Tu(e){return e.colorR===null||e.colorG===null||e.colorB===null?gu:e.colorR<<16|e.colorG<<8|e.colorB}const Su=ni().domain([0,100]).range(So(Wt("#e6f1cf","#85906d"),10));function Mu(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)||Au(e,a,i))return o}}function Au(e,t,n){const i=[];return Wr(n,e.name,i),i.some(r=>t.name===r.identifier)}function Cu(e,t,n){return t.reduce((r,s,o)=>{var a;if(!s.isBase){r[s.group]||(r[s.group]=[]);const c=Mu(s,o,t,n);(a=r[s.group])==null||a.push({id:s.name,label:s.name,color:s.unit&&Tu(s.unit)||pu,exclude:s.visualization==="none"||!s.unit,data:e.map((h,l)=>{const u=s.values[l]!=null?Pu(c,t,l):void 0;return[h[0],s.values[l],u]})})}return r},{})}function Pu(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,Lu=150,ku=30,Eu=10;function Fu(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 Ru(e,t){if(!e||e.length===0)return[];const n=e?e.map(v=>[v.easting,v.northing,v.tvd,v.md]):[],i=new gn(n,{tension:.75,arcDivisions:5e3}),r=i.length,s=Math.round(r*Eu);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<Lu){const x=t/180*Math.PI;l=new $(Math.cos(x),Math.sin(x)).mutable}else l=Ou(o,ku);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(v=>l.set(p).scale(u*(1-v)).subFrom(a).toArray()),g.pop(),d.push(...g)),d.push(...o);const y=Li(Math.ceil(On*Yr)).map(v=>l.set(p).scale(On*v).add(c).toArray()).splice(1);return d.push(...y),Xr(d,void 0,f)}function Ou(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 Du=18,zu=8,Nu=13,$u="black",Bu="Arial",Iu=70;class Hu extends xt{constructor(t,n){super(t,n),this.defaultMargins=Du,this.defaultMinFontSize=zu,this.defaultMaxFontSize=Nu,this.defaultTextColor=$u,this.defaultFont=Bu,this.isLabelsOnLeftSide=!0,this.maxFontSizeInWorldCoordinates=Iu,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 v=(this.options.margins||this.defaultMargins)*(l?-1:1)/d,x=this.options.minFontSize||this.defaultMinFontSize;let b=(this.options.maxFontSize||this.defaultMaxFontSize)/g;b>h&&(b=h,b*g<x&&(b=x/g));const S=u.invert(u.range()[0])+v,T=u.invert(u.range()[1])-v,[L,E]=this.getSurfacesAreaEdges();c.save(),c.font=`${b*g}px ${this.options.font||this.defaultFont}`;let D=c.measureText(i.label??""),P=D.width/d;if(y){const W=S+(l?-P:P);(!l&&W>E||l&&W<E)&&(y=!1)}else{const W=T+(l?P:-P);(!l&&W<L||l&&W>L)&&(y=!0)}let z;const I=.07;y?z=l?Math.min(L,S):Math.max(L,S):z=l?Math.max(E,T):Math.min(E,T);const _=f.invert(f.range()[0]),A=f.invert(f.range()[1]),w=5,k=3,R=I*(P/k)*(y?1:-1)*(l?-1:1),O=P/w*(y?1:-1)*(l?-1:1),N=a.map(W=>[W[0],W[1]]),B=this.calcPos(N,z,k,R,_,A);if(!B)return;const H=a.map(W=>[W[0],W[2]]);let V=this.calcPos(H,z,k,R,_,A,(r==null?void 0:r.data.map(W=>[W[0],W[1]]))??[],s,o);V||(V=new $(B.x,A));const U=V.y-B.y;if(U<b){if(U*g<x)return;b=U,c.font=`${b*g}px ${this.options.font||this.defaultFont}`,D=c.measureText(i.label??""),P=D.width/d}const X=y!==l?$.right:$.left,J=this.calcAreaDir(N,H,z,w,O,X,_,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=(B.y+V.y)/2,nf=l?-Y:Y;c&&(c.textAlign=y?"left":"right",c.translate(u(q),f(lt)),c.rotate(nf),c.fillStyle=this.options.textColor||this.defaultTextColor,c.font=`${b*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,v=o.invert(o.range()[1])-f,[x,M]=this.getSurfacesAreaEdges();let b;const S=5;u?b=s?Math.max(M,v):Math.min(M,v):b=s?Math.min(x,m):Math.max(x,m);const T=y/S*(u?-1:1),{data:L}=i,E=this.calcPos(L,b,S,T),D=this.calcLineDir(L,b,S,T,l,u?$.left:$.right);if(!E||!D)return;const P=b,z=E.y-_r-g/2,I=$.angleRight(D)-(u?Math.PI:0);r&&(r.textAlign=u?"right":"left",r.translate(o(P),a(z)),r.rotate(I),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 L=i+T*s,E=wt(t,L,a,c),D=wt(n,L,a,c)||c,P=this.getAlternativeYValueIfAvailable(L,a,c,f,d,g),z=P?Math.min(D,P):D;if(T===0){if(E===null)return $.angleRight(o);const I=(E+z)/2;m=new $(i,I)}else E!==null?(y.set(L,(E+z)/2),y.sub(m),p.push($.angleRight(y))):p.push($.angleRight(o))}const v=p[0],x=p.map(T=>T-v);let M=0;return x.reduce((T,L)=>{const E=(Math.abs(L)-h)/l,D=Math.pow(1-mt(E,0,1),u);return M+=D,T+L*D},0)/M+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(){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,I,_,A,w;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],(I=f[0])==null?void 0:I[0]),g=Math.min((_=u[0])==null?void 0:_[0],(A=f[0])==null?void 0:A[0]),p={left:n?d:g,right:n?g:d},y=this.getMarginsInWorldCoordinates(),m=a+y,v=c-y,[x,M]=this.getSurfacesAreaEdges(),b=n?Math.min(m,x):Math.max(m,x),S=n?Math.max(v,M):Math.min(v,M),T=Math.max(n?b-p.left:p.left-b,0),L=Math.max(n?p.right-S:S-p.right,0),E=T*s,D=L*s;return T>L||E>o||E<o&&D<o&&n||((w=f[0])==null?void 0:w[1])<h}}const Vu=1e4;class Uu 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])||Vu);n.push(i),i=void 0}}return n},this.generateAreaPolygon=t=>{const n=new F.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 F.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,Wu={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||Wu},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()),v=this.mapMinorTicks(c.ticks());this.renderTicksX(a,m,p,y),this.renderTicksY(c,v,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 Yu 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 Gu={dash:[10,5],width:1,color:16777215,alpha:1,scale:1,useTexture:!1,alignment:.5},Qr=class St{constructor(t,n={}){this.cursor=new ot.Point,this.scale=1,this.graphics=t,n={...Gu,...n},this.dash=n.dash,this.dashSize=this.dash.reduce((i,r)=>i+r),this.useTexture=n.useTexture,this.options=n,this.setLineStyle()}setLineStyle(){const t=this.options;if(this.useTexture){const n=St.getTexture(t,this.dashSize);this.graphics.lineTextureStyle({width:t.width*t.scale,color:t.color,alpha:t.alpha,texture:n,alignment:t.alignment})}else this.graphics.lineStyle({width:t.width*t.scale,color:t.color,alpha:t.alpha,cap:t.cap,join:t.join,alignment:t.alignment});this.scale=t.scale}static distance(t,n,i,r){return Math.sqrt(Math.pow(i-t,2)+Math.pow(r-n,2))}moveTo(t,n){return this.lineLength=0,this.cursor.set(t,n),this.start=new ot.Point(t,n),this.graphics.moveTo(this.cursor.x,this.cursor.y),this}lineTo(t,n,i){typeof this.lineLength===void 0&&this.moveTo(0,0);const r=St.distance(this.cursor.x,this.cursor.y,t,n),s=Math.atan2(n-this.cursor.y,t-this.cursor.x),o=i&&t===this.start.x&&n===this.start.y;if(this.useTexture)if(this.graphics.moveTo(this.cursor.x,this.cursor.y),this.adjustLineStyle(s),o&&this.dash.length%2===0){const a=Math.min(this.dash[this.dash.length-1],r);this.graphics.lineTo(t-Math.cos(s)*a,n-Math.sin(s)*a),this.graphics.closePath()}else this.graphics.lineTo(t,n);else{const a=Math.cos(s),c=Math.sin(s);let h=this.cursor.x,l=this.cursor.y;const u=this.lineLength%(this.dashSize*this.scale);let f=0,d=0,g=0;for(let y=0;y<this.dash.length;y++){const m=this.dash[y]*this.scale;if(u<g+m){f=y,d=u-g;break}else g+=m}let p=r;for(;p>0;){const y=this.dash[f]*this.scale-d,m=p>y?y:p;if(o&&St.distance(h+a*m,l+c*m,this.start.x,this.start.y)<=m){if(f%2===0){const x=St.distance(h,l,this.start.x,this.start.y)-this.dash[this.dash.length-1]*this.scale;h+=a*x,l+=c*x,this.graphics.lineTo(h,l)}break}h+=a*m,l+=c*m,f%2?this.graphics.moveTo(h,l):this.graphics.lineTo(h,l),p-=m,f++,f=f===this.dash.length?0:f,d=0}}return this.lineLength+=r,this.cursor.set(t,n),this}closePath(){this.lineTo(this.start.x,this.start.y,!0)}drawCircle(t,n,i,r=80,s){const o=Math.PI*2/r;let a=0,c;s?(c=new ot.Point(t+Math.cos(a)*i,n+Math.sin(a)*i),s.apply(c,c),this.moveTo(c[0],c[1])):(c=new ot.Point(t+Math.cos(a)*i,n+Math.sin(a)*i),this.moveTo(c.x,c.y)),a+=o;for(let h=1;h<r+1;h++){const l=h===r?c:[t+Math.cos(a)*i,n+Math.sin(a)*i];this.lineTo(l[0],l[1]),a+=o}return this}drawEllipse(t,n,i,r,s=80,o){const a=Math.PI*2/s;let c;const h=new ot.Point;for(let l=0;l<Math.PI*2;l+=a){let u=t-i*Math.sin(l),f=n-r*Math.cos(l);o&&(h.set(u,f),o.apply(h,h),u=h.x,f=h.y),l===0?(this.moveTo(u,f),c={x:u,y:f}):this.lineTo(u,f)}return this.lineTo(c.x,c.y,!0),this}drawPolygon(t,n){const i=new ot.Point;if(typeof t[0]=="number")if(n){i.set(t[0],t[1]),n.apply(i,i),this.moveTo(i.x,i.y);for(let r=2;r<t.length;r+=2)i.set(t[r],t[r+1]),n.apply(i,i),this.lineTo(i.x,i.y,r===t.length-2)}else{this.moveTo(t[0],t[1]);for(let r=2;r<t.length;r+=2)this.lineTo(t[r],t[r+1],r===t.length-2)}else if(n){const r=t[0];i.copyFrom(r),n.apply(i,i),this.moveTo(i.x,i.y);for(let s=1;s<t.length;s++){const o=t[s];i.copyFrom(o),n.apply(i,i),this.lineTo(i.x,i.y,s===t.length-1)}}else{const r=t[0];this.moveTo(r.x,r.y);for(let s=1;s<t.length;s++){const o=t[s];this.lineTo(o.x,o.y,s===t.length-1)}}return this}drawRect(t,n,i,r,s){if(s){const o=new ot.Point;o.set(t,n),s.apply(o,o),this.moveTo(o.x,o.y),o.set(t+i,n),s.apply(o,o),this.lineTo(o.x,o.y),o.set(t+i,n+r),s.apply(o,o),this.lineTo(o.x,o.y),o.set(t,n+r),s.apply(o,o),this.lineTo(o.x,o.y),o.set(t,n),s.apply(o,o),this.lineTo(o.x,o.y,!0)}else this.moveTo(t,n).lineTo(t+i,n).lineTo(t+i,n+r).lineTo(t,n+r).lineTo(t,n,!0);return this}adjustLineStyle(t){const n=this.graphics.line;n.matrix=new ot.Matrix,t&&n.matrix.rotate(t),this.scale!==1&&n.matrix.scale(this.scale,this.scale);const i=-this.lineLength;n.matrix.translate(this.cursor.x+i*Math.cos(t),this.cursor.y+i*Math.sin(t)),this.graphics.lineStyle(n)}static getTexture(t,n){const i=t.dash.toString();if(St.dashTextureCache[i])return St.dashTextureCache[i];const r=document.createElement("canvas");r.width=n,r.height=Math.ceil(t.width);const s=r.getContext("2d");if(!s){console.warn("Did not get context from canvas");return}s.strokeStyle="white",s.globalAlpha=t.alpha,s.lineWidth=t.width;let o=0;const a=t.width/2;s.moveTo(o,a);for(let h=0;h<t.dash.length;h+=2)o+=t.dash[h],s.lineTo(o,a),t.dash.length!==h+1&&(o+=t.dash[h+1],s.moveTo(o,a));s.stroke();const c=St.dashTextureCache[i]=ot.Texture.from(r);return c.baseTexture.scaleMode=ot.SCALE_MODES.NEAREST,c}};Qr.dashTextureCache={};let Xu=Qr;const Dn=e=>new $(e.x,e.y),qu=e=>new F.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=Dn(s);return t=Dn(o).sub(a).rotate90().normalized(),t}return t})},ts=(e,t,n)=>{const i=Dn(e);return qu(i.add(t.scale(n)))},zn=(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,ju=(e,t,n,i)=>e<i&&n<t,Zu=e=>Array.from(new Set(e)),De=(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}},ze=([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),Zu(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},Ku=(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},Qu=(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},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((p,y)=>p.end-y.end);const c=o[o.length-1].end,{overlappingOuterStrings:h,overlappingHoles:l}=De(e.toc,c,a,i),u=[...h,...l].map(p=>({start:p.start,end:p.end}));return ze([e.toc,c],u).flatMap((p,y,m)=>{if(y===m.length-1)return[];const v=m[y+1],x=ns(o,h,l,p);return[{top:p,bottom:v,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:[]}),t0=(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}=De(e.start,e.end,a,i),l=[...c,...h].map(g=>({start:g.start,end:g.end}));return ze([e.start,e.end],l).flatMap((g,p,y)=>{if(p===y.length-1)return[];const m=y[p+1],v=ns(o,c,h,g);return[{top:g,bottom:m,diameter:v*r}]}).map(g=>({diameter:g.diameter,points:s(g.top,g.bottom)}))},e0=(e,t,n,i,r,s)=>{const{attachedStrings:o,nonAttachedStrings:a}=Nn(e.referenceIds,t,n),{overlappingHoles:c,overlappingOuterStrings:h}=De(e.start,e.end,a,i),l=[...o,...c,...h].map(g=>({start:g.start,end:g.end}));return ze([e.start,e.end],l).flatMap((g,p,y)=>{if(p===y.length-1)return[];const m=y[p+1],v=Qu(o,h,c,g);return[{top:g,bottom:m,diameter:v*r}]}).map(g=>({diameter:g.diameter,points:s(g.top,g.bottom)}))},n0=(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},i0=({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=n0(r,s,e,t,0),s.fillRect(0,0,r.width,r.height),F.Texture.from(r)},r0=({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(),F.Texture.from(t)},s0=({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),F.Texture.from(r)},o0=({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(),F.Texture.from(i)},a0=({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(),F.Texture.from(i)},c0=({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(),F.Texture.from(i)},Ne=(e,t)=>{const n=Jr(t),i=zn(t,n,e);return{leftPath:zn(t,n,-e),rightPath:i}},$n=(e,t)=>({kind:"casing",start:e,end:t}),h0=(e,t)=>({kind:"casing-window",start:e,end:t}),l0=e=>{const t=(e.windows||[]).filter(n=>ju(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=h0(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)]},u0=(e,t,n)=>{const i=t.diameter*e,r=i/2,o=t.innerDiameter*e/2,a=r-o,c=l0(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}},f0=(e,t,n,i,r)=>{const{overlappingOuterStrings:s,overlappingHoles:o}=De(e.start,e.end,t,n),a=[...s,...o].map(u=>({start:u.start,end:u.end}));return ze([e.start,e.end],a).flatMap((u,f,d)=>{if(f===d.length-1)return[];const g=d[f+1],p=Ku(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()},Bn=(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],v=[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,...v),t.bezierCurveTo(...v,...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],v=[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,...v),t.bezierCurveTo(...v,...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()},d0=(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 F.Texture(F.Texture.from(n,{wrapMode:F.WRAP_MODES.CLAMP}).baseTexture,void 0,new F.Rectangle(0,0,n.width,n.height),void 0,F.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");if(s==null)throw Error("Could not get canvas context!");return{canvas:n,ctx:s}},Tt=e=>new F.Texture(F.Texture.from(e,{wrapMode:F.WRAP_MODES.CLAMP}).baseTexture,void 0,new F.Rectangle(0,0,e.width,e.height),void 0,F.groupD8.MIRROR_HORIZONTAL),g0=(e,t)=>n=>t.some(i=>n(i)&&kr(e,i)),In={packing:()=>ht(),fracLines:()=>ht(),spikes:(e,t,n,i)=>{const{canvas:r,ctx:s}=bt(t,i),o=g0(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),d0(r,s,t.diameter,i),h&&Bn(r,s,t.diameter,i,"spike"),Tt(r)}},is={packing:()=>ht(),fracLines:(e,t)=>{const{canvas:n,ctx:i}=bt(e,t);return Bn(n,i,e.diameter,t,"diameter"),Tt(n)},spikes:()=>ht()},Be={packing:(e,t)=>{const{canvas:n,ctx:i}=bt(e,t);return $e(n,i,t),Tt(n)},fracLines:(e,t)=>{const{canvas:n}=bt(e,t);return Tt(n)},spikes:()=>ht()},Hn={packing:(e,t)=>{const{canvas:n,ctx:i}=bt(e,t);return $e(n,i,t),Tt(n)},fracLines:()=>ht(),spikes:()=>ht()},Vn={packing:(e,t)=>{const{canvas:n,ctx:i}=bt(e,t);return $e(n,i,t),Tt(n)},fracLines:()=>ht(),spikes:()=>ht()},Un={packing:(e,t,n)=>{const{canvas:i,ctx:r}=bt(t,n);return $e(i,r,n),Tt(i)},fracLines:(e,t)=>{const{canvas:n,ctx:i}=bt(e,t);return Bn(n,i,e.diameter,t,"diameter"),Tt(n)},spikes:()=>ht()},p0=(e,t,n)=>K({Perforation:()=>In.packing(),CasedHoleFracturation:()=>Be.packing(t,n),CasedHoleFracPack:()=>Be.packing(t,n),OpenHoleGravelPack:()=>Vn.packing(t,n),OpenHoleFracPack:()=>Un.packing(e,t,n),CasedHoleGravelPack:()=>Hn.packing(t,n)},e.subKind),m0=(e,t,n)=>K({Perforation:()=>In.fracLines(),OpenHoleGravelPack:()=>Vn.fracLines(),OpenHoleFracPack:()=>Un.fracLines(t,n),CasedHoleFracturation:()=>is.fracLines(t,n),CasedHoleGravelPack:()=>Hn.fracLines(),CasedHoleFracPack:()=>Be.fracLines(t,n)},e.subKind),y0=(e,t,n,i)=>K({Perforation:()=>In.spikes(e,n,t,i),OpenHoleGravelPack:()=>Vn.spikes(),OpenHoleFracPack:()=>Un.spikes(),CasedHoleFracturation:()=>is.spikes(),CasedHoleGravelPack:()=>Hn.spikes(),CasedHoleFracPack:()=>Be.spikes()},e.subKind);class _0 extends F.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,v,x,M,b;const t=this.segments;if(!t)return;const n=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex(),s=Xe(t,S=>S.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,S=>S.diameter);let l=0,u=0,f=0,d=0;for(let S=0;S<c;S++){let T=(g=t[S])==null?void 0:g.points[0];const L=h,E=((p=t[S])==null?void 0:p.diameter)/h/2,D=(y=t[S])==null?void 0:y.points.length;for(let P=0;P<D;P++){const z=T.x-((v=(m=t[S])==null?void 0:m.points[P])==null?void 0:v.x),I=T.y-((M=(x=t[S])==null?void 0:x.points[P])==null?void 0:M.y),_=Math.sqrt(z*z+I*I);T=(b=t[S])==null?void 0:b.points[P],l+=_/L,o[u]=l,o[u+1]=.5-E,o[u+2]=l,o[u+3]=.5+E,u+=4}for(let P=0;P<D-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 v=(o=this.buffers[0])==null?void 0:o.data,x=(a=t[d])==null?void 0:a.points.length;let M=0;for(let b=0;b<x;b++){const S=(c=t[d])==null?void 0:c.points[b];M=r+b*4,b<((h=t[d])==null?void 0:h.points.length)-1?p=(l=t[d])==null?void 0:l.points[b+1]:p=S,m=-(p.x-g.x),y=p.y-g.y;const T=Math.sqrt(y*y+m*m),L=((u=t[d])==null?void 0:u.diameter)/2;y/=T,m/=T,y*=L,m*=L,v!=null&&(v[M]=S.x+y,v[M+1]=S.y+m,v[M+2]=S.x-y,v[M+3]=S.y-m),g=S}r=M+4}(f=this.buffers[0])==null||f.update()}update(){this.build()}}class v0 extends F.Mesh{constructor(t,n){const i=new _0(n),r=new F.MeshMaterial(t);t.baseTexture.wrapMode=F.WRAP_MODES.REPEAT,super(i,r),this.autoUpdate=!0}_render(t){const n=this.geometry;this.autoUpdate&&n.update(),super._render(t)}}class x0 extends F.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 w0 extends F.Mesh{constructor(t,n,i){const r=new x0(n,i),s=new F.MeshMaterial(t);t.baseTexture.wrapMode=F.WRAP_MODES.REPEAT,super(r,s),this.autoUpdate=!0}_render(t){const n=this.geometry;this.autoUpdate&&n.update(),super._render(t)}}class b0 extends F.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 v=a.x-((d=t[m])==null?void 0:d.x),x=a.y-((g=t[m])==null?void 0:g.y),M=Math.sqrt(v*v+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 v=m*4,x=u.x-((p=t[m])==null?void 0:p.x),M=u.y-((y=t[m])==null?void 0:y.y),b=Math.sqrt(x*x+M*M);u=t[m],l+=b/o,c[v]=l,c[v+1]=0,c[v+2]=l,c[v+3]=1}let f=0;for(let m=0;m<s-1;m++){const v=m*2;h[f++]=v,h[f++]=v+1,h[f++]=v+2,h[f++]=v+2,h[f++]=v+1,h[f++]=v+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 T0 extends F.Mesh{constructor(t,n){const i=new b0(n,t.height),r=new F.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 S0=(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)}},M0=e=>({exaggerationFactor:2,internalLayerOptions:Er(e),holeOptions:Fr,casingOptions:Rr,cementOptions:Dr,cementSqueezeOptions:zr,screenOptions:Nr,tubingOptions:$r,cementPlugOptions:Br,perforationOptions:Or}),rs=class Ts extends kn{constructor(t,n,i){super(t,n,i),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=(r,s)=>{var c;const o=h=>h*this.scalingFactors.zFactor;return(((c=this.referenceSystem)==null?void 0:c.getCurtainPath(r,s,!0))??[]).map(h=>new F.Point(h.point[0],o(h.point[1])))},this.drawBigPolygon=(r,s=0)=>{const o=new F.Graphics;o.beginFill(s),o.drawPolygon(r),o.endFill(),this.addChild(o)},this.perforationRopeAndTextureReferences=[],this.prepareSymbolRenderObject=r=>{const{exaggerationFactor:s=1}=this.options,o=r.diameter*s;return{pathPoints:this.getZFactorScaledPathForPoints(r.start,r.end),referenceDiameter:o,symbolKey:r.symbolKey}},this.drawSymbolComponent=({pathPoints:r,referenceDiameter:s,symbolKey:o})=>{const a=this.getSymbolTexture(o,s);this.drawSVGRope(r,a)},this.drawHoleSize=(r,s)=>{if(s==null)return;const o=this.getZFactorScaledPathForPoints(s.start,s.end);if(o.length===0)return;const{exaggerationFactor:a=1,holeOptions:c}=this.options,h=s.diameter*a,{rightPath:l,leftPath:u}=Ne(h/2,o),f=this.getHoleTexture(c,h,r);this.drawHoleRope(o,f,r),this.drawOutline(u,l,pt(c.lineColor),Al*a,"TopAndBottom",0)},this.drawCasing=r=>{const{casingOptions:s}=this.options,o=pt(s.solidColor),a=pt(s.lineColor);r.sections.forEach((c,h,l)=>{const u=Ts.getOutlineClosureType(h,l.length-1),f=this.createCasingTexture(r.referenceDiameter);this.drawRope(c.pathPoints,f,o),c.kind==="casing-window"?this.drawCasingWindowOutline(c.leftPath,c.rightPath,s,r.casingWallWidth):this.drawOutline(c.leftPath,c.rightPath,a,r.casingWallWidth,u)})},this.generateShoe=(r,s,o,a)=>{const c=r-o,h=r,l=this.getZFactorScaledPathForPoints(c,h),u=Jr(l),f=zn(l,u,s*(a<0?-1:1)),d=l[l.length-1],g=u[u.length-1],p=ts(d,g,a+s*(a<0?-1:1));return[...f,p]},this.createCementSqueezeShape=(r,s,o,a)=>{const{exaggerationFactor:c=1}=this.options;return t0(r,s,o,a,c,this.getZFactorScaledPathForPoints)},this.createPerforationShape=(r,s,o)=>{const{exaggerationFactor:a=1}=this.options;return f0(r,s,o,a,this.getZFactorScaledPathForPoints)},this.options={...this.options,...M0(this.id),...i}}onUnmount(t){super.onUnmount(t),this.cementTextureCache=null,this.cementSqueezeTextureCache=null,this.holeTextureCache=null,this.screenTextureCache=null,this.tubingTextureCache=null,this.textureSymbolCacheArray=null}onUpdate(t){super.onUpdate(t),this.clearLayer(),this.preRender(),this.render()}onRescale(t){const n=this.scalingFactors.zFactor!==t.zFactor;this.scalingFactors={height:t.height,zFactor:t.zFactor,yScale:t.yScale},super.optionsRescale(t);const i=this.yRatio(),r=t.xBounds[0]>t.xBounds[1],s=t.yBounds[0]>t.yBounds[1];this.setContainerPosition(t.xScale(0),t.yScale(0)),this.setContainerScale(t.xRatio*(r?-1:1),i*(s?-1:1)),n&&(this.clearLayer(),this.preRender()),this.render()}setVisibility(t,n){if(n===this.id){super.setVisibility(t,n);return}const{internalLayerOptions:i}=this.options,s=(i?Object.entries(i):[]).find(([a,c])=>c===n),o=s==null?void 0:s[0];o&&(this.internalLayerVisibility[o]=t,this.clearLayer(),this.preRender(),this.render())}getInternalLayerIds(){const{internalLayerOptions:t}=this.options;return t?Object.values(t):[]}yRatio(){const t=this.scalingFactors.yScale.domain(),i=(t[1]-t[0])*this.scalingFactors.zFactor,r=[t[0],t[0]+i];return Math.abs(this.scalingFactors.height/(r[1]-r[0]))}drawRope(t,n,i){if(t.length===0)return;const r=new F.SimpleRope(n,t,1);r.tint=i||r.tint,this.addChild(r)}drawOutline(t,n,i,r=1,s="None",o=1){const a=t.map(u=>u.clone()).reverse(),c=n[0],h=a[0],l=new F.Graphics;l.lineStyle(r,i,void 0,o),l.moveTo(c.x,c.y),n.forEach(u=>l.lineTo(u.x,u.y)),(s==="None"||s==="Top")&&l.moveTo(h.x,h.y),a.forEach(u=>l.lineTo(u.x,u.y)),(s==="TopAndBottom"||s==="Top")&&l.lineTo(c.x,c.y),this.addChild(l)}drawCasingWindowOutline(t,n,{lineColor:i,windowOptions:r},s=1){var p,y;const o=!!((y=(p=this.referenceSystem)==null?void 0:p.options)!=null&&y.calculateDisplacementFromBottom),[a,c]=o?[t,n]:[n,t],[h,l]=o?[1,0]:[0,1],u=new F.Graphics;u.lineStyle(s,pt(i),void 0,l);const f=a[0];u.moveTo(f.x,f.y),a.forEach(m=>u.lineTo(m.x,m.y));const d=new Xu(u,{dash:[r.dashLength,r.spaceLength],color:pt(r.dashColor),width:s,alignment:h}),g=c[0];d.moveTo(g.x,g.y),c.forEach(m=>{d.lineTo(m.x,m.y)}),this.addChild(u)}preRender(){if(!this.data||!this.referenceSystem)return;const{exaggerationFactor:t=1}=this.options,{holeSizes:n,casings:i,cements:r,completion:s,symbols:o,pAndA:a,perforations:c}=this.data;this.updateSymbolCache(o),n.sort((p,y)=>y.diameter-p.diameter);const h=n.length>0?(Ge(n,p=>p.diameter)??0)*t:Ml*t;this.internalLayerVisibility.holeLayerId&&n.forEach(p=>this.drawHoleSize(h,p)),i.sort((p,y)=>y.diameter-p.diameter);const l=i.map(p=>this.createCasingRenderObject(p)),u=r.map(p=>({kind:"cement",segments:Ju(p,i,s,n,t,this.getZFactorScaledPathForPoints),casingIds:(p.referenceIds||[]).filter(y=>y)})),[f,d]=a.reduce(([p,y],m)=>wr(m)?[[m,...p],y]:[p,[m,...y]],[[],[]]),g=f.map(p=>({kind:"cementSqueeze",segments:this.createCementSqueezeShape(p,i,s,n),casingIds:p.referenceIds}));if(this.sortCementAndCasingRenderObjects(l,u,g).forEach(S0(p=>{this.internalLayerVisibility.casingLayerId&&(this.drawCasing(p),p.hasShoe&&this.drawShoe(p.bottom,p.referenceRadius))},p=>{if(this.internalLayerVisibility.cementLayerId){const y=this.getCementTexture();y&&this.drawComplexRope(p.segments,y)}},p=>{if(this.internalLayerVisibility.pAndALayerId){const y=this.getCementSqueezeTexture();y&&this.drawComplexRope(p.segments,y)}})),this.perforationRopeAndTextureReferences.forEach(({rope:p,texture:y})=>{p.destroy({children:!0,texture:!0,baseTexture:!0}),y.destroy(!0)}),this.perforationRopeAndTextureReferences=[],this.internalLayerVisibility.perforationLayerId){const{perforationOptions:p}=this.options,y=c.filter(Sr),m=c.filter(Mr),v=c.filter(Ar);y.forEach(x=>{const b=this.createPerforationShape(x,i,n).reduce((S,T)=>(S[T.diameter]||(S[T.diameter]=[]),S[T.diameter]=[...S[T.diameter]??[],T],S),{});Object.values(b).forEach(S=>{const T=p0(x,S[0],p),L=this.drawComplexRope(S,T);L&&this.perforationRopeAndTextureReferences.push({rope:L,texture:T})})}),v.forEach(x=>{const S=this.createPerforationShape(x,i,n).map(T=>({...T,diameter:T.diameter*3})).reduce((T,L)=>(T[L.diameter]||(T[L.diameter]=[]),T[L.diameter]=[...T[L.diameter]??[],L],T),{});Object.values(S).forEach(T=>{T.forEach(L=>{const E=y0(x,c,L,p),D=this.drawComplexRope([L],E);D&&this.perforationRopeAndTextureReferences.push({rope:D,texture:E})})})}),m.forEach(x=>{const S=this.createPerforationShape(x,i,n).map(T=>({...T,diameter:T.diameter*3})).reduce((T,L)=>(T[L.diameter]||(T[L.diameter]=[]),T[L.diameter]=[...T[L.diameter]??[],L],T),{});Object.values(S).forEach(T=>{T.forEach(L=>{const E=m0(x,L,p),D=this.drawComplexRope([L],E);D&&this.perforationRopeAndTextureReferences.push({rope:D,texture:E})})})})}this.internalLayerVisibility.completionLayerId&&s.forEach(Tr(p=>this.drawScreen(p),p=>this.drawTubing(p),p=>{const y=this.prepareSymbolRenderObject(p);this.drawSymbolComponent(y)})),this.internalLayerVisibility.pAndALayerId&&d.forEach(p=>{if(xr(p)){const y=this.prepareSymbolRenderObject(p);this.drawSymbolComponent(y)}br(p)&&this.drawCementPlug(p,i,s,n)})}updateSymbolCache(t){if(this.textureSymbolCacheArray||(this.textureSymbolCacheArray={}),!t)return;const n=Object.keys(this.textureSymbolCacheArray);Object.entries(t).forEach(([i,r])=>{!n.includes(i)&&this.textureSymbolCacheArray&&(this.textureSymbolCacheArray[i]=F.Texture.from(r))})}drawCementPlug(t,n,i,r){const{exaggerationFactor:s=1,cementPlugOptions:o}=this.options,a=e0(t,n,i,r,s,this.getZFactorScaledPathForPoints);o&&this.drawComplexRope(a,this.getCementPlugTexture(o));const{rightPath:c,leftPath:h}=a.reduce((l,u)=>{const{leftPath:f,rightPath:d}=Ne(u.diameter/2,u.points);return{rightPath:[...l.rightPath,...d],leftPath:[...l.leftPath,...f]}},{rightPath:[],leftPath:[]});this.drawOutline(h,c,pt("black"),.25,"TopAndBottom")}createCasingRenderObject(t){const{exaggerationFactor:n=1}=this.options;return u0(n,t,this.getZFactorScaledPathForPoints)}getCementPlugTexture(t){return this.cementPlugTextureCache||(this.cementPlugTextureCache=a0(t)),this.cementPlugTextureCache}drawSVGRope(t,n){if(t.length===0)return;const i=new T0(n,t);this.addChild(i)}getSymbolTexture(t,n){var r,s;const i=(s=(r=this.textureSymbolCacheArray)==null?void 0:r[t])==null?void 0:s.baseTexture;return i?new F.Texture(i,void 0,new F.Rectangle(0,0,0,n),void 0,F.groupD8.MAIN_DIAGONAL):void 0}drawHoleRope(t,n,i){if(t.length===0)return;const r=new F.SimpleRope(n,t,i/vt);this.addChild(r)}getHoleTexture(t,n,i){const r=vt,s=r,o=r,a=n/i*r;this.holeTextureCache||(this.holeTextureCache=i0(t,o,s));const c=this.holeTextureCache.baseTexture,h=(s-a)/2,l=new F.Rectangle(0,h,o,a);return new F.Texture(c,l)}sortCementAndCasingRenderObjects(t,n,i){let r=0;const{result:s}=t.reduce((o,a)=>{const c=o.remainingCement.find(l=>l.casingIds.includes(a.id)),h=o.remainingCementSqueezes.filter(l=>l.casingIds.includes(a.id));return c&&(c.zIndex=r++),h.forEach(l=>l.zIndex=r++),a.zIndex=r++,{result:[...o.result,c,a,...h],remainingCement:o.remainingCement.filter(l=>l!==c),remainingCementSqueezes:o.remainingCementSqueezes.filter(l=>!h.includes(l))}},{result:[],remainingCement:n,remainingCementSqueezes:i});return s.filter(o=>o!=null).sort((o,a)=>o.zIndex-a.zIndex)}drawComplexRope(t,n){if(t.length===0)return;const i=new v0(n,t);return this.addChild(i),i}createCasingTexture(t){return new F.Texture(F.Texture.WHITE.baseTexture,void 0,new F.Rectangle(0,0,16,t))}drawShoe(t,n){const{exaggerationFactor:i=1,casingOptions:r}=this.options,s=r.shoeSize.width*i,o=r.shoeSize.length*i,a=this.generateShoe(t,n,o,s),c=this.generateShoe(t,n,o,-s);this.drawBigPolygon(c),this.drawBigPolygon(a)}getCementTexture(){if(!this.cementTextureCache){const{cementOptions:t}=this.options;t&&(this.cementTextureCache=o0(t))}return this.cementTextureCache}getCementSqueezeTexture(){if(!this.cementSqueezeTextureCache){const{cementSqueezeOptions:t}=this.options;t&&(this.cementSqueezeTextureCache=c0(t))}return this.cementSqueezeTextureCache}drawScreen({start:t,end:n,diameter:i}){const{exaggerationFactor:r=1,screenOptions:s}=this.options,o=r*i,a=this.getZFactorScaledPathForPoints(t,n),{leftPath:c,rightPath:h}=Ne(o/2,a),l=this.getScreenTexture();l&&(this.drawCompletionRope(a,l,o),this.drawOutline(c,h,pt(s.lineColor),Cl*r,"TopAndBottom"))}drawTubing({diameter:t,start:n,end:i}){const{exaggerationFactor:r=1,tubingOptions:s}=this.options,o=r*t,a=this.getZFactorScaledPathForPoints(n,i),c=this.getTubingTexture(s);this.drawCompletionRope(a,c,o)}getTubingTexture(t){return this.tubingTextureCache||(this.tubingTextureCache=s0(t)),this.tubingTextureCache}getScreenTexture(){if(!this.screenTextureCache){const{screenOptions:t}=this.options;t&&(this.screenTextureCache=r0(t))}return this.screenTextureCache}drawCompletionRope(t,n,i){if(t.length===0)return;const r=new w0(n,t,i);this.addChild(r)}};rs.getOutlineClosureType=(e,t)=>e===0?e===t?"TopAndBottom":"Top":e===t?"Bottom":"None";let A0=rs;class C0 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 It(e){return function(){return e}}const ss=1e-12,Wn=Math.PI,Yn=2*Wn,kt=1e-6,P0=Yn-kt;function os(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function L0(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return os;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 k0{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?os:L0(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),v=Math.sqrt(f),x=s*Math.tan((Wn-Math.acos((p+f-y)/(2*m*v)))/2),M=x/v,b=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+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)>kt||Math.abs(this._y1-l)>kt)&&this._append`L${h},${l}`,i&&(f<0&&(f=f%Yn+Yn),f>P0?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 E0(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 k0(t)}function F0(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function as(e){this._context=e}as.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 cs(e){return new as(e)}function R0(e){return e[0]}function O0(e){return e[1]}function D0(e,t){var n=It(!0),i=null,r=cs,s=null,o=E0(a);e=typeof e=="function"?e:e===void 0?R0:It(e),t=typeof t=="function"?t:t===void 0?O0:It(t);function a(c){var h,l=(c=F0(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: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 hs(){}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 Ie(e){this._context=e}Ie.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 z0(e){return new Ie(e)}function ls(e){this._context=e}ls.prototype={areaStart:hs,areaEnd:hs,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 N0(e){return new ls(e)}function us(e,t){this._basis=new Ie(e),this._beta=t}us.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 $0=function e(t){function n(i){return t===1?new Ie(i):new us(i,t)}return n.beta=function(i){return e(+i)},n}(.85);function fs(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:fs(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:fs(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 B0=function e(t){function n(i){return new Xn(i,t)}return n.tension=function(i){return e(+i)},n}(0);function I0(e,t,n){var i=e._x1,r=e._y1,s=e._x2,o=e._y2;if(e._l01_a>ss){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>ss){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 ds(e,t){this._context=e,this._alpha=t}ds.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:I0(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 H0=function e(t){function n(i){return t?new ds(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 ps(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 ms(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,ms(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,ms(this,n=ps(this,e,t)),n);break;default:qn(this,this._t0,n=ps(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function ys(e){this._context=new _s(e)}(ys.prototype=Object.create(He.prototype)).point=function(e,t){He.prototype.point.call(this,t,e)};function _s(e){this._context=e}_s.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 V0(e){return new He(e)}function U0(e){return new ys(e)}function vs(e){this._context=e}vs.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=xs(e),r=xs(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 xs(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 W0(e){return new vs(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 Y0(e){return new Ve(e,.5)}function G0(e){return new Ve(e,0)}function X0(e){return new Ve(e,1)}const q0=.7,j0=.9,Z0=1;class K0 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=H0.alpha(a||q0);break;case"curveLinear":s=cs;break;case"curveBasis":s=z0;break;case"curveBasisClosed":s=N0;break;case"curveBundle":s=$0.beta(a||Z0);break;case"curveCardinal":s=B0.tension(a||j0);break;case"curveMonotoneX":s=V0;break;case"curveMonotoneY":s=U0;break;case"curveNatural":s=W0;break;case"curveStep":s=Y0;break;case"curveStepAfter":s=X0;break;case"curveStepBefore":s=G0;break}return D0().curve(s)(r)??""}return""}}const ws=(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 Q0 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){ws({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=>{ws({solid:i=>this.drawSolid(i),dashed:i=>this.drawDashed(i),wavy:i=>this.drawWavy(i)},n)})})}}class bs{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 J0{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 tf=(e,t)=>new J0(e,t);class ef{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=tf(this,n),this.layerManager=new bs(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=ql,C.CanvasLayer=xt,C.Controller=ef,C.GeomodelCanvasLayer=Jl,C.GeomodelLabelsLayer=Hu,C.GeomodelLayerV2=Uu,C.GridLayer=Oe,C.HTMLLayer=kl,C.ImageLayer=Yu,C.IntersectionReferenceSystem=Nt,C.Layer=ee,C.LayerManager=bs,C.PixiLayer=kn,C.PixiRenderApplication=El,C.ReferenceLineLayer=Q0,C.SVGLayer=vr,C.SchematicLayer=A0,C.SeismicCanvasLayer=C0,C.WellborepathLayer=K0,C.ZoomPanHandler=pr,C.assertNever=ne,C.calcSize=Re,C.defaultCasingOptions=Rr,C.defaultCementOptions=Dr,C.defaultCementPlugOptions=Br,C.defaultCementSqueezeOptions=zr,C.defaultHoleOptions=Fr,C.defaultInternalLayerOptions=Er,C.defaultPerforationOptions=Or,C.defaultScreenOptions=Nr,C.defaultTubingOptions=$r,C.findIndexOfSample=Fn,C.findSampleAtPos=wt,C.foldCompletion=Tr,C.foldPerforationSubKind=K,C.generateProjectedTrajectory=Ru,C.generateProjectedWellborePath=Fu,C.generateSeismicSliceImage=du,C.generateSurfaceData=mu,C.getOverlap=Nl,C.getOverlapOffset=En,C.getPicksData=iu,C.getSeismicInfo=fu,C.getSeismicOptions=uu,C.hasFracLines=Mr,C.hasPacking=Sr,C.hasSpikes=Ar,C.intersect=kr,C.isCementPlug=br,C.isCementSqueeze=wr,C.isOpenHoleFracPack=Dl,C.isOverlapping=Ur,C.isOverlappingHorizontally=zl,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=hu,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
15
- //# sourceMappingURL=index.umd.js.map