@maptiler/geocoding-control 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +3 -4
  2. package/icons/airport.svg +6 -0
  3. package/icons/animal_shelter.svg +4 -0
  4. package/icons/art_gallery.svg +4 -0
  5. package/icons/atm.svg +5 -1
  6. package/icons/barrier.svg +4 -0
  7. package/icons/baseball.svg +4 -0
  8. package/icons/basketball.svg +4 -0
  9. package/icons/bbq.svg +4 -1
  10. package/icons/beach.svg +4 -0
  11. package/icons/beer.svg +4 -1
  12. package/icons/bench.svg +4 -1
  13. package/icons/bicycle.svg +4 -1
  14. package/icons/bicycle_parking.svg +5 -1
  15. package/icons/bicycle_rental.svg +5 -1
  16. package/icons/billiards.svg +4 -0
  17. package/icons/board.svg +4 -1
  18. package/icons/bollard.svg +4 -0
  19. package/icons/bowling.svg +4 -1
  20. package/icons/building.svg +4 -0
  21. package/icons/bulldozer.svg +4 -0
  22. package/icons/bus_guided.svg +4 -0
  23. package/icons/bus_trolley.svg +4 -0
  24. package/icons/butcher.svg +4 -1
  25. package/icons/camper_trailer.svg +4 -0
  26. package/icons/campfire.svg +4 -0
  27. package/icons/caution.svg +4 -0
  28. package/icons/cemetery.svg +3 -11
  29. package/icons/charging_station.svg +4 -1
  30. package/icons/christian.svg +5 -0
  31. package/icons/circle-dot.svg +4 -0
  32. package/icons/circle-stroke.svg +4 -0
  33. package/icons/circle.svg +4 -0
  34. package/icons/city.svg +4 -0
  35. package/icons/communications_tower.svg +4 -1
  36. package/icons/confectionery.svg +4 -1
  37. package/icons/construction.svg +4 -0
  38. package/icons/cricket.svg +4 -0
  39. package/icons/cross.svg +4 -1
  40. package/icons/cycle_barrier.svg +4 -0
  41. package/icons/dam.svg +4 -0
  42. package/icons/danger.svg +4 -0
  43. package/icons/diamond.svg +4 -0
  44. package/icons/diamond_stroked.svg +4 -0
  45. package/icons/dot.svg +4 -0
  46. package/icons/drinking_water.svg +4 -1
  47. package/icons/emergency_phone.svg +4 -1
  48. package/icons/entrance.svg +4 -0
  49. package/icons/farm.svg +3 -8
  50. package/icons/fence.svg +4 -0
  51. package/icons/florist.svg +4 -1
  52. package/icons/furniture.svg +4 -1
  53. package/icons/gaming.svg +4 -0
  54. package/icons/garden.svg +4 -0
  55. package/icons/garden_centre.svg +4 -1
  56. package/icons/gate.svg +4 -1
  57. package/icons/globe.svg +4 -0
  58. package/icons/golf_green.svg +4 -0
  59. package/icons/gondola.svg +4 -0
  60. package/icons/guidepost.svg +4 -1
  61. package/icons/hardware.svg +3 -3
  62. package/icons/heart.svg +4 -0
  63. package/icons/heliport.svg +4 -0
  64. package/icons/highway_rest_area.svg +4 -0
  65. package/icons/home.svg +4 -0
  66. package/icons/hot_spring.svg +4 -1
  67. package/icons/hut.svg +4 -0
  68. package/icons/industry.svg +4 -0
  69. package/icons/karaoke.svg +4 -0
  70. package/icons/lift_gate.svg +4 -0
  71. package/icons/light_rail.svg +4 -0
  72. package/icons/lighthouse.svg +4 -1
  73. package/icons/marker.svg +4 -0
  74. package/icons/marker_stroked.svg +4 -0
  75. package/icons/monorail.svg +4 -0
  76. package/icons/motorcycle.svg +4 -1
  77. package/icons/motorcycle_parking.svg +4 -1
  78. package/icons/motorcycle_rental.svg +4 -0
  79. package/icons/motorcycle_repair.svg +4 -0
  80. package/icons/natural.svg +4 -0
  81. package/icons/noodle.svg +4 -0
  82. package/icons/obelisk.svg +4 -1
  83. package/icons/observation_tower.svg +4 -1
  84. package/icons/oneway.svg +4 -0
  85. package/icons/optician.svg +4 -1
  86. package/icons/park.svg +4 -1
  87. package/icons/parking_paid.svg +4 -0
  88. package/icons/pin.svg +4 -0
  89. package/icons/pipe.svg +4 -0
  90. package/icons/pizza.svg +4 -0
  91. package/icons/place_of_worship.svg +4 -1
  92. package/icons/playground.svg +3 -3
  93. package/icons/racetrack.svg +4 -0
  94. package/icons/radiation.svg +4 -0
  95. package/icons/railway.svg +4 -0
  96. package/icons/ranger_station.svg +4 -0
  97. package/icons/recycling.svg +4 -1
  98. package/icons/road_accident.svg +4 -0
  99. package/icons/roadblock.svg +4 -0
  100. package/icons/rocket.svg +4 -0
  101. package/icons/school_bus.svg +4 -0
  102. package/icons/sculpture.svg +4 -0
  103. package/icons/seafood.svg +4 -1
  104. package/icons/shelter.svg +4 -1
  105. package/icons/shoes.svg +4 -1
  106. package/icons/sikh.svg +4 -0
  107. package/icons/snow.svg +4 -0
  108. package/icons/soccer.svg +4 -1
  109. package/icons/spring.svg +4 -1
  110. package/icons/square.svg +4 -0
  111. package/icons/square_stroked.svg +4 -0
  112. package/icons/star.svg +4 -0
  113. package/icons/star_stroked.svg +4 -0
  114. package/icons/statue.svg +4 -1
  115. package/icons/subway.svg +4 -0
  116. package/icons/sushi.svg +4 -0
  117. package/icons/swimming.svg +5 -0
  118. package/icons/swimming_pool.svg +8 -0
  119. package/icons/tako.svg +4 -0
  120. package/icons/taxi.svg +4 -1
  121. package/icons/teahouse.svg +4 -0
  122. package/icons/terminal.svg +4 -1
  123. package/icons/theme_park.svg +4 -0
  124. package/icons/town.svg +4 -0
  125. package/icons/town_hall.svg +4 -1
  126. package/icons/townhall.svg +4 -1
  127. package/icons/tram_stop.svg +4 -0
  128. package/icons/transit.svg +4 -0
  129. package/icons/triangle.svg +4 -0
  130. package/icons/triangle_stroked.svg +4 -0
  131. package/icons/truck.svg +4 -0
  132. package/icons/tunnel.svg +4 -0
  133. package/icons/veterinary.svg +4 -1
  134. package/icons/viewpoint.svg +4 -1
  135. package/icons/village.svg +4 -0
  136. package/icons/volleyball.svg +4 -0
  137. package/icons/warehouse.svg +4 -0
  138. package/icons/water.svg +3 -5
  139. package/icons/water_park.svg +6 -1
  140. package/icons/water_tower.svg +4 -1
  141. package/icons/watermill.svg +4 -0
  142. package/icons/wetland.svg +4 -0
  143. package/icons/wine.svg +4 -0
  144. package/leaflet-controller.d.ts +2 -2
  145. package/leaflet-controller.js +1828 -12736
  146. package/leaflet-controller.js.map +1 -1
  147. package/leaflet-controller.umd.js +13 -22
  148. package/leaflet-controller.umd.js.map +1 -1
  149. package/leaflet.js +3052 -13916
  150. package/leaflet.js.map +1 -1
  151. package/leaflet.umd.js +3 -12
  152. package/leaflet.umd.js.map +1 -1
  153. package/maplibregl-controller.d.ts +2 -2
  154. package/maplibregl-controller.js +1767 -12761
  155. package/maplibregl-controller.js.map +1 -1
  156. package/maplibregl-controller.umd.js +13 -22
  157. package/maplibregl-controller.umd.js.map +1 -1
  158. package/maplibregl.js +2950 -13900
  159. package/maplibregl.js.map +1 -1
  160. package/maplibregl.umd.js +3 -12
  161. package/maplibregl.umd.js.map +1 -1
  162. package/maptilersdk.js +2958 -13908
  163. package/maptilersdk.js.map +1 -1
  164. package/maptilersdk.umd.js +3 -12
  165. package/maptilersdk.umd.js.map +1 -1
  166. package/mask.d.ts +1 -1
  167. package/openlayers-controller.js +1177 -12154
  168. package/openlayers-controller.js.map +1 -1
  169. package/openlayers-controller.umd.js +13 -22
  170. package/openlayers-controller.umd.js.map +1 -1
  171. package/openlayers.js +2667 -13607
  172. package/openlayers.js.map +1 -1
  173. package/openlayers.umd.js +3 -12
  174. package/openlayers.umd.js.map +1 -1
  175. package/package.json +31 -29
  176. package/react.js +996 -955
  177. package/react.js.map +1 -1
  178. package/react.umd.js +1 -1
  179. package/react.umd.js.map +1 -1
  180. package/style.css +1 -1
  181. package/svelte/FeatureItem.svelte +7 -5
  182. package/svelte/GeocodingControl.svelte +72 -14
  183. package/svelte/GeocodingControl.svelte.d.ts +4 -2
  184. package/svelte/geoUtils.js +7 -1
  185. package/svelte/leaflet-controller.d.ts +2 -2
  186. package/svelte/leaflet-controller.js +48 -2
  187. package/svelte/maplibregl-controller.d.ts +2 -2
  188. package/svelte/maplibregl-controller.js +5 -2
  189. package/svelte/mask.d.ts +1 -1
  190. package/svelte/mask.js +32 -29
  191. package/svelte/openlayers-controller.js +13 -14
  192. package/svelte/types.d.ts +15 -9
  193. package/types.d.ts +15 -9
  194. package/vanilla.js +1016 -975
  195. package/vanilla.js.map +1 -1
  196. package/vanilla.umd.js +1 -1
  197. package/vanilla.umd.js.map +1 -1
  198. package/icons/beach_resort.svg +0 -1
  199. package/icons/drinking-water.svg +0 -1
  200. package/icons/emergency-phone.svg +0 -1
  201. package/icons/rental_bicycle.svg +0 -1
  202. package/icons/rental_car.svg +0 -1
  203. /package/icons/{camp_site.svg → campsite.svg} +0 -0
  204. /package/icons/{toll_booth.svg → toll.svg} +0 -0
@@ -1,13 +1,4 @@
1
- (function(Oe,Fe){typeof exports=="object"&&typeof module<"u"?Fe(exports,require("ol"),require("ol/geom"),require("ol/layer/Vector"),require("ol/proj"),require("ol/source/Vector"),require("ol/style/Fill"),require("ol/style/Icon"),require("ol/style/Stroke"),require("ol/style/Style"),require("ol/style/Text")):typeof define=="function"&&define.amd?define(["exports","ol","ol/geom","ol/layer/Vector","ol/proj","ol/source/Vector","ol/style/Fill","ol/style/Icon","ol/style/Stroke","ol/style/Style","ol/style/Text"],Fe):(Oe=typeof globalThis<"u"?globalThis:Oe||self,Fe(Oe.openlayersMaptilerGeocodingController={},Oe.ol,Oe.ol.geom,Oe.ol.layer.Vector,Oe.ol.proj,Oe.ol.source.Vector,Oe.ol.style.Fill,Oe.ol.style.Icon,Oe.ol.style.Stroke,Oe.ol.style.Style,Oe.ol.style.Text))})(this,function(Oe,Fe,ze,fc,It,hc,js,gc,Vs,yc,vc){"use strict";var Sn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ws(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function pc(o){if(o.__esModule)return o;var r=o.default;if(typeof r=="function"){var a=function l(){return this instanceof l?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};a.prototype=r.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(o).forEach(function(l){var c=Object.getOwnPropertyDescriptor(o,l);Object.defineProperty(a,l,c.get?c:{enumerable:!0,get:function(){return o[l]}})}),a}var Hs=Object.prototype.toString,Zs=function(r){var a=Hs.call(r),l=a==="[object Arguments]";return l||(l=a!=="[object Array]"&&r!==null&&typeof r=="object"&&typeof r.length=="number"&&r.length>=0&&Hs.call(r.callee)==="[object Function]"),l},ni,Js;function mc(){if(Js)return ni;Js=1;var o;if(!Object.keys){var r=Object.prototype.hasOwnProperty,a=Object.prototype.toString,l=Zs,c=Object.prototype.propertyIsEnumerable,h=!c.call({toString:null},"toString"),v=c.call(function(){},"prototype"),p=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],_=function(E){var k=E.constructor;return k&&k.prototype===E},x={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var E in window)try{if(!x["$"+E]&&r.call(window,E)&&window[E]!==null&&typeof window[E]=="object")try{_(window[E])}catch{return!0}}catch{return!0}return!1}(),m=function(E){if(typeof window>"u"||!S)return _(E);try{return _(E)}catch{return!1}};o=function(k){var w=k!==null&&typeof k=="object",T=a.call(k)==="[object Function]",C=l(k),P=w&&a.call(k)==="[object String]",A=[];if(!w&&!T&&!C)throw new TypeError("Object.keys called on a non-object");var R=v&&T;if(P&&k.length>0&&!r.call(k,0))for(var G=0;G<k.length;++G)A.push(String(G));if(C&&k.length>0)for(var M=0;M<k.length;++M)A.push(String(M));else for(var $ in k)!(R&&$==="prototype")&&r.call(k,$)&&A.push(String($));if(h)for(var Y=m(k),U=0;U<p.length;++U)!(Y&&p[U]==="constructor")&&r.call(k,p[U])&&A.push(p[U]);return A}}return ni=o,ni}var dc=Array.prototype.slice,_c=Zs,Qs=Object.keys,Qn=Qs?function(r){return Qs(r)}:mc(),Ks=Object.keys;Qn.shim=function(){if(Object.keys){var r=function(){var a=Object.keys(arguments);return a&&a.length===arguments.length}(1,2);r||(Object.keys=function(l){return _c(l)?Ks(dc.call(l)):Ks(l)})}else Object.keys=Qn;return Object.keys||Qn};var ri=Qn,xc=Error,Ec=EvalError,kc=RangeError,Sc=ReferenceError,ea=SyntaxError,wt=TypeError,Ic=URIError,Kn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var r={},a=Symbol("test"),l=Object(a);if(typeof a=="string"||Object.prototype.toString.call(a)!=="[object Symbol]"||Object.prototype.toString.call(l)!=="[object Symbol]")return!1;var c=42;r[a]=c;for(a in r)return!1;if(typeof Object.keys=="function"&&Object.keys(r).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(r).length!==0)return!1;var h=Object.getOwnPropertySymbols(r);if(h.length!==1||h[0]!==a||!Object.prototype.propertyIsEnumerable.call(r,a))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var v=Object.getOwnPropertyDescriptor(r,a);if(v.value!==c||v.enumerable!==!0)return!1}return!0},ta=typeof Symbol<"u"&&Symbol,wc=Kn,ii=function(){return typeof ta!="function"||typeof Symbol!="function"||typeof ta("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:wc()},si={__proto__:null,foo:{}},Nc=Object,bc=function(){return{__proto__:si}.foo===si.foo&&!(si instanceof Nc)},Oc="Function.prototype.bind called on incompatible ",Tc=Object.prototype.toString,Lc=Math.max,Rc="[object Function]",na=function(r,a){for(var l=[],c=0;c<r.length;c+=1)l[c]=r[c];for(var h=0;h<a.length;h+=1)l[h+r.length]=a[h];return l},Cc=function(r,a){for(var l=[],c=a,h=0;c<r.length;c+=1,h+=1)l[h]=r[c];return l},Pc=function(o,r){for(var a="",l=0;l<o.length;l+=1)a+=o[l],l+1<o.length&&(a+=r);return a},Ac=function(r){var a=this;if(typeof a!="function"||Tc.apply(a)!==Rc)throw new TypeError(Oc+a);for(var l=Cc(arguments,1),c,h=function(){if(this instanceof c){var S=a.apply(this,na(l,arguments));return Object(S)===S?S:this}return a.apply(r,na(l,arguments))},v=Lc(0,a.length-l.length),p=[],_=0;_<v;_++)p[_]="$"+_;if(c=Function("binder","return function ("+Pc(p,",")+"){ return binder.apply(this,arguments); }")(h),a.prototype){var x=function(){};x.prototype=a.prototype,c.prototype=new x,x.prototype=null}return c},Mc=Ac,ai=Function.prototype.bind||Mc,Dc=Function.prototype.call,Fc=Object.prototype.hasOwnProperty,Gc=ai,ra=Gc.call(Dc,Fc),oe,Bc=xc,$c=Ec,qc=kc,zc=Sc,Zt=ea,Jt=wt,Yc=Ic,ia=Function,oi=function(o){try{return ia('"use strict"; return ('+o+").constructor;")()}catch{}},Ft=Object.getOwnPropertyDescriptor;if(Ft)try{Ft({},"")}catch{Ft=null}var ui=function(){throw new Jt},Uc=Ft?function(){try{return arguments.callee,ui}catch{try{return Ft(arguments,"callee").get}catch{return ui}}}():ui,Qt=ii(),Xc=bc(),ke=Object.getPrototypeOf||(Xc?function(o){return o.__proto__}:null),Kt={},jc=typeof Uint8Array>"u"||!ke?oe:ke(Uint8Array),Gt={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?oe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?oe:ArrayBuffer,"%ArrayIteratorPrototype%":Qt&&ke?ke([][Symbol.iterator]()):oe,"%AsyncFromSyncIteratorPrototype%":oe,"%AsyncFunction%":Kt,"%AsyncGenerator%":Kt,"%AsyncGeneratorFunction%":Kt,"%AsyncIteratorPrototype%":Kt,"%Atomics%":typeof Atomics>"u"?oe:Atomics,"%BigInt%":typeof BigInt>"u"?oe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?oe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?oe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?oe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Bc,"%eval%":eval,"%EvalError%":$c,"%Float32Array%":typeof Float32Array>"u"?oe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?oe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?oe:FinalizationRegistry,"%Function%":ia,"%GeneratorFunction%":Kt,"%Int8Array%":typeof Int8Array>"u"?oe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?oe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?oe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qt&&ke?ke(ke([][Symbol.iterator]())):oe,"%JSON%":typeof JSON=="object"?JSON:oe,"%Map%":typeof Map>"u"?oe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Qt||!ke?oe:ke(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?oe:Promise,"%Proxy%":typeof Proxy>"u"?oe:Proxy,"%RangeError%":qc,"%ReferenceError%":zc,"%Reflect%":typeof Reflect>"u"?oe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?oe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Qt||!ke?oe:ke(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?oe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qt&&ke?ke(""[Symbol.iterator]()):oe,"%Symbol%":Qt?Symbol:oe,"%SyntaxError%":Zt,"%ThrowTypeError%":Uc,"%TypedArray%":jc,"%TypeError%":Jt,"%Uint8Array%":typeof Uint8Array>"u"?oe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?oe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?oe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?oe:Uint32Array,"%URIError%":Yc,"%WeakMap%":typeof WeakMap>"u"?oe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?oe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?oe:WeakSet};if(ke)try{null.error}catch(o){var Vc=ke(ke(o));Gt["%Error.prototype%"]=Vc}var Wc=function o(r){var a;if(r==="%AsyncFunction%")a=oi("async function () {}");else if(r==="%GeneratorFunction%")a=oi("function* () {}");else if(r==="%AsyncGeneratorFunction%")a=oi("async function* () {}");else if(r==="%AsyncGenerator%"){var l=o("%AsyncGeneratorFunction%");l&&(a=l.prototype)}else if(r==="%AsyncIteratorPrototype%"){var c=o("%AsyncGenerator%");c&&ke&&(a=ke(c.prototype))}return Gt[r]=a,a},sa={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},In=ai,er=ra,Hc=In.call(Function.call,Array.prototype.concat),Zc=In.call(Function.apply,Array.prototype.splice),aa=In.call(Function.call,String.prototype.replace),tr=In.call(Function.call,String.prototype.slice),Jc=In.call(Function.call,RegExp.prototype.exec),Qc=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Kc=/\\(\\)?/g,ef=function(r){var a=tr(r,0,1),l=tr(r,-1);if(a==="%"&&l!=="%")throw new Zt("invalid intrinsic syntax, expected closing `%`");if(l==="%"&&a!=="%")throw new Zt("invalid intrinsic syntax, expected opening `%`");var c=[];return aa(r,Qc,function(h,v,p,_){c[c.length]=p?aa(_,Kc,"$1"):v||h}),c},tf=function(r,a){var l=r,c;if(er(sa,l)&&(c=sa[l],l="%"+c[0]+"%"),er(Gt,l)){var h=Gt[l];if(h===Kt&&(h=Wc(l)),typeof h>"u"&&!a)throw new Jt("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:c,name:l,value:h}}throw new Zt("intrinsic "+r+" does not exist!")},it=function(r,a){if(typeof r!="string"||r.length===0)throw new Jt("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof a!="boolean")throw new Jt('"allowMissing" argument must be a boolean');if(Jc(/^%?[^%]*%?$/,r)===null)throw new Zt("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var l=ef(r),c=l.length>0?l[0]:"",h=tf("%"+c+"%",a),v=h.name,p=h.value,_=!1,x=h.alias;x&&(c=x[0],Zc(l,Hc([0,1],x)));for(var S=1,m=!0;S<l.length;S+=1){var E=l[S],k=tr(E,0,1),w=tr(E,-1);if((k==='"'||k==="'"||k==="`"||w==='"'||w==="'"||w==="`")&&k!==w)throw new Zt("property names with quotes must have matching quotes");if((E==="constructor"||!m)&&(_=!0),c+="."+E,v="%"+c+"%",er(Gt,v))p=Gt[v];else if(p!=null){if(!(E in p)){if(!a)throw new Jt("base intrinsic for "+r+" exists, but the property is not available.");return}if(Ft&&S+1>=l.length){var T=Ft(p,E);m=!!T,m&&"get"in T&&!("originalValue"in T.get)?p=T.get:p=p[E]}else m=er(p,E),p=p[E];m&&!_&&(Gt[v]=p)}}return p},nf=it,nr=nf("%Object.defineProperty%",!0)||!1;if(nr)try{nr({},"a",{value:1})}catch{nr=!1}var li=nr,rf=it,rr=rf("%Object.getOwnPropertyDescriptor%",!0);if(rr)try{rr([],"length")}catch{rr=null}var ci=rr,oa=li,sf=ea,en=wt,ua=ci,fi=function(r,a,l){if(!r||typeof r!="object"&&typeof r!="function")throw new en("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new en("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new en("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new en("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new en("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new en("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,v=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,_=!!ua&&ua(r,a);if(oa)oa(r,a,{configurable:v===null&&_?_.configurable:!v,enumerable:c===null&&_?_.enumerable:!c,value:l,writable:h===null&&_?_.writable:!h});else if(p||!c&&!h&&!v)r[a]=l;else throw new sf("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},hi=li,la=function(){return!!hi};la.hasArrayLengthDefineBug=function(){if(!hi)return null;try{return hi([],"length",{value:1}).length!==1}catch{return!0}};var gi=la,af=ri,of=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",uf=Object.prototype.toString,lf=Array.prototype.concat,ca=fi,cf=function(o){return typeof o=="function"&&uf.call(o)==="[object Function]"},fa=gi(),ff=function(o,r,a,l){if(r in o){if(l===!0){if(o[r]===a)return}else if(!cf(l)||!l())return}fa?ca(o,r,a,!0):ca(o,r,a)},ha=function(o,r){var a=arguments.length>2?arguments[2]:{},l=af(r);of&&(l=lf.call(l,Object.getOwnPropertySymbols(r)));for(var c=0;c<l.length;c+=1)ff(o,l[c],r[l[c]],a[l[c]])};ha.supportsDescriptors=!!fa;var Bt=ha,ga={exports:{}},hf=it,ya=fi,gf=gi(),va=ci,pa=wt,yf=hf("%Math.floor%"),vf=function(r,a){if(typeof r!="function")throw new pa("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||yf(a)!==a)throw new pa("`length` must be a positive 32-bit integer");var l=arguments.length>2&&!!arguments[2],c=!0,h=!0;if("length"in r&&va){var v=va(r,"length");v&&!v.configurable&&(c=!1),v&&!v.writable&&(h=!1)}return(c||h||!l)&&(gf?ya(r,"length",a,!0,!0):ya(r,"length",a)),r};(function(o){var r=ai,a=it,l=vf,c=wt,h=a("%Function.prototype.apply%"),v=a("%Function.prototype.call%"),p=a("%Reflect.apply%",!0)||r.call(v,h),_=li,x=a("%Math.max%");o.exports=function(E){if(typeof E!="function")throw new c("a function is required");var k=p(r,v,arguments);return l(k,1+x(0,E.length-(arguments.length-1)),!0)};var S=function(){return p(r,h,arguments)};_?_(o.exports,"apply",{value:S}):o.exports.apply=S})(ga);var tn=ga.exports,ma=it,da=tn,pf=da(ma("String.prototype.indexOf")),Ye=function(r,a){var l=ma(r,!!a);return typeof l=="function"&&pf(r,".prototype.")>-1?da(l):l},mf=ri,_a=Kn(),xa=Ye,Ea=Object,df=xa("Array.prototype.push"),ka=xa("Object.prototype.propertyIsEnumerable"),_f=_a?Object.getOwnPropertySymbols:null,Sa=function(r,a){if(r==null)throw new TypeError("target must be an object");var l=Ea(r);if(arguments.length===1)return l;for(var c=1;c<arguments.length;++c){var h=Ea(arguments[c]),v=mf(h),p=_a&&(Object.getOwnPropertySymbols||_f);if(p)for(var _=p(h),x=0;x<_.length;++x){var S=_[x];ka(h,S)&&df(v,S)}for(var m=0;m<v.length;++m){var E=v[m];if(ka(h,E)){var k=h[E];l[E]=k}}}return l},yi=Sa,xf=function(){if(!Object.assign)return!1;for(var o="abcdefghijklmnopqrst",r=o.split(""),a={},l=0;l<r.length;++l)a[r[l]]=r[l];var c=Object.assign({},a),h="";for(var v in c)h+=v;return o!==h},Ef=function(){if(!Object.assign||!Object.preventExtensions)return!1;var o=Object.preventExtensions({1:2});try{Object.assign(o,"xy")}catch{return o[1]==="y"}return!1},Ia=function(){return!Object.assign||xf()||Ef()?yi:Object.assign},kf=Bt,Sf=Ia,If=function(){var r=Sf();return kf(Object,{assign:r},{assign:function(){return Object.assign!==r}}),r},wf=Bt,Nf=tn,bf=Sa,wa=Ia,Of=If,Tf=Nf.apply(wa()),Na=function(r,a){return Tf(Object,arguments)};wf(Na,{getPolyfill:wa,implementation:bf,shim:Of});var Lf=Na,wn=function(){return typeof(function(){}).name=="string"},Nn=Object.getOwnPropertyDescriptor;if(Nn)try{Nn([],"length")}catch{Nn=null}wn.functionsHaveConfigurableNames=function(){if(!wn()||!Nn)return!1;var r=Nn(function(){},"name");return!!r&&!!r.configurable};var Rf=Function.prototype.bind;wn.boundFunctionsHaveNames=function(){return wn()&&typeof Rf=="function"&&(function(){}).bind().name!==""};var Cf=wn,ba=fi,Pf=gi(),Af=Cf.functionsHaveConfigurableNames(),Mf=wt,Df=function(r,a){if(typeof r!="function")throw new Mf("`fn` is not a function");var l=arguments.length>2&&!!arguments[2];return(!l||Af)&&(Pf?ba(r,"name",a,!0,!0):ba(r,"name",a)),r},Ff=Df,Gf=wt,Bf=Object,Oa=Ff(function(){if(this==null||this!==Bf(this))throw new Gf("RegExp.prototype.flags getter called on non-object");var r="";return this.hasIndices&&(r+="d"),this.global&&(r+="g"),this.ignoreCase&&(r+="i"),this.multiline&&(r+="m"),this.dotAll&&(r+="s"),this.unicode&&(r+="u"),this.unicodeSets&&(r+="v"),this.sticky&&(r+="y"),r},"get flags",!0),$f=Oa,qf=Bt.supportsDescriptors,zf=Object.getOwnPropertyDescriptor,Ta=function(){if(qf&&/a/mig.flags==="gim"){var r=zf(RegExp.prototype,"flags");if(r&&typeof r.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var a="",l={};if(Object.defineProperty(l,"hasIndices",{get:function(){a+="d"}}),Object.defineProperty(l,"sticky",{get:function(){a+="y"}}),a==="dy")return r.get}}return $f},Yf=Bt.supportsDescriptors,Uf=Ta,Xf=Object.getOwnPropertyDescriptor,jf=Object.defineProperty,Vf=TypeError,La=Object.getPrototypeOf,Wf=/a/,Hf=function(){if(!Yf||!La)throw new Vf("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var r=Uf(),a=La(Wf),l=Xf(a,"flags");return(!l||l.get!==r)&&jf(a,"flags",{configurable:!0,enumerable:!1,get:r}),r},Zf=Bt,Jf=tn,Qf=Oa,Ra=Ta,Kf=Hf,Ca=Jf(Ra());Zf(Ca,{getPolyfill:Ra,implementation:Qf,shim:Kf});var eh=Ca,ir={exports:{}},th=Kn,$t=function(){return th()&&!!Symbol.toStringTag},nh=$t(),rh=Ye,vi=rh("Object.prototype.toString"),sr=function(r){return nh&&r&&typeof r=="object"&&Symbol.toStringTag in r?!1:vi(r)==="[object Arguments]"},Pa=function(r){return sr(r)?!0:r!==null&&typeof r=="object"&&typeof r.length=="number"&&r.length>=0&&vi(r)!=="[object Array]"&&vi(r.callee)==="[object Function]"},ih=function(){return sr(arguments)}();sr.isLegacyArguments=Pa;var Aa=ih?sr:Pa;const sh=pc(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var pi=typeof Map=="function"&&Map.prototype,mi=Object.getOwnPropertyDescriptor&&pi?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ar=pi&&mi&&typeof mi.get=="function"?mi.get:null,Ma=pi&&Map.prototype.forEach,di=typeof Set=="function"&&Set.prototype,_i=Object.getOwnPropertyDescriptor&&di?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,or=di&&_i&&typeof _i.get=="function"?_i.get:null,Da=di&&Set.prototype.forEach,ah=typeof WeakMap=="function"&&WeakMap.prototype,bn=ah?WeakMap.prototype.has:null,oh=typeof WeakSet=="function"&&WeakSet.prototype,On=oh?WeakSet.prototype.has:null,uh=typeof WeakRef=="function"&&WeakRef.prototype,Fa=uh?WeakRef.prototype.deref:null,lh=Boolean.prototype.valueOf,ch=Object.prototype.toString,fh=Function.prototype.toString,hh=String.prototype.match,xi=String.prototype.slice,Nt=String.prototype.replace,gh=String.prototype.toUpperCase,Ga=String.prototype.toLowerCase,Ba=RegExp.prototype.test,$a=Array.prototype.concat,st=Array.prototype.join,yh=Array.prototype.slice,qa=Math.floor,Ei=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ki=Object.getOwnPropertySymbols,Si=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,nn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Te=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===nn||!0)?Symbol.toStringTag:null,za=Object.prototype.propertyIsEnumerable,Ya=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(o){return o.__proto__}:null);function Ua(o,r){if(o===1/0||o===-1/0||o!==o||o&&o>-1e3&&o<1e3||Ba.call(/e/,r))return r;var a=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof o=="number"){var l=o<0?-qa(-o):qa(o);if(l!==o){var c=String(l),h=xi.call(r,c.length+1);return Nt.call(c,a,"$&_")+"."+Nt.call(Nt.call(h,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Nt.call(r,a,"$&_")}var Ii=sh,Xa=Ii.custom,ja=Ha(Xa)?Xa:null,vh=function o(r,a,l,c){var h=a||{};if(bt(h,"quoteStyle")&&h.quoteStyle!=="single"&&h.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(bt(h,"maxStringLength")&&(typeof h.maxStringLength=="number"?h.maxStringLength<0&&h.maxStringLength!==1/0:h.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var v=bt(h,"customInspect")?h.customInspect:!0;if(typeof v!="boolean"&&v!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(bt(h,"indent")&&h.indent!==null&&h.indent!==" "&&!(parseInt(h.indent,10)===h.indent&&h.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(bt(h,"numericSeparator")&&typeof h.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var p=h.numericSeparator;if(typeof r>"u")return"undefined";if(r===null)return"null";if(typeof r=="boolean")return r?"true":"false";if(typeof r=="string")return Ja(r,h);if(typeof r=="number"){if(r===0)return 1/0/r>0?"0":"-0";var _=String(r);return p?Ua(r,_):_}if(typeof r=="bigint"){var x=String(r)+"n";return p?Ua(r,x):x}var S=typeof h.depth>"u"?5:h.depth;if(typeof l>"u"&&(l=0),l>=S&&S>0&&typeof r=="object")return wi(r)?"[Array]":"[Object]";var m=Ph(h,l);if(typeof c>"u")c=[];else if(Za(c,r)>=0)return"[Circular]";function E(ae,q,ne){if(q&&(c=yh.call(c),c.push(q)),ne){var ue={depth:h.depth};return bt(h,"quoteStyle")&&(ue.quoteStyle=h.quoteStyle),o(ae,ue,l+1,c)}return o(ae,h,l+1,c)}if(typeof r=="function"&&!Wa(r)){var k=Ih(r),w=ur(r,E);return"[Function"+(k?": "+k:" (anonymous)")+"]"+(w.length>0?" { "+st.call(w,", ")+" }":"")}if(Ha(r)){var T=nn?Nt.call(String(r),/^(Symbol\(.*\))_[^)]*$/,"$1"):Si.call(r);return typeof r=="object"&&!nn?Tn(T):T}if(Lh(r)){for(var C="<"+Ga.call(String(r.nodeName)),P=r.attributes||[],A=0;A<P.length;A++)C+=" "+P[A].name+"="+Va(ph(P[A].value),"double",h);return C+=">",r.childNodes&&r.childNodes.length&&(C+="..."),C+="</"+Ga.call(String(r.nodeName))+">",C}if(wi(r)){if(r.length===0)return"[]";var R=ur(r,E);return m&&!Ch(R)?"["+bi(R,m)+"]":"[ "+st.call(R,", ")+" ]"}if(dh(r)){var G=ur(r,E);return!("cause"in Error.prototype)&&"cause"in r&&!za.call(r,"cause")?"{ ["+String(r)+"] "+st.call($a.call("[cause]: "+E(r.cause),G),", ")+" }":G.length===0?"["+String(r)+"]":"{ ["+String(r)+"] "+st.call(G,", ")+" }"}if(typeof r=="object"&&v){if(ja&&typeof r[ja]=="function"&&Ii)return Ii(r,{depth:S-l});if(v!=="symbol"&&typeof r.inspect=="function")return r.inspect()}if(wh(r)){var M=[];return Ma&&Ma.call(r,function(ae,q){M.push(E(q,r,!0)+" => "+E(ae,r))}),Qa("Map",ar.call(r),M,m)}if(Oh(r)){var $=[];return Da&&Da.call(r,function(ae){$.push(E(ae,r))}),Qa("Set",or.call(r),$,m)}if(Nh(r))return Ni("WeakMap");if(Th(r))return Ni("WeakSet");if(bh(r))return Ni("WeakRef");if(xh(r))return Tn(E(Number(r)));if(kh(r))return Tn(E(Ei.call(r)));if(Eh(r))return Tn(lh.call(r));if(_h(r))return Tn(E(String(r)));if(typeof window<"u"&&r===window)return"{ [object Window] }";if(typeof globalThis<"u"&&r===globalThis||typeof Sn<"u"&&r===Sn)return"{ [object globalThis] }";if(!mh(r)&&!Wa(r)){var Y=ur(r,E),U=Ya?Ya(r)===Object.prototype:r instanceof Object||r.constructor===Object,X=r instanceof Object?"":"null prototype",ie=!U&&Te&&Object(r)===r&&Te in r?xi.call(Ot(r),8,-1):X?"Object":"",ee=U||typeof r.constructor!="function"?"":r.constructor.name?r.constructor.name+" ":"",te=ee+(ie||X?"["+st.call($a.call([],ie||[],X||[]),": ")+"] ":"");return Y.length===0?te+"{}":m?te+"{"+bi(Y,m)+"}":te+"{ "+st.call(Y,", ")+" }"}return String(r)};function Va(o,r,a){var l=(a.quoteStyle||r)==="double"?'"':"'";return l+o+l}function ph(o){return Nt.call(String(o),/"/g,"&quot;")}function wi(o){return Ot(o)==="[object Array]"&&(!Te||!(typeof o=="object"&&Te in o))}function mh(o){return Ot(o)==="[object Date]"&&(!Te||!(typeof o=="object"&&Te in o))}function Wa(o){return Ot(o)==="[object RegExp]"&&(!Te||!(typeof o=="object"&&Te in o))}function dh(o){return Ot(o)==="[object Error]"&&(!Te||!(typeof o=="object"&&Te in o))}function _h(o){return Ot(o)==="[object String]"&&(!Te||!(typeof o=="object"&&Te in o))}function xh(o){return Ot(o)==="[object Number]"&&(!Te||!(typeof o=="object"&&Te in o))}function Eh(o){return Ot(o)==="[object Boolean]"&&(!Te||!(typeof o=="object"&&Te in o))}function Ha(o){if(nn)return o&&typeof o=="object"&&o instanceof Symbol;if(typeof o=="symbol")return!0;if(!o||typeof o!="object"||!Si)return!1;try{return Si.call(o),!0}catch{}return!1}function kh(o){if(!o||typeof o!="object"||!Ei)return!1;try{return Ei.call(o),!0}catch{}return!1}var Sh=Object.prototype.hasOwnProperty||function(o){return o in this};function bt(o,r){return Sh.call(o,r)}function Ot(o){return ch.call(o)}function Ih(o){if(o.name)return o.name;var r=hh.call(fh.call(o),/^function\s*([\w$]+)/);return r?r[1]:null}function Za(o,r){if(o.indexOf)return o.indexOf(r);for(var a=0,l=o.length;a<l;a++)if(o[a]===r)return a;return-1}function wh(o){if(!ar||!o||typeof o!="object")return!1;try{ar.call(o);try{or.call(o)}catch{return!0}return o instanceof Map}catch{}return!1}function Nh(o){if(!bn||!o||typeof o!="object")return!1;try{bn.call(o,bn);try{On.call(o,On)}catch{return!0}return o instanceof WeakMap}catch{}return!1}function bh(o){if(!Fa||!o||typeof o!="object")return!1;try{return Fa.call(o),!0}catch{}return!1}function Oh(o){if(!or||!o||typeof o!="object")return!1;try{or.call(o);try{ar.call(o)}catch{return!0}return o instanceof Set}catch{}return!1}function Th(o){if(!On||!o||typeof o!="object")return!1;try{On.call(o,On);try{bn.call(o,bn)}catch{return!0}return o instanceof WeakSet}catch{}return!1}function Lh(o){return!o||typeof o!="object"?!1:typeof HTMLElement<"u"&&o instanceof HTMLElement?!0:typeof o.nodeName=="string"&&typeof o.getAttribute=="function"}function Ja(o,r){if(o.length>r.maxStringLength){var a=o.length-r.maxStringLength,l="... "+a+" more character"+(a>1?"s":"");return Ja(xi.call(o,0,r.maxStringLength),r)+l}var c=Nt.call(Nt.call(o,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Rh);return Va(c,"single",r)}function Rh(o){var r=o.charCodeAt(0),a={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return a?"\\"+a:"\\x"+(r<16?"0":"")+gh.call(r.toString(16))}function Tn(o){return"Object("+o+")"}function Ni(o){return o+" { ? }"}function Qa(o,r,a,l){var c=l?bi(a,l):st.call(a,", ");return o+" ("+r+") {"+c+"}"}function Ch(o){for(var r=0;r<o.length;r++)if(Za(o[r],`
2
- `)>=0)return!1;return!0}function Ph(o,r){var a;if(o.indent===" ")a=" ";else if(typeof o.indent=="number"&&o.indent>0)a=st.call(Array(o.indent+1)," ");else return null;return{base:a,prev:st.call(Array(r+1),a)}}function bi(o,r){if(o.length===0)return"";var a=`
3
- `+r.prev+r.base;return a+st.call(o,","+a)+`
4
- `+r.prev}function ur(o,r){var a=wi(o),l=[];if(a){l.length=o.length;for(var c=0;c<o.length;c++)l[c]=bt(o,c)?r(o[c],o):""}var h=typeof ki=="function"?ki(o):[],v;if(nn){v={};for(var p=0;p<h.length;p++)v["$"+h[p]]=h[p]}for(var _ in o)bt(o,_)&&(a&&String(Number(_))===_&&_<o.length||nn&&v["$"+_]instanceof Symbol||(Ba.call(/[^\w$]/,_)?l.push(r(_,o)+": "+r(o[_],o)):l.push(_+": "+r(o[_],o))));if(typeof ki=="function")for(var x=0;x<h.length;x++)za.call(o,h[x])&&l.push("["+r(h[x])+"]: "+r(o[h[x]],o));return l}var Ka=it,rn=Ye,Ah=vh,Mh=wt,lr=Ka("%WeakMap%",!0),cr=Ka("%Map%",!0),Dh=rn("WeakMap.prototype.get",!0),Fh=rn("WeakMap.prototype.set",!0),Gh=rn("WeakMap.prototype.has",!0),Bh=rn("Map.prototype.get",!0),$h=rn("Map.prototype.set",!0),qh=rn("Map.prototype.has",!0),Oi=function(o,r){for(var a=o,l;(l=a.next)!==null;a=l)if(l.key===r)return a.next=l.next,l.next=o.next,o.next=l,l},zh=function(o,r){var a=Oi(o,r);return a&&a.value},Yh=function(o,r,a){var l=Oi(o,r);l?l.value=a:o.next={key:r,next:o.next,value:a}},Uh=function(o,r){return!!Oi(o,r)},eo=function(){var r,a,l,c={assert:function(h){if(!c.has(h))throw new Mh("Side channel does not contain "+Ah(h))},get:function(h){if(lr&&h&&(typeof h=="object"||typeof h=="function")){if(r)return Dh(r,h)}else if(cr){if(a)return Bh(a,h)}else if(l)return zh(l,h)},has:function(h){if(lr&&h&&(typeof h=="object"||typeof h=="function")){if(r)return Gh(r,h)}else if(cr){if(a)return qh(a,h)}else if(l)return Uh(l,h);return!1},set:function(h,v){lr&&h&&(typeof h=="object"||typeof h=="function")?(r||(r=new lr),Fh(r,h,v)):cr?(a||(a=new cr),$h(a,h,v)):(l||(l={key:{},next:null}),Yh(l,h,v))}};return c},Xh=ra,Ln=eo(),vt=wt,Ti={assert:function(o,r){if(!o||typeof o!="object"&&typeof o!="function")throw new vt("`O` is not an object");if(typeof r!="string")throw new vt("`slot` must be a string");if(Ln.assert(o),!Ti.has(o,r))throw new vt("`"+r+"` is not present on `O`")},get:function(o,r){if(!o||typeof o!="object"&&typeof o!="function")throw new vt("`O` is not an object");if(typeof r!="string")throw new vt("`slot` must be a string");var a=Ln.get(o);return a&&a["$"+r]},has:function(o,r){if(!o||typeof o!="object"&&typeof o!="function")throw new vt("`O` is not an object");if(typeof r!="string")throw new vt("`slot` must be a string");var a=Ln.get(o);return!!a&&Xh(a,"$"+r)},set:function(o,r,a){if(!o||typeof o!="object"&&typeof o!="function")throw new vt("`O` is not an object");if(typeof r!="string")throw new vt("`slot` must be a string");var l=Ln.get(o);l||(l={},Ln.set(o,l)),l["$"+r]=a}};Object.freeze&&Object.freeze(Ti);var jh=Ti,Rn=jh,Vh=SyntaxError,to=typeof StopIteration=="object"?StopIteration:null,Wh=function(r){if(!to)throw new Vh("this environment lacks StopIteration");Rn.set(r,"[[Done]]",!1);var a={next:function(){var c=Rn.get(this,"[[Iterator]]"),h=Rn.get(c,"[[Done]]");try{return{done:h,value:h?void 0:c.next()}}catch(v){if(Rn.set(c,"[[Done]]",!0),v!==to)throw v;return{done:!0,value:void 0}}}};return Rn.set(a,"[[Iterator]]",r),a},Hh={}.toString,no=Array.isArray||function(o){return Hh.call(o)=="[object Array]"},Zh=String.prototype.valueOf,Jh=function(r){try{return Zh.call(r),!0}catch{return!1}},Qh=Object.prototype.toString,Kh="[object String]",eg=$t(),ro=function(r){return typeof r=="string"?!0:typeof r!="object"?!1:eg?Jh(r):Qh.call(r)===Kh},Li=typeof Map=="function"&&Map.prototype?Map:null,tg=typeof Set=="function"&&Set.prototype?Set:null,fr;Li||(fr=function(r){return!1});var io=Li?Map.prototype.has:null,so=tg?Set.prototype.has:null;!fr&&!io&&(fr=function(r){return!1});var ao=fr||function(r){if(!r||typeof r!="object")return!1;try{if(io.call(r),so)try{so.call(r)}catch{return!0}return r instanceof Li}catch{}return!1},ng=typeof Map=="function"&&Map.prototype?Map:null,Ri=typeof Set=="function"&&Set.prototype?Set:null,hr;Ri||(hr=function(r){return!1});var oo=ng?Map.prototype.has:null,uo=Ri?Set.prototype.has:null;!hr&&!uo&&(hr=function(r){return!1});var lo=hr||function(r){if(!r||typeof r!="object")return!1;try{if(uo.call(r),oo)try{oo.call(r)}catch{return!0}return r instanceof Ri}catch{}return!1},co=Aa,fo=Wh;if(ii()||Kn()){var Ci=Symbol.iterator;ir.exports=function(r){if(r!=null&&typeof r[Ci]<"u")return r[Ci]();if(co(r))return Array.prototype[Ci].call(r)}}else{var rg=no,ig=ro,ho=it,sg=ho("%Map%",!0),ag=ho("%Set%",!0),Je=Ye,go=Je("Array.prototype.push"),yo=Je("String.prototype.charCodeAt"),og=Je("String.prototype.slice"),ug=function(r,a){var l=r.length;if(a+1>=l)return a+1;var c=yo(r,a);if(c<55296||c>56319)return a+1;var h=yo(r,a+1);return h<56320||h>57343?a+1:a+2},Pi=function(r){var a=0;return{next:function(){var c=a>=r.length,h;return c||(h=r[a],a+=1),{done:c,value:h}}}},vo=function(r,a){if(rg(r)||co(r))return Pi(r);if(ig(r)){var l=0;return{next:function(){var h=ug(r,l),v=og(r,l,h);return l=h,{done:h>r.length,value:v}}}}if(a&&typeof r["_es6-shim iterator_"]<"u")return r["_es6-shim iterator_"]()};if(!sg&&!ag)ir.exports=function(r){if(r!=null)return vo(r,!0)};else{var lg=ao,cg=lo,po=Je("Map.prototype.forEach",!0),mo=Je("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var _o=Je("Map.prototype.iterator",!0),xo=Je("Set.prototype.iterator",!0);var Eo=Je("Map.prototype.@@iterator",!0)||Je("Map.prototype._es6-shim iterator_",!0),ko=Je("Set.prototype.@@iterator",!0)||Je("Set.prototype._es6-shim iterator_",!0),fg=function(r){if(lg(r)){if(_o)return fo(_o(r));if(Eo)return Eo(r);if(po){var a=[];return po(r,function(c,h){go(a,[h,c])}),Pi(a)}}if(cg(r)){if(xo)return fo(xo(r));if(ko)return ko(r);if(mo){var l=[];return mo(r,function(c){go(l,c)}),Pi(l)}}};ir.exports=function(r){return fg(r)||vo(r)}}}var hg=ir.exports,So=function(o){return o!==o},Io=function(r,a){return r===0&&a===0?1/r===1/a:!!(r===a||So(r)&&So(a))},gg=Io,wo=function(){return typeof Object.is=="function"?Object.is:gg},yg=wo,vg=Bt,pg=function(){var r=yg();return vg(Object,{is:r},{is:function(){return Object.is!==r}}),r},mg=Bt,dg=tn,_g=Io,No=wo,xg=pg,bo=dg(No(),Object);mg(bo,{getPolyfill:No,implementation:_g,shim:xg});var Eg=bo,kg=tn,Oo=Ye,Sg=it,Ai=Sg("%ArrayBuffer%",!0),gr=Oo("ArrayBuffer.prototype.byteLength",!0),Ig=Oo("Object.prototype.toString"),To=!!Ai&&!gr&&new Ai(0).slice,Lo=!!To&&kg(To),Ro=gr||Lo?function(r){if(!r||typeof r!="object")return!1;try{return gr?gr(r):Lo(r,0),!0}catch{return!1}}:Ai?function(r){return Ig(r)==="[object ArrayBuffer]"}:function(r){return!1},wg=Date.prototype.getDay,Ng=function(r){try{return wg.call(r),!0}catch{return!1}},bg=Object.prototype.toString,Og="[object Date]",Tg=$t(),Lg=function(r){return typeof r!="object"||r===null?!1:Tg?Ng(r):bg.call(r)===Og},Mi=Ye,Co=$t(),Po,Ao,Di,Fi;if(Co){Po=Mi("Object.prototype.hasOwnProperty"),Ao=Mi("RegExp.prototype.exec"),Di={};var Gi=function(){throw Di};Fi={toString:Gi,valueOf:Gi},typeof Symbol.toPrimitive=="symbol"&&(Fi[Symbol.toPrimitive]=Gi)}var Rg=Mi("Object.prototype.toString"),Cg=Object.getOwnPropertyDescriptor,Pg="[object RegExp]",Ag=Co?function(r){if(!r||typeof r!="object")return!1;var a=Cg(r,"lastIndex"),l=a&&Po(a,"value");if(!l)return!1;try{Ao(r,Fi)}catch(c){return c===Di}}:function(r){return!r||typeof r!="object"&&typeof r!="function"?!1:Rg(r)===Pg},Mg=Ye,Mo=Mg("SharedArrayBuffer.prototype.byteLength",!0),Dg=Mo?function(r){if(!r||typeof r!="object")return!1;try{return Mo(r),!0}catch{return!1}}:function(r){return!1},Fg=Number.prototype.toString,Gg=function(r){try{return Fg.call(r),!0}catch{return!1}},Bg=Object.prototype.toString,$g="[object Number]",qg=$t(),zg=function(r){return typeof r=="number"?!0:typeof r!="object"?!1:qg?Gg(r):Bg.call(r)===$g},Do=Ye,Yg=Do("Boolean.prototype.toString"),Ug=Do("Object.prototype.toString"),Xg=function(r){try{return Yg(r),!0}catch{return!1}},jg="[object Boolean]",Vg=$t(),Wg=function(r){return typeof r=="boolean"?!0:r===null||typeof r!="object"?!1:Vg&&Symbol.toStringTag in r?Xg(r):Ug(r)===jg},Bi={exports:{}},Hg=Object.prototype.toString,Zg=ii();if(Zg){var Jg=Symbol.prototype.toString,Qg=/^Symbol\(.*\)$/,Kg=function(r){return typeof r.valueOf()!="symbol"?!1:Qg.test(Jg.call(r))};Bi.exports=function(r){if(typeof r=="symbol")return!0;if(Hg.call(r)!=="[object Symbol]")return!1;try{return Kg(r)}catch{return!1}}}else Bi.exports=function(r){return!1};var ey=Bi.exports,$i={exports:{}},Fo=typeof BigInt<"u"&&BigInt,ty=function(){return typeof Fo=="function"&&typeof BigInt=="function"&&typeof Fo(42)=="bigint"&&typeof BigInt(42)=="bigint"},ny=ty();if(ny){var ry=BigInt.prototype.valueOf,iy=function(r){try{return ry.call(r),!0}catch{}return!1};$i.exports=function(r){return r===null||typeof r>"u"||typeof r=="boolean"||typeof r=="string"||typeof r=="number"||typeof r=="symbol"||typeof r=="function"?!1:typeof r=="bigint"?!0:iy(r)}}else $i.exports=function(r){return!1};var sy=$i.exports,ay=ro,oy=zg,uy=Wg,ly=ey,cy=sy,fy=function(r){if(r==null||typeof r!="object"&&typeof r!="function")return null;if(ay(r))return"String";if(oy(r))return"Number";if(uy(r))return"Boolean";if(ly(r))return"Symbol";if(cy(r))return"BigInt"},yr=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Go=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,vr;yr||(vr=function(r){return!1});var qi=yr?yr.prototype.has:null,zi=Go?Go.prototype.has:null;!vr&&!qi&&(vr=function(r){return!1});var hy=vr||function(r){if(!r||typeof r!="object")return!1;try{if(qi.call(r,qi),zi)try{zi.call(r,zi)}catch{return!0}return r instanceof yr}catch{}return!1},Yi={exports:{}},gy=it,Bo=Ye,yy=gy("%WeakSet%",!0),Ui=Bo("WeakSet.prototype.has",!0);if(Ui){var Xi=Bo("WeakMap.prototype.has",!0);Yi.exports=function(r){if(!r||typeof r!="object")return!1;try{if(Ui(r,Ui),Xi)try{Xi(r,Xi)}catch{return!0}return r instanceof yy}catch{}return!1}}else Yi.exports=function(r){return!1};var vy=Yi.exports,py=ao,my=lo,dy=hy,_y=vy,xy=function(r){if(r&&typeof r=="object"){if(py(r))return"Map";if(my(r))return"Set";if(dy(r))return"WeakMap";if(_y(r))return"WeakSet"}return!1},$o=Function.prototype.toString,sn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,ji,pr;if(typeof sn=="function"&&typeof Object.defineProperty=="function")try{ji=Object.defineProperty({},"length",{get:function(){throw pr}}),pr={},sn(function(){throw 42},null,ji)}catch(o){o!==pr&&(sn=null)}else sn=null;var Ey=/^\s*class\b/,Vi=function(r){try{var a=$o.call(r);return Ey.test(a)}catch{return!1}},Wi=function(r){try{return Vi(r)?!1:($o.call(r),!0)}catch{return!1}},mr=Object.prototype.toString,ky="[object Object]",Sy="[object Function]",Iy="[object GeneratorFunction]",wy="[object HTMLAllCollection]",Ny="[object HTML document.all class]",by="[object HTMLCollection]",Oy=typeof Symbol=="function"&&!!Symbol.toStringTag,Ty=!(0 in[,]),Hi=function(){return!1};if(typeof document=="object"){var Ly=document.all;mr.call(Ly)===mr.call(document.all)&&(Hi=function(r){if((Ty||!r)&&(typeof r>"u"||typeof r=="object"))try{var a=mr.call(r);return(a===wy||a===Ny||a===by||a===ky)&&r("")==null}catch{}return!1})}var Ry=sn?function(r){if(Hi(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;try{sn(r,null,ji)}catch(a){if(a!==pr)return!1}return!Vi(r)&&Wi(r)}:function(r){if(Hi(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;if(Oy)return Wi(r);if(Vi(r))return!1;var a=mr.call(r);return a!==Sy&&a!==Iy&&!/^\[object HTML/.test(a)?!1:Wi(r)},Cy=Ry,Py=Object.prototype.toString,qo=Object.prototype.hasOwnProperty,Ay=function(r,a,l){for(var c=0,h=r.length;c<h;c++)qo.call(r,c)&&(l==null?a(r[c],c,r):a.call(l,r[c],c,r))},My=function(r,a,l){for(var c=0,h=r.length;c<h;c++)l==null?a(r.charAt(c),c,r):a.call(l,r.charAt(c),c,r)},Dy=function(r,a,l){for(var c in r)qo.call(r,c)&&(l==null?a(r[c],c,r):a.call(l,r[c],c,r))},Fy=function(r,a,l){if(!Cy(a))throw new TypeError("iterator must be a function");var c;arguments.length>=3&&(c=l),Py.call(r)==="[object Array]"?Ay(r,a,c):typeof r=="string"?My(r,a,c):Dy(r,a,c)},Gy=Fy,By=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Zi=By,$y=typeof globalThis>"u"?Sn:globalThis,qy=function(){for(var r=[],a=0;a<Zi.length;a++)typeof $y[Zi[a]]=="function"&&(r[r.length]=Zi[a]);return r},dr=Gy,zy=qy,zo=tn,Ji=Ye,_r=ci,Yy=Ji("Object.prototype.toString"),Yo=$t(),Uo=typeof globalThis>"u"?Sn:globalThis,Qi=zy(),Ki=Ji("String.prototype.slice"),es=Object.getPrototypeOf,Uy=Ji("Array.prototype.indexOf",!0)||function(r,a){for(var l=0;l<r.length;l+=1)if(r[l]===a)return l;return-1},xr={__proto__:null};Yo&&_r&&es?dr(Qi,function(o){var r=new Uo[o];if(Symbol.toStringTag in r){var a=es(r),l=_r(a,Symbol.toStringTag);if(!l){var c=es(a);l=_r(c,Symbol.toStringTag)}xr["$"+o]=zo(l.get)}}):dr(Qi,function(o){var r=new Uo[o],a=r.slice||r.set;a&&(xr["$"+o]=zo(a))});var Xy=function(r){var a=!1;return dr(xr,function(l,c){if(!a)try{"$"+l(r)===c&&(a=Ki(c,1))}catch{}}),a},jy=function(r){var a=!1;return dr(xr,function(l,c){if(!a)try{l(r),a=Ki(c,1)}catch{}}),a},Vy=function(r){if(!r||typeof r!="object")return!1;if(!Yo){var a=Ki(Yy(r),8,-1);return Uy(Qi,a)>-1?a:a!=="Object"?!1:jy(r)}return _r?Xy(r):null},Wy=Ye,Xo=Wy("ArrayBuffer.prototype.byteLength",!0),Hy=Ro,Zy=function(r){return Hy(r)?Xo?Xo(r):r.byteLength:NaN},jo=Lf,at=Ye,Vo=eh,Jy=it,an=hg,Qy=eo,Wo=Eg,Ho=Aa,Zo=no,Jo=Ro,Qo=Lg,Ko=Ag,eu=Dg,tu=ri,nu=fy,ru=xy,iu=Vy,su=Zy,au=at("SharedArrayBuffer.prototype.byteLength",!0),ou=at("Date.prototype.getTime"),ts=Object.getPrototypeOf,uu=at("Object.prototype.toString"),Er=Jy("%Set%",!0),ns=at("Map.prototype.has",!0),kr=at("Map.prototype.get",!0),lu=at("Map.prototype.size",!0),Sr=at("Set.prototype.add",!0),cu=at("Set.prototype.delete",!0),Ir=at("Set.prototype.has",!0),wr=at("Set.prototype.size",!0);function fu(o,r,a,l){for(var c=an(o),h;(h=c.next())&&!h.done;)if(Qe(r,h.value,a,l))return cu(o,h.value),!0;return!1}function hu(o){if(typeof o>"u")return null;if(typeof o!="object")return typeof o=="symbol"?!1:typeof o=="string"||typeof o=="number"?+o==+o:!0}function Ky(o,r,a,l,c,h){var v=hu(a);if(v!=null)return v;var p=kr(r,v),_=jo({},c,{strict:!1});return typeof p>"u"&&!ns(r,v)||!Qe(l,p,_,h)?!1:!ns(o,v)&&Qe(l,p,_,h)}function ev(o,r,a){var l=hu(a);return l??(Ir(r,l)&&!Ir(o,l))}function gu(o,r,a,l,c,h){for(var v=an(o),p,_;(p=v.next())&&!p.done;)if(_=p.value,Qe(a,_,c,h)&&Qe(l,kr(r,_),c,h))return cu(o,_),!0;return!1}function Qe(o,r,a,l){var c=a||{};if(c.strict?Wo(o,r):o===r)return!0;var h=nu(o),v=nu(r);if(h!==v)return!1;if(!o||!r||typeof o!="object"&&typeof r!="object")return c.strict?Wo(o,r):o==r;var p=l.has(o),_=l.has(r),x;if(p&&_){if(l.get(o)===l.get(r))return!0}else x={};return p||l.set(o,x),_||l.set(r,x),rv(o,r,c,l)}function yu(o){return!o||typeof o!="object"||typeof o.length!="number"||typeof o.copy!="function"||typeof o.slice!="function"||o.length>0&&typeof o[0]!="number"?!1:!!(o.constructor&&o.constructor.isBuffer&&o.constructor.isBuffer(o))}function tv(o,r,a,l){if(wr(o)!==wr(r))return!1;for(var c=an(o),h=an(r),v,p,_;(v=c.next())&&!v.done;)if(v.value&&typeof v.value=="object")_||(_=new Er),Sr(_,v.value);else if(!Ir(r,v.value)){if(a.strict||!ev(o,r,v.value))return!1;_||(_=new Er),Sr(_,v.value)}if(_){for(;(p=h.next())&&!p.done;)if(p.value&&typeof p.value=="object"){if(!fu(_,p.value,a.strict,l))return!1}else if(!a.strict&&!Ir(o,p.value)&&!fu(_,p.value,a.strict,l))return!1;return wr(_)===0}return!0}function nv(o,r,a,l){if(lu(o)!==lu(r))return!1;for(var c=an(o),h=an(r),v,p,_,x,S,m;(v=c.next())&&!v.done;)if(x=v.value[0],S=v.value[1],x&&typeof x=="object")_||(_=new Er),Sr(_,x);else if(m=kr(r,x),typeof m>"u"&&!ns(r,x)||!Qe(S,m,a,l)){if(a.strict||!Ky(o,r,x,S,a,l))return!1;_||(_=new Er),Sr(_,x)}if(_){for(;(p=h.next())&&!p.done;)if(x=p.value[0],m=p.value[1],x&&typeof x=="object"){if(!gu(_,o,x,m,a,l))return!1}else if(!a.strict&&(!o.has(x)||!Qe(kr(o,x),m,a,l))&&!gu(_,o,x,m,jo({},a,{strict:!1}),l))return!1;return wr(_)===0}return!0}function rv(o,r,a,l){var c,h;if(typeof o!=typeof r||o==null||r==null||uu(o)!==uu(r)||Ho(o)!==Ho(r))return!1;var v=Zo(o),p=Zo(r);if(v!==p)return!1;var _=o instanceof Error,x=r instanceof Error;if(_!==x||(_||x)&&(o.name!==r.name||o.message!==r.message))return!1;var S=Ko(o),m=Ko(r);if(S!==m||(S||m)&&(o.source!==r.source||Vo(o)!==Vo(r)))return!1;var E=Qo(o),k=Qo(r);if(E!==k||(E||k)&&ou(o)!==ou(r)||a.strict&&ts&&ts(o)!==ts(r))return!1;var w=iu(o),T=iu(r);if(w!==T)return!1;if(w||T){if(o.length!==r.length)return!1;for(c=0;c<o.length;c++)if(o[c]!==r[c])return!1;return!0}var C=yu(o),P=yu(r);if(C!==P)return!1;if(C||P){if(o.length!==r.length)return!1;for(c=0;c<o.length;c++)if(o[c]!==r[c])return!1;return!0}var A=Jo(o),R=Jo(r);if(A!==R)return!1;if(A||R)return su(o)!==su(r)?!1:typeof Uint8Array=="function"&&Qe(new Uint8Array(o),new Uint8Array(r),a,l);var G=eu(o),M=eu(r);if(G!==M)return!1;if(G||M)return au(o)!==au(r)?!1:typeof Uint8Array=="function"&&Qe(new Uint8Array(o),new Uint8Array(r),a,l);if(typeof o!=typeof r)return!1;var $=tu(o),Y=tu(r);if($.length!==Y.length)return!1;for($.sort(),Y.sort(),c=$.length-1;c>=0;c--)if($[c]!=Y[c])return!1;for(c=$.length-1;c>=0;c--)if(h=$[c],!Qe(o[h],r[h],a,l))return!1;var U=ru(o),X=ru(r);return U!==X?!1:U==="Set"||X==="Set"?tv(o,r,a,l):U==="Map"?nv(o,r,a,l):!0}var iv=function(r,a,l){return Qe(r,a,l,Qy())};const sv=Ws(iv);var av=Object.defineProperty,he=(o,r)=>av(o,"name",{value:r,configurable:!0}),ov=class{constructor(r){this.direction=!1,this.compareProperties=!0;var a,l,c;this.precision=10**-((a=r==null?void 0:r.precision)!=null?a:17),this.direction=(l=r==null?void 0:r.direction)!=null?l:!1,this.compareProperties=(c=r==null?void 0:r.compareProperties)!=null?c:!0}compare(r,a){if(r.type!==a.type||!Cn(r,a))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,a.coordinates);case"LineString":return this.compareLine(r.coordinates,a.coordinates);case"Polygon":return this.comparePolygon(r,a);case"GeometryCollection":return this.compareGeometryCollection(r,a);case"Feature":return this.compareFeature(r,a);case"FeatureCollection":return this.compareFeatureCollection(r,a);default:if(r.type.startsWith("Multi")){const l=rs(r),c=rs(a);return l.every(h=>c.some(v=>this.compare(h,v)))}}return!1}compareCoord(r,a){return r.length===a.length&&r.every((l,c)=>Math.abs(l-a[c])<this.precision)}compareLine(r,a,l=0,c=!1){if(!Cn(r,a))return!1;const h=r;let v=a;if(c&&!this.compareCoord(h[0],v[0])){const _=this.fixStartIndex(v,h);if(_)v=_;else return!1}const p=this.compareCoord(h[l],v[l]);return this.direction||p?this.comparePath(h,v):this.compareCoord(h[l],v[v.length-(1+l)])?this.comparePath(h.slice().reverse(),v):!1}fixStartIndex(r,a){let l,c=-1;for(let h=0;h<r.length;h++)if(this.compareCoord(r[h],a[0])){c=h;break}return c>=0&&(l=[].concat(r.slice(c,r.length),r.slice(1,c+1))),l}comparePath(r,a){return r.every((l,c)=>this.compareCoord(l,a[c]))}comparePolygon(r,a){if(this.compareLine(r.coordinates[0],a.coordinates[0],1,!0)){const l=r.coordinates.slice(1,r.coordinates.length),c=a.coordinates.slice(1,a.coordinates.length);return l.every(h=>c.some(v=>this.compareLine(h,v,1,!0)))}return!1}compareGeometryCollection(r,a){return Cn(r.geometries,a.geometries)&&this.compareBBox(r,a)&&r.geometries.every((l,c)=>this.compare(l,a.geometries[c]))}compareFeature(r,a){return r.id===a.id&&(this.compareProperties?sv(r.properties,a.properties):!0)&&this.compareBBox(r,a)&&this.compare(r.geometry,a.geometry)}compareFeatureCollection(r,a){return Cn(r.features,a.features)&&this.compareBBox(r,a)&&r.features.every((l,c)=>this.compare(l,a.features[c]))}compareBBox(r,a){return!r.bbox&&!a.bbox||(r.bbox&&a.bbox?this.compareCoord(r.bbox,a.bbox):!1)}};he(ov,"GeojsonEquality");function Cn(o,r){return o.coordinates?o.coordinates.length===r.coordinates.length:o.length===r.length}he(Cn,"sameLength");function rs(o){return o.coordinates.map(r=>({type:o.type.replace("Multi",""),coordinates:r}))}he(rs,"explode");var Me=63710088e-1,vu={centimeters:Me*100,centimetres:Me*100,degrees:360/(2*Math.PI),feet:Me*3.28084,inches:Me*39.37,kilometers:Me/1e3,kilometres:Me/1e3,meters:Me,metres:Me,miles:Me/1609.344,millimeters:Me*1e3,millimetres:Me*1e3,nauticalmiles:Me/1852,radians:1,yards:Me*1.0936},pu={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ke(o,r,a={}){const l={type:"Feature"};return(a.id===0||a.id)&&(l.id=a.id),a.bbox&&(l.bbox=a.bbox),l.properties=r||{},l.geometry=o,l}he(Ke,"feature");function uv(o,r,a={}){switch(o){case"Point":return ot(r).geometry;case"LineString":return pt(r).geometry;case"Polygon":return Pn(r).geometry;case"MultiPoint":return du(r).geometry;case"MultiLineString":return mu(r).geometry;case"MultiPolygon":return is(r).geometry;default:throw new Error(o+" is invalid")}}he(uv,"geometry");function ot(o,r,a={}){if(!o)throw new Error("coordinates is required");if(!Array.isArray(o))throw new Error("coordinates must be an Array");if(o.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!br(o[0])||!br(o[1]))throw new Error("coordinates must contain numbers");return Ke({type:"Point",coordinates:o},r,a)}he(ot,"point");function lv(o,r,a={}){return mt(o.map(l=>ot(l,r)),a)}he(lv,"points");function Pn(o,r,a={}){for(const c of o){if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(c[c.length-1].length!==c[0].length)throw new Error("First and last Position are not equivalent.");for(let h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}return Ke({type:"Polygon",coordinates:o},r,a)}he(Pn,"polygon");function cv(o,r,a={}){return mt(o.map(l=>Pn(l,r)),a)}he(cv,"polygons");function pt(o,r,a={}){if(o.length<2)throw new Error("coordinates must be an array of two or more positions");return Ke({type:"LineString",coordinates:o},r,a)}he(pt,"lineString");function fv(o,r,a={}){return mt(o.map(l=>pt(l,r)),a)}he(fv,"lineStrings");function mt(o,r={}){const a={type:"FeatureCollection"};return r.id&&(a.id=r.id),r.bbox&&(a.bbox=r.bbox),a.features=o,a}he(mt,"featureCollection");function mu(o,r,a={}){return Ke({type:"MultiLineString",coordinates:o},r,a)}he(mu,"multiLineString");function du(o,r,a={}){return Ke({type:"MultiPoint",coordinates:o},r,a)}he(du,"multiPoint");function is(o,r,a={}){return Ke({type:"MultiPolygon",coordinates:o},r,a)}he(is,"multiPolygon");function hv(o,r,a={}){return Ke({type:"GeometryCollection",geometries:o},r,a)}he(hv,"geometryCollection");function gv(o,r=0){if(r&&!(r>=0))throw new Error("precision must be a positive number");const a=Math.pow(10,r||0);return Math.round(o*a)/a}he(gv,"round");function ss(o,r="kilometers"){const a=vu[r];if(!a)throw new Error(r+" units is invalid");return o*a}he(ss,"radiansToLength");function Nr(o,r="kilometers"){const a=vu[r];if(!a)throw new Error(r+" units is invalid");return o/a}he(Nr,"lengthToRadians");function yv(o,r){return _u(Nr(o,r))}he(yv,"lengthToDegrees");function vv(o){let r=o%360;return r<0&&(r+=360),r}he(vv,"bearingToAzimuth");function _u(o){return o%(2*Math.PI)*180/Math.PI}he(_u,"radiansToDegrees");function pv(o){return o%360*Math.PI/180}he(pv,"degreesToRadians");function mv(o,r="kilometers",a="kilometers"){if(!(o>=0))throw new Error("length must be a positive number");return ss(Nr(o,r),a)}he(mv,"convertLength");function dv(o,r="meters",a="kilometers"){if(!(o>=0))throw new Error("area must be a positive number");const l=pu[r];if(!l)throw new Error("invalid original units");const c=pu[a];if(!c)throw new Error("invalid final units");return o/l*c}he(dv,"convertArea");function br(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}he(br,"isNumber");function as(o){return o!==null&&typeof o=="object"&&!Array.isArray(o)}he(as,"isObject");function _v(o){if(!o)throw new Error("bbox is required");if(!Array.isArray(o))throw new Error("bbox must be an Array");if(o.length!==4&&o.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");o.forEach(r=>{if(!br(r))throw new Error("bbox must only contain numbers")})}he(_v,"validateBBox");function xv(o){if(!o)throw new Error("id is required");if(["string","number"].indexOf(typeof o)===-1)throw new Error("id must be a number or a string")}he(xv,"validateId");var Ev=Object.defineProperty,be=(o,r)=>Ev(o,"name",{value:r,configurable:!0});function on(o,r,a){if(o!==null)for(var l,c,h,v,p,_,x,S=0,m=0,E,k=o.type,w=k==="FeatureCollection",T=k==="Feature",C=w?o.features.length:1,P=0;P<C;P++){x=w?o.features[P].geometry:T?o.geometry:o,E=x?x.type==="GeometryCollection":!1,p=E?x.geometries.length:1;for(var A=0;A<p;A++){var R=0,G=0;if(v=E?x.geometries[A]:x,v!==null){_=v.coordinates;var M=v.type;switch(S=a&&(M==="Polygon"||M==="MultiPolygon")?1:0,M){case null:break;case"Point":if(r(_,m,P,R,G)===!1)return!1;m++,R++;break;case"LineString":case"MultiPoint":for(l=0;l<_.length;l++){if(r(_[l],m,P,R,G)===!1)return!1;m++,M==="MultiPoint"&&R++}M==="LineString"&&R++;break;case"Polygon":case"MultiLineString":for(l=0;l<_.length;l++){for(c=0;c<_[l].length-S;c++){if(r(_[l][c],m,P,R,G)===!1)return!1;m++}M==="MultiLineString"&&R++,M==="Polygon"&&G++}M==="Polygon"&&R++;break;case"MultiPolygon":for(l=0;l<_.length;l++){for(G=0,c=0;c<_[l].length;c++){for(h=0;h<_[l][c].length-S;h++){if(r(_[l][c][h],m,P,R,G)===!1)return!1;m++}G++}R++}break;case"GeometryCollection":for(l=0;l<v.geometries.length;l++)if(on(v.geometries[l],r,a)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}be(on,"coordEach");function kv(o,r,a,l){var c=a;return on(o,function(h,v,p,_,x){v===0&&a===void 0?c=h:c=r(c,h,v,p,_,x)},l),c}be(kv,"coordReduce");function xu(o,r){var a;switch(o.type){case"FeatureCollection":for(a=0;a<o.features.length&&r(o.features[a].properties,a)!==!1;a++);break;case"Feature":r(o.properties,0);break}}be(xu,"propEach");function Sv(o,r,a){var l=a;return xu(o,function(c,h){h===0&&a===void 0?l=c:l=r(l,c,h)}),l}be(Sv,"propReduce");function Or(o,r){if(o.type==="Feature")r(o,0);else if(o.type==="FeatureCollection")for(var a=0;a<o.features.length&&r(o.features[a],a)!==!1;a++);}be(Or,"featureEach");function Iv(o,r,a){var l=a;return Or(o,function(c,h){h===0&&a===void 0?l=c:l=r(l,c,h)}),l}be(Iv,"featureReduce");function wv(o){var r=[];return on(o,function(a){r.push(a)}),r}be(wv,"coordAll");function un(o,r){var a,l,c,h,v,p,_,x,S,m,E=0,k=o.type==="FeatureCollection",w=o.type==="Feature",T=k?o.features.length:1;for(a=0;a<T;a++){for(p=k?o.features[a].geometry:w?o.geometry:o,x=k?o.features[a].properties:w?o.properties:{},S=k?o.features[a].bbox:w?o.bbox:void 0,m=k?o.features[a].id:w?o.id:void 0,_=p?p.type==="GeometryCollection":!1,v=_?p.geometries.length:1,c=0;c<v;c++){if(h=_?p.geometries[c]:p,h===null){if(r(null,E,x,S,m)===!1)return!1;continue}switch(h.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(h,E,x,S,m)===!1)return!1;break}case"GeometryCollection":{for(l=0;l<h.geometries.length;l++)if(r(h.geometries[l],E,x,S,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}E++}}be(un,"geomEach");function Nv(o,r,a){var l=a;return un(o,function(c,h,v,p,_){h===0&&a===void 0?l=c:l=r(l,c,h,v,p,_)}),l}be(Nv,"geomReduce");function Tr(o,r){un(o,function(a,l,c,h,v){var p=a===null?null:a.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return r(Ke(a,c,{bbox:h,id:v}),l,0)===!1?!1:void 0}var _;switch(p){case"MultiPoint":_="Point";break;case"MultiLineString":_="LineString";break;case"MultiPolygon":_="Polygon";break}for(var x=0;x<a.coordinates.length;x++){var S=a.coordinates[x],m={type:_,coordinates:S};if(r(Ke(m,c),l,x)===!1)return!1}})}be(Tr,"flattenEach");function bv(o,r,a){var l=a;return Tr(o,function(c,h,v){h===0&&v===0&&a===void 0?l=c:l=r(l,c,h,v)}),l}be(bv,"flattenReduce");function Eu(o,r){Tr(o,function(a,l,c){var h=0;if(a.geometry){var v=a.geometry.type;if(!(v==="Point"||v==="MultiPoint")){var p,_=0,x=0,S=0;if(on(a,function(m,E,k,w,T){if(p===void 0||l>_||w>x||T>S){p=m,_=l,x=w,S=T,h=0;return}var C=pt([p,m],a.properties);if(r(C,l,c,T,h)===!1)return!1;h++,p=m})===!1)return!1}}})}be(Eu,"segmentEach");function Ov(o,r,a){var l=a,c=!1;return Eu(o,function(h,v,p,_,x){c===!1&&a===void 0?l=h:l=r(l,h,v,p,_,x),c=!0}),l}be(Ov,"segmentReduce");function ku(o,r){if(!o)throw new Error("geojson is required");Tr(o,function(a,l,c){if(a.geometry!==null){var h=a.geometry.type,v=a.geometry.coordinates;switch(h){case"LineString":if(r(a,l,c,0,0)===!1)return!1;break;case"Polygon":for(var p=0;p<v.length;p++)if(r(pt(v[p],a.properties),l,c,p)===!1)return!1;break}}})}be(ku,"lineEach");function Tv(o,r,a){var l=a;return ku(o,function(c,h,v,p){h===0&&a===void 0?l=c:l=r(l,c,h,v,p)}),l}be(Tv,"lineReduce");function Lv(o,r){if(r=r||{},!as(r))throw new Error("options is invalid");var a=r.featureIndex||0,l=r.multiFeatureIndex||0,c=r.geometryIndex||0,h=r.segmentIndex||0,v=r.properties,p;switch(o.type){case"FeatureCollection":a<0&&(a=o.features.length+a),v=v||o.features[a].properties,p=o.features[a].geometry;break;case"Feature":v=v||o.properties,p=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=o;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var _=p.coordinates;switch(p.type){case"Point":case"MultiPoint":return null;case"LineString":return h<0&&(h=_.length+h-1),pt([_[h],_[h+1]],v,r);case"Polygon":return c<0&&(c=_.length+c),h<0&&(h=_[c].length+h-1),pt([_[c][h],_[c][h+1]],v,r);case"MultiLineString":return l<0&&(l=_.length+l),h<0&&(h=_[l].length+h-1),pt([_[l][h],_[l][h+1]],v,r);case"MultiPolygon":return l<0&&(l=_.length+l),c<0&&(c=_[l].length+c),h<0&&(h=_[l][c].length-h-1),pt([_[l][c][h],_[l][c][h+1]],v,r)}throw new Error("geojson is invalid")}be(Lv,"findSegment");function Rv(o,r){if(r=r||{},!as(r))throw new Error("options is invalid");var a=r.featureIndex||0,l=r.multiFeatureIndex||0,c=r.geometryIndex||0,h=r.coordIndex||0,v=r.properties,p;switch(o.type){case"FeatureCollection":a<0&&(a=o.features.length+a),v=v||o.features[a].properties,p=o.features[a].geometry;break;case"Feature":v=v||o.properties,p=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=o;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var _=p.coordinates;switch(p.type){case"Point":return ot(_,v,r);case"MultiPoint":return l<0&&(l=_.length+l),ot(_[l],v,r);case"LineString":return h<0&&(h=_.length+h),ot(_[h],v,r);case"Polygon":return c<0&&(c=_.length+c),h<0&&(h=_[c].length+h),ot(_[c][h],v,r);case"MultiLineString":return l<0&&(l=_.length+l),h<0&&(h=_[l].length+h),ot(_[l][h],v,r);case"MultiPolygon":return l<0&&(l=_.length+l),c<0&&(c=_[l].length+c),h<0&&(h=_[l][c].length-h),ot(_[l][c][h],v,r)}throw new Error("geojson is invalid")}be(Rv,"findPoint");var Cv=Object.defineProperty,Pv=(o,r)=>Cv(o,"name",{value:r,configurable:!0});function Su(o,r={}){if(o.bbox!=null&&r.recompute!==!0)return o.bbox;const a=[1/0,1/0,-1/0,-1/0];return on(o,l=>{a[0]>l[0]&&(a[0]=l[0]),a[1]>l[1]&&(a[1]=l[1]),a[2]<l[0]&&(a[2]=l[0]),a[3]<l[1]&&(a[3]=l[1])}),a}Pv(Su,"bbox");var Av=Object.defineProperty,Mv=(o,r)=>Av(o,"name",{value:r,configurable:!0});function Iu(o,r={}){const a=Su(o),l=(a[0]+a[2])/2,c=(a[1]+a[3])/2;return ot([l,c],r.properties,r)}Mv(Iu,"center");var wu={exports:{}};(function(o,r){(function(a,l){o.exports=l()})(Sn,function(){function a(s,e){if(!(s instanceof e))throw new TypeError("Cannot call a class as a function")}function l(s,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,n.key,n)}}function c(s,e,t){return e&&l(s.prototype,e),t&&l(s,t),s}function h(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(e&&e.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),e&&p(s,e)}function v(s){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(s)}function p(s,e){return p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t},p(s,e)}function _(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function x(s,e,t){return x=_()?Reflect.construct:function(n,i,u){var f=[null];f.push.apply(f,i);var g=new(Function.bind.apply(n,f));return u&&p(g,u.prototype),g},x.apply(null,arguments)}function S(s){var e=typeof Map=="function"?new Map:void 0;return S=function(t){if(t===null||(n=t,Function.toString.call(n).indexOf("[native code]")===-1))return t;var n;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return x(t,arguments,v(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),p(i,t)},S(s)}function m(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function E(s,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m(s)}function k(s){var e=_();return function(){var t,n=v(s);if(e){var i=v(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return E(this,t)}}function w(s,e,t){return w=typeof Reflect<"u"&&Reflect.get?Reflect.get:function(n,i,u){var f=function(y,d){for(;!Object.prototype.hasOwnProperty.call(y,d)&&(y=v(y))!==null;);return y}(n,i);if(f){var g=Object.getOwnPropertyDescriptor(f,i);return g.get?g.get.call(u):g.value}},w(s,e,t||s)}function T(s){return function(e){if(Array.isArray(e))return P(e)}(s)||function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}(s)||C(s)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
5
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function C(s,e){if(s){if(typeof s=="string")return P(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);return t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set"?Array.from(s):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?P(s,e):void 0}}function P(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=s[t];return n}function A(s,e){var t=typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(!t){if(Array.isArray(s)||(t=C(s))||e){t&&(s=t);var n=0,i=function(){};return{s:i,n:function(){return n>=s.length?{done:!0}:{done:!1,value:s[n++]}},e:function(y){throw y},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var u,f=!0,g=!1;return{s:function(){t=t.call(s)},n:function(){var y=t.next();return f=y.done,y},e:function(y){g=!0,u=y},f:function(){try{f||t.return==null||t.return()}finally{if(g)throw u}}}}var R=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=s.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=s.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==s.JOIN_ROUND&&(this._quadrantSegments=s.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(e){this._joinStyle=e}},{key:"setSimplifyFactor",value:function(e){this._simplifyFactor=e<0?0:e}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(e){this._endCapStyle=e}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(e){this._mitreLimit=e}},{key:"setSingleSided",value:function(e){this._isSingleSided=e}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=s.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=s.CAP_ROUND,this._joinStyle=s.JOIN_ROUND,this._mitreLimit=s.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=s.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.setQuadrantSegments(t),this.setEndCapStyle(n)}else if(arguments.length===4){var i=arguments[0],u=arguments[1],f=arguments[2],g=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(u),this.setJoinStyle(f),this.setMitreLimit(g)}}}},{key:"bufferDistanceError",value:function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)}}]),s}();R.CAP_ROUND=1,R.CAP_FLAT=2,R.CAP_SQUARE=3,R.JOIN_ROUND=1,R.JOIN_MITRE=2,R.JOIN_BEVEL=3,R.DEFAULT_QUADRANT_SEGMENTS=8,R.DEFAULT_MITRE_LIMIT=5,R.DEFAULT_SIMPLIFY_FACTOR=.01;var G=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({Exception:t})[0],i}return c(t,[{key:"toString",value:function(){return this.message}}]),t}(S(Error)),M=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({IllegalArgumentException:t})[0],i}return t}(G),$=function(){function s(){a(this,s)}return c(s,[{key:"filter",value:function(e){}}]),s}();function Y(){}function U(){}function X(){}var ie,ee,te,ae,q,ne,ue,ve,Ie=function(){function s(){a(this,s)}return c(s,null,[{key:"equalsWithTolerance",value:function(e,t,n){return Math.abs(e-t)<=n}}]),s}(),we=function(){function s(e,t){a(this,s),this.low=t||0,this.high=e||0}return c(s,null,[{key:"toBinaryString",value:function(e){var t,n="";for(t=2147483648;t>0;t>>>=1)n+=(e.high&t)===t?"1":"0";for(t=2147483648;t>0;t>>>=1)n+=(e.low&t)===t?"1":"0";return n}}]),s}();function j(){}function Pe(){}j.NaN=NaN,j.isNaN=function(s){return Number.isNaN(s)},j.isInfinite=function(s){return!Number.isFinite(s)},j.MAX_VALUE=Number.MAX_VALUE,j.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,j.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(ne=2146435072,ue=new Float64Array(1),ve=new Int32Array(ue.buffer),j.doubleToLongBits=function(s){ue[0]=s;var e=0|ve[0],t=0|ve[1];return(t&ne)===ne&&1048575&t&&e!==0&&(e=0,t=2146959360),new we(t,e)},j.longBitsToDouble=function(s){return ve[0]=s.low,ve[1]=s.high,ue[0]}):(ie=1023,ee=Math.log2,te=Math.floor,ae=Math.pow,q=function(){for(var s=53;s>0;s--){var e=ae(2,s)-1;if(te(ee(e))+1===s)return e}return 0}(),j.doubleToLongBits=function(s){var e,t,n,i,u,f,g,y,d;if(s<0||1/s===Number.NEGATIVE_INFINITY?(f=1<<31,s=-s):f=0,s===0)return new we(y=f,d=0);if(s===1/0)return new we(y=2146435072|f,d=0);if(s!=s)return new we(y=2146959360,d=0);if(i=0,d=0,(e=te(s))>1)if(e<=q)(i=te(ee(e)))<=20?(d=0,y=e<<20-i&1048575):(d=e%(t=ae(2,n=i-20))<<32-n,y=e/t&1048575);else for(n=e,d=0;(n=te(t=n/2))!==0;)i++,d>>>=1,d|=(1&y)<<31,y>>>=1,t!==n&&(y|=524288);if(g=i+ie,u=e===0,e=s-e,i<52&&e!==0)for(n=0;;){if((t=2*e)>=1?(e=t-1,u?(g--,u=!1):(n<<=1,n|=1,i++)):(e=t,u?--g==0&&(i++,u=!1):(n<<=1,i++)),i===20)y|=n,n=0;else if(i===52){d|=n;break}if(t===1){i<20?y|=n<<20-i:i<52&&(d|=n<<52-i);break}}return y|=g<<20,new we(y|=f,d)},j.longBitsToDouble=function(s){var e,t,n,i,u=s.high,f=s.low,g=u&1<<31?-1:1;for(n=((2146435072&u)>>20)-ie,i=0,t=1<<19,e=1;e<=20;e++)u&t&&(i+=ae(2,-e)),t>>>=1;for(t=1<<31,e=21;e<=52;e++)f&t&&(i+=ae(2,-e)),t>>>=1;if(n===-1023){if(i===0)return 0*g;n=-1022}else{if(n===1024)return i===0?g/0:NaN;i+=1}return g*i*ae(2,n)});var Ne=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({RuntimeException:t})[0],i}return t}(G),De=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,null,[{key:"constructor_",value:function(){if(arguments.length===0)Ne.constructor_.call(this);else if(arguments.length===1){var n=arguments[0];Ne.constructor_.call(this,n)}}}]),t}(Ne),se=function(){function s(){a(this,s)}return c(s,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)s.shouldNeverReachHere(null);else if(arguments.length===1){var e=arguments[0];throw new De("Should never reach here"+(e!==null?": "+e:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var e=arguments[0];s.isTrue(e,null)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(!t)throw n===null?new De:new De(n)}}},{key:"equals",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];s.equals(e,t,null)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],u=arguments[2];if(!i.equals(n))throw new De("Expected "+n+" but encountered "+i+(u!==null?": "+u:""))}}}]),s}(),_t=new ArrayBuffer(8),Up=new Float64Array(_t),xl=new Int32Array(_t),O=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getM",value:function(){return j.NaN}},{key:"setOrdinate",value:function(e,t){switch(e){case s.X:this.x=t;break;case s.Y:this.y=t;break;case s.Z:this.setZ(t);break;default:throw new M("Invalid ordinate index: "+e)}}},{key:"equals2D",value:function(){if(arguments.length===1){var e=arguments[0];return this.x===e.x&&this.y===e.y}if(arguments.length===2){var t=arguments[0],n=arguments[1];return!!Ie.equalsWithTolerance(this.x,t.x,n)&&!!Ie.equalsWithTolerance(this.y,t.y,n)}}},{key:"setM",value:function(e){throw new M("Invalid ordinate index: "+s.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(e){switch(e){case s.X:return this.x;case s.Y:return this.y;case s.Z:return this.getZ()}throw new M("Invalid ordinate index: "+e)}},{key:"equals3D",value:function(e){return this.x===e.x&&this.y===e.y&&(this.getZ()===e.getZ()||j.isNaN(this.getZ())&&j.isNaN(e.getZ()))}},{key:"equals",value:function(e){return e instanceof s&&this.equals2D(e)}},{key:"equalInZ",value:function(e,t){return Ie.equalsWithTolerance(this.getZ(),e.getZ(),t)}},{key:"setX",value:function(e){this.x=e}},{key:"compareTo",value:function(e){var t=e;return this.x<t.x?-1:this.x>t.x?1:this.y<t.y?-1:this.y>t.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(e){this.z=e}},{key:"clone",value:function(){try{return null}catch(e){if(e instanceof CloneNotSupportedException)return se.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw e}}},{key:"copy",value:function(){return new s(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.getZ()-e.getZ();return Math.sqrt(t*t+n*n+i*i)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(e){this.y=e}},{key:"distance",value:function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)}},{key:"hashCode",value:function(){var e=17;return e=37*(e=37*e+s.hashCode(this.x))+s.hashCode(this.y)}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ()}},{key:"interfaces_",get:function(){return[Y,U,X]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)s.constructor_.call(this,0,0);else if(arguments.length===1){var e=arguments[0];s.constructor_.call(this,e.x,e.y,e.getZ())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];s.constructor_.call(this,t,n,s.NULL_ORDINATE)}else if(arguments.length===3){var i=arguments[0],u=arguments[1],f=arguments[2];this.x=i,this.y=u,this.z=f}}},{key:"hashCode",value:function(e){return Up[0]=e,xl[0]^xl[1]}}]),s}(),Xp=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"compare",value:function(e,t){var n=s.compare(e.x,t.x);if(n!==0)return n;var i=s.compare(e.y,t.y);return i!==0?i:this._dimensionsToTest<=2?0:s.compare(e.getZ(),t.getZ())}},{key:"interfaces_",get:function(){return[Pe]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)s.constructor_.call(this,2);else if(arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new M("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}}},{key:"compare",value:function(e,t){return e<t?-1:e>t?1:j.isNaN(e)?j.isNaN(t)?0:-1:j.isNaN(t)?1:0}}]),s}();O.DimensionalComparator=Xp,O.NULL_ORDINATE=j.NaN,O.X=0,O.Y=1,O.Z=2,O.M=3;var pe=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(e){if(!(e instanceof s))return!1;var t=e;return this.isNull()?t.isNull():this._maxx===t.getMaxX()&&this._maxy===t.getMaxY()&&this._minx===t.getMinX()&&this._miny===t.getMinY()}},{key:"intersection",value:function(e){if(this.isNull()||e.isNull()||!this.intersects(e))return new s;var t=this._minx>e._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny;return new s(t,this._maxx<e._maxx?this._maxx:e._maxx,n,this._maxy<e._maxy?this._maxy:e._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof O){var e=arguments[0];return this.covers(e.x,e.y)}if(arguments[0]instanceof s){var t=arguments[0];return!this.isNull()&&!t.isNull()&&t.getMinX()>=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof s){var e=arguments[0];return!this.isNull()&&!e.isNull()&&!(e._minx>this._maxx||e._maxx<this._minx||e._miny>this._maxy||e._maxy<this._miny)}if(arguments[0]instanceof O){var t=arguments[0];return this.intersects(t.x,t.y)}}else if(arguments.length===2){if(arguments[0]instanceof O&&arguments[1]instanceof O){var n=arguments[0],i=arguments[1];if(this.isNull())return!1;var u=n.x<i.x?n.x:i.x;if(u>this._maxx)return!1;var f=n.x>i.x?n.x:i.x;if(f<this._minx)return!1;var g=n.y<i.y?n.y:i.y;if(g>this._maxy)return!1;var y=n.y>i.y?n.y:i.y;return!(y<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var d=arguments[0],N=arguments[1];return!this.isNull()&&!(d>this._maxx||d<this._minx||N>this._maxy||N<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return Math.sqrt(e*e+t*t)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof O){var e=arguments[0];this.expandToInclude(e.x,e.y)}else if(arguments[0]instanceof s){var t=arguments[0];if(t.isNull())return null;this.isNull()?(this._minx=t.getMinX(),this._maxx=t.getMaxX(),this._miny=t.getMinY(),this._maxy=t.getMaxY()):(t._minx<this._minx&&(this._minx=t._minx),t._maxx>this._maxx&&(this._maxx=t._maxx),t._miny<this._miny&&(this._miny=t._miny),t._maxy>this._maxy&&(this._maxy=t._maxy))}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),i<this._miny&&(this._miny=i),i>this._maxy&&(this._maxy=i))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e<t?e:t}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(e){var t=e;return this.isNull()?t.isNull()?0:-1:t.isNull()?1:this._minx<t._minx?-1:this._minx>t._minx?1:this._miny<t._miny?-1:this._miny>t._miny?1:this._maxx<t._maxx?-1:this._maxx>t._maxx?1:this._maxy<t._maxy?-1:this._maxy>t._maxy?1:0}},{key:"translate",value:function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)}},{key:"copy",value:function(){return new s(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(e){return!(!this.isNull()&&!e.isNull())||e._minx>this._maxx||e._maxx<this._minx||e._miny>this._maxy||e._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t}},{key:"expandBy",value:function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof s){var e=arguments[0];return this.covers(e)}if(arguments[0]instanceof O){var t=arguments[0];return this.covers(t)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}}},{key:"centre",value:function(){return this.isNull()?null:new O((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof O){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof s){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3];u<f?(this._minx=u,this._maxx=f):(this._minx=f,this._maxx=u),g<y?(this._miny=g,this._maxy=y):(this._miny=y,this._maxy=g)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(e){if(this.intersects(e))return 0;var t=0;this._maxx<e._minx?t=e._minx-this._maxx:this._minx>e._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxy<e._miny?n=e._miny-this._maxy:this._miny>e._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)}},{key:"hashCode",value:function(){var e=17;return e=37*(e=37*(e=37*(e=37*e+O.hashCode(this._minx))+O.hashCode(this._maxx))+O.hashCode(this._miny))+O.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[Y,X]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof O){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof s){var t=arguments[0];this.init(t)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3];this.init(u,f,g,y)}}},{key:"intersects",value:function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.x<t.x?e.x:t.x)&&n.x<=(e.x>t.x?e.x:t.x)&&n.y>=(e.y<t.y?e.y:t.y)&&n.y<=(e.y>t.y?e.y:t.y)}if(arguments.length===4){var i=arguments[0],u=arguments[1],f=arguments[2],g=arguments[3],y=Math.min(f.x,g.x),d=Math.max(f.x,g.x),N=Math.min(i.x,u.x),b=Math.max(i.x,u.x);return!(N>d)&&!(b<y)&&(y=Math.min(f.y,g.y),d=Math.max(f.y,g.y),N=Math.min(i.y,u.y),b=Math.max(i.y,u.y),!(N>d)&&!(b<y))}}}]),s}(),W=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===s.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(e){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(e){return this===e||this.equalsExact(e,0)}},{key:"geometryChanged",value:function(){this.apply(s.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(e){return e!==null&&this.norm().equalsExact(e.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var e;if(arguments.length===1){var t=arguments[0];return e=t,this.getTypeCode()!==e.getTypeCode()?this.getTypeCode()-e.getTypeCode():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return e=n,this.getTypeCode()!==e.getTypeCode()?this.getTypeCode()-e.getTypeCode():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(n,i)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(e){if(e.getTypeCode()===s.TYPECODE_GEOMETRYCOLLECTION)throw new M("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(e,t,n){return n===0?e.equals(t):e.distance(t)<=n}},{key:"norm",value:function(){var e=this.copy();return e.normalize(),e}},{key:"reverse",value:function(){var e=this.reverseInternal();return this.envelope!=null&&(e.envelope=this.envelope.copy()),e.setSRID(this.getSRID()),e}},{key:"copy",value:function(){var e=this.copyInternal();return e.envelope=this._envelope==null?null:this._envelope.copy(),e._SRID=this._SRID,e._userData=this._userData,e}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new pe(this._envelope)}},{key:"setSRID",value:function(e){this._SRID=e}},{key:"setUserData",value:function(e){this._userData=e}},{key:"compare",value:function(e,t){for(var n=e.iterator(),i=t.iterator();n.hasNext()&&i.hasNext();){var u=n.next(),f=i.next(),g=u.compareTo(f);if(g!==0)return g}return n.hasNext()?1:i.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(e){return this.getClass()===e.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===s.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===s.TYPECODE_MULTIPOINT||this.getTypeCode()===s.TYPECODE_MULTILINESTRING||this.getTypeCode()===s.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[U,Y,X]}},{key:"getClass",value:function(){return s}}],[{key:"hasNonEmptyElements",value:function(e){for(var t=0;t<e.length;t++)if(!e[t].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(e){for(var t=0;t<e.length;t++)if(e[t]===null)return!0;return!1}}]),s}();W.constructor_=function(s){s&&(this._envelope=null,this._userData=null,this._factory=s,this._SRID=s.getSRID())},W.TYPECODE_POINT=0,W.TYPECODE_MULTIPOINT=1,W.TYPECODE_LINESTRING=2,W.TYPECODE_LINEARRING=3,W.TYPECODE_MULTILINESTRING=4,W.TYPECODE_POLYGON=5,W.TYPECODE_MULTIPOLYGON=6,W.TYPECODE_GEOMETRYCOLLECTION=7,W.TYPENAME_POINT="Point",W.TYPENAME_MULTIPOINT="MultiPoint",W.TYPENAME_LINESTRING="LineString",W.TYPENAME_LINEARRING="LinearRing",W.TYPENAME_MULTILINESTRING="MultiLineString",W.TYPENAME_POLYGON="Polygon",W.TYPENAME_MULTIPOLYGON="MultiPolygon",W.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",W.geometryChangedFilter={get interfaces_(){return[$]},filter:function(s){s.geometryChangedAction()}};var I=function(){function s(){a(this,s)}return c(s,null,[{key:"toLocationSymbol",value:function(e){switch(e){case s.EXTERIOR:return"e";case s.BOUNDARY:return"b";case s.INTERIOR:return"i";case s.NONE:return"-"}throw new M("Unknown location value: "+e)}}]),s}();I.INTERIOR=0,I.BOUNDARY=1,I.EXTERIOR=2,I.NONE=-1;var ct=function(){function s(){a(this,s)}return c(s,[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}]),s}(),Ur=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({NoSuchElementException:t})[0],i}return t}(G),Mt=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({UnsupportedOperationException:t})[0],i}return t}(G),El=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.apply(this,arguments)}return c(t,[{key:"contains",value:function(){}}]),t}(ct),ws=function(s,e){h(n,s);var t=k(n);function n(i){var u;return a(this,n),(u=t.call(this)).map=new Map,i instanceof ct&&u.addAll(i),u}return c(n,[{key:"contains",value:function(i){var u=i.hashCode?i.hashCode():i;return!!this.map.has(u)}},{key:"add",value:function(i){var u=i.hashCode?i.hashCode():i;return!this.map.has(u)&&!!this.map.set(u,i)}},{key:"addAll",value:function(i){var u,f=A(i);try{for(f.s();!(u=f.n()).done;){var g=u.value;this.add(g)}}catch(y){f.e(y)}finally{f.f()}return!0}},{key:"remove",value:function(){throw new Mt}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new jp(this.map)}},{key:e,value:function(){return this.map}}]),n}(El,Symbol.iterator),jp=function(){function s(e){a(this,s),this.iterator=e.values();var t=this.iterator.next(),n=t.done,i=t.value;this.done=n,this.value=i}return c(s,[{key:"next",value:function(){if(this.done)throw new Ur;var e=this.value,t=this.iterator.next(),n=t.done,i=t.value;return this.done=n,this.value=i,e}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new Mt}}]),s}(),B=function(){function s(){a(this,s)}return c(s,null,[{key:"opposite",value:function(e){return e===s.LEFT?s.RIGHT:e===s.RIGHT?s.LEFT:e}}]),s}();B.ON=0,B.LEFT=1,B.RIGHT=2;var kl=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({EmptyStackException:t})[0],i}return t}(G),Sl=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({IndexOutOfBoundsException:t})[0],i}return t}(G),zt=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.apply(this,arguments)}return c(t,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}]),t}(ct),Vp=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),(n=e.call(this)).array=[],n}return c(t,[{key:"add",value:function(n){return this.array.push(n),!0}},{key:"get",value:function(n){if(n<0||n>=this.size())throw new Sl;return this.array[n]}},{key:"push",value:function(n){return this.array.push(n),n}},{key:"pop",value:function(){if(this.array.length===0)throw new kl;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new kl;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(n){return this.array.indexOf(n)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}]),t}(zt);function re(s,e){return s.interfaces_&&s.interfaces_.indexOf(e)>-1}var qn=function(){function s(e){a(this,s),this.str=e}return c(s,[{key:"append",value:function(e){this.str+=e}},{key:"setCharAt",value:function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)}},{key:"toString",value:function(){return this.str}}]),s}(),Xr=function(){function s(e){a(this,s),this.value=e}return c(s,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(e){return this.value<e?-1:this.value>e?1:0}}],[{key:"compare",value:function(e,t){return e<t?-1:e>t?1:0}},{key:"isNan",value:function(e){return Number.isNaN(e)}},{key:"valueOf",value:function(e){return new s(e)}}]),s}(),Ns=function(){function s(){a(this,s)}return c(s,null,[{key:"isWhitespace",value:function(e){return e<=32&&e>=0||e===127}},{key:"toUpperCase",value:function(e){return e.toUpperCase()}}]),s}(),J=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"le",value:function(e){return this._hi<e._hi||this._hi===e._hi&&this._lo<=e._lo}},{key:"extractSignificantDigits",value:function(e,t){var n=this.abs(),i=s.magnitude(n._hi),u=s.TEN.pow(i);(n=n.divide(u)).gt(s.TEN)?(n=n.divide(s.TEN),i+=1):n.lt(s.ONE)&&(n=n.multiply(s.TEN),i-=1);for(var f=i+1,g=new qn,y=s.MAX_PRINT_DIGITS-1,d=0;d<=y;d++){e&&d===f&&g.append(".");var N=Math.trunc(n._hi);if(N<0)break;var b=!1,L=0;N>9?(b=!0,L="9"):L="0"+N,g.append(L),n=n.subtract(s.valueOf(N)).multiply(s.TEN),b&&n.selfAdd(s.TEN);var F=!0,D=s.magnitude(n._hi);if(D<0&&Math.abs(D)>=y-d&&(F=!1),!F)break}return t[0]=i,g.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return this.add(e.negate())}if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof s){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(e){return this.le(e)?this:e}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof s){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],u=null,f=null,g=null,y=null,d=null,N=null,b=null,L=null;return d=this._hi/n,L=(u=(N=s.SPLIT*d)-(u=N-d))*(g=(L=s.SPLIT*n)-(g=L-n))-(b=d*n)+u*(y=n-g)+(f=d-u)*g+f*y,L=d+(N=(this._hi-b-L+this._lo-d*i)/n),this._hi=L,this._lo=d-L+N,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof s){var e=arguments[0],t=null,n=null,i=null,u=null,f=null,g=null,y=null,d=null;n=(f=this._hi/e._hi)-(t=(g=s.SPLIT*f)-(t=g-f)),d=t*(i=(d=s.SPLIT*e._hi)-(i=d-e._hi))-(y=f*e._hi)+t*(u=e._hi-i)+n*i+n*u;var N=d=f+(g=(this._hi-y-d+this._lo-f*e._lo)/e._hi),b=f-d+g;return new s(N,b)}if(typeof arguments[0]=="number"){var L=arguments[0];return j.isNaN(L)?s.createNaN():s.copy(this).selfDivide(L,0)}}},{key:"ge",value:function(e){return this._hi>e._hi||this._hi===e._hi&&this._lo>=e._lo}},{key:"pow",value:function(e){if(e===0)return s.valueOf(1);var t=new s(this),n=s.valueOf(1),i=Math.abs(e);if(i>1)for(;i>0;)i%2==1&&n.selfMultiply(t),(i/=2)>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n}},{key:"ceil",value:function(){if(this.isNaN())return s.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new s(e,t)}},{key:"compareTo",value:function(e){var t=e;return this._hi<t._hi?-1:this._hi>t._hi?1:this._lo<t._lo?-1:this._lo>t._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return this.init(e),this}if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}}},{key:"max",value:function(e){return this.ge(e)?this:e}},{key:"sqrt",value:function(){if(this.isZero())return s.valueOf(0);if(this.isNegative())return s.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=s.valueOf(t),i=this.subtract(n.sqr())._hi*(.5*e);return n.add(i)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof s){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0],n=null,i=null,u=null,f=null,g=null,y=null;return f=(u=this._hi+t)-(g=u-this._hi),i=(y=(f=t-g+(this._hi-f))+this._lo)+(u-(n=u+y)),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var d=arguments[0],N=arguments[1],b=null,L=null,F=null,D=null,V=null,H=null,K=null;D=this._hi+d,L=this._lo+N,V=D-(H=D-this._hi),F=L-(K=L-this._lo);var ge=(b=D+(H=(V=d-H+(this._hi-V))+L))+(H=(F=N-K+(this._lo-F))+(H+(D-b))),xe=H+(b-ge);return this._hi=ge,this._lo=xe,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof s){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],u=null,f=null,g=null,y=null,d=null,N=null;u=(d=s.SPLIT*this._hi)-this._hi,N=s.SPLIT*n,u=d-u,f=this._hi-u,g=N-n;var b=(d=this._hi*n)+(N=u*(g=N-g)-d+u*(y=n-g)+f*g+f*y+(this._hi*i+this._lo*n)),L=N+(u=d-b);return this._hi=b,this._lo=L,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return s.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new s(e,t)}},{key:"negate",value:function(){return this.isNaN()?this:new s(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(e){if(e instanceof CloneNotSupportedException)return null;throw e}}},{key:"multiply",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return e.isNaN()?s.createNaN():s.copy(this).selfMultiply(e)}if(typeof arguments[0]=="number"){var t=arguments[0];return j.isNaN(t)?s.createNaN():s.copy(this).selfMultiply(t,0)}}},{key:"isNaN",value:function(){return j.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var e=s.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),i=t[0]+1,u=n;if(n.charAt(0)===".")u="0"+n;else if(i<0)u="0."+s.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var f=i-n.length;u=n+s.stringOfChar("0",f)+".0"}return this.isNegative()?"-"+u:u}},{key:"reciprocal",value:function(){var e,t,n,i,u=null,f=null,g=null,y=null;e=(n=1/this._hi)-(u=(g=s.SPLIT*n)-(u=g-n)),f=(y=s.SPLIT*this._hi)-this._hi;var d=n+(g=(1-(i=n*this._hi)-(y=u*(f=y-f)-i+u*(t=this._hi-f)+e*f+e*t)-n*this._lo)/this._hi);return new s(d,n-d+g)}},{key:"toSciNotation",value:function(){if(this.isZero())return s.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),i=s.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+n);var u="";n.length>1&&(u=n.substring(1));var f=n.charAt(0)+"."+u;return this.isNegative()?"-"+f+i:f+i}},{key:"abs",value:function(){return this.isNaN()?s.NaN:this.isNegative()?this.negate():new s(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(e){return this._hi<e._hi||this._hi===e._hi&&this._lo<e._lo}},{key:"add",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return s.copy(this).selfAdd(e)}if(typeof arguments[0]=="number"){var t=arguments[0];return s.copy(this).selfAdd(t)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this._hi=e,this._lo=0}else if(arguments[0]instanceof s){var t=arguments[0];this._hi=t._hi,this._lo=t._lo}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._hi=n,this._lo=i}}},{key:"gt",value:function(e){return this._hi>e._hi||this._hi===e._hi&&this._lo>e._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?s.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[X,Y,U]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof s){var t=arguments[0];this.init(t)}else if(typeof arguments[0]=="string"){var n=arguments[0];s.constructor_.call(this,s.parse(n))}}else if(arguments.length===2){var i=arguments[0],u=arguments[1];this.init(i,u)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];return s.determinant(s.valueOf(e),s.valueOf(t),s.valueOf(n),s.valueOf(i))}if(arguments[3]instanceof s&&arguments[2]instanceof s&&arguments[0]instanceof s&&arguments[1]instanceof s){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3],d=u.multiply(y).selfSubtract(f.multiply(g));return d}}},{key:"sqr",value:function(e){return s.valueOf(e).selfMultiply(e)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var e=arguments[0];return s.parse(e)}if(typeof arguments[0]=="number"){var t=arguments[0];return new s(t)}}},{key:"sqrt",value:function(e){return s.valueOf(e).sqrt()}},{key:"parse",value:function(e){for(var t=0,n=e.length;Ns.isWhitespace(e.charAt(t));)t++;var i=!1;if(t<n){var u=e.charAt(t);u!=="-"&&u!=="+"||(t++,u==="-"&&(i=!0))}for(var f=new s,g=0,y=0,d=0,N=!1;!(t>=n);){var b=e.charAt(t);if(t++,Ns.isDigit(b)){var L=b-"0";f.selfMultiply(s.TEN),f.selfAdd(L),g++}else{if(b!=="."){if(b==="e"||b==="E"){var F=e.substring(t);try{d=Xr.parseInt(F)}catch(ge){throw ge instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+F+" in string "+e):ge}break}throw new NumberFormatException("Unexpected character '"+b+"' at position "+t+" in string "+e)}y=g,N=!0}}var D=f;N||(y=g);var V=g-y-d;if(V===0)D=f;else if(V>0){var H=s.TEN.pow(V);D=f.divide(H)}else if(V<0){var K=s.TEN.pow(-V);D=f.multiply(K)}return i?D.negate():D}},{key:"createNaN",value:function(){return new s(j.NaN,j.NaN)}},{key:"copy",value:function(e){return new s(e)}},{key:"magnitude",value:function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),i=Math.trunc(Math.floor(n));return 10*Math.pow(10,i)<=t&&(i+=1),i}},{key:"stringOfChar",value:function(e,t){for(var n=new qn,i=0;i<t;i++)n.append(e);return n.toString()}}]),s}();J.PI=new J(3.141592653589793,12246467991473532e-32),J.TWO_PI=new J(6.283185307179586,24492935982947064e-32),J.PI_2=new J(1.5707963267948966,6123233995736766e-32),J.E=new J(2.718281828459045,14456468917292502e-32),J.NaN=new J(j.NaN,j.NaN),J.EPS=123259516440783e-46,J.SPLIT=134217729,J.MAX_PRINT_DIGITS=32,J.TEN=J.valueOf(10),J.ONE=J.valueOf(1),J.SCI_NOT_EXPONENT_CHAR="E",J.SCI_NOT_ZERO="0.0E0";var bs=function(){function s(){a(this,s)}return c(s,null,[{key:"orientationIndex",value:function(e,t,n){var i=s.orientationIndexFilter(e,t,n);if(i<=1)return i;var u=J.valueOf(t.x).selfAdd(-e.x),f=J.valueOf(t.y).selfAdd(-e.y),g=J.valueOf(n.x).selfAdd(-t.x),y=J.valueOf(n.y).selfAdd(-t.y);return u.selfMultiply(y).selfSubtract(f.selfMultiply(g)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof J&&arguments[2]instanceof J&&arguments[0]instanceof J&&arguments[1]instanceof J){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3],u=e.multiply(i).selfSubtract(t.multiply(n));return u.signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var f=arguments[0],g=arguments[1],y=arguments[2],d=arguments[3],N=J.valueOf(f),b=J.valueOf(g),L=J.valueOf(y),F=J.valueOf(d),D=N.multiply(F).selfSubtract(b.multiply(L));return D.signum()}}},{key:"intersection",value:function(e,t,n,i){var u=new J(e.y).selfSubtract(t.y),f=new J(t.x).selfSubtract(e.x),g=new J(e.x).selfMultiply(t.y).selfSubtract(new J(t.x).selfMultiply(e.y)),y=new J(n.y).selfSubtract(i.y),d=new J(i.x).selfSubtract(n.x),N=new J(n.x).selfMultiply(i.y).selfSubtract(new J(i.x).selfMultiply(n.y)),b=f.multiply(N).selfSubtract(d.multiply(g)),L=y.multiply(g).selfSubtract(u.multiply(N)),F=u.multiply(d).selfSubtract(y.multiply(f)),D=b.selfDivide(F).doubleValue(),V=L.selfDivide(F).doubleValue();return j.isNaN(D)||j.isInfinite(D)||j.isNaN(V)||j.isInfinite(V)?null:new O(D,V)}},{key:"orientationIndexFilter",value:function(e,t,n){var i=null,u=(e.x-n.x)*(t.y-n.y),f=(e.y-n.y)*(t.x-n.x),g=u-f;if(u>0){if(f<=0)return s.signum(g);i=u+f}else{if(!(u<0)||f>=0)return s.signum(g);i=-u-f}var y=s.DP_SAFE_EPSILON*i;return g>=y||-g>=y?s.signum(g):2}},{key:"signum",value:function(e){return e>0?1:e<0?-1:0}}]),s}();bs.DP_SAFE_EPSILON=1e-15;var le=function(){function s(){a(this,s)}return c(s,[{key:"getM",value:function(e){if(this.hasM()){var t=this.getDimension()-this.getMeasures();return this.getOrdinate(e,t)}return j.NaN}},{key:"setOrdinate",value:function(e,t,n){}},{key:"getZ",value:function(e){return this.hasZ()?this.getOrdinate(e,2):j.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(e,t){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(e){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(e){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(e){}},{key:"copy",value:function(){}},{key:"getY",value:function(e){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[U]}}]),s}();le.X=0,le.Y=1,le.Z=2,le.M=3;var Q=function(){function s(){a(this,s)}return c(s,null,[{key:"index",value:function(e,t,n){return bs.orientationIndex(e,t,n)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var e=arguments[0],t=e.length-1;if(t<3)throw new M("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=e[0],i=0,u=1;u<=t;u++){var f=e[u];f.y>n.y&&(n=f,i=u)}var g=i;do(g-=1)<0&&(g=t);while(e[g].equals2D(n)&&g!==i);var y=i;do y=(y+1)%t;while(e[y].equals2D(n)&&y!==i);var d=e[g],N=e[y];if(d.equals2D(n)||N.equals2D(n)||d.equals2D(N))return!1;var b=s.index(d,n,N),L=null;return L=b===0?d.x>N.x:b>0,L}if(re(arguments[0],le)){var F=arguments[0],D=F.size()-1;if(D<3)throw new M("Ring has fewer than 4 points, so orientation cannot be determined");for(var V=F.getCoordinate(0),H=0,K=1;K<=D;K++){var ge=F.getCoordinate(K);ge.y>V.y&&(V=ge,H=K)}var xe=null,Re=H;do(Re-=1)<0&&(Re=D),xe=F.getCoordinate(Re);while(xe.equals2D(V)&&Re!==H);var qe=null,rt=H;do rt=(rt+1)%D,qe=F.getCoordinate(rt);while(qe.equals2D(V)&&rt!==H);if(xe.equals2D(V)||qe.equals2D(V)||xe.equals2D(qe))return!1;var St=s.index(xe,V,qe);return St===0?xe.x>qe.x:St>0}}}]),s}();Q.CLOCKWISE=-1,Q.RIGHT=Q.CLOCKWISE,Q.COUNTERCLOCKWISE=1,Q.LEFT=Q.COUNTERCLOCKWISE,Q.COLLINEAR=0,Q.STRAIGHT=Q.COLLINEAR;var Wp=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(e,t){var n=this.getRightmostSideOfSegment(e,t);return n<0&&(n=this.getRightmostSideOfSegment(e,t-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(e)),n}},{key:"findRightmostEdgeAtVertex",value:function(){var e=this._minDe.getEdge().getCoordinates();se.isTrue(this._minIndex>0&&this._minIndex<e.length,"rightmost point expected to be interior vertex of edge");var t=e[this._minIndex-1],n=e[this._minIndex+1],i=Q.index(this._minCoord,n,t),u=!1;(t.y<this._minCoord.y&&n.y<this._minCoord.y&&i===Q.COUNTERCLOCKWISE||t.y>this._minCoord.y&&n.y>this._minCoord.y&&i===Q.CLOCKWISE)&&(u=!0),u&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(e,t){var n=e.getEdge().getCoordinates();if(t<0||t+1>=n.length||n[t].y===n[t+1].y)return-1;var i=B.LEFT;return n[t].y<n[t+1].y&&(i=B.RIGHT),i}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(e){for(var t=e.getEdge().getCoordinates(),n=0;n<t.length-1;n++)(this._minCoord===null||t[n].x>this._minCoord.x)&&(this._minDe=e,this._minIndex=n,this._minCoord=t[n])}},{key:"findRightmostEdgeAtNode",value:function(){var e=this._minDe.getNode().getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(e){for(var t=e.iterator();t.hasNext();){var n=t.next();n.isForward()&&this.checkForRightmostCoordinate(n)}se.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===B.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}]),s}(),xt=function(s){h(t,s);var e=k(t);function t(n,i){var u;return a(this,t),(u=e.call(this,i?n+" [ "+i+" ]":n)).pt=i?new O(i):void 0,u.name=Object.keys({TopologyException:t})[0],u}return c(t,[{key:"getCoordinate",value:function(){return this.pt}}]),t}(Ne),Hp=function(){function s(){a(this,s),this.array=[]}return c(s,[{key:"addLast",value:function(e){this.array.push(e)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}]),s}(),Z=function(s,e){h(n,s);var t=k(n);function n(i){var u;return a(this,n),(u=t.call(this)).array=[],i instanceof ct&&u.addAll(i),u}return c(n,[{key:"interfaces_",get:function(){return[zt,ct]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(i){return arguments.length===1?this.array.push(i):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(i){var u,f=A(i);try{for(f.s();!(u=f.n()).done;){var g=u.value;this.array.push(g)}}catch(y){f.e(y)}finally{f.f()}}},{key:"set",value:function(i,u){var f=this.array[i];return this.array[i]=u,f}},{key:"iterator",value:function(){return new Zp(this)}},{key:"get",value:function(i){if(i<0||i>=this.size())throw new Sl;return this.array[i]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(i){i?this.array.sort(function(u,f){return i.compare(u,f)}):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(i){for(var u=0,f=this.array.length;u<f;u++)if(this.array[u]===i)return!!this.array.splice(u,1);return!1}},{key:e,value:function(){return this.array.values()}}]),n}(zt,Symbol.iterator),Zp=function(){function s(e){a(this,s),this.arrayList=e,this.position=0}return c(s,[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new Ur;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(e){return this.arrayList.set(this.position-1,e)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}]),s}(),Jp=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"clearVisitedEdges",value:function(){for(var e=this._dirEdgeList.iterator();e.hasNext();)e.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(e){for(var t=null,n=e.getEdges().iterator();n.hasNext();){var i=n.next();if(i.isVisited()||i.getSym().isVisited()){t=i;break}}if(t===null)throw new xt("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(t);for(var u=e.getEdges().iterator();u.hasNext();){var f=u.next();f.setVisited(!0),this.copySymDepths(f)}}},{key:"computeDepth",value:function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.getNode(),t.getLabel(),t.setEdgeDepths(B.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)}},{key:"create",value:function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(B.RIGHT)>=1&&t.getDepth(B.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}}},{key:"computeDepths",value:function(e){var t=new ws,n=new Hp,i=e.getNode();for(n.addLast(i),t.add(i),e.setVisited(!0);!n.isEmpty();){var u=n.removeFirst();t.add(u),this.computeNodeDepth(u);for(var f=u.getEdges().iterator();f.hasNext();){var g=f.next().getSym();if(!g.isVisited()){var y=g.getNode();t.contains(y)||(n.addLast(y),t.add(y))}}}}},{key:"compareTo",value:function(e){var t=e;return this._rightMostCoord.x<t._rightMostCoord.x?-1:this._rightMostCoord.x>t._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var e=new pe,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next().getEdge().getCoordinates(),i=0;i<n.length-1;i++)e.expandToInclude(n[i]);this._env=e}return this._env}},{key:"addReachable",value:function(e){var t=new Vp;for(t.add(e);!t.empty();){var n=t.pop();this.add(n,t)}}},{key:"copySymDepths",value:function(e){var t=e.getSym();t.setDepth(B.LEFT,e.getDepth(B.RIGHT)),t.setDepth(B.RIGHT,e.getDepth(B.LEFT))}},{key:"add",value:function(e,t){e.setVisited(!0),this._nodes.add(e);for(var n=e.getEdges().iterator();n.hasNext();){var i=n.next();this._dirEdgeList.add(i);var u=i.getSym().getNode();u.isVisited()||t.push(u)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new Z,this._nodes=new Z,this._rightMostCoord=null,this._env=null,this._finder=new Wp}}]),s}(),Os=function(){function s(){a(this,s)}return c(s,null,[{key:"intersection",value:function(e,t,n,i){var u=e.x<t.x?e.x:t.x,f=e.y<t.y?e.y:t.y,g=e.x>t.x?e.x:t.x,y=e.y>t.y?e.y:t.y,d=n.x<i.x?n.x:i.x,N=n.y<i.y?n.y:i.y,b=n.x>i.x?n.x:i.x,L=n.y>i.y?n.y:i.y,F=((u>d?u:d)+(g<b?g:b))/2,D=((f>N?f:N)+(y<L?y:L))/2,V=e.x-F,H=e.y-D,K=t.x-F,ge=t.y-D,xe=n.x-F,Re=n.y-D,qe=i.x-F,rt=i.y-D,St=H-ge,Ht=K-V,Zn=V*ge-K*H,Jn=Re-rt,kn=qe-xe,lc=xe*rt-qe*Re,cc=St*kn-Jn*Ht,Us=(Ht*lc-kn*Zn)/cc,Xs=(Jn*Zn-St*lc)/cc;return j.isNaN(Us)||j.isInfinite(Us)||j.isNaN(Xs)||j.isInfinite(Xs)?null:new O(Us+F,Xs+D)}}]),s}(),je=function(){function s(){a(this,s)}return c(s,null,[{key:"arraycopy",value:function(e,t,n,i,u){for(var f=0,g=t;g<t+u;g++)n[i+f]=e[g],f++}},{key:"getProperty",value:function(e){return{"line.separator":`
7
- `}[e]}}]),s}(),zn=function(){function s(){a(this,s)}return c(s,null,[{key:"log10",value:function(e){var t=Math.log(e);return j.isInfinite(t)||j.isNaN(t)?t:t/s.LOG_10}},{key:"min",value:function(e,t,n,i){var u=e;return t<u&&(u=t),n<u&&(u=n),i<u&&(u=i),u}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1],n=arguments[2];return e<t?t:e>n?n:e}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],u=arguments[1],f=arguments[2];return i<u?u:i>f?f:i}}},{key:"wrap",value:function(e,t){return e<0?t- -e%t:e%t}},{key:"max",value:function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],i=e;return t>i&&(i=t),n>i&&(i=n),i}if(arguments.length===4){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3],d=u;return f>d&&(d=f),g>d&&(d=g),y>d&&(d=y),d}}},{key:"average",value:function(e,t){return(e+t)/2}}]),s}();zn.LOG_10=Math.log(10);var ft=function(){function s(){a(this,s)}return c(s,null,[{key:"segmentToSegment",value:function(e,t,n,i){if(e.equals(t))return s.pointToSegment(e,n,i);if(n.equals(i))return s.pointToSegment(i,e,t);var u=!1;if(pe.intersects(e,t,n,i)){var f=(t.x-e.x)*(i.y-n.y)-(t.y-e.y)*(i.x-n.x);if(f===0)u=!0;else{var g=(e.y-n.y)*(i.x-n.x)-(e.x-n.x)*(i.y-n.y),y=((e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y))/f,d=g/f;(d<0||d>1||y<0||y>1)&&(u=!0)}}else u=!0;return u?zn.min(s.pointToSegment(e,n,i),s.pointToSegment(t,n,i),s.pointToSegment(n,e,t),s.pointToSegment(i,e,t)):0}},{key:"pointToSegment",value:function(e,t,n){if(t.x===n.x&&t.y===n.y)return e.distance(t);var i=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),u=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/i;if(u<=0)return e.distance(t);if(u>=1)return e.distance(n);var f=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/i;return Math.abs(f)*Math.sqrt(i)}},{key:"pointToLinePerpendicular",value:function(e,t,n){var i=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),u=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/i;return Math.abs(u)*Math.sqrt(i)}},{key:"pointToSegmentString",value:function(e,t){if(t.length===0)throw new M("Line array must contain at least one vertex");for(var n=e.distance(t[0]),i=0;i<t.length-1;i++){var u=s.pointToSegment(e,t[i],t[i+1]);u<n&&(n=u)}return n}}]),s}(),Il=function(){function s(){a(this,s)}return c(s,[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||re(arguments[0],le);else if(arguments.length!==2){if(arguments.length===3){var e=arguments[0],t=arguments[1];return this.create(e,t)}}}}]),s}(),jr=function(){function s(){a(this,s)}return c(s,[{key:"filter",value:function(e){}}]),s}(),Qp=function(){function s(){a(this,s)}return c(s,null,[{key:"ofLine",value:function(e){var t=e.size();if(t<=1)return 0;var n=0,i=new O;e.getCoordinate(0,i);for(var u=i.x,f=i.y,g=1;g<t;g++){e.getCoordinate(g,i);var y=i.x,d=i.y,N=y-u,b=d-f;n+=Math.sqrt(N*N+b*b),u=y,f=d}return n}}]),s}(),wl=function s(){a(this,s)},Yt=function(){function s(){a(this,s)}return c(s,null,[{key:"copyCoord",value:function(e,t,n,i){for(var u=Math.min(e.getDimension(),n.getDimension()),f=0;f<u;f++)n.setOrdinate(i,f,e.getOrdinate(t,f))}},{key:"isRing",value:function(e){var t=e.size();return t===0||!(t<=3)&&e.getOrdinate(0,le.X)===e.getOrdinate(t-1,le.X)&&e.getOrdinate(0,le.Y)===e.getOrdinate(t-1,le.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(re(arguments[0],le)&&Number.isInteger(arguments[1])){var e=arguments[0],t=arguments[1];s.scroll(e,t,s.isRing(e))}else if(re(arguments[0],le)&&arguments[1]instanceof O){var n=arguments[0],i=arguments[1],u=s.indexOf(i,n);if(u<=0)return null;s.scroll(n,u)}}else if(arguments.length===3){var f=arguments[0],g=arguments[1],y=arguments[2],d=g;if(d<=0)return null;for(var N=f.copy(),b=y?f.size()-1:f.size(),L=0;L<b;L++)for(var F=0;F<f.getDimension();F++)f.setOrdinate(L,F,N.getOrdinate((g+L)%b,F));if(y)for(var D=0;D<f.getDimension();D++)f.setOrdinate(b,D,f.getOrdinate(0,D))}}},{key:"isEqual",value:function(e,t){var n=e.size();if(n!==t.size())return!1;for(var i=Math.min(e.getDimension(),t.getDimension()),u=0;u<n;u++)for(var f=0;f<i;f++){var g=e.getOrdinate(u,f),y=t.getOrdinate(u,f);if(e.getOrdinate(u,f)!==t.getOrdinate(u,f)&&(!j.isNaN(g)||!j.isNaN(y)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var e=arguments[0];return s.minCoordinateIndex(e,0,e.size()-1)}if(arguments.length===3){for(var t=arguments[0],n=arguments[1],i=arguments[2],u=-1,f=null,g=n;g<=i;g++){var y=t.getCoordinate(g);(f===null||f.compareTo(y)>0)&&(f=y,u=g)}return u}}},{key:"extend",value:function(e,t,n){var i=e.create(n,t.getDimension()),u=t.size();if(s.copy(t,0,i,0,u),u>0)for(var f=u;f<n;f++)s.copy(t,u-1,i,f,1);return i}},{key:"reverse",value:function(e){for(var t=e.size()-1,n=Math.trunc(t/2),i=0;i<=n;i++)s.swap(e,i,t-i)}},{key:"swap",value:function(e,t,n){if(t===n)return null;for(var i=0;i<e.getDimension();i++){var u=e.getOrdinate(t,i);e.setOrdinate(t,i,e.getOrdinate(n,i)),e.setOrdinate(n,i,u)}}},{key:"copy",value:function(e,t,n,i,u){for(var f=0;f<u;f++)s.copyCoord(e,t+f,n,i+f)}},{key:"ensureValidRing",value:function(e,t){var n=t.size();return n===0?t:n<=3?s.createClosedRing(e,t,4):t.getOrdinate(0,le.X)===t.getOrdinate(n-1,le.X)&&t.getOrdinate(0,le.Y)===t.getOrdinate(n-1,le.Y)?t:s.createClosedRing(e,t,n+1)}},{key:"indexOf",value:function(e,t){for(var n=0;n<t.size();n++)if(e.x===t.getOrdinate(n,le.X)&&e.y===t.getOrdinate(n,le.Y))return n;return-1}},{key:"createClosedRing",value:function(e,t,n){var i=e.create(n,t.getDimension()),u=t.size();s.copy(t,0,i,0,u);for(var f=u;f<n;f++)s.copy(t,0,i,f,1);return i}},{key:"minCoordinate",value:function(e){for(var t=null,n=0;n<e.size();n++){var i=e.getCoordinate(n);(t===null||t.compareTo(i)>0)&&(t=i)}return t}}]),s}(),z=function(){function s(){a(this,s)}return c(s,null,[{key:"toDimensionSymbol",value:function(e){switch(e){case s.FALSE:return s.SYM_FALSE;case s.TRUE:return s.SYM_TRUE;case s.DONTCARE:return s.SYM_DONTCARE;case s.P:return s.SYM_P;case s.L:return s.SYM_L;case s.A:return s.SYM_A}throw new M("Unknown dimension value: "+e)}},{key:"toDimensionValue",value:function(e){switch(Ns.toUpperCase(e)){case s.SYM_FALSE:return s.FALSE;case s.SYM_TRUE:return s.TRUE;case s.SYM_DONTCARE:return s.DONTCARE;case s.SYM_P:return s.P;case s.SYM_L:return s.L;case s.SYM_A:return s.A}throw new M("Unknown dimension symbol: "+e)}}]),s}();z.P=0,z.L=1,z.A=2,z.FALSE=-1,z.TRUE=-2,z.DONTCARE=-3,z.SYM_FALSE="F",z.SYM_TRUE="T",z.SYM_DONTCARE="*",z.SYM_P="0",z.SYM_L="1",z.SYM_A="2";var Vr=function(){function s(){a(this,s)}return c(s,[{key:"filter",value:function(e){}}]),s}(),Wr=function(){function s(){a(this,s)}return c(s,[{key:"filter",value:function(e,t){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}]),s}(),Yn=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new pe:this._points.expandEnvelope(new pe)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];if(!this.isEquivalentClass(n))return!1;var u=n;if(this._points.size()!==u._points.size())return!1;for(var f=0;f<this._points.size();f++)if(!this.equal(this._points.getCoordinate(f),u._points.getCoordinate(f),i))return!1;return!0}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){for(var n=0;n<Math.trunc(this._points.size()/2);n++){var i=this._points.size()-1-n;if(!this._points.getCoordinate(n).equals(this._points.getCoordinate(i))){if(this._points.getCoordinate(n).compareTo(this._points.getCoordinate(i))>0){var u=this._points.copy();Yt.reverse(u),this._points=u}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?z.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var n=this._points.copy();return Yt.reverse(n),this.getFactory().createLineString(n)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return W.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return Qp.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var n=arguments[0],i=n,u=0,f=0;u<this._points.size()&&f<i._points.size();){var g=this._points.getCoordinate(u).compareTo(i._points.getCoordinate(f));if(g!==0)return g;u++,f++}return u<this._points.size()?1:f<i._points.size()?-1:0}if(arguments.length===2){var y=arguments[0],d=arguments[1],N=y;return d.compare(this._points,N._points)}}},{key:"apply",value:function(){if(re(arguments[0],jr))for(var n=arguments[0],i=0;i<this._points.size();i++)n.filter(this._points.getCoordinate(i));else if(re(arguments[0],Wr)){var u=arguments[0];if(this._points.size()===0)return null;for(var f=0;f<this._points.size()&&(u.filter(this._points,f),!u.isDone());f++);u.isGeometryChanged()&&this.geometryChanged()}else if(re(arguments[0],Vr)){var g=arguments[0];g.filter(this)}else if(re(arguments[0],$)){var y=arguments[0];y.filter(this)}}},{key:"getBoundary",value:function(){throw new Mt}},{key:"isEquivalentClass",value:function(n){return n instanceof t}},{key:"getCoordinateN",value:function(n){return this._points.getCoordinate(n)}},{key:"getGeometryType",value:function(){return W.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(n){if(n===null&&(n=this.getFactory().getCoordinateSequenceFactory().create([])),n.size()===1)throw new M("Invalid number of points in LineString (found "+n.size()+" - must be 0 or >= 2)");this._points=n}},{key:"isCoordinate",value:function(n){for(var i=0;i<this._points.size();i++)if(this._points.getCoordinate(i).equals(n))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(n){return this.getFactory().createPoint(this._points.getCoordinate(n))}},{key:"interfaces_",get:function(){return[wl]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0){if(arguments.length===2){var n=arguments[0],i=arguments[1];W.constructor_.call(this,i),this.init(n)}}}}]),t}(W),Nl=function s(){a(this,s)},Ts=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new pe;var n=new pe;return n.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),n}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new t(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&(!(!this.isEmpty()||!n.isEmpty())||this.isEmpty()===n.isEmpty()&&this.equal(n.getCoordinate(),this.getCoordinate(),i))}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return z.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return W.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getCoordinate().compareTo(i.getCoordinate())}if(arguments.length===2){var u=arguments[0],f=arguments[1],g=u;return f.compare(this._coordinates,g._coordinates)}}},{key:"apply",value:function(){if(re(arguments[0],jr)){var n=arguments[0];if(this.isEmpty())return null;n.filter(this.getCoordinate())}else if(re(arguments[0],Wr)){var i=arguments[0];if(this.isEmpty())return null;i.filter(this._coordinates,0),i.isGeometryChanged()&&this.geometryChanged()}else if(re(arguments[0],Vr)){var u=arguments[0];u.filter(this)}else if(re(arguments[0],$)){var f=arguments[0];f.filter(this)}}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return W.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(n){n===null&&(n=this.getFactory().getCoordinateSequenceFactory().create([])),se.isTrue(n.size()<=1),this._coordinates=n}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[Nl]}}],[{key:"constructor_",value:function(){this._coordinates=null;var n=arguments[0],i=arguments[1];W.constructor_.call(this,i),this.init(n)}}]),t}(W),bl=function(){function s(){a(this,s)}return c(s,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var e=arguments[0];return Math.abs(s.ofRingSigned(e))}if(re(arguments[0],le)){var t=arguments[0];return Math.abs(s.ofRingSigned(t))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var e=arguments[0];if(e.length<3)return 0;for(var t=0,n=e[0].x,i=1;i<e.length-1;i++){var u=e[i].x-n,f=e[i+1].y,g=e[i-1].y;t+=u*(g-f)}return t/2}if(re(arguments[0],le)){var y=arguments[0],d=y.size();if(d<3)return 0;var N=new O,b=new O,L=new O;y.getCoordinate(0,b),y.getCoordinate(1,L);var F=b.x;L.x-=F;for(var D=0,V=1;V<d-1;V++)N.y=b.y,b.x=L.x,b.y=L.y,y.getCoordinate(V+1,L),L.x-=F,D+=b.x*(N.y-L.y);return D/2}}}]),s}(),Ut=function(){function s(){a(this,s)}return c(s,null,[{key:"sort",value:function(){var e=arguments,t=arguments[0];if(arguments.length===1)t.sort(function(F,D){return F.compareTo(D)});else if(arguments.length===2)t.sort(function(F,D){return e[1].compare(F,D)});else if(arguments.length===3){var n=t.slice(arguments[1],arguments[2]);n.sort();var i=t.slice(0,arguments[1]).concat(n,t.slice(arguments[2],t.length));t.splice(0,t.length);var u,f=A(i);try{for(f.s();!(u=f.n()).done;){var g=u.value;t.push(g)}}catch(F){f.e(F)}finally{f.f()}}else if(arguments.length===4){var y=t.slice(arguments[1],arguments[2]);y.sort(function(F,D){return e[3].compare(F,D)});var d=t.slice(0,arguments[1]).concat(y,t.slice(arguments[2],t.length));t.splice(0,t.length);var N,b=A(d);try{for(b.s();!(N=b.n()).done;){var L=N.value;t.push(L)}}catch(F){b.e(F)}finally{b.f()}}}},{key:"asList",value:function(e){var t,n=new Z,i=A(e);try{for(i.s();!(t=i.n()).done;){var u=t.value;n.add(u)}}catch(f){i.e(f)}finally{i.f()}return n}},{key:"copyOf",value:function(e,t){return e.slice(0,t)}}]),s}(),Ol=function s(){a(this,s)},Hr=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var n=new Array(this.getNumPoints()).fill(null),i=-1,u=this._shell.getCoordinates(),f=0;f<u.length;f++)n[++i]=u[f];for(var g=0;g<this._holes.length;g++)for(var y=this._holes[g].getCoordinates(),d=0;d<y.length;d++)n[++i]=y[d];return n}},{key:"getArea",value:function(){var n=0;n+=bl.ofRing(this._shell.getCoordinateSequence());for(var i=0;i<this._holes.length;i++)n-=bl.ofRing(this._holes[i].getCoordinateSequence());return n}},{key:"copyInternal",value:function(){for(var n=this._shell.copy(),i=new Array(this._holes.length).fill(null),u=0;u<this._holes.length;u++)i[u]=this._holes[u].copy();return new t(n,i,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var n=this._shell.getCoordinateSequence(),i=this.getEnvelopeInternal(),u=0;u<5;u++){var f=n.getX(u);if(f!==i.getMinX()&&f!==i.getMaxX())return!1;var g=n.getY(u);if(g!==i.getMinY()&&g!==i.getMaxY())return!1}for(var y=n.getX(0),d=n.getY(0),N=1;N<=4;N++){var b=n.getX(N),L=n.getY(N);if(b!==y==(L!==d))return!1;y=b,d=L}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];if(!this.isEquivalentClass(n))return!1;var u=n,f=this._shell,g=u._shell;if(!f.equalsExact(g,i)||this._holes.length!==u._holes.length)return!1;for(var y=0;y<this._holes.length;y++)if(!this._holes[y].equalsExact(u._holes[y],i))return!1;return!0}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var n=0;n<this._holes.length;n++)this._holes[n]=this.normalized(this._holes[n],!1);Ut.sort(this._holes)}else if(arguments.length===2){var i=arguments[0],u=arguments[1];if(i.isEmpty())return null;var f=i.getCoordinateSequence(),g=Yt.minCoordinateIndex(f,0,f.size()-2);Yt.scroll(f,g,!0),Q.isCCW(f)===u&&Yt.reverse(f)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var n=this.getExteriorRing().reverse(),i=new Array(this.getNumInteriorRing()).fill(null),u=0;u<i.length;u++)i[u]=this.getInteriorRingN(u).reverse();return this.getFactory().createPolygon(n,i)}},{key:"getTypeCode",value:function(){return W.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var n=0;n+=this._shell.getLength();for(var i=0;i<this._holes.length;i++)n+=this._holes[i].getLength();return n}},{key:"getNumPoints",value:function(){for(var n=this._shell.getNumPoints(),i=0;i<this._holes.length;i++)n+=this._holes[i].getNumPoints();return n}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(n,i){var u=n.copy();return this.normalize(u,i),u}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var n=arguments[0],i=this._shell,u=n._shell;return i.compareToSameClass(u)}if(arguments.length===2){var f=arguments[0],g=arguments[1],y=f,d=this._shell,N=y._shell,b=d.compareToSameClass(N,g);if(b!==0)return b;for(var L=this.getNumInteriorRing(),F=y.getNumInteriorRing(),D=0;D<L&&D<F;){var V=this.getInteriorRingN(D),H=y.getInteriorRingN(D),K=V.compareToSameClass(H,g);if(K!==0)return K;D++}return D<L?1:D<F?-1:0}}},{key:"apply",value:function(){if(re(arguments[0],jr)){var n=arguments[0];this._shell.apply(n);for(var i=0;i<this._holes.length;i++)this._holes[i].apply(n)}else if(re(arguments[0],Wr)){var u=arguments[0];if(this._shell.apply(u),!u.isDone())for(var f=0;f<this._holes.length&&(this._holes[f].apply(u),!u.isDone());f++);u.isGeometryChanged()&&this.geometryChanged()}else if(re(arguments[0],Vr)){var g=arguments[0];g.filter(this)}else if(re(arguments[0],$)){var y=arguments[0];y.filter(this),this._shell.apply(y);for(var d=0;d<this._holes.length;d++)this._holes[d].apply(y)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var n=new Array(this._holes.length+1).fill(null);n[0]=this._shell;for(var i=0;i<this._holes.length;i++)n[i+1]=this._holes[i];return n.length<=1?this.getFactory().createLinearRing(n[0].getCoordinateSequence()):this.getFactory().createMultiLineString(n)}},{key:"getGeometryType",value:function(){return W.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(n){return this._holes[n]}},{key:"interfaces_",get:function(){return[Ol]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var n=arguments[0],i=arguments[1],u=arguments[2];if(W.constructor_.call(this,u),n===null&&(n=this.getFactory().createLinearRing()),i===null&&(i=[]),W.hasNullElements(i))throw new M("holes must not contain null elements");if(n.isEmpty()&&W.hasNonEmptyElements(i))throw new M("shell is empty but holes are not");this._shell=n,this._holes=i}}]),t}(W),Kp=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.apply(this,arguments)}return t}(El),Tl=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this)).array=[],n instanceof ct&&i.addAll(n),i}return c(t,[{key:"contains",value:function(n){var i,u=A(this.array);try{for(u.s();!(i=u.n()).done;)if(i.value.compareTo(n)===0)return!0}catch(f){u.e(f)}finally{u.f()}return!1}},{key:"add",value:function(n){if(this.contains(n))return!1;for(var i=0,u=this.array.length;i<u;i++)if(this.array[i].compareTo(n)===1)return!!this.array.splice(i,0,n);return this.array.push(n),!0}},{key:"addAll",value:function(n){var i,u=A(n);try{for(u.s();!(i=u.n()).done;){var f=i.value;this.add(f)}}catch(g){u.e(g)}finally{u.f()}return!0}},{key:"remove",value:function(){throw new Mt}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new em(this.array)}}]),t}(Kp),em=function(){function s(e){a(this,s),this.array=e,this.position=0}return c(s,[{key:"next",value:function(){if(this.position===this.array.length)throw new Ur;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new Mt}}]),s}(),Ge=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"computeEnvelopeInternal",value:function(){for(var n=new pe,i=0;i<this._geometries.length;i++)n.expandToInclude(this._geometries[i].getEnvelopeInternal());return n}},{key:"getGeometryN",value:function(n){return this._geometries[n]}},{key:"getCoordinates",value:function(){for(var n=new Array(this.getNumPoints()).fill(null),i=-1,u=0;u<this._geometries.length;u++)for(var f=this._geometries[u].getCoordinates(),g=0;g<f.length;g++)n[++i]=f[g];return n}},{key:"getArea",value:function(){for(var n=0,i=0;i<this._geometries.length;i++)n+=this._geometries[i].getArea();return n}},{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new t(n,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];if(!this.isEquivalentClass(n))return!1;var u=n;if(this._geometries.length!==u._geometries.length)return!1;for(var f=0;f<this._geometries.length;f++)if(!this._geometries[f].equalsExact(u._geometries[f],i))return!1;return!0}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){for(var n=0;n<this._geometries.length;n++)this._geometries[n].normalize();Ut.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var n=z.FALSE,i=0;i<this._geometries.length;i++)n=Math.max(n,this._geometries[i].getBoundaryDimension());return n}},{key:"reverseInternal",value:function(){for(var n=this._geometries.length,i=new Z(n),u=0;u<n;u++)i.add(this._geometries[u].reverse());return this.getFactory().buildGeometry(i)}},{key:"getTypeCode",value:function(){return W.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var n=z.FALSE,i=0;i<this._geometries.length;i++)n=Math.max(n,this._geometries[i].getDimension());return n}},{key:"getLength",value:function(){for(var n=0,i=0;i<this._geometries.length;i++)n+=this._geometries[i].getLength();return n}},{key:"getNumPoints",value:function(){for(var n=0,i=0;i<this._geometries.length;i++)n+=this._geometries[i].getNumPoints();return n}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var n=arguments[0],i=new Tl(Ut.asList(this._geometries)),u=new Tl(Ut.asList(n._geometries));return this.compare(i,u)}if(arguments.length===2){for(var f=arguments[0],g=arguments[1],y=f,d=this.getNumGeometries(),N=y.getNumGeometries(),b=0;b<d&&b<N;){var L=this.getGeometryN(b),F=y.getGeometryN(b),D=L.compareToSameClass(F,g);if(D!==0)return D;b++}return b<d?1:b<N?-1:0}}},{key:"apply",value:function(){if(re(arguments[0],jr))for(var n=arguments[0],i=0;i<this._geometries.length;i++)this._geometries[i].apply(n);else if(re(arguments[0],Wr)){var u=arguments[0];if(this._geometries.length===0)return null;for(var f=0;f<this._geometries.length&&(this._geometries[f].apply(u),!u.isDone());f++);u.isGeometryChanged()&&this.geometryChanged()}else if(re(arguments[0],Vr)){var g=arguments[0];g.filter(this);for(var y=0;y<this._geometries.length;y++)this._geometries[y].apply(g)}else if(re(arguments[0],$)){var d=arguments[0];d.filter(this);for(var N=0;N<this._geometries.length;N++)this._geometries[N].apply(d)}}},{key:"getBoundary",value:function(){return W.checkNotGeometryCollection(this),se.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return W.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var n=0;n<this._geometries.length;n++)if(!this._geometries[n].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(W.constructor_.call(this,i),n===null&&(n=[]),W.hasNullElements(n))throw new M("geometries must not contain null elements");this._geometries=n}}}}]),t}(W),Ls=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new t(n,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&w(v(t.prototype),"equalsExact",this).call(this,n,i)}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var n=arguments[0];return this._geometries[n].getCoordinate()}return w(v(t.prototype),"getCoordinate",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return z.FALSE}},{key:"getTypeCode",value:function(){return W.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return W.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[Nl]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Ge.constructor_.call(this,n,i)}}]),t}(Ge),Un=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return z.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||w(v(t.prototype),"isClosed",this).call(this)}},{key:"reverseInternal",value:function(){var n=this._points.copy();return Yt.reverse(n),this.getFactory().createLinearRing(n)}},{key:"getTypeCode",value:function(){return W.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!w(v(t.prototype),"isClosed",this).call(this))throw new M("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new M("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return W.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Yn.constructor_.call(this,n,i),this.validateConstruction()}}]),t}(Yn);Un.MINIMUM_VALID_SIZE=4;var Xt=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"setOrdinate",value:function(n,i){switch(n){case t.X:this.x=i;break;case t.Y:this.y=i;break;default:throw new M("Invalid ordinate index: "+n)}}},{key:"getZ",value:function(){return O.NULL_ORDINATE}},{key:"getOrdinate",value:function(n){switch(n){case t.X:return this.x;case t.Y:return this.y}throw new M("Invalid ordinate index: "+n)}},{key:"setZ",value:function(n){throw new M("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)O.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof t){var n=arguments[0];O.constructor_.call(this,n.x,n.y)}else if(arguments[0]instanceof O){var i=arguments[0];O.constructor_.call(this,i.x,i.y)}}else if(arguments.length===2){var u=arguments[0],f=arguments[1];O.constructor_.call(this,u,f,O.NULL_ORDINATE)}}}]),t}(O);Xt.X=0,Xt.Y=1,Xt.Z=-1,Xt.M=-1;var jt=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(n,i){switch(n){case t.X:this.x=i;break;case t.Y:this.y=i;break;case t.M:this._m=i;break;default:throw new M("Invalid ordinate index: "+n)}}},{key:"setM",value:function(n){this._m=n}},{key:"getZ",value:function(){return O.NULL_ORDINATE}},{key:"getOrdinate",value:function(n){switch(n){case t.X:return this.x;case t.Y:return this.y;case t.M:return this._m}throw new M("Invalid ordinate index: "+n)}},{key:"setZ",value:function(n){throw new M("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ(),this._m=n.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)O.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var n=arguments[0];O.constructor_.call(this,n.x,n.y),this._m=n._m}else if(arguments[0]instanceof O){var i=arguments[0];O.constructor_.call(this,i.x,i.y),this._m=this.getM()}}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];O.constructor_.call(this,u,f,O.NULL_ORDINATE),this._m=g}}}]),t}(O);jt.X=0,jt.Y=1,jt.Z=-1,jt.M=2;var Rs=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(n,i){switch(n){case O.X:this.x=i;break;case O.Y:this.y=i;break;case O.Z:this.z=i;break;case O.M:this._m=i;break;default:throw new M("Invalid ordinate index: "+n)}}},{key:"setM",value:function(n){this._m=n}},{key:"getOrdinate",value:function(n){switch(n){case O.X:return this.x;case O.Y:return this.y;case O.Z:return this.getZ();case O.M:return this.getM()}throw new M("Invalid ordinate index: "+n)}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ(),this._m=n.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)O.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var n=arguments[0];O.constructor_.call(this,n),this._m=n._m}else if(arguments[0]instanceof O){var i=arguments[0];O.constructor_.call(this,i),this._m=this.getM()}}else if(arguments.length===4){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3];O.constructor_.call(this,u,f,g),this._m=y}}}]),t}(O),Zr=function(){function s(){a(this,s)}return c(s,null,[{key:"measures",value:function(e){return e instanceof Xt?0:e instanceof jt||e instanceof Rs?1:0}},{key:"dimension",value:function(e){return e instanceof Xt?2:e instanceof jt?3:e instanceof Rs?4:3}},{key:"create",value:function(){if(arguments.length===1){var e=arguments[0];return s.create(e,0)}if(arguments.length===2){var t=arguments[0],n=arguments[1];return t===2?new Xt:t===3&&n===0?new O:t===3&&n===1?new jt:t===4&&n===1?new Rs:new O}}}]),s}(),Xn=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getCoordinate",value:function(n){return this.get(n)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&re(arguments[0],ct)){for(var n=arguments[0],i=arguments[1],u=!1,f=n.iterator();f.hasNext();)this.add(f.next(),i),u=!0;return u}return w(v(t.prototype),"addAll",this).apply(this,arguments)}},{key:"clone",value:function(){for(var n=w(v(t.prototype),"clone",this).call(this),i=0;i<this.size();i++)n.add(i,this.get(i).clone());return n}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(t.coordArrayType);if(arguments.length===1){var n=arguments[0];if(n)return this.toArray(t.coordArrayType);for(var i=this.size(),u=new Array(i).fill(null),f=0;f<i;f++)u[f]=this.get(i-f-1);return u}}},{key:"add",value:function(){if(arguments.length===1){var n=arguments[0];return w(v(t.prototype),"add",this).call(this,n)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var i=arguments[0],u=arguments[1];return this.add(i,u,!0),!0}if(arguments[0]instanceof O&&typeof arguments[1]=="boolean"){var f=arguments[0],g=arguments[1];if(!g&&this.size()>=1){var y=this.get(this.size()-1);if(y.equals2D(f))return null}w(v(t.prototype),"add",this).call(this,f)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var d=arguments[0],N=arguments[1];return this.add(d,N),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var b=arguments[0],L=arguments[1],F=arguments[2];if(F)for(var D=0;D<b.length;D++)this.add(b[D],L);else for(var V=b.length-1;V>=0;V--)this.add(b[V],L);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof O){var H=arguments[0],K=arguments[1],ge=arguments[2];if(!ge){var xe=this.size();if(xe>0){if(H>0){var Re=this.get(H-1);if(Re.equals2D(K))return null}if(H<xe){var qe=this.get(H);if(qe.equals2D(K))return null}}}w(v(t.prototype),"add",this).call(this,H,K)}}else if(arguments.length===4){var rt=arguments[0],St=arguments[1],Ht=arguments[2],Zn=arguments[3],Jn=1;Ht>Zn&&(Jn=-1);for(var kn=Ht;kn!==Zn;kn+=Jn)this.add(rt[kn],St);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var n=this.get(0).copy();this.add(n,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.ensureCapacity(n.length),this.add(n,!0)}else if(arguments.length===2){var i=arguments[0],u=arguments[1];this.ensureCapacity(i.length),this.add(i,u)}}}}]),t}(Z);Xn.coordArrayType=new Array(0).fill(null);var Ee=function(){function s(){a(this,s)}return c(s,null,[{key:"isRing",value:function(e){return!(e.length<4)&&!!e[0].equals2D(e[e.length-1])}},{key:"ptNotInList",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n];if(s.indexOf(i,t)<0)return i}return null}},{key:"scroll",value:function(e,t){var n=s.indexOf(t,e);if(n<0)return null;var i=new Array(e.length).fill(null);je.arraycopy(e,n,i,0,e.length-n),je.arraycopy(e,0,i,e.length-n,n),je.arraycopy(i,0,e,0,e.length)}},{key:"equals",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(e===t)return!0;if(e===null||t===null||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].equals(t[n]))return!1;return!0}if(arguments.length===3){var i=arguments[0],u=arguments[1],f=arguments[2];if(i===u)return!0;if(i===null||u===null||i.length!==u.length)return!1;for(var g=0;g<i.length;g++)if(f.compare(i[g],u[g])!==0)return!1;return!0}}},{key:"intersection",value:function(e,t){for(var n=new Xn,i=0;i<e.length;i++)t.intersects(e[i])&&n.add(e[i],!0);return n.toCoordinateArray()}},{key:"measures",value:function(e){if(e===null||e.length===0)return 0;var t,n=0,i=A(e);try{for(i.s();!(t=i.n()).done;){var u=t.value;n=Math.max(n,Zr.measures(u))}}catch(f){i.e(f)}finally{i.f()}return n}},{key:"hasRepeatedPoints",value:function(e){for(var t=1;t<e.length;t++)if(e[t-1].equals(e[t]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(e){return s.hasRepeatedPoints(e)?new Xn(e,!1).toCoordinateArray():e}},{key:"reverse",value:function(e){for(var t=e.length-1,n=Math.trunc(t/2),i=0;i<=n;i++){var u=e[i];e[i]=e[t-i],e[t-i]=u}}},{key:"removeNull",value:function(e){for(var t=0,n=0;n<e.length;n++)e[n]!==null&&t++;var i=new Array(t).fill(null);if(t===0)return i;for(var u=0,f=0;f<e.length;f++)e[f]!==null&&(i[u++]=e[f]);return i}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var e=arguments[0],t=new Array(e.length).fill(null),n=0;n<e.length;n++)t[n]=e[n].copy();return t}if(arguments.length===5)for(var i=arguments[0],u=arguments[1],f=arguments[2],g=arguments[3],y=arguments[4],d=0;d<y;d++)f[g+d]=i[u+d].copy()}},{key:"isEqualReversed",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n],u=t[e.length-n-1];if(i.compareTo(u)!==0)return!1}return!0}},{key:"envelope",value:function(e){for(var t=new pe,n=0;n<e.length;n++)t.expandToInclude(e[n]);return t}},{key:"toCoordinateArray",value:function(e){return e.toArray(s.coordArrayType)}},{key:"dimension",value:function(e){if(e===null||e.length===0)return 3;var t,n=0,i=A(e);try{for(i.s();!(t=i.n()).done;){var u=t.value;n=Math.max(n,Zr.dimension(u))}}catch(f){i.e(f)}finally{i.f()}return n}},{key:"atLeastNCoordinatesOrNothing",value:function(e,t){return t.length>=e?t:[]}},{key:"indexOf",value:function(e,t){for(var n=0;n<t.length;n++)if(e.equals(t[n]))return n;return-1}},{key:"increasingDirection",value:function(e){for(var t=0;t<Math.trunc(e.length/2);t++){var n=e.length-1-t,i=e[t].compareTo(e[n]);if(i!==0)return i}return 1}},{key:"compare",value:function(e,t){for(var n=0;n<e.length&&n<t.length;){var i=e[n].compareTo(t[n]);if(i!==0)return i;n++}return n<t.length?-1:n<e.length?1:0}},{key:"minCoordinate",value:function(e){for(var t=null,n=0;n<e.length;n++)(t===null||t.compareTo(e[n])>0)&&(t=e[n]);return t}},{key:"extract",value:function(e,t,n){t=zn.clamp(t,0,e.length);var i=(n=zn.clamp(n,-1,e.length))-t+1;n<0&&(i=0),t>=e.length&&(i=0),n<t&&(i=0);var u=new Array(i).fill(null);if(i===0)return u;for(var f=0,g=t;g<=n;g++)u[f++]=e[g];return u}}]),s}(),tm=function(){function s(){a(this,s)}return c(s,[{key:"compare",value:function(e,t){var n=e,i=t;return Ee.compare(n,i)}},{key:"interfaces_",get:function(){return[Pe]}}]),s}(),nm=function(){function s(){a(this,s)}return c(s,[{key:"compare",value:function(e,t){var n=e,i=t;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;var u=Ee.compare(n,i);return Ee.isEqualReversed(n,i)?0:u}},{key:"OLDcompare",value:function(e,t){var n=e,i=t;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;for(var u=Ee.increasingDirection(n),f=Ee.increasingDirection(i),g=u>0?0:n.length-1,y=f>0?0:n.length-1,d=0;d<n.length;d++){var N=n[g].compareTo(i[y]);if(N!==0)return N;g+=u,y+=f}return 0}},{key:"interfaces_",get:function(){return[Pe]}}]),s}();Ee.ForwardComparator=tm,Ee.BidirectionalComparator=nm,Ee.coordArrayType=new Array(0).fill(null);var Jr=function(){function s(e){a(this,s),this.str=e}return c(s,[{key:"append",value:function(e){this.str+=e}},{key:"setCharAt",value:function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)}},{key:"toString",value:function(){return this.str}}]),s}(),jn=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getM",value:function(e){return this.hasM()?this._coordinates[e].getM():j.NaN}},{key:"setOrdinate",value:function(e,t,n){switch(t){case le.X:this._coordinates[e].x=n;break;case le.Y:this._coordinates[e].y=n;break;default:this._coordinates[e].setOrdinate(t,n)}}},{key:"getZ",value:function(e){return this.hasZ()?this._coordinates[e].getZ():j.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(e,t){switch(t){case le.X:return this._coordinates[e].x;case le.Y:return this._coordinates[e].y;default:return this._coordinates[e].getOrdinate(t)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var e=arguments[0];return this._coordinates[e]}if(arguments.length===2){var t=arguments[0],n=arguments[1];n.setCoordinate(this._coordinates[t])}}},{key:"getCoordinateCopy",value:function(e){var t=this.createCoordinate();return t.setCoordinate(this._coordinates[e]),t}},{key:"createCoordinate",value:function(){return Zr.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(e){return this._coordinates[e].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(e){for(var t=0;t<this._coordinates.length;t++)e.expandToInclude(this._coordinates[t]);return e}},{key:"copy",value:function(){for(var e=new Array(this.size()).fill(null),t=0;t<this._coordinates.length;t++){var n=this.createCoordinate();n.setCoordinate(this._coordinates[t]),e[t]=n}return new s(e,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var e=new Jr(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var t=1;t<this._coordinates.length;t++)e.append(", "),e.append(this._coordinates[t]);return e.append(")"),e.toString()}return"()"}},{key:"getY",value:function(e){return this._coordinates[e].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[le,X]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];s.constructor_.call(this,e,Ee.dimension(e),Ee.measures(e))}else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n<t;n++)this._coordinates[n]=new O}else if(re(arguments[0],le)){var i=arguments[0];if(i===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=i.getDimension(),this._measures=i.getMeasures(),this._coordinates=new Array(i.size()).fill(null);for(var u=0;u<this._coordinates.length;u++)this._coordinates[u]=i.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var f=arguments[0],g=arguments[1];s.constructor_.call(this,f,g,Ee.measures(f))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var y=arguments[0],d=arguments[1];this._coordinates=new Array(y).fill(null),this._dimension=d;for(var N=0;N<y;N++)this._coordinates[N]=Zr.create(d)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var b=arguments[0],L=arguments[1],F=arguments[2];this._dimension=L,this._measures=F,this._coordinates=b===null?new Array(0).fill(null):b}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var D=arguments[0],V=arguments[1],H=arguments[2];this._coordinates=new Array(D).fill(null),this._dimension=V,this._measures=H;for(var K=0;K<D;K++)this._coordinates[K]=this.createCoordinate()}}}}]),s}(),Cs=function(){function s(){a(this,s)}return c(s,[{key:"readResolve",value:function(){return s.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new jn(e)}if(re(arguments[0],le)){var t=arguments[0];return new jn(t)}}else{if(arguments.length===2){var n=arguments[0],i=arguments[1];return i>3&&(i=3),i<2&&(i=2),new jn(n,i)}if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2],y=f-g;return g>1&&(g=1),y>3&&(y=3),y<2&&(y=2),new jn(u,y+g,g)}}}},{key:"interfaces_",get:function(){return[Il,X]}}],[{key:"instance",value:function(){return s.instanceObject}}]),s}();Cs.instanceObject=new Cs;var Ps=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new t(n,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&w(v(t.prototype),"equalsExact",this).call(this,n,i)}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return W.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var n=new Z,i=0;i<this._geometries.length;i++)for(var u=this._geometries[i].getBoundary(),f=0;f<u.getNumGeometries();f++)n.add(u.getGeometryN(f));var g=new Array(n.size()).fill(null);return this.getFactory().createMultiLineString(n.toArray(g))}},{key:"getGeometryType",value:function(){return W.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[Ol]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Ge.constructor_.call(this,n,i)}}]),t}(Ge),Ll=function(){function s(){a(this,s)}return c(s,[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}]),s}(),rm=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),(n=e.call(this)).map=new Map,n}return c(t,[{key:"get",value:function(n){return this.map.get(n)||null}},{key:"put",value:function(n,i){return this.map.set(n,i),i}},{key:"values",value:function(){for(var n=new Z,i=this.map.values(),u=i.next();!u.done;)n.add(u.value),u=i.next();return n}},{key:"entrySet",value:function(){var n=new ws;return this.map.entries().forEach(function(i){return n.add(i)}),n}},{key:"size",value:function(){return this.map.size()}}]),t}(Ll),tt=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"equals",value:function(e){if(!(e instanceof s))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale}},{key:"compareTo",value:function(e){var t=e,n=this.getMaximumSignificantDigits(),i=t.getMaximumSignificantDigits();return Xr.compare(n,i)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===s.FLOATING||this._modelType===s.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var e="UNKNOWN";return this._modelType===s.FLOATING?e="Floating":this._modelType===s.FLOATING_SINGLE?e="Floating-Single":this._modelType===s.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var e=arguments[0];return j.isNaN(e)||this._modelType===s.FLOATING_SINGLE?e:this._modelType===s.FIXED?Math.round(e*this._scale)/this._scale:e}if(arguments[0]instanceof O){var t=arguments[0];if(this._modelType===s.FLOATING)return null;t.x=this.makePrecise(t.x),t.y=this.makePrecise(t.y)}}},{key:"getMaximumSignificantDigits",value:function(){var e=16;return this._modelType===s.FLOATING?e=16:this._modelType===s.FLOATING_SINGLE?e=6:this._modelType===s.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e}},{key:"setScale",value:function(e){this._scale=Math.abs(e)}},{key:"interfaces_",get:function(){return[X,Y]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=s.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof vn){var e=arguments[0];this._modelType=e,e===s.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var t=arguments[0];this._modelType=s.FIXED,this.setScale(t)}else if(arguments[0]instanceof s){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}}}},{key:"mostPrecise",value:function(e,t){return e.compareTo(t)>=0?e:t}}]),s}(),vn=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"readResolve",value:function(){return s.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){this._name=null;var e=arguments[0];this._name=e,s.nameToTypeMap.put(e,this)}}]),s}();vn.nameToTypeMap=new rm,tt.Type=vn,tt.FIXED=new vn("FIXED"),tt.FLOATING=new vn("FLOATING"),tt.FLOATING_SINGLE=new vn("FLOATING SINGLE"),tt.maximumPreciseValue=9007199254740992;var As=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new t(n,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&w(v(t.prototype),"equalsExact",this).call(this,n,i)}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?z.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var n=0;n<this._geometries.length;n++)if(!this._geometries[n].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return W.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new Mt}},{key:"getGeometryType",value:function(){return W.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[wl]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Ge.constructor_.call(this,n,i)}}]),t}(Ge),pn=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"createEmpty",value:function(e){switch(e){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new M("Invalid dimension: "+e)}}},{key:"toGeometry",value:function(e){return e.isNull()?this.createPoint():e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new O(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new O(e.getMinX(),e.getMinY()),new O(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new O(e.getMinX(),e.getMinY()),new O(e.getMinX(),e.getMaxY()),new O(e.getMaxX(),e.getMaxY()),new O(e.getMaxX(),e.getMinY()),new O(e.getMinX(),e.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLineString(e!==null?this.getCoordinateSequenceFactory().create(e):null)}if(re(arguments[0],le)){var t=arguments[0];return new Yn(t,this)}}}},{key:"createMultiLineString",value:function(){if(arguments.length===0)return new As(null,this);if(arguments.length===1){var e=arguments[0];return new As(e,this)}}},{key:"buildGeometry",value:function(e){for(var t=null,n=!1,i=!1,u=e.iterator();u.hasNext();){var f=u.next(),g=f.getTypeCode();t===null&&(t=g),g!==t&&(n=!0),f instanceof Ge&&(i=!0)}if(t===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(s.toGeometryArray(e));var y=e.iterator().next();if(e.size()>1){if(y instanceof Hr)return this.createMultiPolygon(s.toPolygonArray(e));if(y instanceof Yn)return this.createMultiLineString(s.toLineStringArray(e));if(y instanceof Ts)return this.createMultiPoint(s.toPointArray(e));se.shouldNeverReachHere("Unhandled geometry type: "+y.getGeometryType())}return y}},{key:"createMultiPointFromCoords",value:function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof O){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}if(re(arguments[0],le)){var t=arguments[0];return new Ts(t,this)}}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(re(arguments[0],le)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Un){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],u=arguments[1];return new Hr(i,u,this)}}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){if(arguments.length===0)return new Ge(null,this);if(arguments.length===1){var e=arguments[0];return new Ge(e,this)}}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}if(re(arguments[0],le)){var t=arguments[0];return new Un(t,this)}}}},{key:"createMultiPolygon",value:function(){if(arguments.length===0)return new Ps(null,this);if(arguments.length===1){var e=arguments[0];return new Ps(e,this)}}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new Ls(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Ls(e,this)}if(re(arguments[0],le)){var t=arguments[0];if(t===null)return this.createMultiPoint(new Array(0).fill(null));for(var n=new Array(t.size()).fill(null),i=0;i<t.size();i++){var u=this.getCoordinateSequenceFactory().create(1,t.getDimension(),t.getMeasures());Yt.copy(t,i,u,0,1),n[i]=this.createPoint(u)}return this.createMultiPoint(n)}}}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)s.constructor_.call(this,new tt,0);else if(arguments.length===1){if(re(arguments[0],Il)){var e=arguments[0];s.constructor_.call(this,new tt,0,e)}else if(arguments[0]instanceof tt){var t=arguments[0];s.constructor_.call(this,t,0,s.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];s.constructor_.call(this,n,i,s.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];this._precisionModel=u,this._coordinateSequenceFactory=g,this._SRID=f}}},{key:"toMultiPolygonArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toGeometryArray",value:function(e){if(e===null)return null;var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return Cs.instance()}},{key:"toMultiLineStringArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toLineStringArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toMultiPointArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toLinearRingArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toPointArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toPolygonArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"createPointFromInternalCoord",value:function(e,t){return t.getPrecisionModel().makePrecise(e),t.getFactory().createPoint(e)}}]),s}(),Ms="XY",im="XYZ",sm="XYM",am="XYZM",Rl={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},Cl="EMPTY",Qr=1,Et=2,Dt=3,Pl=4,mn=5,om=6;for(var um in Rl)Rl[um].toUpperCase();var lm=function(){function s(e){a(this,s),this.wkt=e,this.index_=-1}return c(s,[{key:"isAlpha_",value:function(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}},{key:"isNumeric_",value:function(e,t){return e>="0"&&e<="9"||e=="."&&!(t!==void 0&&t)}},{key:"isWhiteSpace_",value:function(e){return e==" "||e==" "||e=="\r"||e==`
8
- `}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var e,t=this.nextChar_(),n=this.index_,i=t;if(t=="(")e=Et;else if(t==",")e=mn;else if(t==")")e=Dt;else if(this.isNumeric_(t)||t=="-")e=Pl,i=this.readNumber_();else if(this.isAlpha_(t))e=Qr,i=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(t!=="")throw new Error("Unexpected character: "+t);e=om}return{position:n,value:i,type:e}}},{key:"readNumber_",value:function(){var e,t=this.index_,n=!1,i=!1;do e=="."?n=!0:e!="e"&&e!="E"||(i=!0),e=this.nextChar_();while(this.isNumeric_(e,n)||!i&&(e=="e"||e=="E")||i&&(e=="-"||e=="+"));return parseFloat(this.wkt.substring(t,this.index_--))}},{key:"readText_",value:function(){var e,t=this.index_;do e=this.nextChar_();while(this.isAlpha_(e));return this.wkt.substring(t,this.index_--).toUpperCase()}}]),s}(),cm=function(){function s(e,t){a(this,s),this.lexer_=e,this.token_,this.layout_=Ms,this.factory=t}return c(s,[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(e){return this.token_.type==e}},{key:"match",value:function(e){var t=this.isTokenType(e);return t&&this.consume_(),t}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var e=Ms,t=this.token_;if(this.isTokenType(Qr)){var n=t.value;n==="Z"?e=im:n==="M"?e=sm:n==="ZM"&&(e=am),e!==Ms&&this.consume_()}return e}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(Et)){var e=[];do e.push(this.parseGeometry_());while(this.match(mn));if(this.match(Dt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(Et)){var e=this.parsePoint_();if(this.match(Dt))return e}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(Et)){var e=this.parsePointList_();if(this.match(Dt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(Et)){var e=this.parseLineStringTextList_();if(this.match(Dt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var e;if(this.match(Et)){if(e=this.token_.type==Et?this.parsePointTextList_():this.parsePointList_(),this.match(Dt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(Et)){var e=this.parseLineStringTextList_();if(this.match(Dt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(Et)){var e=this.parsePolygonTextList_();if(this.match(Dt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var e=[],t=this.layout_.length,n=0;n<t;++n){var i=this.token_;if(!this.match(Pl))break;e.push(i.value)}if(e.length==t)return e;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var e=[this.parsePoint_()];this.match(mn);)e.push(this.parsePoint_());return e}},{key:"parsePointTextList_",value:function(){for(var e=[this.parsePointText_()];this.match(mn);)e.push(this.parsePointText_());return e}},{key:"parseLineStringTextList_",value:function(){for(var e=[this.parseLineStringText_()];this.match(mn);)e.push(this.parseLineStringText_());return e}},{key:"parsePolygonTextList_",value:function(){for(var e=[this.parsePolygonText_()];this.match(mn);)e.push(this.parsePolygonText_());return e}},{key:"isEmptyGeometry_",value:function(){var e=this.isTokenType(Qr)&&this.token_.value==Cl;return e&&this.consume_(),e}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var e=this.factory,t=function(H){return x(O,T(H))},n=function(H){var K=H.map(function(ge){return e.createLinearRing(ge.map(t))});return K.length>1?e.createPolygon(K[0],K.slice(1)):e.createPolygon(K[0])},i=this.token_;if(this.match(Qr)){var u=i.value;if(this.layout_=this.parseGeometryLayout_(),u=="GEOMETRYCOLLECTION"){var f=this.parseGeometryCollectionText_();return e.createGeometryCollection(f)}switch(u){case"POINT":var g=this.parsePointText_();return g?e.createPoint(x(O,T(g))):e.createPoint();case"LINESTRING":var y=this.parseLineStringText_().map(t);return e.createLineString(y);case"LINEARRING":var d=this.parseLineStringText_().map(t);return e.createLinearRing(d);case"POLYGON":var N=this.parsePolygonText_();return N&&N.length!==0?n(N):e.createPolygon();case"MULTIPOINT":var b=this.parseMultiPointText_();if(!b||b.length===0)return e.createMultiPoint();var L=b.map(t).map(function(H){return e.createPoint(H)});return e.createMultiPoint(L);case"MULTILINESTRING":var F=this.parseMultiLineStringText_().map(function(H){return e.createLineString(H.map(t))});return e.createMultiLineString(F);case"MULTIPOLYGON":var D=this.parseMultiPolygonText_();if(!D||D.length===0)return e.createMultiPolygon();var V=D.map(n);return e.createMultiPolygon(V);default:throw new Error("Invalid geometry type: "+u)}}throw new Error(this.formatErrorMessage_())}}]),s}();function Al(s){if(s.isEmpty())return"";var e=s.getCoordinate(),t=[e.x,e.y];return e.z===void 0||Number.isNaN(e.z)||t.push(e.z),e.m===void 0||Number.isNaN(e.m)||t.push(e.m),t.join(" ")}function Vn(s){for(var e=s.getCoordinates().map(function(u){var f=[u.x,u.y];return u.z===void 0||Number.isNaN(u.z)||f.push(u.z),u.m===void 0||Number.isNaN(u.m)||f.push(u.m),f}),t=[],n=0,i=e.length;n<i;++n)t.push(e[n].join(" "));return t.join(", ")}function Ml(s){var e=[];e.push("("+Vn(s.getExteriorRing())+")");for(var t=0,n=s.getNumInteriorRing();t<n;++t)e.push("("+Vn(s.getInteriorRingN(t))+")");return e.join(", ")}var fm={Point:Al,LineString:Vn,LinearRing:Vn,Polygon:Ml,MultiPoint:function(s){for(var e=[],t=0,n=s.getNumGeometries();t<n;++t)e.push("("+Al(s.getGeometryN(t))+")");return e.join(", ")},MultiLineString:function(s){for(var e=[],t=0,n=s.getNumGeometries();t<n;++t)e.push("("+Vn(s.getGeometryN(t))+")");return e.join(", ")},MultiPolygon:function(s){for(var e=[],t=0,n=s.getNumGeometries();t<n;++t)e.push("("+Ml(s.getGeometryN(t))+")");return e.join(", ")},GeometryCollection:function(s){for(var e=[],t=0,n=s.getNumGeometries();t<n;++t)e.push(Dl(s.getGeometryN(t)));return e.join(", ")}};function Dl(s){var e=s.getGeometryType(),t=fm[e];e=e.toUpperCase();var n=function(i){var u="";if(i.isEmpty())return u;var f=i.getCoordinate();return f.z===void 0||Number.isNaN(f.z)||(u+="Z"),f.m===void 0||Number.isNaN(f.m)||(u+="M"),u}(s);return n.length>0&&(e+=" "+n),s.isEmpty()?e+" "+Cl:e+" ("+t(s)+")"}var hm=function(){function s(e){a(this,s),this.geometryFactory=e||new pn,this.precisionModel=this.geometryFactory.getPrecisionModel()}return c(s,[{key:"read",value:function(e){var t=new lm(e);return new cm(t,this.geometryFactory).parse()}},{key:"write",value:function(e){return Dl(e)}}]),s}(),Ds=function(){function s(e){a(this,s),this.parser=new hm(e)}return c(s,[{key:"write",value:function(e){return this.parser.write(e)}}],[{key:"toLineString",value:function(e,t){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+e.x+" "+e.y+", "+t.x+" "+t.y+" )"}}]),s}(),me=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getIndexAlongSegment",value:function(e,t){return this.computeIntLineIndex(),this._intLineIndex[e][t]}},{key:"getTopologySummary",value:function(){var e=new Jr;return this.isEndPoint()&&e.append(" endpoint"),this._isProper&&e.append(" proper"),this.isCollinear()&&e.append(" collinear"),e.toString()}},{key:"computeIntersection",value:function(e,t,n,i){this._inputLines[0][0]=e,this._inputLines[0][1]=t,this._inputLines[1][0]=n,this._inputLines[1][1]=i,this._result=this.computeIntersect(e,t,n,i)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var e=arguments[0],t=this.getEdgeDistance(e,0),n=this.getEdgeDistance(e,1);t>n?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(e){this._precisionModel=e}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var e=arguments[0],t=0;t<this._result;t++)if(!this._intPt[t].equals2D(this._inputLines[e][0])&&!this._intPt[t].equals2D(this._inputLines[e][1]))return!0;return!1}}},{key:"getIntersection",value:function(e){return this._intPt[e]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==s.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(e,t){return s.computeEdgeDistance(this._intPt[t],this._inputLines[e][0],this._inputLines[e][1])}},{key:"isCollinear",value:function(){return this._result===s.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return Ds.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Ds.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(e,t){return this._inputLines[e][t]}},{key:"isIntersection",value:function(e){for(var t=0;t<this._result;t++)if(this._intPt[t].equals2D(e))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(e,t){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[e][t]]}}],[{key:"constructor_",value:function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new O,this._intPt[1]=new O,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(e,t,n){var i=Math.abs(n.x-t.x),u=Math.abs(n.y-t.y),f=-1;if(e.equals(t))f=0;else if(e.equals(n))f=i>u?i:u;else{var g=Math.abs(e.x-t.x),y=Math.abs(e.y-t.y);(f=i>u?g:y)!==0||e.equals(t)||(f=Math.max(g,y))}return se.isTrue(!(f===0&&!e.equals(t)),"Bad distance calculation"),f}},{key:"nonRobustComputeEdgeDistance",value:function(e,t,n){var i=e.x-t.x,u=e.y-t.y,f=Math.sqrt(i*i+u*u);return se.isTrue(!(f===0&&!e.equals(t)),"Invalid distance calculation"),f}}]),s}();me.DONT_INTERSECT=0,me.DO_INTERSECT=1,me.COLLINEAR=2,me.NO_INTERSECTION=0,me.POINT_INTERSECTION=1,me.COLLINEAR_INTERSECTION=2;var Vt=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.call(this)}return c(t,[{key:"isInSegmentEnvelopes",value:function(n){var i=new pe(this._inputLines[0][0],this._inputLines[0][1]),u=new pe(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&u.contains(n)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return w(v(t.prototype),"computeIntersection",this).apply(this,arguments);var n=arguments[0],i=arguments[1],u=arguments[2];if(this._isProper=!1,pe.intersects(i,u,n)&&Q.index(i,u,n)===0&&Q.index(u,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(u))&&(this._isProper=!1),this._result=me.POINT_INTERSECTION,null;this._result=me.NO_INTERSECTION}},{key:"intersection",value:function(n,i,u,f){var g=this.intersectionSafe(n,i,u,f);return this.isInSegmentEnvelopes(g)||(g=new O(t.nearestEndpoint(n,i,u,f))),this._precisionModel!==null&&this._precisionModel.makePrecise(g),g}},{key:"checkDD",value:function(n,i,u,f,g){var y=bs.intersection(n,i,u,f),d=this.isInSegmentEnvelopes(y);je.out.println("DD in env = "+d+" --------------------- "+y),g.distance(y)>1e-4&&je.out.println("Distance = "+g.distance(y))}},{key:"intersectionSafe",value:function(n,i,u,f){var g=Os.intersection(n,i,u,f);return g===null&&(g=t.nearestEndpoint(n,i,u,f)),g}},{key:"computeCollinearIntersection",value:function(n,i,u,f){var g=pe.intersects(n,i,u),y=pe.intersects(n,i,f),d=pe.intersects(u,f,n),N=pe.intersects(u,f,i);return g&&y?(this._intPt[0]=u,this._intPt[1]=f,me.COLLINEAR_INTERSECTION):d&&N?(this._intPt[0]=n,this._intPt[1]=i,me.COLLINEAR_INTERSECTION):g&&d?(this._intPt[0]=u,this._intPt[1]=n,!u.equals(n)||y||N?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):g&&N?(this._intPt[0]=u,this._intPt[1]=i,!u.equals(i)||y||d?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):y&&d?(this._intPt[0]=f,this._intPt[1]=n,!f.equals(n)||g||N?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):y&&N?(this._intPt[0]=f,this._intPt[1]=i,!f.equals(i)||g||d?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):me.NO_INTERSECTION}},{key:"computeIntersect",value:function(n,i,u,f){if(this._isProper=!1,!pe.intersects(n,i,u,f))return me.NO_INTERSECTION;var g=Q.index(n,i,u),y=Q.index(n,i,f);if(g>0&&y>0||g<0&&y<0)return me.NO_INTERSECTION;var d=Q.index(u,f,n),N=Q.index(u,f,i);return d>0&&N>0||d<0&&N<0?me.NO_INTERSECTION:g===0&&y===0&&d===0&&N===0?this.computeCollinearIntersection(n,i,u,f):(g===0||y===0||d===0||N===0?(this._isProper=!1,n.equals2D(u)||n.equals2D(f)?this._intPt[0]=n:i.equals2D(u)||i.equals2D(f)?this._intPt[0]=i:g===0?this._intPt[0]=new O(u):y===0?this._intPt[0]=new O(f):d===0?this._intPt[0]=new O(n):N===0&&(this._intPt[0]=new O(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,u,f)),me.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(n,i,u,f){var g=n,y=ft.pointToSegment(n,u,f),d=ft.pointToSegment(i,u,f);return d<y&&(y=d,g=i),(d=ft.pointToSegment(u,n,i))<y&&(y=d,g=u),(d=ft.pointToSegment(f,n,i))<y&&(y=d,g=f),g}}]),t}(me),gm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"countSegment",value:function(e,t){if(e.x<this._p.x&&t.x<this._p.x)return null;if(this._p.x===t.x&&this._p.y===t.y)return this._isPointOnSegment=!0,null;if(e.y===this._p.y&&t.y===this._p.y){var n=e.x,i=t.x;return n>i&&(n=t.x,i=e.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var u=Q.index(e,t,this._p);if(u===Q.COLLINEAR)return this._isPointOnSegment=!0,null;t.y<e.y&&(u=-u),u===Q.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==I.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?I.BOUNDARY:this._crossingCount%2==1?I.INTERIOR:I.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof O&&re(arguments[1],le)){for(var e=arguments[0],t=arguments[1],n=new s(e),i=new O,u=new O,f=1;f<t.size();f++)if(t.getCoordinate(f,i),t.getCoordinate(f-1,u),n.countSegment(i,u),n.isOnSegment())return n.getLocation();return n.getLocation()}if(arguments[0]instanceof O&&arguments[1]instanceof Array){for(var g=arguments[0],y=arguments[1],d=new s(g),N=1;N<y.length;N++){var b=y[N],L=y[N-1];if(d.countSegment(b,L),d.isOnSegment())return d.getLocation()}return d.getLocation()}}}]),s}(),Fs=function(){function s(){a(this,s)}return c(s,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof O&&re(arguments[1],le)){for(var e=arguments[0],t=arguments[1],n=new Vt,i=new O,u=new O,f=t.size(),g=1;g<f;g++)if(t.getCoordinate(g-1,i),t.getCoordinate(g,u),n.computeIntersection(e,i,u),n.hasIntersection())return!0;return!1}if(arguments[0]instanceof O&&arguments[1]instanceof Array){for(var y=arguments[0],d=arguments[1],N=new Vt,b=1;b<d.length;b++){var L=d[b-1],F=d[b];if(N.computeIntersection(y,L,F),N.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(e,t){return gm.locatePointInRing(e,t)}},{key:"isInRing",value:function(e,t){return s.locateInRing(e,t)!==I.EXTERIOR}}]),s}(),Ve=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"setAllLocations",value:function(e){for(var t=0;t<this.location.length;t++)this.location[t]=e}},{key:"isNull",value:function(){for(var e=0;e<this.location.length;e++)if(this.location[e]!==I.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(e){for(var t=0;t<this.location.length;t++)this.location[t]===I.NONE&&(this.location[t]=e)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(e){if(e.location.length>this.location.length){var t=new Array(3).fill(null);t[B.ON]=this.location[B.ON],t[B.LEFT]=I.NONE,t[B.RIGHT]=I.NONE,this.location=t}for(var n=0;n<this.location.length;n++)this.location[n]===I.NONE&&n<e.location.length&&(this.location[n]=e.location[n])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var e=this.location[B.LEFT];this.location[B.LEFT]=this.location[B.RIGHT],this.location[B.RIGHT]=e}},{key:"toString",value:function(){var e=new qn;return this.location.length>1&&e.append(I.toLocationSymbol(this.location[B.LEFT])),e.append(I.toLocationSymbol(this.location[B.ON])),this.location.length>1&&e.append(I.toLocationSymbol(this.location[B.RIGHT])),e.toString()}},{key:"setLocations",value:function(e,t,n){this.location[B.ON]=e,this.location[B.LEFT]=t,this.location[B.RIGHT]=n}},{key:"get",value:function(e){return e<this.location.length?this.location[e]:I.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var e=0;e<this.location.length;e++)if(this.location[e]===I.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var e=arguments[0];this.setLocation(B.ON,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.location[t]=n}}},{key:"init",value:function(e){this.location=new Array(e).fill(null),this.setAllLocations(I.NONE)}},{key:"isEqualOnSide",value:function(e,t){return this.location[t]===e.location[t]}},{key:"allPositionsEqual",value:function(e){for(var t=0;t<this.location.length;t++)if(this.location[t]!==e)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var t=arguments[0];this.init(1),this.location[B.ON]=t}else if(arguments[0]instanceof s){var n=arguments[0];if(this.init(n.location.length),n!==null)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];this.init(3),this.location[B.ON]=u,this.location[B.LEFT]=f,this.location[B.RIGHT]=g}}}]),s}(),We=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getGeometryCount",value:function(){var e=0;return this.elt[0].isNull()||e++,this.elt[1].isNull()||e++,e}},{key:"setAllLocations",value:function(e,t){this.elt[e].setAllLocations(t)}},{key:"isNull",value:function(e){return this.elt[e].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var e=arguments[0];this.setAllLocationsIfNull(0,e),this.setAllLocationsIfNull(1,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.elt[t].setAllLocationsIfNull(n)}}},{key:"isLine",value:function(e){return this.elt[e].isLine()}},{key:"merge",value:function(e){for(var t=0;t<2;t++)this.elt[t]===null&&e.elt[t]!==null?this.elt[t]=new Ve(e.elt[t]):this.elt[t].merge(e.elt[t])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var e=arguments[0];return this.elt[e].get(B.ON)}if(arguments.length===2){var t=arguments[0],n=arguments[1];return this.elt[t].get(n)}}},{key:"toString",value:function(){var e=new qn;return this.elt[0]!==null&&(e.append("A:"),e.append(this.elt[0].toString())),this.elt[1]!==null&&(e.append(" B:"),e.append(this.elt[1].toString())),e.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var e=arguments[0];return this.elt[e].isArea()}}},{key:"isAnyNull",value:function(e){return this.elt[e].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.elt[e].setLocation(B.ON,t)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],u=arguments[2];this.elt[n].setLocation(i,u)}}},{key:"isEqualOnSide",value:function(e,t){return this.elt[0].isEqualOnSide(e.elt[0],t)&&this.elt[1].isEqualOnSide(e.elt[1],t)}},{key:"allPositionsEqual",value:function(e,t){return this.elt[e].allPositionsEqual(t)}},{key:"toLine",value:function(e){this.elt[e].isArea()&&(this.elt[e]=new Ve(this.elt[e].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new Ve(e),this.elt[1]=new Ve(e)}else if(arguments[0]instanceof s){var t=arguments[0];this.elt[0]=new Ve(t.elt[0]),this.elt[1]=new Ve(t.elt[1])}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[0]=new Ve(I.NONE),this.elt[1]=new Ve(I.NONE),this.elt[n].setLocation(i)}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];this.elt[0]=new Ve(u,f,g),this.elt[1]=new Ve(u,f,g)}else if(arguments.length===4){var y=arguments[0],d=arguments[1],N=arguments[2],b=arguments[3];this.elt[0]=new Ve(I.NONE,I.NONE,I.NONE),this.elt[1]=new Ve(I.NONE,I.NONE,I.NONE),this.elt[y].setLocations(d,N,b)}}},{key:"toLineLabel",value:function(e){for(var t=new s(I.NONE),n=0;n<2;n++)t.setLocation(n,e.getLocation(n));return t}}]),s}(),Kr=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var e=new Array(this._pts.size()).fill(null),t=0;t<this._pts.size();t++)e[t]=this._pts.get(t);this._ring=this._geometryFactory.createLinearRing(e),this._isHole=Q.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(e){this._startDe=e;var t=e,n=!0;do{if(t===null)throw new xt("Found null DirectedEdge");if(t.getEdgeRing()===this)throw new xt("Directed Edge visited twice during ring-building at "+t.getCoordinate());this._edges.add(t);var i=t.getLabel();se.isTrue(i.isArea()),this.mergeLabel(i),this.addPoints(t.getEdge(),t.isForward(),n),n=!1,this.setEdgeRing(t,this),t=this.getNext(t)}while(t!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(e){return this._pts.get(e)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var e=this._startDe;do{var t=e.getNode().getEdges().getOutgoingDegree(this);t>this._maxNodeDegree&&(this._maxNodeDegree=t),e=this.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(e,t,n){var i=e.getCoordinates();if(t){var u=1;n&&(u=0);for(var f=u;f<i.length;f++)this._pts.add(i[f])}else{var g=i.length-2;n&&(g=i.length-1);for(var y=g;y>=0;y--)this._pts.add(i[y])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)}},{key:"containsPoint",value:function(e){var t=this.getLinearRing();if(!t.getEnvelopeInternal().contains(e)||!Fs.isInRing(e,t.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(e))return!1;return!0}},{key:"addHole",value:function(e){this._holes.add(e)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(n,B.RIGHT);if(i===I.NONE)return null;if(this._label.getLocation(n)===I.NONE)return this._label.setLocation(n,i),null}}},{key:"setShell",value:function(e){this._shell=e,e!==null&&e.addHole(this)}},{key:"toPolygon",value:function(e){for(var t=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)t[n]=this._holes.get(n).getLinearRing();return e.createPolygon(this.getLinearRing(),t)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new Z,this._pts=new Z,this._label=new We(I.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Z,this._geometryFactory=null,arguments.length!==0){if(arguments.length===2){var e=arguments[0],t=arguments[1];this._geometryFactory=t,this.computePoints(e),this.computeRing()}}}}]),s}(),ym=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"setEdgeRing",value:function(n,i){n.setMinEdgeRing(i)}},{key:"getNext",value:function(n){return n.getNextMin()}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Kr.constructor_.call(this,n,i)}}]),t}(Kr),vm=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"buildMinimalRings",value:function(){var n=new Z,i=this._startDe;do{if(i.getMinEdgeRing()===null){var u=new ym(i,this._geometryFactory);n.add(u)}i=i.getNext()}while(i!==this._startDe);return n}},{key:"setEdgeRing",value:function(n,i){n.setEdgeRing(i)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var n=this._startDe;do n.getNode().getEdges().linkMinimalDirectedEdges(this),n=n.getNext();while(n!==this._startDe)}},{key:"getNext",value:function(n){return n.getNext()}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Kr.constructor_.call(this,n,i)}}]),t}(Kr),Fl=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"setVisited",value:function(e){this._isVisited=e}},{key:"setInResult",value:function(e){this._isInResult=e}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(e){this._label=e}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(e){this._isCovered=e,this._isCoveredSet=!0}},{key:"updateIM",value:function(e){se.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(e)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this._label=e}}}}]),s}(),ei=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"isIncidentEdgeInResult",value:function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();)if(n.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(n){n.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(n){}},{key:"computeMergedLocation",value:function(n,i){var u=I.NONE;if(u=this._label.getLocation(i),!n.isNull(i)){var f=n.getLocation(i);u!==I.BOUNDARY&&(u=f)}return u}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return w(v(t.prototype),"setLabel",this).apply(this,arguments);var n=arguments[0],i=arguments[1];this._label===null?this._label=new We(n,i):this._label.setLocation(n,i)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof t){var n=arguments[0];this.mergeLabel(n._label)}else if(arguments[0]instanceof We)for(var i=arguments[0],u=0;u<2;u++){var f=this.computeMergedLocation(i,u),g=this._label.getLocation(u);g===I.NONE&&this._label.setLocation(u,f)}}},{key:"add",value:function(n){this._edges.insert(n),n.setNode(this)}},{key:"setLabelBoundary",value:function(n){if(this._label===null)return null;var i=I.NONE;this._label!==null&&(i=this._label.getLocation(n));var u=null;switch(i){case I.BOUNDARY:u=I.INTERIOR;break;case I.INTERIOR:default:u=I.BOUNDARY}this._label.setLocation(n,u)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var n=arguments[0],i=arguments[1];this._coord=n,this._edges=i,this._label=new We(0,I.NONE)}}]),t}(Fl),pm=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.apply(this,arguments)}return t}(Ll);function Gl(s){return s==null?0:s.color}function fe(s){return s==null?null:s.parent}function ht(s,e){s!==null&&(s.color=e)}function Gs(s){return s==null?null:s.left}function Bl(s){return s==null?null:s.right}var Wn=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),(n=e.call(this)).root_=null,n.size_=0,n}return c(t,[{key:"get",value:function(n){for(var i=this.root_;i!==null;){var u=n.compareTo(i.key);if(u<0)i=i.left;else{if(!(u>0))return i.value;i=i.right}}return null}},{key:"put",value:function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var u,f,g=this.root_;do if(u=g,(f=n.compareTo(g.key))<0)g=g.left;else{if(!(f>0)){var y=g.value;return g.value=i,y}g=g.right}while(g!==null);var d={key:n,left:null,right:null,value:i,parent:u,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return f<0?u.left=d:u.right=d,this.fixAfterInsertion(d),this.size_++,null}},{key:"fixAfterInsertion",value:function(n){var i;for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)fe(n)===Gs(fe(fe(n)))?Gl(i=Bl(fe(fe(n))))===1?(ht(fe(n),0),ht(i,0),ht(fe(fe(n)),1),n=fe(fe(n))):(n===Bl(fe(n))&&(n=fe(n),this.rotateLeft(n)),ht(fe(n),0),ht(fe(fe(n)),1),this.rotateRight(fe(fe(n)))):Gl(i=Gs(fe(fe(n))))===1?(ht(fe(n),0),ht(i,0),ht(fe(fe(n)),1),n=fe(fe(n))):(n===Gs(fe(n))&&(n=fe(n),this.rotateRight(n)),ht(fe(n),0),ht(fe(fe(n)),1),this.rotateLeft(fe(fe(n))));this.root_.color=0}},{key:"values",value:function(){var n=new Z,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=t.successor(i))!==null;)n.add(i.value);return n}},{key:"entrySet",value:function(){var n=new ws,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=t.successor(i))!==null;)n.add(i);return n}},{key:"rotateLeft",value:function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent==null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}}},{key:"rotateRight",value:function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent==null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}}},{key:"getFirstEntry",value:function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(n){for(var i=this.root_;i!==null;){var u=n.compareTo(i.key);if(u<0)i=i.left;else{if(!(u>0))return!0;i=i.right}}return!1}}],[{key:"successor",value:function(n){var i;if(n===null)return null;if(n.right!==null){for(i=n.right;i.left!==null;)i=i.left;return i}i=n.parent;for(var u=n;i!==null&&u===i.right;)u=i,i=i.parent;return i}}]),t}(pm),$l=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"find",value:function(e){return this.nodeMap.get(e)}},{key:"addNode",value:function(){if(arguments[0]instanceof O){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}if(arguments[0]instanceof ei){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}}},{key:"print",value:function(e){for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(e){for(var t=new Z,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(e)===I.BOUNDARY&&t.add(i)}return t}},{key:"add",value:function(e){var t=e.getCoordinate();this.addNode(t).add(e)}}],[{key:"constructor_",value:function(){this.nodeMap=new Wn,this.nodeFact=null;var e=arguments[0];this.nodeFact=e}}]),s}(),Ae=function(){function s(){a(this,s)}return c(s,null,[{key:"isNorthern",value:function(e){return e===s.NE||e===s.NW}},{key:"isOpposite",value:function(e,t){return e!==t&&(e-t+4)%4===2}},{key:"commonHalfPlane",value:function(e,t){if(e===t)return e;if((e-t+4)%4===2)return-1;var n=e<t?e:t;return n===0&&(e>t?e:t)===3?3:n}},{key:"isInHalfPlane",value:function(e,t){return t===s.SE?e===s.SE||e===s.SW:e===t||e===t+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new M("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?s.NE:s.SE:t>=0?s.NW:s.SW}if(arguments[0]instanceof O&&arguments[1]instanceof O){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new M("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?s.NE:s.SE:i.y>=n.y?s.NW:s.SW}}}]),s}();Ae.NE=0,Ae.NW=1,Ae.SW=2,Ae.SE=3;var ql=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"compareDirection",value:function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant<e._quadrant?-1:Q.index(e._p0,e._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(e){this._node=e}},{key:"print",value:function(e){var t=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf("."),u=n.substring(i+1);e.print(" "+u+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label)}},{key:"compareTo",value:function(e){var t=e;return this.compareDirection(t)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var e=Math.atan2(this._dy,this._dx),t=this.getClass().getName(),n=t.lastIndexOf(".");return" "+t.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label}},{key:"computeLabel",value:function(e){}},{key:"init",value:function(e,t){this._p0=e,this._p1=t,this._dx=t.x-e.x,this._dy=t.y-e.y,this._quadrant=Ae.quadrant(this._dx,this._dy),se.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2];s.constructor_.call(this,t,n,i,null)}else if(arguments.length===4){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3];s.constructor_.call(this,u),this.init(f,g),this._label=y}}}]),s}(),Bs=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(n){return this._depth[n]}},{key:"setVisited",value:function(n){this._isVisited=n}},{key:"computeDirectedLabel",value:function(){this._label=new We(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(n,i){if(this._depth[n]!==-999&&this._depth[n]!==i)throw new xt("assigned depths do not match",this.getCoordinate());this._depth[n]=i}},{key:"isInteriorAreaEdge",value:function(){for(var n=!0,i=0;i<2;i++)this._label.isArea(i)&&this._label.getLocation(i,B.LEFT)===I.INTERIOR&&this._label.getLocation(i,B.RIGHT)===I.INTERIOR||(n=!1);return n}},{key:"setNextMin",value:function(n){this._nextMin=n}},{key:"print",value:function(n){w(v(t.prototype),"print",this).call(this,n),n.print(" "+this._depth[B.LEFT]+"/"+this._depth[B.RIGHT]),n.print(" ("+this.getDepthDelta()+")"),this._isInResult&&n.print(" inResult")}},{key:"setMinEdgeRing",value:function(n){this._minEdgeRing=n}},{key:"isLineEdge",value:function(){var n=this._label.isLine(0)||this._label.isLine(1),i=!this._label.isArea(0)||this._label.allPositionsEqual(0,I.EXTERIOR),u=!this._label.isArea(1)||this._label.allPositionsEqual(1,I.EXTERIOR);return n&&i&&u}},{key:"setEdgeRing",value:function(n){this._edgeRing=n}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var n=this._edge.getDepthDelta();return this._isForward||(n=-n),n}},{key:"setInResult",value:function(n){this._isInResult=n}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(n){this.print(n),n.print(" "),this._isForward?this._edge.print(n):this._edge.printReverse(n)}},{key:"setSym",value:function(n){this._sym=n}},{key:"setVisitedEdge",value:function(n){this.setVisited(n),this._sym.setVisited(n)}},{key:"setEdgeDepths",value:function(n,i){var u=this.getEdge().getDepthDelta();this._isForward||(u=-u);var f=1;n===B.LEFT&&(f=-1);var g=B.opposite(n),y=i+u*f;this.setDepth(n,i),this.setDepth(g,y)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(n){this._next=n}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999];var n=arguments[0],i=arguments[1];if(ql.constructor_.call(this,n),this._isForward=i,i)this.init(n.getCoordinate(0),n.getCoordinate(1));else{var u=n.getNumPoints()-1;this.init(n.getCoordinate(u),n.getCoordinate(u-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(n,i){return n===I.EXTERIOR&&i===I.INTERIOR?1:n===I.INTERIOR&&i===I.EXTERIOR?-1:0}}]),t}(ql),zl=function(){function s(){a(this,s)}return c(s,[{key:"createNode",value:function(e){return new ei(e,null)}}]),s}(),Yl=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"printEdges",value:function(e){e.println("Edges:");for(var t=0;t<this._edges.size();t++){e.println("edge "+t+":");var n=this._edges.get(t);n.print(e),n.eiList.print(e)}}},{key:"find",value:function(e){return this._nodes.find(e)}},{key:"addNode",value:function(){if(arguments[0]instanceof ei){var e=arguments[0];return this._nodes.addNode(e)}if(arguments[0]instanceof O){var t=arguments[0];return this._nodes.addNode(t)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var e=this._nodes.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(e){je.out.println(e)}},{key:"isBoundaryNode",value:function(e,t){var n=this._nodes.find(t);if(n===null)return!1;var i=n.getLabel();return i!==null&&i.getLocation(e)===I.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var e=this._nodes.iterator();e.hasNext();)e.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(e,t,n,i){return!!e.equals(n)&&Q.index(e,t,i)===Q.COLLINEAR&&Ae.quadrant(e,t)===Ae.quadrant(n,i)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(e){je.out.print(e)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(e,t){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),u=i.getCoordinates();if(this.matchInSameDirection(e,t,u[0],u[1])||this.matchInSameDirection(e,t,u[u.length-1],u[u.length-2]))return i}return null}},{key:"insertEdge",value:function(e){this._edges.add(e)}},{key:"findEdgeEnd",value:function(e){for(var t=this.getEdgeEnds().iterator();t.hasNext();){var n=t.next();if(n.getEdge()===e)return n}return null}},{key:"addEdges",value:function(e){for(var t=e.iterator();t.hasNext();){var n=t.next();this._edges.add(n);var i=new Bs(n,!0),u=new Bs(n,!1);i.setSym(u),u.setSym(i),this.add(i),this.add(u)}}},{key:"add",value:function(e){this._nodes.add(e),this._edgeEndList.add(e)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(e,t){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),u=i.getCoordinates();if(e.equals(u[0])&&t.equals(u[1]))return i}return null}}],[{key:"constructor_",value:function(){if(this._edges=new Z,this._nodes=null,this._edgeEndList=new Z,arguments.length===0)this._nodes=new $l(new zl);else if(arguments.length===1){var e=arguments[0];this._nodes=new $l(e)}}},{key:"linkResultDirectedEdges",value:function(e){for(var t=e.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()}}]),s}(),mm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"sortShellsAndHoles",value:function(e,t,n){for(var i=e.iterator();i.hasNext();){var u=i.next();u.isHole()?n.add(u):t.add(u)}}},{key:"computePolygons",value:function(e){for(var t=new Z,n=e.iterator();n.hasNext();){var i=n.next().toPolygon(this._geometryFactory);t.add(i)}return t}},{key:"placeFreeHoles",value:function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();if(i.getShell()===null){var u=s.findEdgeRingContaining(i,e);if(u===null)throw new xt("unable to assign hole to a shell",i.getCoordinate(0));i.setShell(u)}}}},{key:"buildMinimalEdgeRings",value:function(e,t,n){for(var i=new Z,u=e.iterator();u.hasNext();){var f=u.next();if(f.getMaxNodeDegree()>2){f.linkDirectedEdgesForMinimalEdgeRings();var g=f.buildMinimalRings(),y=this.findShell(g);y!==null?(this.placePolygonHoles(y,g),t.add(y)):n.addAll(g)}else i.add(f)}return i}},{key:"buildMaximalEdgeRings",value:function(e){for(var t=new Z,n=e.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var u=new vm(i,this._geometryFactory);t.add(u),u.setInResult()}}return t}},{key:"placePolygonHoles",value:function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(e)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(e){for(var t=0,n=null,i=e.iterator();i.hasNext();){var u=i.next();u.isHole()||(n=u,t++)}return se.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n}},{key:"add",value:function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];Yl.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(t),u=new Z,f=this.buildMinimalEdgeRings(i,this._shellList,u);this.sortShellsAndHoles(f,this._shellList,u),this.placeFreeHoles(this._shellList,u)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new Z;var e=arguments[0];this._geometryFactory=e}},{key:"findEdgeRingContaining",value:function(e,t){for(var n=e.getLinearRing(),i=n.getEnvelopeInternal(),u=n.getCoordinateN(0),f=null,g=null,y=t.iterator();y.hasNext();){var d=y.next(),N=d.getLinearRing(),b=N.getEnvelopeInternal();if(!b.equals(i)&&b.contains(i)){u=Ee.ptNotInList(n.getCoordinates(),N.getCoordinates());var L=!1;Fs.isInRing(u,N.getCoordinates())&&(L=!0),L&&(f===null||g.contains(b))&&(g=(f=d).getLinearRing().getEnvelopeInternal())}}return f}}]),s}(),Ul=function(){function s(){a(this,s)}return c(s,[{key:"getBounds",value:function(){}}]),s}(),kt=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[Ul,X]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t}}]),s}(),ti=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"poll",value:function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(e){for(var t=null,n=this._items.get(e);2*e<=this._size&&((t=2*e)!==this._size&&this._items.get(t+1).compareTo(this._items.get(t))<0&&t++,this._items.get(t).compareTo(n)<0);e=t)this._items.set(e,this._items.get(t));this._items.set(e,n)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(e){this._items.add(null),this._size+=1;var t=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(t/2)))<0;t/=2)this._items.set(t,this._items.get(Math.trunc(t/2)));this._items.set(t,e)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new Z,this._items.add(null)}}]),s}(),dm=function(){function s(){a(this,s)}return c(s,[{key:"insert",value:function(e,t){}},{key:"remove",value:function(e,t){}},{key:"query",value:function(){}}]),s}(),He=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(e){se.isTrue(this._bounds===null),this._childBoundables.add(e)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[Ul,X]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new Z,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this._level=e}}}}]),s}(),dn={reverseOrder:function(){return{compare:function(s,e){return e.compareTo(s)}}},min:function(s){return dn.sort(s),s.get(0)},sort:function(s,e){var t=s.toArray();e?Ut.sort(t,e):Ut.sort(t);for(var n=s.iterator(),i=0,u=t.length;i<u;i++)n.next(),n.set(t[i])},singletonList:function(s){var e=new Z;return e.add(s),e}},_m=function(){function s(){a(this,s)}return c(s,null,[{key:"maxDistance",value:function(e,t,n,i,u,f,g,y){var d=s.distance(e,t,u,f);return d=Math.max(d,s.distance(e,t,g,y)),d=Math.max(d,s.distance(n,i,u,f)),d=Math.max(d,s.distance(n,i,g,y))}},{key:"distance",value:function(e,t,n,i){var u=n-e,f=i-t;return Math.sqrt(u*u+f*f)}},{key:"maximumDistance",value:function(e,t){var n=Math.min(e.getMinX(),t.getMinX()),i=Math.min(e.getMinY(),t.getMinY()),u=Math.max(e.getMaxX(),t.getMaxX()),f=Math.max(e.getMaxY(),t.getMaxY());return s.distance(n,i,u,f)}},{key:"minMaxDistance",value:function(e,t){var n=e.getMinX(),i=e.getMinY(),u=e.getMaxX(),f=e.getMaxY(),g=t.getMinX(),y=t.getMinY(),d=t.getMaxX(),N=t.getMaxY(),b=s.maxDistance(n,i,n,f,g,y,g,N);return b=Math.min(b,s.maxDistance(n,i,n,f,g,y,d,y)),b=Math.min(b,s.maxDistance(n,i,n,f,d,N,g,N)),b=Math.min(b,s.maxDistance(n,i,n,f,d,N,d,y)),b=Math.min(b,s.maxDistance(n,i,u,i,g,y,g,N)),b=Math.min(b,s.maxDistance(n,i,u,i,g,y,d,y)),b=Math.min(b,s.maxDistance(n,i,u,i,d,N,g,N)),b=Math.min(b,s.maxDistance(n,i,u,i,d,N,d,y)),b=Math.min(b,s.maxDistance(u,f,n,f,g,y,g,N)),b=Math.min(b,s.maxDistance(u,f,n,f,g,y,d,y)),b=Math.min(b,s.maxDistance(u,f,n,f,d,N,g,N)),b=Math.min(b,s.maxDistance(u,f,n,f,d,N,d,y)),b=Math.min(b,s.maxDistance(u,f,u,i,g,y,g,N)),b=Math.min(b,s.maxDistance(u,f,u,i,g,y,d,y)),b=Math.min(b,s.maxDistance(u,f,u,i,d,N,g,N)),b=Math.min(b,s.maxDistance(u,f,u,i,d,N,d,y))}}]),s}(),_n=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"maximumDistance",value:function(){return _m.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(e,t){var n=s.isComposite(this._boundable1),i=s.isComposite(this._boundable2);if(n&&i)return s.area(this._boundable1)>s.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,e,t),null):(this.expand(this._boundable2,this._boundable1,!0,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,!1,e,t),null;if(i)return this.expand(this._boundable2,this._boundable1,!0,e,t),null;throw new M("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(s.isComposite(this._boundable1)||s.isComposite(this._boundable2))}},{key:"compareTo",value:function(e){var t=e;return this._distance<t._distance?-1:this._distance>t._distance?1:0}},{key:"expand",value:function(e,t,n,i,u){for(var f=e.getChildBoundables().iterator();f.hasNext();){var g=f.next(),y=null;(y=n?new s(t,g,this._itemDistance):new s(g,t,this._itemDistance)).getDistance()<u&&i.add(y)}}},{key:"getBoundable",value:function(e){return e===0?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var e=arguments[0],t=arguments[1],n=arguments[2];this._boundable1=e,this._boundable2=t,this._itemDistance=n,this._distance=this.distance()}},{key:"area",value:function(e){return e.getBounds().getArea()}},{key:"isComposite",value:function(e){return e instanceof He}}]),s}(),Xl=function(){function s(){a(this,s)}return c(s,[{key:"visitItem",value:function(e){}}]),s}(),xn=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"queryInternal",value:function(){if(re(arguments[2],Xl)&&arguments[0]instanceof Object&&arguments[1]instanceof He)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=t.getChildBoundables(),u=0;u<i.size();u++){var f=i.get(u);this.getIntersectsOp().intersects(f.getBounds(),e)&&(f instanceof He?this.queryInternal(e,f,n):f instanceof kt?n.visitItem(f.getItem()):se.shouldNeverReachHere())}else if(re(arguments[2],zt)&&arguments[0]instanceof Object&&arguments[1]instanceof He)for(var g=arguments[0],y=arguments[1],d=arguments[2],N=y.getChildBoundables(),b=0;b<N.size();b++){var L=N.get(b);this.getIntersectsOp().intersects(L.getBounds(),g)&&(L instanceof He?this.queryInternal(g,L,d):L instanceof kt?d.add(L.getItem()):se.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(e){return e.get(e.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],t=0,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof He?t+=this.size(i):i instanceof kt&&(t+=1)}return t}}},{key:"removeItem",value:function(e,t){for(var n=null,i=e.getChildBoundables().iterator();i.hasNext();){var u=i.next();u instanceof kt&&u.getItem()===t&&(n=u)}return n!==null&&(e.getChildBoundables().remove(n),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new Z:e}if(arguments.length===1){for(var t=arguments[0],n=new Z,i=t.getChildBoundables().iterator();i.hasNext();){var u=i.next();if(u instanceof He){var f=this.itemsTree(u);f!==null&&n.add(f)}else u instanceof kt?n.add(u.getItem()):se.shouldNeverReachHere()}return n.size()<=0?null:n}}},{key:"insert",value:function(e,t){se.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new kt(e,t))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var e=arguments[0],t=new Z;return this.boundablesAtLevel(e,this._root,t),t}if(arguments.length===3){var n=arguments[0],i=arguments[1],u=arguments[2];if(se.isTrue(n>-2),i.getLevel()===n)return u.add(i),null;for(var f=i.getChildBoundables().iterator();f.hasNext();){var g=f.next();g instanceof He?this.boundablesAtLevel(n,g,u):(se.isTrue(g instanceof kt),n===-1&&u.add(g))}return null}}},{key:"query",value:function(){if(arguments.length===1){var e=arguments[0];this.build();var t=new Z;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.queryInternal(e,this._root,t),t}if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,i)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.remove(e,this._root,t)}if(arguments.length===3){var n=arguments[0],i=arguments[1],u=arguments[2],f=this.removeItem(i,u);if(f)return!0;for(var g=null,y=i.getChildBoundables().iterator();y.hasNext();){var d=y.next();if(this.getIntersectsOp().intersects(d.getBounds(),n)&&d instanceof He&&(f=this.remove(n,d,u))){g=d;break}}return g!==null&&g.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(g),f}}},{key:"createHigherLevels",value:function(e,t){se.isTrue(!e.isEmpty());var n=this.createParentBoundables(e,t+1);return n.size()===1?n.get(0):this.createHigherLevels(n,t+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var e=arguments[0],t=0,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof He){var u=this.depth(i);u>t&&(t=u)}}return t+1}}},{key:"createParentBoundables",value:function(e,t){se.isTrue(!e.isEmpty());var n=new Z;n.add(this.createNode(t));var i=new Z(e);dn.sort(i,this.getComparator());for(var u=i.iterator();u.hasNext();){var f=u.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(t)),this.lastNode(n).addChildBoundable(f)}return n}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new Z,this._nodeCapacity=null,arguments.length===0)s.constructor_.call(this,s.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var e=arguments[0];se.isTrue(e>1,"Node capacity must be greater than 1"),this._nodeCapacity=e}}},{key:"compareDoubles",value:function(e,t){return e>t?1:e<t?-1:0}}]),s}();xn.IntersectsOp=function(){},xn.DEFAULT_NODE_CAPACITY=10;var xm=function(){function s(){a(this,s)}return c(s,[{key:"distance",value:function(e,t){}}]),s}(),gt=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"createParentBoundablesFromVerticalSlices",value:function(n,i){se.isTrue(n.length>0);for(var u=new Z,f=0;f<n.length;f++)u.addAll(this.createParentBoundablesFromVerticalSlice(n[f],i));return u}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.nearestNeighbourK(n,j.POSITIVE_INFINITY,i)}if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2],y=f,d=new ti;d.add(u);for(var N=new ti;!d.isEmpty()&&y>=0;){var b=d.poll(),L=b.getDistance();if(L>=y)break;if(b.isLeaves())if(N.size()<g)N.add(b);else{var F=N.peek();F.getDistance()>L&&(N.poll(),N.add(b));var D=N.peek();y=D.getDistance()}else b.expandToQueue(d,y)}return t.getItems(N)}}},{key:"createNode",value:function(n){return new jl(n)}},{key:"size",value:function(){return arguments.length===0?w(v(t.prototype),"size",this).call(this):w(v(t.prototype),"size",this).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof pe))return w(v(t.prototype),"insert",this).apply(this,arguments);var n=arguments[0],i=arguments[1];if(n.isNull())return null;w(v(t.prototype),"insert",this).call(this,n,i)}},{key:"getIntersectsOp",value:function(){return t.intersectsOp}},{key:"verticalSlices",value:function(n,i){for(var u=Math.trunc(Math.ceil(n.size()/i)),f=new Array(i).fill(null),g=n.iterator(),y=0;y<i;y++){f[y]=new Z;for(var d=0;g.hasNext()&&d<u;){var N=g.next();f[y].add(N),d++}}return f}},{key:"query",value:function(){if(arguments.length===1){var n=arguments[0];return w(v(t.prototype),"query",this).call(this,n)}if(arguments.length===2){var i=arguments[0],u=arguments[1];w(v(t.prototype),"query",this).call(this,i,u)}}},{key:"getComparator",value:function(){return t.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(n,i){return w(v(t.prototype),"createParentBoundables",this).call(this,n,i)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof pe){var n=arguments[0],i=arguments[1];return w(v(t.prototype),"remove",this).call(this,n,i)}return w(v(t.prototype),"remove",this).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?w(v(t.prototype),"depth",this).call(this):w(v(t.prototype),"depth",this).apply(this,arguments)}},{key:"createParentBoundables",value:function(n,i){se.isTrue(!n.isEmpty());var u=Math.trunc(Math.ceil(n.size()/this.getNodeCapacity())),f=new Z(n);dn.sort(f,t.xComparator);var g=this.verticalSlices(f,Math.trunc(Math.ceil(Math.sqrt(u))));return this.createParentBoundablesFromVerticalSlices(g,i)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(re(arguments[0],xm)){var n=arguments[0];if(this.isEmpty())return null;var i=new _n(this.getRoot(),this.getRoot(),n);return this.nearestNeighbour(i)}if(arguments[0]instanceof _n){var u=arguments[0],f=j.POSITIVE_INFINITY,g=null,y=new ti;for(y.add(u);!y.isEmpty()&&f>0;){var d=y.poll(),N=d.getDistance();if(N>=f)break;d.isLeaves()?(f=N,g=d):d.expandToQueue(y,f)}return g===null?null:[g.getBoundable(0).getItem(),g.getBoundable(1).getItem()]}}else{if(arguments.length===2){var b=arguments[0],L=arguments[1];if(this.isEmpty()||b.isEmpty())return null;var F=new _n(this.getRoot(),b.getRoot(),L);return this.nearestNeighbour(F)}if(arguments.length===3){var D=arguments[0],V=arguments[1],H=arguments[2],K=new kt(D,V),ge=new _n(this.getRoot(),K,H);return this.nearestNeighbour(ge)[0]}if(arguments.length===4){var xe=arguments[0],Re=arguments[1],qe=arguments[2],rt=arguments[3],St=new kt(xe,Re),Ht=new _n(this.getRoot(),St,qe);return this.nearestNeighbourK(Ht,rt)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],u=j.POSITIVE_INFINITY,f=new ti;for(f.add(n);!f.isEmpty();){var g=f.poll(),y=g.getDistance();if(y>i)return!1;if(g.maximumDistance()<=i)return!0;if(g.isLeaves()){if((u=y)<=i)return!0}else g.expandToQueue(f,u)}return!1}if(arguments.length===3){var d=arguments[0],N=arguments[1],b=arguments[2],L=new _n(this.getRoot(),d.getRoot(),N);return this.isWithinDistance(L,b)}}},{key:"interfaces_",get:function(){return[dm,X]}}],[{key:"constructor_",value:function(){if(arguments.length===0)t.constructor_.call(this,t.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var n=arguments[0];xn.constructor_.call(this,n)}}},{key:"centreX",value:function(n){return t.avg(n.getMinX(),n.getMaxX())}},{key:"avg",value:function(n,i){return(n+i)/2}},{key:"getItems",value:function(n){for(var i=new Array(n.size()).fill(null),u=0;!n.isEmpty();){var f=n.poll();i[u]=f.getBoundable(0).getItem(),u++}return i}},{key:"centreY",value:function(n){return t.avg(n.getMinY(),n.getMaxY())}}]),t}(xn),jl=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"computeBounds",value:function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var u=i.next();n===null?n=new pe(u.getBounds()):n.expandToInclude(u.getBounds())}return n}}],[{key:"constructor_",value:function(){var n=arguments[0];He.constructor_.call(this,n)}}]),t}(He);gt.STRtreeNode=jl,gt.xComparator=new(function(){function s(){a(this,s)}return c(s,[{key:"interfaces_",get:function(){return[Pe]}},{key:"compare",value:function(e,t){return xn.compareDoubles(gt.centreX(e.getBounds()),gt.centreX(t.getBounds()))}}]),s}()),gt.yComparator=new(function(){function s(){a(this,s)}return c(s,[{key:"interfaces_",get:function(){return[Pe]}},{key:"compare",value:function(e,t){return xn.compareDoubles(gt.centreY(e.getBounds()),gt.centreY(t.getBounds()))}}]),s}()),gt.intersectsOp=new(function(){function s(){a(this,s)}return c(s,[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(e,t){return e.intersects(t)}}]),s}()),gt.DEFAULT_NODE_CAPACITY=10;var Em=function(){function s(){a(this,s)}return c(s,null,[{key:"relativeSign",value:function(e,t){return e<t?-1:e>t?1:0}},{key:"compare",value:function(e,t,n){if(t.equals2D(n))return 0;var i=s.relativeSign(t.x,n.x),u=s.relativeSign(t.y,n.y);switch(e){case 0:return s.compareValue(i,u);case 1:return s.compareValue(u,i);case 2:return s.compareValue(u,-i);case 3:return s.compareValue(-i,u);case 4:return s.compareValue(-i,-u);case 5:return s.compareValue(-u,-i);case 6:return s.compareValue(-u,i);case 7:return s.compareValue(i,-u)}return se.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0}}]),s}(),km=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(e){var t=e;return this.segmentIndex<t.segmentIndex?-1:this.segmentIndex>t.segmentIndex?1:this.coord.equals2D(t.coord)?0:this._isInterior?t._isInterior?Em.compare(this._segmentOctant,this.coord,t.coord):1:-1}},{key:"isEndPoint",value:function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._segString=e,this.coord=new O(t),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!t.equals2D(e.getCoordinate(n))}}]),s}(),Sm=function(){function s(){a(this,s)}return c(s,[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}]),s}(),Im=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getSplitCoordinates",value:function(){var e=new Xn;this.addEndpoints();for(var t=this.iterator(),n=t.next();t.hasNext();){var i=t.next();this.addEdgeCoordinates(n,i,e),n=i}return e.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var e=new Z;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var t=e.iterator();t.hasNext();){var n=t.next().intValue();this.add(this._edge.getCoordinate(n),n)}}},{key:"createSplitEdgePts",value:function(e,t){var n=t.segmentIndex-e.segmentIndex+2;if(n===2)return[new O(e.coord),new O(t.coord)];var i=this._edge.getCoordinate(t.segmentIndex),u=t.isInterior()||!t.coord.equals2D(i);u||n--;var f=new Array(n).fill(null),g=0;f[g++]=new O(e.coord);for(var y=e.segmentIndex+1;y<=t.segmentIndex;y++)f[g++]=this._edge.getCoordinate(y);return u&&(f[g]=new O(t.coord)),f}},{key:"print",value:function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"findCollapsesFromExistingVertices",value:function(e){for(var t=0;t<this._edge.size()-2;t++){var n=this._edge.getCoordinate(t);this._edge.getCoordinate(t+1);var i=this._edge.getCoordinate(t+2);n.equals2D(i)&&e.add(Xr.valueOf(t+1))}}},{key:"addEdgeCoordinates",value:function(e,t,n){var i=this.createSplitEdgePts(e,t);n.add(i,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(e){this.addEndpoints(),this.addCollapsedNodes();for(var t=this.iterator(),n=t.next();t.hasNext();){var i=t.next(),u=this.createSplitEdge(n,i);e.add(u),n=i}}},{key:"findCollapseIndex",value:function(e,t,n){if(!e.coord.equals2D(t.coord))return!1;var i=t.segmentIndex-e.segmentIndex;return t.isInterior()||i--,i===1&&(n[0]=e.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(e){for(var t=new Array(1).fill(null),n=this.iterator(),i=n.next();n.hasNext();){var u=n.next();this.findCollapseIndex(i,u,t)&&e.add(Xr.valueOf(t[0])),i=u}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var e=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(e),e)}},{key:"createSplitEdge",value:function(e,t){var n=this.createSplitEdgePts(e,t);return new Wt(n,this._edge.getData())}},{key:"add",value:function(e,t){var n=new km(this._edge,e,t,this._edge.getSegmentOctant(t)),i=this._nodeMap.get(n);return i!==null?(se.isTrue(i.coord.equals2D(e),"Found equal nodes with different coordinates"),i):(this._nodeMap.put(n,n),n)}},{key:"checkSplitEdgesCorrectness",value:function(e){var t=this._edge.getCoordinates(),n=e.get(0).getCoordinate(0);if(!n.equals2D(t[0]))throw new Ne("bad split edge start point at "+n);var i=e.get(e.size()-1).getCoordinates(),u=i[i.length-1];if(!u.equals2D(t[t.length-1]))throw new Ne("bad split edge end point at "+u)}}],[{key:"constructor_",value:function(){this._nodeMap=new Wn,this._edge=null;var e=arguments[0];this._edge=e}}]),s}(),wm=function(){function s(){a(this,s)}return c(s,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new M("Cannot compute the octant for point ( "+e+", "+t+" )");var n=Math.abs(e),i=Math.abs(t);return e>=0?t>=0?n>=i?0:1:n>=i?7:6:t>=0?n>=i?3:2:n>=i?4:5}if(arguments[0]instanceof O&&arguments[1]instanceof O){var u=arguments[0],f=arguments[1],g=f.x-u.x,y=f.y-u.y;if(g===0&&y===0)throw new M("Cannot compute the octant for two identical points "+u);return s.octant(g,y)}}}]),s}(),Nm=function(){function s(){a(this,s)}return c(s,[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(e){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(e){}},{key:"getData",value:function(){}}]),s}(),bm=function(){function s(){a(this,s)}return c(s,[{key:"addIntersection",value:function(e,t){}},{key:"interfaces_",get:function(){return[Nm]}}]),s}(),Wt=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(e){return this._pts[e]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))}},{key:"setData",value:function(e){this._data=e}},{key:"safeOctant",value:function(e,t){return e.equals2D(t)?0:wm.octant(e,t)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],u=arguments[3],f=new O(n.getIntersection(u));this.addIntersection(f,i)}}},{key:"toString",value:function(){return Ds.toLineString(new jn(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(e,t){var n=t,i=n+1;if(i<this._pts.length){var u=this._pts[i];e.equals2D(u)&&(n=i)}return this._nodeList.add(e,n)}},{key:"addIntersections",value:function(e,t,n){for(var i=0;i<e.getIntersectionNum();i++)this.addIntersection(e,t,n,i)}},{key:"interfaces_",get:function(){return[bm]}}],[{key:"constructor_",value:function(){this._nodeList=new Im(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var e=arguments[0],t=new Z;return s.getNodedSubstrings(e,t),t}if(arguments.length===2)for(var n=arguments[0],i=arguments[1],u=n.iterator();u.hasNext();){var f=u.next();f.getNodeList().addSplitEdges(i)}}}]),s}(),Be=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof s){var e=arguments[0],t=Q.index(this.p0,this.p1,e.p0),n=Q.index(this.p0,this.p1,e.p1);return t>=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}if(arguments[0]instanceof O){var i=arguments[0];return Q.index(this.p0,this.p1,i)}}},{key:"toGeometry",value:function(e){return e.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(e){if(!(e instanceof s))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)}},{key:"intersection",value:function(e){var t=new Vt;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof O){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new O(e);var t=this.projectionFactor(e),n=new O;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof s){var i=arguments[0],u=this.projectionFactor(i.p0),f=this.projectionFactor(i.p1);if(u>=1&&f>=1||u<=0&&f<=0)return null;var g=this.project(i.p0);u<0&&(g=this.p0),u>1&&(g=this.p1);var y=this.project(i.p1);return f<0&&(y=this.p0),f>1&&(y=this.p1),new s(g,y)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(e){return e===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(e){return ft.pointToLinePerpendicular(e,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return s.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=t*t+n*n;return i<=0?j.NaN:((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/i}},{key:"closestPoints",value:function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),i=j.MAX_VALUE,u=null,f=this.closestPoint(e.p0);i=f.distance(e.p0),n[0]=f,n[1]=e.p0;var g=this.closestPoint(e.p1);(u=g.distance(e.p1))<i&&(i=u,n[0]=g,n[1]=e.p1);var y=e.closestPoint(this.p0);(u=y.distance(this.p0))<i&&(i=u,n[0]=this.p0,n[1]=y);var d=e.closestPoint(this.p1);return(u=d.distance(this.p1))<i&&(i=u,n[0]=this.p1,n[1]=d),n}},{key:"closestPoint",value:function(e){var t=this.projectionFactor(e);return t>0&&t<1?this.project(e):this.p0.distance(e)<this.p1.distance(e)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(e){var t=e,n=this.p0.compareTo(t.p0);return n!==0?n:this.p1.compareTo(t.p1)}},{key:"reverse",value:function(){var e=this.p0;this.p0=this.p1,this.p1=e}},{key:"equalsTopo",value:function(e){return this.p0.equals(e.p0)&&this.p1.equals(e.p1)||this.p0.equals(e.p1)&&this.p1.equals(e.p0)}},{key:"lineIntersection",value:function(e){return Os.intersection(this.p0,this.p1,e.p0,e.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(e,t){var n=this.p0.x+e*(this.p1.x-this.p0.x),i=this.p0.y+e*(this.p1.y-this.p0.y),u=this.p1.x-this.p0.x,f=this.p1.y-this.p0.y,g=Math.sqrt(u*u+f*f),y=0,d=0;if(t!==0){if(g<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");y=t*u/g,d=t*f/g}return new O(n-d,i+y)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var e=arguments[0];this.setCoordinates(e.p0,e.p1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.p0.x=t.x,this.p0.y=t.y,this.p1.x=n.x,this.p1.y=n.y}}},{key:"segmentFraction",value:function(e){var t=this.projectionFactor(e);return t<0?t=0:(t>1||j.isNaN(t))&&(t=1),t}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(e){var t=this.p1.getY()-this.p0.getY(),n=this.p0.getX()-this.p1.getX(),i=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),u=t*t+n*n,f=t*t-n*n,g=e.getX(),y=e.getY();return new O((-f*g-2*t*n*y-2*t*i)/u,(f*y-2*t*n*g-2*n*i)/u)}},{key:"distance",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return ft.segmentToSegment(this.p0,this.p1,e.p0,e.p1)}if(arguments[0]instanceof O){var t=arguments[0];return ft.pointToSegment(t,this.p0,this.p1)}}},{key:"pointAlong",value:function(e){var t=new O;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t}},{key:"hashCode",value:function(){var e=j.doubleToLongBits(this.p0.x);e^=31*j.doubleToLongBits(this.p0.y);var t=Math.trunc(e)^Math.trunc(e>>32),n=j.doubleToLongBits(this.p1.x);return n^=31*j.doubleToLongBits(this.p1.y),t^(Math.trunc(n)^Math.trunc(n>>32))}},{key:"interfaces_",get:function(){return[Y,X]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)s.constructor_.call(this,new O,new O);else if(arguments.length===1){var e=arguments[0];s.constructor_.call(this,e.p0,e.p1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.p0=t,this.p1=n}else if(arguments.length===4){var i=arguments[0],u=arguments[1],f=arguments[2],g=arguments[3];s.constructor_.call(this,new O(i,u),new O(f,g))}}},{key:"midPoint",value:function(e,t){return new O((e.x+t.x)/2,(e.y+t.y)/2)}}]),s}(),Om=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"overlap",value:function(){if(arguments.length!==2){if(arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new Be,this._overlapSeg2=new Be}}]),s}(),Vl=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getLineSegment",value:function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]}},{key:"computeSelect",value:function(e,t,n,i){var u=this._pts[t],f=this._pts[n];if(n-t==1)return i.select(this,t),null;if(!e.intersects(u,f))return null;var g=Math.trunc((t+n)/2);t<g&&this.computeSelect(e,t,g,i),g<n&&this.computeSelect(e,g,n,i)}},{key:"getCoordinates",value:function(){for(var e=new Array(this._end-this._start+1).fill(null),t=0,n=this._start;n<=this._end;n++)e[t++]=this._pts[n];return e}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.computeOverlaps(this._start,this._end,e,e._start,e._end,t)}else if(arguments.length===6){var n=arguments[0],i=arguments[1],u=arguments[2],f=arguments[3],g=arguments[4],y=arguments[5];if(i-n==1&&g-f==1)return y.overlap(this,n,u,f),null;if(!this.overlaps(n,i,u,f,g))return null;var d=Math.trunc((n+i)/2),N=Math.trunc((f+g)/2);n<d&&(f<N&&this.computeOverlaps(n,d,u,f,N,y),N<g&&this.computeOverlaps(n,d,u,N,g,y)),d<i&&(f<N&&this.computeOverlaps(d,i,u,f,N,y),N<g&&this.computeOverlaps(d,i,u,N,g,y))}}},{key:"setId",value:function(e){this._id=e}},{key:"select",value:function(e,t){this.computeSelect(e,this._start,this._end,t)}},{key:"getEnvelope",value:function(){if(this._env===null){var e=this._pts[this._start],t=this._pts[this._end];this._env=new pe(e,t)}return this._env}},{key:"overlaps",value:function(e,t,n,i,u){return pe.intersects(this._pts[e],this._pts[t],n._pts[i],n._pts[u])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=i}}]),s}(),Tm=function(){function s(){a(this,s)}return c(s,null,[{key:"findChainEnd",value:function(e,t){for(var n=t;n<e.length-1&&e[n].equals2D(e[n+1]);)n++;if(n>=e.length-1)return e.length-1;for(var i=Ae.quadrant(e[n],e[n+1]),u=t+1;u<e.length&&!(!e[u-1].equals2D(e[u])&&Ae.quadrant(e[u-1],e[u])!==i);)u++;return u-1}},{key:"getChains",value:function(){if(arguments.length===1){var e=arguments[0];return s.getChains(e,null)}if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new Z,u=0;do{var f=s.findChainEnd(t,u),g=new Vl(t,u,f,n);i.add(g),u=f}while(u<t.length-1);return i}}}]),s}(),$s=function(){function s(){a(this,s)}return c(s,[{key:"computeNodes",value:function(e){}},{key:"getNodedSubstrings",value:function(){}}]),s}(),Wl=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"setSegmentIntersector",value:function(e){this._segInt=e}},{key:"interfaces_",get:function(){return[$s]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setSegmentIntersector(e)}}}}]),s}(),qs=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return Wt.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(n){for(var i=Tm.getChains(n.getCoordinates(),n).iterator();i.hasNext();){var u=i.next();u.setId(this._idCounter++),this._index.insert(u.getEnvelope(),u),this._monoChains.add(u)}}},{key:"computeNodes",value:function(n){this._nodedSegStrings=n;for(var i=n.iterator();i.hasNext();)this.add(i.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var n=new Hl(this._segInt),i=this._monoChains.iterator();i.hasNext();)for(var u=i.next(),f=this._index.query(u.getEnvelope()).iterator();f.hasNext();){var g=f.next();if(g.getId()>u.getId()&&(u.computeOverlaps(g,n),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new Z,this._index=new gt,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var n=arguments[0];Wl.constructor_.call(this,n)}}}}]),t}(Wl),Hl=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"overlap",value:function(){if(arguments.length!==4)return w(v(t.prototype),"overlap",this).apply(this,arguments);var n=arguments[0],i=arguments[1],u=arguments[2],f=arguments[3],g=n.getContext(),y=u.getContext();this._si.processIntersections(g,i,y,f)}}],[{key:"constructor_",value:function(){this._si=null;var n=arguments[0];this._si=n}}]),t}(Om);qs.SegmentOverlapAction=Hl;var nt=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"isDeletable",value:function(e,t,n,i){var u=this._inputLine[e],f=this._inputLine[t],g=this._inputLine[n];return!!this.isConcave(u,f,g)&&!!this.isShallow(u,f,g,i)&&this.isShallowSampled(u,f,e,n,i)}},{key:"deleteShallowConcavities",value:function(){for(var e=1,t=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(t),i=!1;n<this._inputLine.length;){var u=!1;this.isDeletable(e,t,n,this._distanceTol)&&(this._isDeleted[t]=s.DELETE,u=!0,i=!0),e=u?n:t,t=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(t)}return i}},{key:"isShallowConcavity",value:function(e,t,n,i){return Q.index(e,t,n)===this._angleOrientation&&ft.pointToSegment(t,e,n)<i}},{key:"isShallowSampled",value:function(e,t,n,i,u){var f=Math.trunc((i-n)/s.NUM_PTS_TO_CHECK);f<=0&&(f=1);for(var g=n;g<i;g+=f)if(!this.isShallow(e,t,this._inputLine[g],u))return!1;return!0}},{key:"isConcave",value:function(e,t,n){var i=Q.index(e,t,n)===this._angleOrientation;return i}},{key:"simplify",value:function(e){this._distanceTol=Math.abs(e),e<0&&(this._angleOrientation=Q.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var t=!1;do t=this.deleteShallowConcavities();while(t);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(e){for(var t=e+1;t<this._inputLine.length&&this._isDeleted[t]===s.DELETE;)t++;return t}},{key:"isShallow",value:function(e,t,n,i){return ft.pointToSegment(t,e,n)<i}},{key:"collapseLine",value:function(){for(var e=new Xn,t=0;t<this._inputLine.length;t++)this._isDeleted[t]!==s.DELETE&&e.add(this._inputLine[t]);return e.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Q.COUNTERCLOCKWISE;var e=arguments[0];this._inputLine=e}},{key:"simplify",value:function(e,t){return new s(e).simplify(t)}}]),s}();nt.INIT=0,nt.DELETE=1,nt.KEEP=1,nt.NUM_PTS_TO_CHECK=10;var Zl=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getCoordinates",value:function(){return this._ptList.toArray(s.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(e){this._precisionModel=e}},{key:"addPt",value:function(e){var t=new O(e);if(this._precisionModel.makePrecise(t),this.isRedundant(t))return null;this._ptList.add(t)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(e,t){if(t)for(var n=0;n<e.length;n++)this.addPt(e[n]);else for(var i=e.length-1;i>=0;i--)this.addPt(e[i])}},{key:"isRedundant",value:function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1);return e.distance(t)<this._minimimVertexDistance}},{key:"toString",value:function(){return new pn().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var e=new O(this._ptList.get(0)),t=this._ptList.get(this._ptList.size()-1);if(e.equals(t))return null;this._ptList.add(e)}},{key:"setMinimumVertexDistance",value:function(e){this._minimimVertexDistance=e}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Z}}]),s}();Zl.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var $e=function(){function s(){a(this,s)}return c(s,null,[{key:"toDegrees",value:function(e){return 180*e/Math.PI}},{key:"normalize",value:function(e){for(;e>Math.PI;)e-=s.PI_TIMES_2;for(;e<=-Math.PI;)e+=s.PI_TIMES_2;return e}},{key:"angle",value:function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}if(arguments.length===2){var t=arguments[0],n=arguments[1],i=n.x-t.x,u=n.y-t.y;return Math.atan2(u,i)}}},{key:"isAcute",value:function(e,t,n){var i=e.x-t.x,u=e.y-t.y;return i*(n.x-t.x)+u*(n.y-t.y)>0}},{key:"isObtuse",value:function(e,t,n){var i=e.x-t.x,u=e.y-t.y;return i*(n.x-t.x)+u*(n.y-t.y)<0}},{key:"interiorAngle",value:function(e,t,n){var i=s.angle(t,e),u=s.angle(t,n);return Math.abs(u-i)}},{key:"normalizePositive",value:function(e){if(e<0){for(;e<0;)e+=s.PI_TIMES_2;e>=s.PI_TIMES_2&&(e=0)}else{for(;e>=s.PI_TIMES_2;)e-=s.PI_TIMES_2;e<0&&(e=0)}return e}},{key:"angleBetween",value:function(e,t,n){var i=s.angle(t,e),u=s.angle(t,n);return s.diff(i,u)}},{key:"diff",value:function(e,t){var n=null;return(n=e<t?t-e:e-t)>Math.PI&&(n=2*Math.PI-n),n}},{key:"toRadians",value:function(e){return e*Math.PI/180}},{key:"getTurn",value:function(e,t){var n=Math.sin(t-e);return n>0?s.COUNTERCLOCKWISE:n<0?s.CLOCKWISE:s.NONE}},{key:"angleBetweenOriented",value:function(e,t,n){var i=s.angle(t,e),u=s.angle(t,n)-i;return u<=-Math.PI?u+s.PI_TIMES_2:u>Math.PI?u-s.PI_TIMES_2:u}}]),s}();$e.PI_TIMES_2=2*Math.PI,$e.PI_OVER_2=Math.PI/2,$e.PI_OVER_4=Math.PI/4,$e.COUNTERCLOCKWISE=Q.COUNTERCLOCKWISE,$e.CLOCKWISE=Q.CLOCKWISE,$e.NONE=Q.COLLINEAR;var Hn=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"addNextSegment",value:function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=Q.index(this._s0,this._s1,this._s2),i=n===Q.CLOCKWISE&&this._side===B.LEFT||n===Q.COUNTERCLOCKWISE&&this._side===B.RIGHT;n===0?this.addCollinear(t):i?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)}},{key:"addLineEndCap",value:function(e,t){var n=new Be(e,t),i=new Be;this.computeOffsetSegment(n,B.LEFT,this._distance,i);var u=new Be;this.computeOffsetSegment(n,B.RIGHT,this._distance,u);var f=t.x-e.x,g=t.y-e.y,y=Math.atan2(g,f);switch(this._bufParams.getEndCapStyle()){case R.CAP_ROUND:this._segList.addPt(i.p1),this.addDirectedFillet(t,y+Math.PI/2,y-Math.PI/2,Q.CLOCKWISE,this._distance),this._segList.addPt(u.p1);break;case R.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(u.p1);break;case R.CAP_SQUARE:var d=new O;d.x=Math.abs(this._distance)*Math.cos(y),d.y=Math.abs(this._distance)*Math.sin(y);var N=new O(i.p1.x+d.x,i.p1.y+d.y),b=new O(u.p1.x+d.x,u.p1.y+d.y);this._segList.addPt(N),this._segList.addPt(b)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(e,t,n,i){var u=Os.intersection(t.p0,t.p1,n.p0,n.p1);if(u!==null&&(i<=0?1:u.distance(e)/Math.abs(i))<=this._bufParams.getMitreLimit())return this._segList.addPt(u),null;this.addLimitedMitreJoin(t,n,i,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(e,t){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*s.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===R.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===R.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(t&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,e,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(e){this._segList.addPt(new O(e.x+this._distance,e.y+this._distance)),this._segList.addPt(new O(e.x+this._distance,e.y-this._distance)),this._segList.addPt(new O(e.x-this._distance,e.y-this._distance)),this._segList.addPt(new O(e.x-this._distance,e.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(e,t){this._segList.addPts(e,t)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(e,t,n,i,u){var f=t.x-e.x,g=t.y-e.y,y=Math.atan2(g,f),d=n.x-e.x,N=n.y-e.y,b=Math.atan2(N,d);i===Q.CLOCKWISE?y<=b&&(y+=2*Math.PI):y>=b&&(y-=2*Math.PI),this._segList.addPt(t),this.addDirectedFillet(e,y,b,i,u),this._segList.addPt(n)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(e,t,n){this._s1=e,this._s2=t,this._side=n,this._seg1.setCoordinates(e,t),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(e,t,n,i){var u=this._seg0.p1,f=$e.angle(u,this._seg0.p0),g=$e.angleBetweenOriented(this._seg0.p0,u,this._seg1.p1)/2,y=$e.normalize(f+g),d=$e.normalize(y+Math.PI),N=i*n,b=n-N*Math.abs(Math.sin(g)),L=u.x+N*Math.cos(d),F=u.y+N*Math.sin(d),D=new O(L,F),V=new Be(u,D),H=V.pointAlongOffset(1,b),K=V.pointAlongOffset(1,-b);this._side===B.LEFT?(this._segList.addPt(H),this._segList.addPt(K)):(this._segList.addPt(K),this._segList.addPt(H))}},{key:"addDirectedFillet",value:function(e,t,n,i,u){var f=i===Q.CLOCKWISE?-1:1,g=Math.abs(t-n),y=Math.trunc(g/this._filletAngleQuantum+.5);if(y<1)return null;for(var d=g/y,N=new O,b=0;b<y;b++){var L=t+f*b*d;N.x=e.x+u*Math.cos(L),N.y=e.y+u*Math.sin(L),this._segList.addPt(N)}}},{key:"computeOffsetSegment",value:function(e,t,n,i){var u=t===B.LEFT?1:-1,f=e.p1.x-e.p0.x,g=e.p1.y-e.p0.y,y=Math.sqrt(f*f+g*g),d=u*n*f/y,N=u*n*g/y;i.p0.x=e.p0.x-N,i.p0.y=e.p0.y+d,i.p1.x=e.p1.x-N,i.p1.y=e.p1.y+d}},{key:"addInsideTurn",value:function(e,t){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*s.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new O((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var i=new O((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(e){var t=new O(e.x+this._distance,e.y);this._segList.addPt(t),this.addDirectedFillet(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)}},{key:"init",value:function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Zl,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*s.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===R.JOIN_BEVEL||this._bufParams.getJoinStyle()===R.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,Q.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Be,this._seg1=new Be,this._offset0=new Be,this._offset1=new Be,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=t,this._li=new Vt,this._filletAngleQuantum=Math.PI/2/t.getQuadrantSegments(),t.getQuadrantSegments()>=8&&t.getJoinStyle()===R.JOIN_ROUND&&(this._closingSegLengthFactor=s.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}}]),s}();Hn.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Hn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Hn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Hn.MAX_CLOSING_SEG_LEN_FACTOR=80;var Lm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getOffsetCurve",value:function(e,t){if(this._distance=t,t===0)return null;var n=t<0,i=Math.abs(t),u=this.getSegGen(i);e.length<=1?this.computePointCurve(e[0],u):this.computeOffsetCurve(e,n,u);var f=u.getCoordinates();return n&&Ee.reverse(f),f}},{key:"computeSingleSidedBufferCurve",value:function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var u=nt.simplify(e,-i),f=u.length-1;n.initSideSegments(u[f],u[f-1],B.LEFT),n.addFirstSegment();for(var g=f-2;g>=0;g--)n.addNextSegment(u[g],!0)}else{n.addSegments(e,!1);var y=nt.simplify(e,i),d=y.length-1;n.initSideSegments(y[0],y[1],B.LEFT),n.addFirstSegment();for(var N=2;N<=d;N++)n.addNextSegment(y[N],!0)}n.addLastSegment(),n.closeRing()}},{key:"computeRingBufferCurve",value:function(e,t,n){var i=this.simplifyTolerance(this._distance);t===B.RIGHT&&(i=-i);var u=nt.simplify(e,i),f=u.length-1;n.initSideSegments(u[f-1],u[0],t);for(var g=1;g<=f;g++){var y=g!==1;n.addNextSegment(u[g],y)}n.closeRing()}},{key:"computeLineBufferCurve",value:function(e,t){var n=this.simplifyTolerance(this._distance),i=nt.simplify(e,n),u=i.length-1;t.initSideSegments(i[0],i[1],B.LEFT);for(var f=2;f<=u;f++)t.addNextSegment(i[f],!0);t.addLastSegment(),t.addLineEndCap(i[u-1],i[u]);var g=nt.simplify(e,-n),y=g.length-1;t.initSideSegments(g[y],g[y-1],B.LEFT);for(var d=y-2;d>=0;d--)t.addNextSegment(g[d],!0);t.addLastSegment(),t.addLineEndCap(g[1],g[0]),t.closeRing()}},{key:"computePointCurve",value:function(e,t){switch(this._bufParams.getEndCapStyle()){case R.CAP_ROUND:t.createCircle(e);break;case R.CAP_SQUARE:t.createSquare(e)}}},{key:"getLineCurve",value:function(e,t){if(this._distance=t,this.isLineOffsetEmpty(t))return null;var n=Math.abs(t),i=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],i);else if(this._bufParams.isSingleSided()){var u=t<0;this.computeSingleSidedBufferCurve(e,u,i)}else this.computeLineBufferCurve(e,i);return i.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(e){return e*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return s.copyCoordinates(e);var i=this.getSegGen(n);return this.computeRingBufferCurve(e,t,i),i.getCoordinates()}},{key:"computeOffsetCurve",value:function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){var u=nt.simplify(e,-i),f=u.length-1;n.initSideSegments(u[f],u[f-1],B.LEFT),n.addFirstSegment();for(var g=f-2;g>=0;g--)n.addNextSegment(u[g],!0)}else{var y=nt.simplify(e,i),d=y.length-1;n.initSideSegments(y[0],y[1],B.LEFT),n.addFirstSegment();for(var N=2;N<=d;N++)n.addNextSegment(y[N],!0)}n.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(e){return e===0||e<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(e){return new Hn(this._precisionModel,this._bufParams,e)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t}},{key:"copyCoordinates",value:function(e){for(var t=new Array(e.length).fill(null),n=0;n<t.length;n++)t[n]=new O(e[n]);return t}}]),s}(),Jl=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var e=arguments[0],t=new Z,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),u=i.getEnvelope();e.y<u.getMinY()||e.y>u.getMaxY()||this.findStabbedSegments(e,i.getDirectedEdges(),t)}return t}if(arguments.length===3){if(re(arguments[2],zt)&&arguments[0]instanceof O&&arguments[1]instanceof Bs)for(var f=arguments[0],g=arguments[1],y=arguments[2],d=g.getEdge().getCoordinates(),N=0;N<d.length-1;N++){this._seg.p0=d[N],this._seg.p1=d[N+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse();var b=Math.max(this._seg.p0.x,this._seg.p1.x);if(!(b<f.x)&&!(this._seg.isHorizontal()||f.y<this._seg.p0.y||f.y>this._seg.p1.y||Q.index(this._seg.p0,this._seg.p1,f)===Q.RIGHT)){var L=g.getDepth(B.LEFT);this._seg.p0.equals(d[N])||(L=g.getDepth(B.RIGHT));var F=new Ql(this._seg,L);y.add(F)}}else if(re(arguments[2],zt)&&arguments[0]instanceof O&&re(arguments[1],zt))for(var D=arguments[0],V=arguments[1],H=arguments[2],K=V.iterator();K.hasNext();){var ge=K.next();ge.isForward()&&this.findStabbedSegments(D,ge,H)}}}},{key:"getDepth",value:function(e){var t=this.findStabbedSegments(e);return t.size()===0?0:dn.min(t)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new Be;var e=arguments[0];this._subgraphs=e}}]),s}(),Ql=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"compareTo",value:function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg))!==0?n:this._upwardSeg.compareTo(t._upwardSeg)}},{key:"compareX",value:function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new Be(e),this._leftDepth=t}}]),s}();Jl.DepthSegment=Ql;var Kl=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,null,[{key:"constructor_",value:function(){G.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}]),t}(G),zs=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getY",value:function(){var e=this.y/this.w;if(j.isNaN(e)||j.isInfinite(e))throw new Kl;return e}},{key:"getX",value:function(){var e=this.x/this.w;if(j.isNaN(e)||j.isInfinite(e))throw new Kl;return e}},{key:"getCoordinate",value:function(){var e=new O;return e.x=this.getX(),e.y=this.getY(),e}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];this.x=t,this.y=n,this.w=1}else if(arguments[0]instanceof s&&arguments[1]instanceof s){var i=arguments[0],u=arguments[1];this.x=i.y*u.w-u.y*i.w,this.y=u.x*i.w-i.x*u.w,this.w=i.x*u.y-u.x*i.y}else if(arguments[0]instanceof O&&arguments[1]instanceof O){var f=arguments[0],g=arguments[1];this.x=f.y-g.y,this.y=g.x-f.x,this.w=f.x*g.y-g.x*f.y}}else if(arguments.length===3){var y=arguments[0],d=arguments[1],N=arguments[2];this.x=y,this.y=d,this.w=N}else if(arguments.length===4){var b=arguments[0],L=arguments[1],F=arguments[2],D=arguments[3],V=b.y-L.y,H=L.x-b.x,K=b.x*L.y-L.x*b.y,ge=F.y-D.y,xe=D.x-F.x,Re=F.x*D.y-D.x*F.y;this.x=H*Re-xe*K,this.y=ge*K-V*Re,this.w=V*xe-ge*H}}}]),s}(),Rm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"area",value:function(){return s.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return s.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(e){if(e===null)throw new M("Supplied point is null.");return s.interpolateZ(e,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return s.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return s.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return s.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return s.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return s.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return s.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var e=arguments[0],t=arguments[1],n=arguments[2];this.p0=e,this.p1=t,this.p2=n}},{key:"area",value:function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)}},{key:"signedArea",value:function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2}},{key:"det",value:function(e,t,n,i){return e*i-t*n}},{key:"interpolateZ",value:function(e,t,n,i){var u=t.x,f=t.y,g=n.x-u,y=i.x-u,d=n.y-f,N=i.y-f,b=g*N-y*d,L=e.x-u,F=e.y-f,D=(N*L-y*F)/b,V=(-d*L+g*F)/b;return t.getZ()+D*(n.getZ()-t.getZ())+V*(i.getZ()-t.getZ())}},{key:"longestSideLength",value:function(e,t,n){var i=e.distance(t),u=t.distance(n),f=n.distance(e),g=i;return u>g&&(g=u),f>g&&(g=f),g}},{key:"circumcentreDD",value:function(e,t,n){var i=J.valueOf(e.x).subtract(n.x),u=J.valueOf(e.y).subtract(n.y),f=J.valueOf(t.x).subtract(n.x),g=J.valueOf(t.y).subtract(n.y),y=J.determinant(i,u,f,g).multiply(2),d=i.sqr().add(u.sqr()),N=f.sqr().add(g.sqr()),b=J.determinant(u,d,g,N),L=J.determinant(i,d,f,N),F=J.valueOf(n.x).subtract(b.divide(y)).doubleValue(),D=J.valueOf(n.y).add(L.divide(y)).doubleValue();return new O(F,D)}},{key:"isAcute",value:function(e,t,n){return!!$e.isAcute(e,t,n)&&!!$e.isAcute(t,n,e)&&!!$e.isAcute(n,e,t)}},{key:"circumcentre",value:function(e,t,n){var i=n.x,u=n.y,f=e.x-i,g=e.y-u,y=t.x-i,d=t.y-u,N=2*s.det(f,g,y,d),b=s.det(g,f*f+g*g,d,y*y+d*d),L=s.det(f,f*f+g*g,y,y*y+d*d);return new O(i-b/N,u+L/N)}},{key:"perpendicularBisector",value:function(e,t){var n=t.x-e.x,i=t.y-e.y,u=new zs(e.x+n/2,e.y+i/2,1),f=new zs(e.x-i+n/2,e.y+n+i/2,1);return new zs(u,f)}},{key:"angleBisector",value:function(e,t,n){var i=t.distance(e),u=i/(i+t.distance(n)),f=n.x-e.x,g=n.y-e.y;return new O(e.x+u*f,e.y+u*g)}},{key:"area3D",value:function(e,t,n){var i=t.x-e.x,u=t.y-e.y,f=t.getZ()-e.getZ(),g=n.x-e.x,y=n.y-e.y,d=n.getZ()-e.getZ(),N=u*d-f*y,b=f*g-i*d,L=i*y-u*g,F=N*N+b*b+L*L,D=Math.sqrt(F)/2;return D}},{key:"centroid",value:function(e,t,n){var i=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3;return new O(i,u)}},{key:"inCentre",value:function(e,t,n){var i=t.distance(n),u=e.distance(n),f=e.distance(t),g=i+u+f,y=(i*e.x+u*t.x+f*n.x)/g,d=(i*e.y+u*t.y+f*n.y)/g;return new O(y,d)}}]),s}(),Cm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"addRingSide",value:function(e,t,n,i,u){if(t===0&&e.length<Un.MINIMUM_VALID_SIZE)return null;var f=i,g=u;e.length>=Un.MINIMUM_VALID_SIZE&&Q.isCCW(e)&&(f=u,g=i,n=B.opposite(n));var y=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(y,f,g)}},{key:"addRingBothSides",value:function(e,t){this.addRingSide(e,t,B.LEFT,I.EXTERIOR,I.INTERIOR),this.addRingSide(e,t,B.RIGHT,I.INTERIOR,I.EXTERIOR)}},{key:"addPoint",value:function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,I.EXTERIOR,I.INTERIOR)}},{key:"addPolygon",value:function(e){var t=this._distance,n=B.LEFT;this._distance<0&&(t=-this._distance,n=B.RIGHT);var i=e.getExteriorRing(),u=Ee.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&u.length<3)return null;this.addRingSide(u,t,n,I.EXTERIOR,I.INTERIOR);for(var f=0;f<e.getNumInteriorRing();f++){var g=e.getInteriorRingN(f),y=Ee.removeRepeatedPoints(g.getCoordinates());this._distance>0&&this.isErodedCompletely(g,-this._distance)||this.addRingSide(y,t,B.opposite(n),I.INTERIOR,I.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(e,t){var n=new Rm(e[0],e[1],e[2]),i=n.inCentre();return ft.pointToSegment(i,n.p0,n.p1)<Math.abs(t)}},{key:"addLineString",value:function(e){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var t=Ee.removeRepeatedPoints(e.getCoordinates());if(Ee.isRing(t)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(t,this._distance);else{var n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,I.EXTERIOR,I.INTERIOR)}}},{key:"addCurve",value:function(e,t,n){if(e===null||e.length<2)return null;var i=new Wt(e,new We(0,I.BOUNDARY,t,n));this._curveList.add(i)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(e){if(e.isEmpty())return null;if(e instanceof Hr)this.addPolygon(e);else if(e instanceof Yn)this.addLineString(e);else if(e instanceof Ts)this.addPoint(e);else if(e instanceof Ls)this.addCollection(e);else if(e instanceof As)this.addCollection(e);else if(e instanceof Ps)this.addCollection(e);else{if(!(e instanceof Ge))throw new Mt(e.getGeometryType());this.addCollection(e)}}},{key:"isErodedCompletely",value:function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var i=e.getEnvelopeInternal(),u=Math.min(i.getHeight(),i.getWidth());return t<0&&2*Math.abs(t)>u}},{key:"addCollection",value:function(e){for(var t=0;t<e.getNumGeometries();t++){var n=e.getGeometryN(t);this.add(n)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Z;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n}}]),s}(),Pm=function(){function s(){a(this,s)}return c(s,[{key:"locate",value:function(e){}}]),s}(),Am=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,s.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new Ur;var e=this._parent.getGeometryN(this._index++);return e instanceof Ge?(this._subcollectionIterator=new s(e),this._subcollectionIterator.next()):e}},{key:"remove",value:function(){throw new Mt(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[Sm]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var e=arguments[0];this._parent=e,this._atStart=!0,this._index=0,this._max=e.getNumGeometries()}},{key:"isAtomic",value:function(e){return!(e instanceof Ge)}}]),s}(),Mm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"locate",value:function(e){return s.locate(e,this._geom)}},{key:"interfaces_",get:function(){return[Pm]}}],[{key:"constructor_",value:function(){this._geom=null;var e=arguments[0];this._geom=e}},{key:"locatePointInPolygon",value:function(e,t){if(t.isEmpty())return I.EXTERIOR;var n=t.getExteriorRing(),i=s.locatePointInRing(e,n);if(i!==I.INTERIOR)return i;for(var u=0;u<t.getNumInteriorRing();u++){var f=t.getInteriorRingN(u),g=s.locatePointInRing(e,f);if(g===I.BOUNDARY)return I.BOUNDARY;if(g===I.INTERIOR)return I.EXTERIOR}return I.INTERIOR}},{key:"locatePointInRing",value:function(e,t){return t.getEnvelopeInternal().intersects(e)?Fs.locateInRing(e,t.getCoordinates()):I.EXTERIOR}},{key:"containsPointInPolygon",value:function(e,t){return I.EXTERIOR!==s.locatePointInPolygon(e,t)}},{key:"locateInGeometry",value:function(e,t){if(t instanceof Hr)return s.locatePointInPolygon(e,t);if(t instanceof Ge)for(var n=new Am(t);n.hasNext();){var i=n.next();if(i!==t){var u=s.locateInGeometry(e,i);if(u!==I.EXTERIOR)return u}}return I.EXTERIOR}},{key:"isContained",value:function(e,t){return I.EXTERIOR!==s.locate(e,t)}},{key:"locate",value:function(e,t){return t.isEmpty()?I.EXTERIOR:t.getEnvelopeInternal().intersects(e)?s.locateInGeometry(e,t):I.EXTERIOR}}]),s}(),Dm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getNextCW",value:function(e){this.getEdges();var t=this._edgeList.indexOf(e),n=t-1;return t===0&&(n=this._edgeList.size()-1),this._edgeList.get(n)}},{key:"propagateSideLabels",value:function(e){for(var t=I.NONE,n=this.iterator();n.hasNext();){var i=n.next().getLabel();i.isArea(e)&&i.getLocation(e,B.LEFT)!==I.NONE&&(t=i.getLocation(e,B.LEFT))}if(t===I.NONE)return null;for(var u=t,f=this.iterator();f.hasNext();){var g=f.next(),y=g.getLabel();if(y.getLocation(e,B.ON)===I.NONE&&y.setLocation(e,B.ON,u),y.isArea(e)){var d=y.getLocation(e,B.LEFT),N=y.getLocation(e,B.RIGHT);if(N!==I.NONE){if(N!==u)throw new xt("side location conflict",g.getCoordinate());d===I.NONE&&se.shouldNeverReachHere("found single null side (at "+g.getCoordinate()+")"),u=d}else se.isTrue(y.getLocation(e,B.LEFT)===I.NONE,"found single null side"),y.setLocation(e,B.RIGHT,u),y.setLocation(e,B.LEFT,u)}}}},{key:"getCoordinate",value:function(){var e=this.iterator();return e.hasNext()?e.next().getCoordinate():null}},{key:"print",value:function(e){je.out.println("EdgeEndStar: "+this.getCoordinate());for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"isAreaLabelsConsistent",value:function(e){return this.computeEdgeEndLabels(e.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(e){var t=this.getEdges();if(t.size()<=0)return!0;var n=t.size()-1,i=t.get(n).getLabel().getLocation(e,B.LEFT);se.isTrue(i!==I.NONE,"Found unlabelled area edge");for(var u=i,f=this.iterator();f.hasNext();){var g=f.next().getLabel();se.isTrue(g.isArea(e),"Found non-area edge");var y=g.getLocation(e,B.LEFT),d=g.getLocation(e,B.RIGHT);if(y===d||d!==u)return!1;u=y}return!0}},{key:"findIndex",value:function(e){this.iterator();for(var t=0;t<this._edgeList.size();t++)if(this._edgeList.get(t)===e)return t;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new Z(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(e,t,n){return this._ptInAreaLocation[e]===I.NONE&&(this._ptInAreaLocation[e]=Mm.locate(t,n[e].getGeometry())),this._ptInAreaLocation[e]}},{key:"toString",value:function(){var e=new qn;e.append("EdgeEndStar: "+this.getCoordinate()),e.append(`
9
- `);for(var t=this.iterator();t.hasNext();){var n=t.next();e.append(n),e.append(`
10
- `)}return e.toString()}},{key:"computeEdgeEndLabels",value:function(e){for(var t=this.iterator();t.hasNext();)t.next().computeLabel(e)}},{key:"computeLabelling",value:function(e){this.computeEdgeEndLabels(e[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var t=[!1,!1],n=this.iterator();n.hasNext();)for(var i=n.next().getLabel(),u=0;u<2;u++)i.isLine(u)&&i.getLocation(u)===I.BOUNDARY&&(t[u]=!0);for(var f=this.iterator();f.hasNext();)for(var g=f.next(),y=g.getLabel(),d=0;d<2;d++)if(y.isAnyNull(d)){var N=I.NONE;if(t[d])N=I.EXTERIOR;else{var b=g.getCoordinate();N=this.getLocation(d,b,e)}y.setAllLocationsIfNull(d,N)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(e,t){this._edgeMap.put(e,t),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new Wn,this._edgeList=null,this._ptInAreaLocation=[I.NONE,I.NONE]}}]),s}(),Fm=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var n=null,i=null,u=this._SCANNING_FOR_INCOMING,f=0;f<this._resultAreaEdgeList.size();f++){var g=this._resultAreaEdgeList.get(f),y=g.getSym();if(g.getLabel().isArea())switch(n===null&&g.isInResult()&&(n=g),u){case this._SCANNING_FOR_INCOMING:if(!y.isInResult())continue;i=y,u=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!g.isInResult())continue;i.setNext(g),u=this._SCANNING_FOR_INCOMING}}if(u===this._LINKING_TO_OUTGOING){if(n===null)throw new xt("no outgoing dirEdge found",this.getCoordinate());se.isTrue(n.isInResult(),"unable to link last incoming dirEdge"),i.setNext(n)}}},{key:"insert",value:function(n){var i=n;this.insertEdgeEnd(i,i)}},{key:"getRightmostEdge",value:function(){var n=this.getEdges(),i=n.size();if(i<1)return null;var u=n.get(0);if(i===1)return u;var f=n.get(i-1),g=u.getQuadrant(),y=f.getQuadrant();return Ae.isNorthern(g)&&Ae.isNorthern(y)?u:Ae.isNorthern(g)||Ae.isNorthern(y)?u.getDy()!==0?u:f.getDy()!==0?f:(se.shouldNeverReachHere("found two horizontal edges incident on node"),null):f}},{key:"print",value:function(n){je.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();){var u=i.next();n.print("out "),u.print(n),n.println(),n.print("in "),u.getSym().print(n),n.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new Z;for(var n=this.iterator();n.hasNext();){var i=n.next();(i.isInResult()||i.getSym().isInResult())&&this._resultAreaEdgeList.add(i)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(n){for(var i=this.iterator();i.hasNext();){var u=i.next().getLabel();u.setAllLocationsIfNull(0,n.getLocation(0)),u.setAllLocationsIfNull(1,n.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var n=null,i=null,u=this._edgeList.size()-1;u>=0;u--){var f=this._edgeList.get(u),g=f.getSym();i===null&&(i=g),n!==null&&g.setNext(n),n=f}i.setNext(n)}},{key:"computeDepths",value:function(){if(arguments.length===1){var n=arguments[0],i=this.findIndex(n),u=n.getDepth(B.LEFT),f=n.getDepth(B.RIGHT),g=this.computeDepths(i+1,this._edgeList.size(),u),y=this.computeDepths(0,i,g);if(y!==f)throw new xt("depth mismatch at "+n.getCoordinate())}else if(arguments.length===3){for(var d=arguments[0],N=arguments[1],b=arguments[2],L=b,F=d;F<N;F++){var D=this._edgeList.get(F);D.setEdgeDepths(B.RIGHT,L),L=D.getDepth(B.LEFT)}return L}}},{key:"mergeSymLabels",value:function(){for(var n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().merge(i.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(n){for(var i=null,u=null,f=this._SCANNING_FOR_INCOMING,g=this._resultAreaEdgeList.size()-1;g>=0;g--){var y=this._resultAreaEdgeList.get(g),d=y.getSym();switch(i===null&&y.getEdgeRing()===n&&(i=y),f){case this._SCANNING_FOR_INCOMING:if(d.getEdgeRing()!==n)continue;u=d,f=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(y.getEdgeRing()!==n)continue;u.setNextMin(y),f=this._SCANNING_FOR_INCOMING}}f===this._LINKING_TO_OUTGOING&&(se.isTrue(i!==null,"found null for first outgoing dirEdge"),se.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),u.setNextMin(i))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var u=i.next();u.isInResult()&&n++}return n}if(arguments.length===1){for(var f=arguments[0],g=0,y=this.iterator();y.hasNext();){var d=y.next();d.getEdgeRing()===f&&g++}return g}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var n=I.NONE,i=this.iterator();i.hasNext();){var u=i.next(),f=u.getSym();if(!u.isLineEdge()){if(u.isInResult()){n=I.INTERIOR;break}if(f.isInResult()){n=I.EXTERIOR;break}}}if(n===I.NONE)return null;for(var g=n,y=this.iterator();y.hasNext();){var d=y.next(),N=d.getSym();d.isLineEdge()?d.getEdge().setCovered(g===I.INTERIOR):(d.isInResult()&&(g=I.EXTERIOR),N.isInResult()&&(g=I.INTERIOR))}}},{key:"computeLabelling",value:function(n){w(v(t.prototype),"computeLabelling",this).call(this,n),this._label=new We(I.NONE);for(var i=this.iterator();i.hasNext();)for(var u=i.next().getEdge().getLabel(),f=0;f<2;f++){var g=u.getLocation(f);g!==I.INTERIOR&&g!==I.BOUNDARY||this._label.setLocation(f,I.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}]),t}(Dm),Gm=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.call(this)}return c(t,[{key:"createNode",value:function(n){return new ei(n,new Fm)}}]),t}(zl),ec=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"compareTo",value:function(e){var t=e;return s.compareOriented(this._pts,this._orientation,t._pts,t._orientation)}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=s.orientation(e)}},{key:"orientation",value:function(e){return Ee.increasingDirection(e)===1}},{key:"compareOriented",value:function(e,t,n,i){for(var u=t?1:-1,f=i?1:-1,g=t?e.length:-1,y=i?n.length:-1,d=t?0:e.length-1,N=i?0:n.length-1;;){var b=e[d].compareTo(n[N]);if(b!==0)return b;var L=(d+=u)===g,F=(N+=f)===y;if(L&&!F)return-1;if(!L&&F)return 1;if(L&&F)return 0}}}]),s}(),Bm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"print",value:function(e){e.print("MULTILINESTRING ( ");for(var t=0;t<this._edges.size();t++){var n=this._edges.get(t);t>0&&e.print(","),e.print("(");for(var i=n.getCoordinates(),u=0;u<i.length;u++)u>0&&e.print(","),e.print(i[u].x+" "+i[u].y);e.println(")")}e.print(") ")}},{key:"addAll",value:function(e){for(var t=e.iterator();t.hasNext();)this.add(t.next())}},{key:"findEdgeIndex",value:function(e){for(var t=0;t<this._edges.size();t++)if(this._edges.get(t).equals(e))return t;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(e){return this._edges.get(e)}},{key:"findEqualEdge",value:function(e){var t=new ec(e.getCoordinates());return this._ocaMap.get(t)}},{key:"add",value:function(e){this._edges.add(e);var t=new ec(e.getCoordinates());this._ocaMap.put(t,e)}}],[{key:"constructor_",value:function(){this._edges=new Z,this._ocaMap=new Wn}}]),s}(),tc=function(){function s(){a(this,s)}return c(s,[{key:"processIntersections",value:function(e,t,n,i){}},{key:"isDone",value:function(){}}]),s}(),$m=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"isTrivialIntersection",value:function(e,t,n,i){if(e===n&&this._li.getIntersectionNum()===1){if(s.isAdjacentSegments(t,i))return!0;if(e.isClosed()){var u=e.size()-1;if(t===0&&i===u||i===0&&t===u)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(e,t,n,i){if(e===n&&t===i)return null;this.numTests++;var u=e.getCoordinates()[t],f=e.getCoordinates()[t+1],g=n.getCoordinates()[i],y=n.getCoordinates()[i+1];this._li.computeIntersection(u,f,g,y),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(e,t,n,i)||(this._hasIntersection=!0,e.addIntersections(this._li,t,0),n.addIntersections(this._li,i,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[tc]}}],[{key:"constructor_",value:function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var e=arguments[0];this._li=e}},{key:"isAdjacentSegments",value:function(e,t){return Math.abs(e-t)===1}}]),s}(),qm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex),e.println(" dist = "+this.dist)}},{key:"compareTo",value:function(e){var t=e;return this.compare(t.segmentIndex,t.dist)}},{key:"isEndPoint",value:function(e){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===e}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(e,t){return this.segmentIndex<e?-1:this.segmentIndex>e?1:this.dist<t?-1:this.dist>t?1:0}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var e=arguments[0],t=arguments[1],n=arguments[2];this.coord=new O(e),this.segmentIndex=t,this.dist=n}}]),s}(),zm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"print",value:function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(e){this.addEndpoints();for(var t=this.iterator(),n=t.next();t.hasNext();){var i=t.next(),u=this.createSplitEdge(n,i);e.add(u),n=i}}},{key:"addEndpoints",value:function(){var e=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[e],e,0)}},{key:"createSplitEdge",value:function(e,t){var n=t.segmentIndex-e.segmentIndex+2,i=this.edge.pts[t.segmentIndex],u=t.dist>0||!t.coord.equals2D(i);u||n--;var f=new Array(n).fill(null),g=0;f[g++]=new O(e.coord);for(var y=e.segmentIndex+1;y<=t.segmentIndex;y++)f[g++]=this.edge.pts[y];return u&&(f[g]=t.coord),new rc(f,new We(this.edge._label))}},{key:"add",value:function(e,t,n){var i=new qm(e,t,n),u=this._nodeMap.get(i);return u!==null?u:(this._nodeMap.put(i,i),i)}},{key:"isIntersection",value:function(e){for(var t=this.iterator();t.hasNext();)if(t.next().coord.equals(e))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new Wn,this.edge=null;var e=arguments[0];this.edge=e}}]),s}(),Ym=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(s.isTrue(this._matrix[I.INTERIOR][I.INTERIOR])||s.isTrue(this._matrix[I.INTERIOR][I.BOUNDARY])||s.isTrue(this._matrix[I.BOUNDARY][I.INTERIOR])||s.isTrue(this._matrix[I.BOUNDARY][I.BOUNDARY]))&&this._matrix[I.EXTERIOR][I.INTERIOR]===z.FALSE&&this._matrix[I.EXTERIOR][I.BOUNDARY]===z.FALSE}},{key:"isCoveredBy",value:function(){return(s.isTrue(this._matrix[I.INTERIOR][I.INTERIOR])||s.isTrue(this._matrix[I.INTERIOR][I.BOUNDARY])||s.isTrue(this._matrix[I.BOUNDARY][I.INTERIOR])||s.isTrue(this._matrix[I.BOUNDARY][I.BOUNDARY]))&&this._matrix[I.INTERIOR][I.EXTERIOR]===z.FALSE&&this._matrix[I.BOUNDARY][I.EXTERIOR]===z.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var e=arguments[0],t=0;t<e.length;t++){var n=Math.trunc(t/3),i=t%3;this._matrix[n][i]=z.toDimensionValue(e.charAt(t))}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];this._matrix[u][f]=g}}},{key:"isContains",value:function(){return s.isTrue(this._matrix[I.INTERIOR][I.INTERIOR])&&this._matrix[I.EXTERIOR][I.INTERIOR]===z.FALSE&&this._matrix[I.EXTERIOR][I.BOUNDARY]===z.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var e=arguments[0],t=0;t<e.length;t++){var n=Math.trunc(t/3),i=t%3;this.setAtLeast(n,i,z.toDimensionValue(e.charAt(t)))}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];this._matrix[u][f]<g&&(this._matrix[u][f]=g)}}},{key:"setAtLeastIfValid",value:function(e,t,n){e>=0&&t>=0&&this.setAtLeast(e,t,n)}},{key:"isWithin",value:function(){return s.isTrue(this._matrix[I.INTERIOR][I.INTERIOR])&&this._matrix[I.INTERIOR][I.EXTERIOR]===z.FALSE&&this._matrix[I.BOUNDARY][I.EXTERIOR]===z.FALSE}},{key:"isTouches",value:function(e,t){return e>t?this.isTouches(t,e):(e===z.A&&t===z.A||e===z.L&&t===z.L||e===z.L&&t===z.A||e===z.P&&t===z.A||e===z.P&&t===z.L)&&this._matrix[I.INTERIOR][I.INTERIOR]===z.FALSE&&(s.isTrue(this._matrix[I.INTERIOR][I.BOUNDARY])||s.isTrue(this._matrix[I.BOUNDARY][I.INTERIOR])||s.isTrue(this._matrix[I.BOUNDARY][I.BOUNDARY]))}},{key:"isOverlaps",value:function(e,t){return e===z.P&&t===z.P||e===z.A&&t===z.A?s.isTrue(this._matrix[I.INTERIOR][I.INTERIOR])&&s.isTrue(this._matrix[I.INTERIOR][I.EXTERIOR])&&s.isTrue(this._matrix[I.EXTERIOR][I.INTERIOR]):e===z.L&&t===z.L&&this._matrix[I.INTERIOR][I.INTERIOR]===1&&s.isTrue(this._matrix[I.INTERIOR][I.EXTERIOR])&&s.isTrue(this._matrix[I.EXTERIOR][I.INTERIOR])}},{key:"isEquals",value:function(e,t){return e===t&&s.isTrue(this._matrix[I.INTERIOR][I.INTERIOR])&&this._matrix[I.INTERIOR][I.EXTERIOR]===z.FALSE&&this._matrix[I.BOUNDARY][I.EXTERIOR]===z.FALSE&&this._matrix[I.EXTERIOR][I.INTERIOR]===z.FALSE&&this._matrix[I.EXTERIOR][I.BOUNDARY]===z.FALSE}},{key:"toString",value:function(){for(var e=new Jr("123456789"),t=0;t<3;t++)for(var n=0;n<3;n++)e.setCharAt(3*t+n,z.toDimensionSymbol(this._matrix[t][n]));return e.toString()}},{key:"setAll",value:function(e){for(var t=0;t<3;t++)for(var n=0;n<3;n++)this._matrix[t][n]=e}},{key:"get",value:function(e,t){return this._matrix[e][t]}},{key:"transpose",value:function(){var e=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=e,e=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=e,e=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=e,this}},{key:"matches",value:function(e){if(e.length!==9)throw new M("Should be length 9: "+e);for(var t=0;t<3;t++)for(var n=0;n<3;n++)if(!s.matches(this._matrix[t][n],e.charAt(3*t+n)))return!1;return!0}},{key:"add",value:function(e){for(var t=0;t<3;t++)for(var n=0;n<3;n++)this.setAtLeast(t,n,e.get(t,n))}},{key:"isDisjoint",value:function(){return this._matrix[I.INTERIOR][I.INTERIOR]===z.FALSE&&this._matrix[I.INTERIOR][I.BOUNDARY]===z.FALSE&&this._matrix[I.BOUNDARY][I.INTERIOR]===z.FALSE&&this._matrix[I.BOUNDARY][I.BOUNDARY]===z.FALSE}},{key:"isCrosses",value:function(e,t){return e===z.P&&t===z.L||e===z.P&&t===z.A||e===z.L&&t===z.A?s.isTrue(this._matrix[I.INTERIOR][I.INTERIOR])&&s.isTrue(this._matrix[I.INTERIOR][I.EXTERIOR]):e===z.L&&t===z.P||e===z.A&&t===z.P||e===z.A&&t===z.L?s.isTrue(this._matrix[I.INTERIOR][I.INTERIOR])&&s.isTrue(this._matrix[I.EXTERIOR][I.INTERIOR]):e===z.L&&t===z.L&&this._matrix[I.INTERIOR][I.INTERIOR]===0}},{key:"interfaces_",get:function(){return[U]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map(function(){return Array(3)}),this.setAll(z.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var e=arguments[0];s.constructor_.call(this),this.set(e)}else if(arguments[0]instanceof s){var t=arguments[0];s.constructor_.call(this),this._matrix[I.INTERIOR][I.INTERIOR]=t._matrix[I.INTERIOR][I.INTERIOR],this._matrix[I.INTERIOR][I.BOUNDARY]=t._matrix[I.INTERIOR][I.BOUNDARY],this._matrix[I.INTERIOR][I.EXTERIOR]=t._matrix[I.INTERIOR][I.EXTERIOR],this._matrix[I.BOUNDARY][I.INTERIOR]=t._matrix[I.BOUNDARY][I.INTERIOR],this._matrix[I.BOUNDARY][I.BOUNDARY]=t._matrix[I.BOUNDARY][I.BOUNDARY],this._matrix[I.BOUNDARY][I.EXTERIOR]=t._matrix[I.BOUNDARY][I.EXTERIOR],this._matrix[I.EXTERIOR][I.INTERIOR]=t._matrix[I.EXTERIOR][I.INTERIOR],this._matrix[I.EXTERIOR][I.BOUNDARY]=t._matrix[I.EXTERIOR][I.BOUNDARY],this._matrix[I.EXTERIOR][I.EXTERIOR]=t._matrix[I.EXTERIOR][I.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var e=arguments[0],t=arguments[1];return t===z.SYM_DONTCARE||t===z.SYM_TRUE&&(e>=0||e===z.TRUE)||t===z.SYM_FALSE&&e===z.FALSE||t===z.SYM_P&&e===z.P||t===z.SYM_L&&e===z.L||t===z.SYM_A&&e===z.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var n=arguments[0],i=arguments[1],u=new s(n);return u.matches(i)}}},{key:"isTrue",value:function(e){return e>=0||e===z.TRUE}}]),s}(),Um=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(e){return e===null||e.length===0?null:(this.ensureCapacity(this._size+e.length),je.arraycopy(e,0,this._data,this._size,e.length),void(this._size+=e.length))}},{key:"ensureCapacity",value:function(e){if(e<=this._data.length)return null;var t=Math.max(e,2*this._data.length);this._data=Ut.copyOf(this._data,t)}},{key:"toArray",value:function(){var e=new Array(this._size).fill(null);return je.arraycopy(this._data,0,e,0,this._size),e}},{key:"add",value:function(e){this.ensureCapacity(this._size+1),this._data[this._size]=e,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)s.constructor_.call(this,10);else if(arguments.length===1){var e=arguments[0];this._data=new Array(e).fill(null)}}}]),s}(),Xm=function(){function s(){a(this,s)}return c(s,[{key:"getChainStartIndices",value:function(e){var t=0,n=new Um(Math.trunc(e.length/2));n.add(t);do{var i=this.findChainEnd(e,t);n.add(i),t=i}while(t<e.length-1);return n.toArray()}},{key:"findChainEnd",value:function(e,t){for(var n=Ae.quadrant(e[t],e[t+1]),i=t+1;i<e.length&&Ae.quadrant(e[i-1],e[i])===n;)i++;return i-1}},{key:"OLDgetChainStartIndices",value:function(e){var t=0,n=new Z;n.add(t);do{var i=this.findChainEnd(e,t);n.add(i),t=i}while(t<e.length-1);return s.toIntArray(n)}}],[{key:"toIntArray",value:function(e){for(var t=new Array(e.size()).fill(null),n=0;n<t.length;n++)t[n]=e.get(n).intValue();return t}}]),s}(),jm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return t>n?t:n}},{key:"getMinX",value:function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return t<n?t:n}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this.computeIntersectsForChain(this.startIndex[e],this.startIndex[e+1],t,t.startIndex[n],t.startIndex[n+1],i)}else if(arguments.length===6){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3],d=arguments[4],N=arguments[5];if(f-u==1&&d-y==1)return N.addIntersections(this.e,u,g.e,y),null;if(!this.overlaps(u,f,g,y,d))return null;var b=Math.trunc((u+f)/2),L=Math.trunc((y+d)/2);u<b&&(y<L&&this.computeIntersectsForChain(u,b,g,y,L,N),L<d&&this.computeIntersectsForChain(u,b,g,L,d,N)),b<f&&(y<L&&this.computeIntersectsForChain(b,f,g,y,L,N),L<d&&this.computeIntersectsForChain(b,f,g,L,d,N))}}},{key:"overlaps",value:function(e,t,n,i,u){return pe.intersects(this.pts[e],this.pts[t],n.pts[i],n.pts[u])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(e,t){for(var n=0;n<this.startIndex.length-1;n++)for(var i=0;i<e.startIndex.length-1;i++)this.computeIntersectsForChain(n,e,i,t)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var e=arguments[0];this.e=e,this.pts=e.getCoordinates();var t=new Xm;this.startIndex=t.getChainStartIndices(this.pts)}}]),s}(),nc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getDepth",value:function(e,t){return this._depth[e][t]}},{key:"setDepth",value:function(e,t,n){this._depth[e][t]=n}},{key:"isNull",value:function(){if(arguments.length===0){for(var e=0;e<2;e++)for(var t=0;t<3;t++)if(this._depth[e][t]!==s.NULL_VALUE)return!1;return!0}if(arguments.length===1){var n=arguments[0];return this._depth[n][1]===s.NULL_VALUE}if(arguments.length===2){var i=arguments[0],u=arguments[1];return this._depth[i][u]===s.NULL_VALUE}}},{key:"normalize",value:function(){for(var e=0;e<2;e++)if(!this.isNull(e)){var t=this._depth[e][1];this._depth[e][2]<t&&(t=this._depth[e][2]),t<0&&(t=0);for(var n=1;n<3;n++){var i=0;this._depth[e][n]>t&&(i=1),this._depth[e][n]=i}}}},{key:"getDelta",value:function(e){return this._depth[e][B.RIGHT]-this._depth[e][B.LEFT]}},{key:"getLocation",value:function(e,t){return this._depth[e][t]<=0?I.EXTERIOR:I.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var e=arguments[0],t=0;t<2;t++)for(var n=1;n<3;n++){var i=e.getLocation(t,n);i!==I.EXTERIOR&&i!==I.INTERIOR||(this.isNull(t,n)?this._depth[t][n]=s.depthAtLocation(i):this._depth[t][n]+=s.depthAtLocation(i))}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];g===I.INTERIOR&&this._depth[u][f]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var e=0;e<2;e++)for(var t=0;t<3;t++)this._depth[e][t]=s.NULL_VALUE}},{key:"depthAtLocation",value:function(e){return e===I.EXTERIOR?0:e===I.INTERIOR?1:s.NULL_VALUE}}]),s}();nc.NULL_VALUE=-1;var rc=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var n=new Array(2).fill(null);return n[0]=this.pts[0],n[1]=this.pts[1],new t(n,We.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(n){this._isIsolated=n}},{key:"setName",value:function(n){this._name=n}},{key:"equals",value:function(n){if(!(n instanceof t))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var u=!0,f=!0,g=this.pts.length,y=0;y<this.pts.length;y++)if(this.pts[y].equals2D(i.pts[y])||(u=!1),this.pts[y].equals2D(i.pts[--g])||(f=!1),!u&&!f)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}}},{key:"print",value:function(n){n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i<this.pts.length;i++)i>0&&n.print(","),n.print(this.pts[i].x+" "+this.pts[i].y);n.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(n){t.updateIM(this._label,n)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(n){n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(this.pts[i]+" ");n.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new jm(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new pe;for(var n=0;n<this.pts.length;n++)this._env.expandToInclude(this.pts[n])}return this._env}},{key:"addIntersection",value:function(n,i,u,f){var g=new O(n.getIntersection(f)),y=i,d=n.getEdgeDistance(u,f),N=y+1;if(N<this.pts.length){var b=this.pts[N];g.equals2D(b)&&(y=N,d=0)}this.eiList.add(g,y,d)}},{key:"toString",value:function(){var n=new Jr;n.append("edge "+this._name+": "),n.append("LINESTRING (");for(var i=0;i<this.pts.length;i++)i>0&&n.append(","),n.append(this.pts[i].x+" "+this.pts[i].y);return n.append(") "+this._label+" "+this._depthDelta),n.toString()}},{key:"isPointwiseEqual",value:function(n){if(this.pts.length!==n.pts.length)return!1;for(var i=0;i<this.pts.length;i++)if(!this.pts[i].equals2D(n.pts[i]))return!1;return!0}},{key:"setDepthDelta",value:function(n){this._depthDelta=n}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(n,i,u){for(var f=0;f<n.getIntersectionNum();f++)this.addIntersection(n,i,u,f)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new zm(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new nc,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.constructor_.call(this,n,null)}else if(arguments.length===2){var i=arguments[0],u=arguments[1];this.pts=i,this._label=u}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Ym&&arguments[0]instanceof We))return w(v(t),"updateIM",this).apply(this,arguments);var n=arguments[0],i=arguments[1];i.setAtLeastIfValid(n.getLocation(0,B.ON),n.getLocation(1,B.ON),1),n.isArea()&&(i.setAtLeastIfValid(n.getLocation(0,B.LEFT),n.getLocation(1,B.LEFT),2),i.setAtLeastIfValid(n.getLocation(0,B.RIGHT),n.getLocation(1,B.RIGHT),2))}}]),t}(Fl),ic=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"setWorkingPrecisionModel",value:function(e){this._workingPrecisionModel=e}},{key:"insertUniqueEdge",value:function(e){var t=this._edgeList.findEqualEdge(e);if(t!==null){var n=t.getLabel(),i=e.getLabel();t.isPointwiseEqual(e)||(i=new We(e.getLabel())).flip(),n.merge(i);var u=s.depthDelta(i),f=t.getDepthDelta()+u;t.setDepthDelta(f)}else this._edgeList.add(e),e.setDepthDelta(s.depthDelta(e.getLabel()))}},{key:"buildSubgraphs",value:function(e,t){for(var n=new Z,i=e.iterator();i.hasNext();){var u=i.next(),f=u.getRightmostCoordinate(),g=new Jl(n).getDepth(f);u.computeDepth(g),u.findResultEdges(),n.add(u),t.add(u.getDirectedEdges(),u.getNodes())}}},{key:"createSubgraphs",value:function(e){for(var t=new Z,n=e.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var u=new Jp;u.create(i),t.add(u)}}return dn.sort(t,dn.reverseOrder()),t}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(e){if(this._workingNoder!==null)return this._workingNoder;var t=new qs,n=new Vt;return n.setPrecisionModel(e),t.setSegmentIntersector(new $m(n)),t}},{key:"buffer",value:function(e,t){var n=this._workingPrecisionModel;n===null&&(n=e.getPrecisionModel()),this._geomFact=e.getFactory();var i=new Lm(n,this._bufParams),u=new Cm(e,t,i).getCurves();if(u.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(u,n),this._graph=new Yl(new Gm),this._graph.addEdges(this._edgeList.getEdges());var f=this.createSubgraphs(this._graph),g=new mm(this._geomFact);this.buildSubgraphs(f,g);var y=g.getPolygons();return y.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(y)}},{key:"computeNodedEdges",value:function(e,t){var n=this.getNoder(t);n.computeNodes(e);for(var i=n.getNodedSubstrings().iterator();i.hasNext();){var u=i.next(),f=u.getCoordinates();if(f.length!==2||!f[0].equals2D(f[1])){var g=u.getData(),y=new rc(u.getCoordinates(),new We(g));this.insertUniqueEdge(y)}}}},{key:"setNoder",value:function(e){this._workingNoder=e}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Bm;var e=arguments[0];this._bufParams=e}},{key:"depthDelta",value:function(e){var t=e.getLocation(0,B.LEFT),n=e.getLocation(0,B.RIGHT);return t===I.INTERIOR&&n===I.EXTERIOR?1:t===I.EXTERIOR&&n===I.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(e){for(var t=new pn,n=new Z;e.hasNext();){var i=e.next(),u=t.createLineString(i.getCoordinates());n.add(u)}return t.buildGeometry(n)}}]),s}(),Vm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"rescale",value:function(){if(re(arguments[0],ct))for(var e=arguments[0],t=e.iterator();t.hasNext();){var n=t.next();this.rescale(n.getCoordinates())}else if(arguments[0]instanceof Array){for(var i=arguments[0],u=0;u<i.length;u++)i[u].x=i[u].x/this._scaleFactor+this._offsetX,i[u].y=i[u].y/this._scaleFactor+this._offsetY;i.length===2&&i[0].equals2D(i[1])&&je.out.println(i)}}},{key:"scale",value:function(){if(re(arguments[0],ct)){for(var e=arguments[0],t=new Z(e.size()),n=e.iterator();n.hasNext();){var i=n.next();t.add(new Wt(this.scale(i.getCoordinates()),i.getData()))}return t}if(arguments[0]instanceof Array){for(var u=arguments[0],f=new Array(u.length).fill(null),g=0;g<u.length;g++)f[g]=new O(Math.round((u[g].x-this._offsetX)*this._scaleFactor),Math.round((u[g].y-this._offsetY)*this._scaleFactor),u[g].getZ());var y=Ee.removeRepeatedPoints(f);return y}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var e=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(e),e}},{key:"computeNodes",value:function(e){var t=e;this._isScaled&&(t=this.scale(e)),this._noder.computeNodes(t)}},{key:"interfaces_",get:function(){return[$s]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var e=arguments[0],t=arguments[1];s.constructor_.call(this,e,t,0,0)}else if(arguments.length===4){var n=arguments[0],i=arguments[1];this._noder=n,this._scaleFactor=i,this._isScaled=!this.isIntegerPrecision()}}}]),s}(),sc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var t=e.next(),n=t.getCoordinates();this.checkEndPtVertexIntersections(n[0],this._segStrings),this.checkEndPtVertexIntersections(n[n.length-1],this._segStrings)}else if(arguments.length===2){for(var i=arguments[0],u=arguments[1],f=u.iterator();f.hasNext();)for(var g=f.next(),y=g.getCoordinates(),d=1;d<y.length-1;d++)if(y[d].equals(i))throw new Ne("found endpt/interior pt intersection at index "+d+" :pt "+i)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();)for(var t=e.next(),n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkInteriorIntersections(t,i)}else if(arguments.length===2)for(var u=arguments[0],f=arguments[1],g=u.getCoordinates(),y=f.getCoordinates(),d=0;d<g.length-1;d++)for(var N=0;N<y.length-1;N++)this.checkInteriorIntersections(u,d,f,N);else if(arguments.length===4){var b=arguments[0],L=arguments[1],F=arguments[2],D=arguments[3];if(b===F&&L===D)return null;var V=b.getCoordinates()[L],H=b.getCoordinates()[L+1],K=F.getCoordinates()[D],ge=F.getCoordinates()[D+1];if(this._li.computeIntersection(V,H,K,ge),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,V,H)||this.hasInteriorIntersection(this._li,K,ge)))throw new Ne("found non-noded intersection at "+V+"-"+H+" and "+K+"-"+ge)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var t=e.next();this.checkCollapses(t)}else if(arguments.length===1)for(var n=arguments[0],i=n.getCoordinates(),u=0;u<i.length-2;u++)this.checkCollapse(i[u],i[u+1],i[u+2])}},{key:"hasInteriorIntersection",value:function(e,t,n){for(var i=0;i<e.getIntersectionNum();i++){var u=e.getIntersection(i);if(!u.equals(t)&&!u.equals(n))return!0}return!1}},{key:"checkCollapse",value:function(e,t,n){if(e.equals(n))throw new Ne("found non-noded collapse at "+s.fact.createLineString([e,t,n]))}}],[{key:"constructor_",value:function(){this._li=new Vt,this._segStrings=null;var e=arguments[0];this._segStrings=e}}]),s}();sc.fact=new pn;var Ys=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"intersectsScaled",value:function(e,t){var n=Math.min(e.x,t.x),i=Math.max(e.x,t.x),u=Math.min(e.y,t.y),f=Math.max(e.y,t.y),g=this._maxx<n||this._minx>i||this._maxy<u||this._miny>f;if(g)return!1;var y=this.intersectsToleranceSquare(e,t);return se.isTrue(!(g&&y),"Found bad envelope test"),y}},{key:"initCorners",value:function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,this._corner[0]=new O(this._maxx,this._maxy),this._corner[1]=new O(this._minx,this._maxy),this._corner[2]=new O(this._minx,this._miny),this._corner[3]=new O(this._maxx,this._miny)}},{key:"intersects",value:function(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(e){return Math.round(e*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var e=s.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new pe(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(e,t){var n=!1,i=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!n||!i)||!!e.equals(this._pt)||!!t.equals(this._pt))))}},{key:"addSnappedNode",value:function(e,t){var n=e.getCoordinate(t),i=e.getCoordinate(t+1);return!!this.intersects(n,i)&&(e.addIntersection(this.getCoordinate(),t),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var e=arguments[0],t=arguments[1],n=arguments[2];if(this._originalPt=e,this._pt=e,this._scaleFactor=t,this._li=n,t<=0)throw new M("Scale factor must be non-zero");t!==1&&(this._pt=new O(this.scale(e.x),this.scale(e.y)),this._p0Scaled=new O,this._p1Scaled=new O),this.initCorners(this._pt)}}]),s}();Ys.SAFE_ENV_EXPANSION_FACTOR=.75;var Wm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"select",value:function(){if(arguments.length!==1){if(arguments.length===2){var e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}}}}],[{key:"constructor_",value:function(){this.selectedSegment=new Be}}]),s}(),ac=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"snap",value:function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],u=t.getSafeEnvelope(),f=new oc(t,n,i);return this._index.query(u,new(function(){function g(){a(this,g)}return c(g,[{key:"interfaces_",get:function(){return[Xl]}},{key:"visitItem",value:function(y){y.select(u,f)}}]),g}())),f.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var e=arguments[0];this._index=e}}]),s}(),oc=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof Vl))return w(v(t.prototype),"select",this).apply(this,arguments);var n=arguments[0],i=arguments[1],u=n.getContext();if(this._parentEdge===u&&(i===this._hotPixelVertexIndex||i+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(u,i)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],i=arguments[1],u=arguments[2];this._hotPixel=n,this._parentEdge=i,this._hotPixelVertexIndex=u}}]),t}(Wm);ac.HotPixelSnapAction=oc;var Hm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"processIntersections",value:function(e,t,n,i){if(e===n&&t===i)return null;var u=e.getCoordinates()[t],f=e.getCoordinates()[t+1],g=n.getCoordinates()[i],y=n.getCoordinates()[i+1];if(this._li.computeIntersection(u,f,g,y),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var d=0;d<this._li.getIntersectionNum();d++)this._interiorIntersections.add(this._li.getIntersection(d));e.addIntersections(this._li,t,0),n.addIntersections(this._li,i,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[tc]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new Z}}]),s}(),Zm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"checkCorrectness",value:function(e){var t=Wt.getNodedSubstrings(e),n=new sc(t);try{n.checkValid()}catch(i){if(!(i instanceof G))throw i;i.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return Wt.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(e,t){var n=this.findInteriorIntersections(e,t);this.computeIntersectionSnaps(n),this.computeVertexSnaps(e)}},{key:"findInteriorIntersections",value:function(e,t){var n=new Hm(t);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(e),n.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(re(arguments[0],ct))for(var e=arguments[0],t=e.iterator();t.hasNext();){var n=t.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Wt)for(var i=arguments[0],u=i.getCoordinates(),f=0;f<u.length;f++){var g=new Ys(u[f],this._scaleFactor,this._li),y=this._pointSnapper.snap(g,i,f);y&&i.addIntersection(u[f],f)}}},{key:"computeNodes",value:function(e){this._nodedSegStrings=e,this._noder=new qs,this._pointSnapper=new ac(this._noder.getIndex()),this.snapRound(e,this._li)}},{key:"computeIntersectionSnaps",value:function(e){for(var t=e.iterator();t.hasNext();){var n=t.next(),i=new Ys(n,this._scaleFactor,this._li);this._pointSnapper.snap(i)}}},{key:"interfaces_",get:function(){return[$s]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var e=arguments[0];this._pm=e,this._li=new Vt,this._li.setPrecisionModel(e),this._scaleFactor=e.getScale()}}]),s}(),En=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"bufferFixedPrecision",value:function(e){var t=new Vm(new Zm(new tt(1)),e.getScale()),n=new ic(this._bufParams);n.setWorkingPrecisionModel(e),n.setNoder(t),this._resultGeometry=n.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var e=s.MAX_PRECISION_DIGITS;e>=0;e--){try{this.bufferReducedPrecision(e)}catch(u){if(!(u instanceof xt))throw u;this._saveException=u}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var t=arguments[0],n=s.precisionScaleFactor(this._argGeom,this._distance,t),i=new tt(n);this.bufferFixedPrecision(i)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===tt.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(e){this._bufParams.setQuadrantSegments(e)}},{key:"bufferOriginalPrecision",value:function(){try{var e=new ic(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof Ne))throw t;this._saveException=t}}},{key:"getResultGeometry",value:function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(e){this._bufParams.setEndCapStyle(e)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new R,this._resultGeometry=null,this._saveException=null,arguments.length===1){var e=arguments[0];this._argGeom=e}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this._argGeom=t,this._bufParams=n}}},{key:"bufferOp",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new s(e),i=n.getResultGeometry(t);return i}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof W&&typeof arguments[1]=="number"){var u=arguments[0],f=arguments[1],g=arguments[2],y=new s(u);y.setQuadrantSegments(g);var d=y.getResultGeometry(f);return d}if(arguments[2]instanceof R&&arguments[0]instanceof W&&typeof arguments[1]=="number"){var N=arguments[0],b=arguments[1],L=arguments[2],F=new s(N,L),D=F.getResultGeometry(b);return D}}else if(arguments.length===4){var V=arguments[0],H=arguments[1],K=arguments[2],ge=arguments[3],xe=new s(V);xe.setQuadrantSegments(K),xe.setEndCapStyle(ge);var Re=xe.getResultGeometry(H);return Re}}},{key:"precisionScaleFactor",value:function(e,t,n){var i=e.getEnvelopeInternal(),u=zn.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY()))+2*(t>0?t:0),f=n-Math.trunc(Math.log(u)/Math.log(10)+1);return Math.pow(10,f)}}]),s}();En.CAP_ROUND=R.CAP_ROUND,En.CAP_BUTT=R.CAP_FLAT,En.CAP_FLAT=R.CAP_FLAT,En.CAP_SQUARE=R.CAP_SQUARE,En.MAX_PRECISION_DIGITS=12;var Jm=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],uc=function(){function s(e){a(this,s),this.geometryFactory=e||new pn}return c(s,[{key:"read",value:function(e){var t,n=(t=typeof e=="string"?JSON.parse(e):e).type;if(!Ze[n])throw new Error("Unknown GeoJSON type: "+t.type);return Jm.indexOf(n)!==-1?Ze[n].call(this,t.coordinates):n==="GeometryCollection"?Ze[n].call(this,t.geometries):Ze[n].call(this,t)}},{key:"write",value:function(e){var t=e.getGeometryType();if(!yt[t])throw new Error("Geometry is not supported");return yt[t].call(this,e)}}]),s}(),Ze={Feature:function(s){var e={};for(var t in s)e[t]=s[t];if(s.geometry){var n=s.geometry.type;if(!Ze[n])throw new Error("Unknown GeoJSON type: "+s.type);e.geometry=this.read(s.geometry)}return s.bbox&&(e.bbox=Ze.bbox.call(this,s.bbox)),e},FeatureCollection:function(s){var e={};if(s.features){e.features=[];for(var t=0;t<s.features.length;++t)e.features.push(this.read(s.features[t]))}return s.bbox&&(e.bbox=this.parse.bbox.call(this,s.bbox)),e},coordinates:function(s){for(var e=[],t=0;t<s.length;++t){var n=s[t];e.push(x(O,T(n)))}return e},bbox:function(s){return this.geometryFactory.createLinearRing([new O(s[0],s[1]),new O(s[2],s[1]),new O(s[2],s[3]),new O(s[0],s[3]),new O(s[0],s[1])])},Point:function(s){var e=x(O,T(s));return this.geometryFactory.createPoint(e)},MultiPoint:function(s){for(var e=[],t=0;t<s.length;++t)e.push(Ze.Point.call(this,s[t]));return this.geometryFactory.createMultiPoint(e)},LineString:function(s){var e=Ze.coordinates.call(this,s);return this.geometryFactory.createLineString(e)},MultiLineString:function(s){for(var e=[],t=0;t<s.length;++t)e.push(Ze.LineString.call(this,s[t]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(s){for(var e=Ze.coordinates.call(this,s[0]),t=this.geometryFactory.createLinearRing(e),n=[],i=1;i<s.length;++i){var u=s[i],f=Ze.coordinates.call(this,u),g=this.geometryFactory.createLinearRing(f);n.push(g)}return this.geometryFactory.createPolygon(t,n)},MultiPolygon:function(s){for(var e=[],t=0;t<s.length;++t){var n=s[t];e.push(Ze.Polygon.call(this,n))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(s){for(var e=[],t=0;t<s.length;++t){var n=s[t];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},yt={coordinate:function(s){var e=[s.x,s.y];return s.z&&e.push(s.z),s.m&&e.push(s.m),e},Point:function(s){return{type:"Point",coordinates:yt.coordinate.call(this,s.getCoordinate())}},MultiPoint:function(s){for(var e=[],t=0;t<s._geometries.length;++t){var n=s._geometries[t],i=yt.Point.call(this,n);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(s){for(var e=[],t=s.getCoordinates(),n=0;n<t.length;++n){var i=t[n];e.push(yt.coordinate.call(this,i))}return{type:"LineString",coordinates:e}},MultiLineString:function(s){for(var e=[],t=0;t<s._geometries.length;++t){var n=s._geometries[t],i=yt.LineString.call(this,n);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(s){var e=[],t=yt.LineString.call(this,s._shell);e.push(t.coordinates);for(var n=0;n<s._holes.length;++n){var i=s._holes[n],u=yt.LineString.call(this,i);e.push(u.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(s){for(var e=[],t=0;t<s._geometries.length;++t){var n=s._geometries[t],i=yt.Polygon.call(this,n);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(s){for(var e=[],t=0;t<s._geometries.length;++t){var n=s._geometries[t],i=n.getGeometryType();e.push(yt[i].call(this,n))}return{type:"GeometryCollection",geometries:e}}};return{BufferOp:En,GeoJSONReader:function(){function s(e){a(this,s),this.parser=new uc(e||new pn)}return c(s,[{key:"read",value:function(e){return this.parser.read(e)}}]),s}(),GeoJSONWriter:function(){function s(){a(this,s),this.parser=new uc(this.geometryFactory)}return c(s,[{key:"write",value:function(e){return this.parser.write(e)}}]),s}()}})})(wu);var Dv=wu.exports;const Fv=Ws(Dv);function Tt(){return new Lr}function Lr(){this.reset()}Lr.prototype={constructor:Lr,reset:function(){this.s=this.t=0},add:function(o){Nu(Rr,o,this.t),Nu(this,Rr.s,this.s),this.s?this.t+=Rr.t:this.s=Rr.t},valueOf:function(){return this.s}};var Rr=new Lr;function Nu(o,r,a){var l=o.s=r+a,c=l-r,h=l-c;o.t=r-h+(a-c)}var ye=1e-6,ce=Math.PI,ut=ce/2,bu=ce/4,lt=ce*2,Lt=180/ce,Ue=ce/180,Se=Math.abs,Gv=Math.atan,ln=Math.atan2,de=Math.cos,_e=Math.sin,cn=Math.sqrt;function Ou(o){return o>1?0:o<-1?ce:Math.acos(o)}function qt(o){return o>1?ut:o<-1?-ut:Math.asin(o)}function An(){}function Cr(o,r){o&&Lu.hasOwnProperty(o.type)&&Lu[o.type](o,r)}var Tu={Feature:function(o,r){Cr(o.geometry,r)},FeatureCollection:function(o,r){for(var a=o.features,l=-1,c=a.length;++l<c;)Cr(a[l].geometry,r)}},Lu={Sphere:function(o,r){r.sphere()},Point:function(o,r){o=o.coordinates,r.point(o[0],o[1],o[2])},MultiPoint:function(o,r){for(var a=o.coordinates,l=-1,c=a.length;++l<c;)o=a[l],r.point(o[0],o[1],o[2])},LineString:function(o,r){os(o.coordinates,r,0)},MultiLineString:function(o,r){for(var a=o.coordinates,l=-1,c=a.length;++l<c;)os(a[l],r,0)},Polygon:function(o,r){Ru(o.coordinates,r)},MultiPolygon:function(o,r){for(var a=o.coordinates,l=-1,c=a.length;++l<c;)Ru(a[l],r)},GeometryCollection:function(o,r){for(var a=o.geometries,l=-1,c=a.length;++l<c;)Cr(a[l],r)}};function os(o,r,a){var l=-1,c=o.length-a,h;for(r.lineStart();++l<c;)h=o[l],r.point(h[0],h[1],h[2]);r.lineEnd()}function Ru(o,r){var a=-1,l=o.length;for(r.polygonStart();++a<l;)os(o[a],r,1);r.polygonEnd()}function Bv(o,r){o&&Tu.hasOwnProperty(o.type)?Tu[o.type](o,r):Cr(o,r)}Tt(),Tt();function us(o){return[ln(o[1],o[0]),qt(o[2])]}function fn(o){var r=o[0],a=o[1],l=de(a);return[l*de(r),l*_e(r),_e(a)]}function Pr(o,r){return o[0]*r[0]+o[1]*r[1]+o[2]*r[2]}function Ar(o,r){return[o[1]*r[2]-o[2]*r[1],o[2]*r[0]-o[0]*r[2],o[0]*r[1]-o[1]*r[0]]}function ls(o,r){o[0]+=r[0],o[1]+=r[1],o[2]+=r[2]}function Mr(o,r){return[o[0]*r,o[1]*r,o[2]*r]}function cs(o){var r=cn(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]);o[0]/=r,o[1]/=r,o[2]/=r}Tt();function Cu(o,r){function a(l,c){return l=o(l,c),r(l[0],l[1])}return o.invert&&r.invert&&(a.invert=function(l,c){return l=r.invert(l,c),l&&o.invert(l[0],l[1])}),a}function fs(o,r){return[o>ce?o-lt:o<-ce?o+lt:o,r]}fs.invert=fs;function $v(o,r,a){return(o%=lt)?r||a?Cu(Au(o),Mu(r,a)):Au(o):r||a?Mu(r,a):fs}function Pu(o){return function(r,a){return r+=o,[r>ce?r-lt:r<-ce?r+lt:r,a]}}function Au(o){var r=Pu(o);return r.invert=Pu(-o),r}function Mu(o,r){var a=de(o),l=_e(o),c=de(r),h=_e(r);function v(p,_){var x=de(_),S=de(p)*x,m=_e(p)*x,E=_e(_),k=E*a+S*l;return[ln(m*c-k*h,S*a-E*l),qt(k*c+m*h)]}return v.invert=function(p,_){var x=de(_),S=de(p)*x,m=_e(p)*x,E=_e(_),k=E*c-m*h;return[ln(m*c+E*h,S*a+k*l),qt(k*a-S*l)]},v}function qv(o,r,a,l,c,h){if(a){var v=de(r),p=_e(r),_=l*a;c==null?(c=r+l*lt,h=r-_/2):(c=Du(v,c),h=Du(v,h),(l>0?c<h:c>h)&&(c+=l*lt));for(var x,S=c;l>0?S>h:S<h;S-=_)x=us([v,-p*de(S),-p*_e(S)]),o.point(x[0],x[1])}}function Du(o,r){r=fn(r),r[0]-=o,cs(r);var a=Ou(-r[1]);return((-r[2]<0?-a:a)+lt-ye)%lt}function Fu(){var o=[],r;return{point:function(a,l){r.push([a,l])},lineStart:function(){o.push(r=[])},lineEnd:An,rejoin:function(){o.length>1&&o.push(o.pop().concat(o.shift()))},result:function(){var a=o;return o=[],r=null,a}}}function zv(o,r,a,l,c,h){var v=o[0],p=o[1],_=r[0],x=r[1],S=0,m=1,E=_-v,k=x-p,w;if(w=a-v,!(!E&&w>0)){if(w/=E,E<0){if(w<S)return;w<m&&(m=w)}else if(E>0){if(w>m)return;w>S&&(S=w)}if(w=c-v,!(!E&&w<0)){if(w/=E,E<0){if(w>m)return;w>S&&(S=w)}else if(E>0){if(w<S)return;w<m&&(m=w)}if(w=l-p,!(!k&&w>0)){if(w/=k,k<0){if(w<S)return;w<m&&(m=w)}else if(k>0){if(w>m)return;w>S&&(S=w)}if(w=h-p,!(!k&&w<0)){if(w/=k,k<0){if(w>m)return;w>S&&(S=w)}else if(k>0){if(w<S)return;w<m&&(m=w)}return S>0&&(o[0]=v+S*E,o[1]=p+S*k),m<1&&(r[0]=v+m*E,r[1]=p+m*k),!0}}}}}function Dr(o,r){return Se(o[0]-r[0])<ye&&Se(o[1]-r[1])<ye}function Fr(o,r,a,l){this.x=o,this.z=r,this.o=a,this.e=l,this.v=!1,this.n=this.p=null}function Gu(o,r,a,l,c){var h=[],v=[],p,_;if(o.forEach(function(w){if(!((T=w.length-1)<=0)){var T,C=w[0],P=w[T],A;if(Dr(C,P)){for(c.lineStart(),p=0;p<T;++p)c.point((C=w[p])[0],C[1]);c.lineEnd();return}h.push(A=new Fr(C,w,null,!0)),v.push(A.o=new Fr(C,null,A,!1)),h.push(A=new Fr(P,w,null,!1)),v.push(A.o=new Fr(P,null,A,!0))}}),!!h.length){for(v.sort(r),Bu(h),Bu(v),p=0,_=v.length;p<_;++p)v[p].e=a=!a;for(var x=h[0],S,m;;){for(var E=x,k=!0;E.v;)if((E=E.n)===x)return;S=E.z,c.lineStart();do{if(E.v=E.o.v=!0,E.e){if(k)for(p=0,_=S.length;p<_;++p)c.point((m=S[p])[0],m[1]);else l(E.x,E.n.x,1,c);E=E.n}else{if(k)for(S=E.p.z,p=S.length-1;p>=0;--p)c.point((m=S[p])[0],m[1]);else l(E.x,E.p.x,-1,c);E=E.p}E=E.o,S=E.z,k=!k}while(!E.v);c.lineEnd()}}}function Bu(o){if(r=o.length){for(var r,a=0,l=o[0],c;++a<r;)l.n=c=o[a],c.p=l,l=c;l.n=c=o[0],c.p=l}}function $u(o,r){return o<r?-1:o>r?1:o>=r?0:NaN}function Yv(o){return o.length===1&&(o=Uv(o)),{left:function(r,a,l,c){for(l==null&&(l=0),c==null&&(c=r.length);l<c;){var h=l+c>>>1;o(r[h],a)<0?l=h+1:c=h}return l},right:function(r,a,l,c){for(l==null&&(l=0),c==null&&(c=r.length);l<c;){var h=l+c>>>1;o(r[h],a)>0?c=h:l=h+1}return l}}}function Uv(o){return function(r,a){return $u(o(r),a)}}Yv($u);function qu(o){for(var r=o.length,a,l=-1,c=0,h,v;++l<r;)c+=o[l].length;for(h=new Array(c);--r>=0;)for(v=o[r],a=v.length;--a>=0;)h[--c]=v[a];return h}var Mn=1e9,Gr=-Mn;function Xv(o,r,a,l){function c(x,S){return o<=x&&x<=a&&r<=S&&S<=l}function h(x,S,m,E){var k=0,w=0;if(x==null||(k=v(x,m))!==(w=v(S,m))||_(x,S)<0^m>0)do E.point(k===0||k===3?o:a,k>1?l:r);while((k=(k+m+4)%4)!==w);else E.point(S[0],S[1])}function v(x,S){return Se(x[0]-o)<ye?S>0?0:3:Se(x[0]-a)<ye?S>0?2:1:Se(x[1]-r)<ye?S>0?1:0:S>0?3:2}function p(x,S){return _(x.x,S.x)}function _(x,S){var m=v(x,1),E=v(S,1);return m!==E?m-E:m===0?S[1]-x[1]:m===1?x[0]-S[0]:m===2?x[1]-S[1]:S[0]-x[0]}return function(x){var S=x,m=Fu(),E,k,w,T,C,P,A,R,G,M,$,Y={point:U,lineStart:te,lineEnd:ae,polygonStart:ie,polygonEnd:ee};function U(ne,ue){c(ne,ue)&&S.point(ne,ue)}function X(){for(var ne=0,ue=0,ve=k.length;ue<ve;++ue)for(var Ie=k[ue],we=1,j=Ie.length,Pe=Ie[0],Ne,De,se=Pe[0],_t=Pe[1];we<j;++we)Ne=se,De=_t,Pe=Ie[we],se=Pe[0],_t=Pe[1],De<=l?_t>l&&(se-Ne)*(l-De)>(_t-De)*(o-Ne)&&++ne:_t<=l&&(se-Ne)*(l-De)<(_t-De)*(o-Ne)&&--ne;return ne}function ie(){S=m,E=[],k=[],$=!0}function ee(){var ne=X(),ue=$&&ne,ve=(E=qu(E)).length;(ue||ve)&&(x.polygonStart(),ue&&(x.lineStart(),h(null,null,1,x),x.lineEnd()),ve&&Gu(E,p,ne,h,x),x.polygonEnd()),S=x,E=k=w=null}function te(){Y.point=q,k&&k.push(w=[]),M=!0,G=!1,A=R=NaN}function ae(){E&&(q(T,C),P&&G&&m.rejoin(),E.push(m.result())),Y.point=U,G&&S.lineEnd()}function q(ne,ue){var ve=c(ne,ue);if(k&&w.push([ne,ue]),M)T=ne,C=ue,P=ve,M=!1,ve&&(S.lineStart(),S.point(ne,ue));else if(ve&&G)S.point(ne,ue);else{var Ie=[A=Math.max(Gr,Math.min(Mn,A)),R=Math.max(Gr,Math.min(Mn,R))],we=[ne=Math.max(Gr,Math.min(Mn,ne)),ue=Math.max(Gr,Math.min(Mn,ue))];zv(Ie,we,o,r,a,l)?(G||(S.lineStart(),S.point(Ie[0],Ie[1])),S.point(we[0],we[1]),ve||S.lineEnd(),$=!1):ve&&(S.lineStart(),S.point(ne,ue),$=!1)}A=ne,R=ue,G=ve}return Y}}var hs=Tt();function jv(o,r){var a=r[0],l=r[1],c=[_e(a),-de(a),0],h=0,v=0;hs.reset();for(var p=0,_=o.length;p<_;++p)if(S=(x=o[p]).length)for(var x,S,m=x[S-1],E=m[0],k=m[1]/2+bu,w=_e(k),T=de(k),C=0;C<S;++C,E=A,w=G,T=M,m=P){var P=x[C],A=P[0],R=P[1]/2+bu,G=_e(R),M=de(R),$=A-E,Y=$>=0?1:-1,U=Y*$,X=U>ce,ie=w*G;if(hs.add(ln(ie*Y*_e(U),T*M+ie*de(U))),h+=X?$+Y*lt:$,X^E>=a^A>=a){var ee=Ar(fn(m),fn(P));cs(ee);var te=Ar(c,ee);cs(te);var ae=(X^$>=0?-1:1)*qt(te[2]);(l>ae||l===ae&&(ee[0]||ee[1]))&&(v+=X^$>=0?1:-1)}}return(h<-ye||h<ye&&hs<-ye)^v&1}Tt();function zu(o){return o}Tt(),Tt();var hn=1/0,Br=hn,Dn=-hn,$r=Dn,Yu={point:Vv,lineStart:An,lineEnd:An,polygonStart:An,polygonEnd:An,result:function(){var o=[[hn,Br],[Dn,$r]];return Dn=$r=-(Br=hn=1/0),o}};function Vv(o,r){o<hn&&(hn=o),o>Dn&&(Dn=o),r<Br&&(Br=r),r>$r&&($r=r)}Tt();function Uu(o,r,a,l){return function(c,h){var v=r(h),p=c.invert(l[0],l[1]),_=Fu(),x=r(_),S=!1,m,E,k,w={point:T,lineStart:P,lineEnd:A,polygonStart:function(){w.point=R,w.lineStart=G,w.lineEnd=M,E=[],m=[]},polygonEnd:function(){w.point=T,w.lineStart=P,w.lineEnd=A,E=qu(E);var $=jv(m,p);E.length?(S||(h.polygonStart(),S=!0),Gu(E,Hv,$,a,h)):$&&(S||(h.polygonStart(),S=!0),h.lineStart(),a(null,null,1,h),h.lineEnd()),S&&(h.polygonEnd(),S=!1),E=m=null},sphere:function(){h.polygonStart(),h.lineStart(),a(null,null,1,h),h.lineEnd(),h.polygonEnd()}};function T($,Y){var U=c($,Y);o($=U[0],Y=U[1])&&h.point($,Y)}function C($,Y){var U=c($,Y);v.point(U[0],U[1])}function P(){w.point=C,v.lineStart()}function A(){w.point=T,v.lineEnd()}function R($,Y){k.push([$,Y]);var U=c($,Y);x.point(U[0],U[1])}function G(){x.lineStart(),k=[]}function M(){R(k[0][0],k[0][1]),x.lineEnd();var $=x.clean(),Y=_.result(),U,X=Y.length,ie,ee,te;if(k.pop(),m.push(k),k=null,!!X){if($&1){if(ee=Y[0],(ie=ee.length-1)>0){for(S||(h.polygonStart(),S=!0),h.lineStart(),U=0;U<ie;++U)h.point((te=ee[U])[0],te[1]);h.lineEnd()}return}X>1&&$&2&&Y.push(Y.pop().concat(Y.shift())),E.push(Y.filter(Wv))}}return w}}function Wv(o){return o.length>1}function Hv(o,r){return((o=o.x)[0]<0?o[1]-ut-ye:ut-o[1])-((r=r.x)[0]<0?r[1]-ut-ye:ut-r[1])}const Xu=Uu(function(){return!0},Zv,Qv,[-ce,-ut]);function Zv(o){var r=NaN,a=NaN,l=NaN,c;return{lineStart:function(){o.lineStart(),c=1},point:function(h,v){var p=h>0?ce:-ce,_=Se(h-r);Se(_-ce)<ye?(o.point(r,a=(a+v)/2>0?ut:-ut),o.point(l,a),o.lineEnd(),o.lineStart(),o.point(p,a),o.point(h,a),c=0):l!==p&&_>=ce&&(Se(r-l)<ye&&(r-=l*ye),Se(h-p)<ye&&(h-=p*ye),a=Jv(r,a,h,v),o.point(l,a),o.lineEnd(),o.lineStart(),o.point(p,a),c=0),o.point(r=h,a=v),l=p},lineEnd:function(){o.lineEnd(),r=a=NaN},clean:function(){return 2-c}}}function Jv(o,r,a,l){var c,h,v=_e(o-a);return Se(v)>ye?Gv((_e(r)*(h=de(l))*_e(a)-_e(l)*(c=de(r))*_e(o))/(c*h*v)):(r+l)/2}function Qv(o,r,a,l){var c;if(o==null)c=a*ut,l.point(-ce,c),l.point(0,c),l.point(ce,c),l.point(ce,0),l.point(ce,-c),l.point(0,-c),l.point(-ce,-c),l.point(-ce,0),l.point(-ce,c);else if(Se(o[0]-r[0])>ye){var h=o[0]<r[0]?ce:-ce;c=a*h/2,l.point(-h,c),l.point(0,c),l.point(h,c)}else l.point(r[0],r[1])}function Kv(o,r){var a=de(o),l=a>0,c=Se(a)>ye;function h(S,m,E,k){qv(k,o,r,E,S,m)}function v(S,m){return de(S)*de(m)>a}function p(S){var m,E,k,w,T;return{lineStart:function(){w=k=!1,T=1},point:function(C,P){var A=[C,P],R,G=v(C,P),M=l?G?0:x(C,P):G?x(C+(C<0?ce:-ce),P):0;if(!m&&(w=k=G)&&S.lineStart(),G!==k&&(R=_(m,A),(!R||Dr(m,R)||Dr(A,R))&&(A[0]+=ye,A[1]+=ye,G=v(A[0],A[1]))),G!==k)T=0,G?(S.lineStart(),R=_(A,m),S.point(R[0],R[1])):(R=_(m,A),S.point(R[0],R[1]),S.lineEnd()),m=R;else if(c&&m&&l^G){var $;!(M&E)&&($=_(A,m,!0))&&(T=0,l?(S.lineStart(),S.point($[0][0],$[0][1]),S.point($[1][0],$[1][1]),S.lineEnd()):(S.point($[1][0],$[1][1]),S.lineEnd(),S.lineStart(),S.point($[0][0],$[0][1])))}G&&(!m||!Dr(m,A))&&S.point(A[0],A[1]),m=A,k=G,E=M},lineEnd:function(){k&&S.lineEnd(),m=null},clean:function(){return T|(w&&k)<<1}}}function _(S,m,E){var k=fn(S),w=fn(m),T=[1,0,0],C=Ar(k,w),P=Pr(C,C),A=C[0],R=P-A*A;if(!R)return!E&&S;var G=a*P/R,M=-a*A/R,$=Ar(T,C),Y=Mr(T,G),U=Mr(C,M);ls(Y,U);var X=$,ie=Pr(Y,X),ee=Pr(X,X),te=ie*ie-ee*(Pr(Y,Y)-1);if(!(te<0)){var ae=cn(te),q=Mr(X,(-ie-ae)/ee);if(ls(q,Y),q=us(q),!E)return q;var ne=S[0],ue=m[0],ve=S[1],Ie=m[1],we;ue<ne&&(we=ne,ne=ue,ue=we);var j=ue-ne,Pe=Se(j-ce)<ye,Ne=Pe||j<ye;if(!Pe&&Ie<ve&&(we=ve,ve=Ie,Ie=we),Ne?Pe?ve+Ie>0^q[1]<(Se(q[0]-ne)<ye?ve:Ie):ve<=q[1]&&q[1]<=Ie:j>ce^(ne<=q[0]&&q[0]<=ue)){var De=Mr(X,(-ie+ae)/ee);return ls(De,Y),[q,us(De)]}}}function x(S,m){var E=l?o:ce-o,k=0;return S<-E?k|=1:S>E&&(k|=2),m<-E?k|=4:m>E&&(k|=8),k}return Uu(v,p,h,l?[0,-o]:[-ce,o-ce])}function ju(o){return function(r){var a=new gs;for(var l in o)a[l]=o[l];return a.stream=r,a}}function gs(){}gs.prototype={constructor:gs,point:function(o,r){this.stream.point(o,r)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Vu(o,r,a){var l=r[1][0]-r[0][0],c=r[1][1]-r[0][1],h=o.clipExtent&&o.clipExtent();o.scale(150).translate([0,0]),h!=null&&o.clipExtent(null),Bv(a,o.stream(Yu));var v=Yu.result(),p=Math.min(l/(v[1][0]-v[0][0]),c/(v[1][1]-v[0][1])),_=+r[0][0]+(l-p*(v[1][0]+v[0][0]))/2,x=+r[0][1]+(c-p*(v[1][1]+v[0][1]))/2;return h!=null&&o.clipExtent(h),o.scale(p*150).translate([_,x])}function ep(o,r,a){return Vu(o,[[0,0],r],a)}var Wu=16,tp=de(30*Ue);function Hu(o,r){return+r?rp(o,r):np(o)}function np(o){return ju({point:function(r,a){r=o(r,a),this.stream.point(r[0],r[1])}})}function rp(o,r){function a(l,c,h,v,p,_,x,S,m,E,k,w,T,C){var P=x-l,A=S-c,R=P*P+A*A;if(R>4*r&&T--){var G=v+E,M=p+k,$=_+w,Y=cn(G*G+M*M+$*$),U=qt($/=Y),X=Se(Se($)-1)<ye||Se(h-m)<ye?(h+m)/2:ln(M,G),ie=o(X,U),ee=ie[0],te=ie[1],ae=ee-l,q=te-c,ne=A*ae-P*q;(ne*ne/R>r||Se((P*ae+A*q)/R-.5)>.3||v*E+p*k+_*w<tp)&&(a(l,c,h,v,p,_,ee,te,X,G/=Y,M/=Y,$,T,C),C.point(ee,te),a(ee,te,X,G,M,$,x,S,m,E,k,w,T,C))}}return function(l){var c,h,v,p,_,x,S,m,E,k,w,T,C={point:P,lineStart:A,lineEnd:G,polygonStart:function(){l.polygonStart(),C.lineStart=M},polygonEnd:function(){l.polygonEnd(),C.lineStart=A}};function P(U,X){U=o(U,X),l.point(U[0],U[1])}function A(){m=NaN,C.point=R,l.lineStart()}function R(U,X){var ie=fn([U,X]),ee=o(U,X);a(m,E,S,k,w,T,m=ee[0],E=ee[1],S=U,k=ie[0],w=ie[1],T=ie[2],Wu,l),l.point(m,E)}function G(){C.point=P,l.lineEnd()}function M(){A(),C.point=$,C.lineEnd=Y}function $(U,X){R(c=U,X),h=m,v=E,p=k,_=w,x=T,C.point=R}function Y(){a(m,E,S,k,w,T,h,v,c,p,_,x,Wu,l),C.lineEnd=G,G()}return C}}var ip=ju({point:function(o,r){this.stream.point(o*Ue,r*Ue)}});function sp(o){return ap(function(){return o})()}function ap(o){var r,a=150,l=480,c=250,h,v,p=0,_=0,x=0,S=0,m=0,E,k,w=null,T=Xu,C=null,P,A,R,G=zu,M=.5,$=Hu(ee,M),Y,U;function X(q){return q=k(q[0]*Ue,q[1]*Ue),[q[0]*a+h,v-q[1]*a]}function ie(q){return q=k.invert((q[0]-h)/a,(v-q[1])/a),q&&[q[0]*Lt,q[1]*Lt]}function ee(q,ne){return q=r(q,ne),[q[0]*a+h,v-q[1]*a]}X.stream=function(q){return Y&&U===q?Y:Y=ip(T(E,$(G(U=q))))},X.clipAngle=function(q){return arguments.length?(T=+q?Kv(w=q*Ue,6*Ue):(w=null,Xu),ae()):w*Lt},X.clipExtent=function(q){return arguments.length?(G=q==null?(C=P=A=R=null,zu):Xv(C=+q[0][0],P=+q[0][1],A=+q[1][0],R=+q[1][1]),ae()):C==null?null:[[C,P],[A,R]]},X.scale=function(q){return arguments.length?(a=+q,te()):a},X.translate=function(q){return arguments.length?(l=+q[0],c=+q[1],te()):[l,c]},X.center=function(q){return arguments.length?(p=q[0]%360*Ue,_=q[1]%360*Ue,te()):[p*Lt,_*Lt]},X.rotate=function(q){return arguments.length?(x=q[0]%360*Ue,S=q[1]%360*Ue,m=q.length>2?q[2]%360*Ue:0,te()):[x*Lt,S*Lt,m*Lt]},X.precision=function(q){return arguments.length?($=Hu(ee,M=q*q),ae()):cn(M)},X.fitExtent=function(q,ne){return Vu(X,q,ne)},X.fitSize=function(q,ne){return ep(X,q,ne)};function te(){k=Cu(E=$v(x,S,m),r);var q=r(p,_);return h=l-q[0]*a,v=c+q[1]*a,ae()}function ae(){return Y=U=null,X}return function(){return r=o.apply(this,arguments),X.invert=r.invert&&ie,te()}}function Zu(o){return function(r,a){var l=de(r),c=de(a),h=o(l*c);return[h*c*_e(r),h*_e(a)]}}function Ju(o){return function(r,a){var l=cn(r*r+a*a),c=o(l),h=_e(c),v=de(c);return[ln(r*h,l*v),qt(l&&a*h/l)]}}var op=Zu(function(o){return cn(2/(1+o))});op.invert=Ju(function(o){return 2*qt(o/2)});var Qu=Zu(function(o){return(o=Ou(o))&&o/_e(o)});Qu.invert=Ju(function(o){return o});function up(){return sp(Qu).scale(79.4188).clipAngle(180-.001)}function Ku(o,r){return[o,r]}Ku.invert=Ku;var lp=Object.defineProperty,gn=(o,r)=>lp(o,"name",{value:r,configurable:!0}),{BufferOp:cp,GeoJSONReader:fp,GeoJSONWriter:hp}=Fv;function el(o,r,a){a=a||{};var l=a.units||"kilometers",c=a.steps||8;if(!o)throw new Error("geojson is required");if(typeof a!="object")throw new Error("options must be an object");if(typeof c!="number")throw new Error("steps must be an number");if(r===void 0)throw new Error("radius is required");if(c<=0)throw new Error("steps must be greater than 0");var h=[];switch(o.type){case"GeometryCollection":return un(o,function(v){var p=Fn(v,r,l,c);p&&h.push(p)}),mt(h);case"FeatureCollection":return Or(o,function(v){var p=Fn(v,r,l,c);p&&Or(p,function(_){_&&h.push(_)})}),mt(h)}return Fn(o,r,l,c)}gn(el,"buffer");function Fn(o,r,a,l){var c=o.properties||{},h=o.type==="Feature"?o.geometry:o;if(h.type==="GeometryCollection"){var v=[];return un(o,function(T){var C=Fn(T,r,a,l);C&&v.push(C)}),mt(v)}var p=tl(h),_={type:h.type,coordinates:vs(h.coordinates,p)},x=new fp,S=x.read(_),m=ss(Nr(r,a),"meters"),E=cp.bufferOp(S,m,l),k=new hp;if(E=k.write(E),!ys(E.coordinates)){var w={type:E.type,coordinates:ps(E.coordinates,p)};return Ke(w,c)}}gn(Fn,"bufferFeature");function ys(o){return Array.isArray(o[0])?ys(o[0]):isNaN(o[0])}gn(ys,"coordsIsNaN");function vs(o,r){return typeof o[0]!="object"?r(o):o.map(function(a){return vs(a,r)})}gn(vs,"projectCoords");function ps(o,r){return typeof o[0]!="object"?r.invert(o):o.map(function(a){return ps(a,r)})}gn(ps,"unprojectCoords");function tl(o){var r=Iu(o).geometry.coordinates,a=[-r[0],-r[1]];return up().rotate(a).scale(Me)}gn(tl,"defineProjection");var gp=el;/**
1
+ (function(S,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("ol"),require("ol/geom"),require("ol/layer/Vector"),require("ol/proj"),require("ol/source/Vector"),require("ol/style/Fill"),require("ol/style/Icon"),require("ol/style/Stroke"),require("ol/style/Style"),require("ol/style/Text")):typeof define=="function"&&define.amd?define(["exports","ol","ol/geom","ol/layer/Vector","ol/proj","ol/source/Vector","ol/style/Fill","ol/style/Icon","ol/style/Stroke","ol/style/Style","ol/style/Text"],L):(S=typeof globalThis<"u"?globalThis:S||self,L(S.openlayersMaptilerGeocodingController={},S.ol,S.ol.geom,S.ol.layer.Vector,S.ol.proj,S.ol.source.Vector,S.ol.style.Fill,S.ol.style.Icon,S.ol.style.Stroke,S.ol.style.Style,S.ol.style.Text))})(this,function(S,L,R,At,$,Ot,ft,Ft,ct,Nt,Gt){"use strict";function j(o,t,e={}){const n={type:"Feature"};return(e.id===0||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=t||{},n.geometry=o,n}function K(o,t,e={}){for(const r of o){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let i=0;i<r[r.length-1].length;i++)if(r[r.length-1][i]!==r[0][i])throw new Error("First and last Position are not equivalent.")}return j({type:"Polygon",coordinates:o},t,e)}function H(o,t={}){const e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=o,e}function ht(o,t,e={}){return j({type:"MultiPolygon",coordinates:o},t,e)}function at(o,t,e){if(o!==null)for(var n,r,i,u,l,c,f,a=0,s=0,h,g=o.type,y=g==="FeatureCollection",p=g==="Feature",d=y?o.features.length:1,x=0;x<d;x++){f=y?o.features[x].geometry:p?o.geometry:o,h=f?f.type==="GeometryCollection":!1,l=h?f.geometries.length:1;for(var w=0;w<l;w++){var v=0,m=0;if(u=h?f.geometries[w]:f,u!==null){c=u.coordinates;var E=u.type;switch(a=0,E){case null:break;case"Point":if(t(c,s,x,v,m)===!1)return!1;s++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(t(c[n],s,x,v,m)===!1)return!1;s++,E==="MultiPoint"&&v++}E==="LineString"&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(r=0;r<c[n].length-a;r++){if(t(c[n][r],s,x,v,m)===!1)return!1;s++}E==="MultiLineString"&&v++,E==="Polygon"&&m++}E==="Polygon"&&v++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(m=0,r=0;r<c[n].length;r++){for(i=0;i<c[n][r].length-a;i++){if(t(c[n][r][i],s,x,v,m)===!1)return!1;s++}m++}v++}break;case"GeometryCollection":for(n=0;n<u.geometries.length;n++)if(at(u.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function tt(o,t){var e,n,r,i,u,l,c,f,a,s,h=0,g=o.type==="FeatureCollection",y=o.type==="Feature",p=g?o.features.length:1;for(e=0;e<p;e++){for(l=g?o.features[e].geometry:y?o.geometry:o,f=g?o.features[e].properties:y?o.properties:{},a=g?o.features[e].bbox:y?o.bbox:void 0,s=g?o.features[e].id:y?o.id:void 0,c=l?l.type==="GeometryCollection":!1,u=c?l.geometries.length:1,r=0;r<u;r++){if(i=c?l.geometries[r]:l,i===null){if(t(null,h,f,a,s)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(i,h,f,a,s)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<i.geometries.length;n++)if(t(i.geometries[n],h,f,a,s)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function Bt(o,t){tt(o,function(e,n,r,i,u){var l=e===null?null:e.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return t(j(e,r,{bbox:i,id:u}),n,0)===!1?!1:void 0}var c;switch(l){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var f=0;f<e.coordinates.length;f++){var a=e.coordinates[f],s={type:c,coordinates:a};if(t(j(s,r),n,f)===!1)return!1}})}function $t(o,t={}){if(o.bbox!=null&&t.recompute!==!0)return o.bbox;const e=[1/0,1/0,-1/0,-1/0];return at(o,n=>{e[0]>n[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]<n[0]&&(e[2]=n[0]),e[3]<n[1]&&(e[3]=n[1])}),e}var gt=$t;/**
11
2
  * splaytree v3.1.2
12
3
  * Fast Splay tree for Node and browser
13
4
  *
@@ -15,18 +6,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
15
6
  * @license MIT
16
7
  * @preserve
17
8
  *//*! *****************************************************************************
18
- Copyright (c) Microsoft Corporation. All rights reserved.
19
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
20
- this file except in compliance with the License. You may obtain a copy of the
21
- License at http://www.apache.org/licenses/LICENSE-2.0
9
+ Copyright (c) Microsoft Corporation. All rights reserved.
10
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11
+ this file except in compliance with the License. You may obtain a copy of the
12
+ License at http://www.apache.org/licenses/LICENSE-2.0
22
13
 
23
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
24
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
25
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
26
- MERCHANTABLITY OR NON-INFRINGEMENT.
14
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17
+ MERCHANTABLITY OR NON-INFRINGEMENT.
27
18
 
28
- See the Apache Version 2.0 License for specific language governing permissions
29
- and limitations under the License.
30
- ***************************************************************************** */function yp(o,r){var a={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},l,c,h,v;return v={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function p(x){return function(S){return _([x,S])}}function _(x){if(l)throw new TypeError("Generator is already executing.");for(;a;)try{if(l=1,c&&(h=x[0]&2?c.return:x[0]?c.throw||((h=c.return)&&h.call(c),0):c.next)&&!(h=h.call(c,x[1])).done)return h;switch(c=0,h&&(x=[x[0]&2,h.value]),x[0]){case 0:case 1:h=x;break;case 4:return a.label++,{value:x[1],done:!1};case 5:a.label++,c=x[1],x=[0];continue;case 7:x=a.ops.pop(),a.trys.pop();continue;default:if(h=a.trys,!(h=h.length>0&&h[h.length-1])&&(x[0]===6||x[0]===2)){a=0;continue}if(x[0]===3&&(!h||x[1]>h[0]&&x[1]<h[3])){a.label=x[1];break}if(x[0]===6&&a.label<h[1]){a.label=h[1],h=x;break}if(h&&a.label<h[2]){a.label=h[2],a.ops.push(x);break}h[2]&&a.ops.pop(),a.trys.pop();continue}x=r.call(o,a)}catch(S){x=[6,S],c=0}finally{l=h=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}}var Rt=function(){function o(r,a){this.next=null,this.key=r,this.data=a,this.left=null,this.right=null}return o}();function vp(o,r){return o>r?1:o<r?-1:0}function Ct(o,r,a){for(var l=new Rt(null,null),c=l,h=l;;){var v=a(o,r.key);if(v<0){if(r.left===null)break;if(a(o,r.left.key)<0){var p=r.left;if(r.left=p.right,p.right=r,r=p,r.left===null)break}h.left=r,h=r,r=r.left}else if(v>0){if(r.right===null)break;if(a(o,r.right.key)>0){var p=r.right;if(r.right=p.left,p.left=r,r=p,r.right===null)break}c.right=r,c=r,r=r.right}else break}return c.right=r.left,h.left=r.right,r.left=l.right,r.right=l.left,r}function ms(o,r,a,l){var c=new Rt(o,r);if(a===null)return c.left=c.right=null,c;a=Ct(o,a,l);var h=l(o,a.key);return h<0?(c.left=a.left,c.right=a,a.left=null):h>=0&&(c.right=a.right,c.left=a,a.right=null),c}function nl(o,r,a){var l=null,c=null;if(r){r=Ct(o,r,a);var h=a(r.key,o);h===0?(l=r.left,c=r.right):h<0?(c=r.right,r.right=null,l=r):(l=r.left,r.left=null,c=r)}return{left:l,right:c}}function pp(o,r,a){return r===null?o:(o===null||(r=Ct(o.key,r,a),r.left=o),r)}function ds(o,r,a,l,c){if(o){l(""+r+(a?"└── ":"├── ")+c(o)+`
31
- `);var h=r+(a?" ":"│ ");o.left&&ds(o.left,h,!1,l,c),o.right&&ds(o.right,h,!0,l,c)}}var _s=function(){function o(r){r===void 0&&(r=vp),this._root=null,this._size=0,this._comparator=r}return o.prototype.insert=function(r,a){return this._size++,this._root=ms(r,a,this._root,this._comparator)},o.prototype.add=function(r,a){var l=new Rt(r,a);this._root===null&&(l.left=l.right=null,this._size++,this._root=l);var c=this._comparator,h=Ct(r,this._root,c),v=c(r,h.key);return v===0?this._root=h:(v<0?(l.left=h.left,l.right=h,h.left=null):v>0&&(l.right=h.right,l.left=h,h.right=null),this._size++,this._root=l),this._root},o.prototype.remove=function(r){this._root=this._remove(r,this._root,this._comparator)},o.prototype._remove=function(r,a,l){var c;if(a===null)return null;a=Ct(r,a,l);var h=l(r,a.key);return h===0?(a.left===null?c=a.right:(c=Ct(r,a.left,l),c.right=a.right),this._size--,c):a},o.prototype.pop=function(){var r=this._root;if(r){for(;r.left;)r=r.left;return this._root=Ct(r.key,this._root,this._comparator),this._root=this._remove(r.key,this._root,this._comparator),{key:r.key,data:r.data}}return null},o.prototype.findStatic=function(r){for(var a=this._root,l=this._comparator;a;){var c=l(r,a.key);if(c===0)return a;c<0?a=a.left:a=a.right}return null},o.prototype.find=function(r){return this._root&&(this._root=Ct(r,this._root,this._comparator),this._comparator(r,this._root.key)!==0)?null:this._root},o.prototype.contains=function(r){for(var a=this._root,l=this._comparator;a;){var c=l(r,a.key);if(c===0)return!0;c<0?a=a.left:a=a.right}return!1},o.prototype.forEach=function(r,a){for(var l=this._root,c=[],h=!1;!h;)l!==null?(c.push(l),l=l.left):c.length!==0?(l=c.pop(),r.call(a,l),l=l.right):h=!0;return this},o.prototype.range=function(r,a,l,c){for(var h=[],v=this._comparator,p=this._root,_;h.length!==0||p;)if(p)h.push(p),p=p.left;else{if(p=h.pop(),_=v(p.key,a),_>0)break;if(v(p.key,r)>=0&&l.call(c,p))return this;p=p.right}return this},o.prototype.keys=function(){var r=[];return this.forEach(function(a){var l=a.key;return r.push(l)}),r},o.prototype.values=function(){var r=[];return this.forEach(function(a){var l=a.data;return r.push(l)}),r},o.prototype.min=function(){return this._root?this.minNode(this._root).key:null},o.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},o.prototype.minNode=function(r){if(r===void 0&&(r=this._root),r)for(;r.left;)r=r.left;return r},o.prototype.maxNode=function(r){if(r===void 0&&(r=this._root),r)for(;r.right;)r=r.right;return r},o.prototype.at=function(r){for(var a=this._root,l=!1,c=0,h=[];!l;)if(a)h.push(a),a=a.left;else if(h.length>0){if(a=h.pop(),c===r)return a;c++,a=a.right}else l=!0;return null},o.prototype.next=function(r){var a=this._root,l=null;if(r.right){for(l=r.right;l.left;)l=l.left;return l}for(var c=this._comparator;a;){var h=c(r.key,a.key);if(h===0)break;h<0?(l=a,a=a.left):a=a.right}return l},o.prototype.prev=function(r){var a=this._root,l=null;if(r.left!==null){for(l=r.left;l.right;)l=l.right;return l}for(var c=this._comparator;a;){var h=c(r.key,a.key);if(h===0)break;h<0?a=a.left:(l=a,a=a.right)}return l},o.prototype.clear=function(){return this._root=null,this._size=0,this},o.prototype.toList=function(){return dp(this._root)},o.prototype.load=function(r,a,l){a===void 0&&(a=[]),l===void 0&&(l=!1);var c=r.length,h=this._comparator;if(l&&ks(r,a,0,c-1,h),this._root===null)this._root=xs(r,a,0,c),this._size=c;else{var v=_p(this.toList(),mp(r,a),h);c=this._size+c,this._root=Es({head:v},0,c)}return this},o.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(o.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),o.prototype.toString=function(r){r===void 0&&(r=function(l){return String(l.key)});var a=[];return ds(this._root,"",!0,function(l){return a.push(l)},r),a.join("")},o.prototype.update=function(r,a,l){var c=this._comparator,h=nl(r,this._root,c),v=h.left,p=h.right;c(r,a)<0?p=ms(a,l,p,c):v=ms(a,l,v,c),this._root=pp(v,p,c)},o.prototype.split=function(r){return nl(r,this._root,this._comparator)},o.prototype[Symbol.iterator]=function(){var r,a,l;return yp(this,function(c){switch(c.label){case 0:r=this._root,a=[],l=!1,c.label=1;case 1:return l?[3,6]:r===null?[3,2]:(a.push(r),r=r.left,[3,5]);case 2:return a.length===0?[3,4]:(r=a.pop(),[4,r]);case 3:return c.sent(),r=r.right,[3,5];case 4:l=!0,c.label=5;case 5:return[3,1];case 6:return[2]}})},o}();function xs(o,r,a,l){var c=l-a;if(c>0){var h=a+Math.floor(c/2),v=o[h],p=r[h],_=new Rt(v,p);return _.left=xs(o,r,a,h),_.right=xs(o,r,h+1,l),_}return null}function mp(o,r){for(var a=new Rt(null,null),l=a,c=0;c<o.length;c++)l=l.next=new Rt(o[c],r[c]);return l.next=null,a.next}function dp(o){for(var r=o,a=[],l=!1,c=new Rt(null,null),h=c;!l;)r?(a.push(r),r=r.left):a.length>0?(r=h=h.next=a.pop(),r=r.right):l=!0;return h.next=null,c.next}function Es(o,r,a){var l=a-r;if(l>0){var c=r+Math.floor(l/2),h=Es(o,r,c),v=o.head;return v.left=h,o.head=o.head.next,v.right=Es(o,c+1,a),v}return null}function _p(o,r,a){for(var l=new Rt(null,null),c=l,h=o,v=r;h!==null&&v!==null;)a(h.key,v.key)<0?(c.next=h,h=h.next):(c.next=v,v=v.next),c=c.next;return h!==null?c.next=h:v!==null&&(c.next=v),l.next}function ks(o,r,a,l,c){if(!(a>=l)){for(var h=o[a+l>>1],v=a-1,p=l+1;;){do v++;while(c(o[v],h)<0);do p--;while(c(o[p],h)>0);if(v>=p)break;var _=o[v];o[v]=o[p],o[p]=_,_=r[v],r[v]=r[p],r[p]=_}ks(o,r,a,p,c),ks(o,r,p+1,l,c)}}const dt=11102230246251565e-32,Le=134217729,xp=(3+8*dt)*dt;function Ss(o,r,a,l,c){let h,v,p,_,x=r[0],S=l[0],m=0,E=0;S>x==S>-x?(h=x,x=r[++m]):(h=S,S=l[++E]);let k=0;if(m<o&&E<a)for(S>x==S>-x?(v=x+h,p=h-(v-x),x=r[++m]):(v=S+h,p=h-(v-S),S=l[++E]),h=v,p!==0&&(c[k++]=p);m<o&&E<a;)S>x==S>-x?(v=h+x,_=v-h,p=h-(v-_)+(x-_),x=r[++m]):(v=h+S,_=v-h,p=h-(v-_)+(S-_),S=l[++E]),h=v,p!==0&&(c[k++]=p);for(;m<o;)v=h+x,_=v-h,p=h-(v-_)+(x-_),x=r[++m],h=v,p!==0&&(c[k++]=p);for(;E<a;)v=h+S,_=v-h,p=h-(v-_)+(S-_),S=l[++E],h=v,p!==0&&(c[k++]=p);return(h!==0||k===0)&&(c[k++]=h),k}function Ep(o,r){let a=r[0];for(let l=1;l<o;l++)a+=r[l];return a}function Gn(o){return new Float64Array(o)}const kp=(3+16*dt)*dt,Sp=(2+12*dt)*dt,Ip=(9+64*dt)*dt*dt,yn=Gn(4),rl=Gn(8),il=Gn(12),sl=Gn(16),Ce=Gn(4);function wp(o,r,a,l,c,h,v){let p,_,x,S,m,E,k,w,T,C,P,A,R,G,M,$,Y,U;const X=o-c,ie=a-c,ee=r-h,te=l-h;G=X*te,E=Le*X,k=E-(E-X),w=X-k,E=Le*te,T=E-(E-te),C=te-T,M=w*C-(G-k*T-w*T-k*C),$=ee*ie,E=Le*ee,k=E-(E-ee),w=ee-k,E=Le*ie,T=E-(E-ie),C=ie-T,Y=w*C-($-k*T-w*T-k*C),P=M-Y,m=M-P,yn[0]=M-(P+m)+(m-Y),A=G+P,m=A-G,R=G-(A-m)+(P-m),P=R-$,m=R-P,yn[1]=R-(P+m)+(m-$),U=A+P,m=U-A,yn[2]=A-(U-m)+(P-m),yn[3]=U;let ae=Ep(4,yn),q=Sp*v;if(ae>=q||-ae>=q||(m=o-X,p=o-(X+m)+(m-c),m=a-ie,x=a-(ie+m)+(m-c),m=r-ee,_=r-(ee+m)+(m-h),m=l-te,S=l-(te+m)+(m-h),p===0&&_===0&&x===0&&S===0)||(q=Ip*v+xp*Math.abs(ae),ae+=X*S+te*p-(ee*x+ie*_),ae>=q||-ae>=q))return ae;G=p*te,E=Le*p,k=E-(E-p),w=p-k,E=Le*te,T=E-(E-te),C=te-T,M=w*C-(G-k*T-w*T-k*C),$=_*ie,E=Le*_,k=E-(E-_),w=_-k,E=Le*ie,T=E-(E-ie),C=ie-T,Y=w*C-($-k*T-w*T-k*C),P=M-Y,m=M-P,Ce[0]=M-(P+m)+(m-Y),A=G+P,m=A-G,R=G-(A-m)+(P-m),P=R-$,m=R-P,Ce[1]=R-(P+m)+(m-$),U=A+P,m=U-A,Ce[2]=A-(U-m)+(P-m),Ce[3]=U;const ne=Ss(4,yn,4,Ce,rl);G=X*S,E=Le*X,k=E-(E-X),w=X-k,E=Le*S,T=E-(E-S),C=S-T,M=w*C-(G-k*T-w*T-k*C),$=ee*x,E=Le*ee,k=E-(E-ee),w=ee-k,E=Le*x,T=E-(E-x),C=x-T,Y=w*C-($-k*T-w*T-k*C),P=M-Y,m=M-P,Ce[0]=M-(P+m)+(m-Y),A=G+P,m=A-G,R=G-(A-m)+(P-m),P=R-$,m=R-P,Ce[1]=R-(P+m)+(m-$),U=A+P,m=U-A,Ce[2]=A-(U-m)+(P-m),Ce[3]=U;const ue=Ss(ne,rl,4,Ce,il);G=p*S,E=Le*p,k=E-(E-p),w=p-k,E=Le*S,T=E-(E-S),C=S-T,M=w*C-(G-k*T-w*T-k*C),$=_*x,E=Le*_,k=E-(E-_),w=_-k,E=Le*x,T=E-(E-x),C=x-T,Y=w*C-($-k*T-w*T-k*C),P=M-Y,m=M-P,Ce[0]=M-(P+m)+(m-Y),A=G+P,m=A-G,R=G-(A-m)+(P-m),P=R-$,m=R-P,Ce[1]=R-(P+m)+(m-$),U=A+P,m=U-A,Ce[2]=A-(U-m)+(P-m),Ce[3]=U;const ve=Ss(ue,il,4,Ce,sl);return sl[ve-1]}function Np(o,r,a,l,c,h){const v=(r-h)*(a-c),p=(o-c)*(l-h),_=v-p,x=Math.abs(v+p);return Math.abs(_)>=kp*x?_:-wp(o,r,a,l,c,h,x)}const Bn=(o,r)=>o.ll.x<=r.x&&r.x<=o.ur.x&&o.ll.y<=r.y&&r.y<=o.ur.y,Is=(o,r)=>{if(r.ur.x<o.ll.x||o.ur.x<r.ll.x||r.ur.y<o.ll.y||o.ur.y<r.ll.y)return null;const a=o.ll.x<r.ll.x?r.ll.x:o.ll.x,l=o.ur.x<r.ur.x?o.ur.x:r.ur.x,c=o.ll.y<r.ll.y?r.ll.y:o.ll.y,h=o.ur.y<r.ur.y?o.ur.y:r.ur.y;return{ll:{x:a,y:c},ur:{x:l,y:h}}};let Pt=Number.EPSILON;Pt===void 0&&(Pt=Math.pow(2,-52));const bp=Pt*Pt,al=(o,r)=>{if(-Pt<o&&o<Pt&&-Pt<r&&r<Pt)return 0;const a=o-r;return a*a<bp*o*r?0:o<r?-1:1};class Op{constructor(){this.reset()}reset(){this.xRounder=new ol,this.yRounder=new ol}round(r,a){return{x:this.xRounder.round(r),y:this.yRounder.round(a)}}}class ol{constructor(){this.tree=new _s,this.round(0)}round(r){const a=this.tree.add(r),l=this.tree.prev(a);if(l!==null&&al(a.key,l.key)===0)return this.tree.remove(r),l.key;const c=this.tree.next(a);return c!==null&&al(a.key,c.key)===0?(this.tree.remove(r),c.key):r}}const $n=new Op,qr=(o,r)=>o.x*r.y-o.y*r.x,ul=(o,r)=>o.x*r.x+o.y*r.y,ll=(o,r,a)=>{const l=Np(o.x,o.y,r.x,r.y,a.x,a.y);return l>0?-1:l<0?1:0},zr=o=>Math.sqrt(ul(o,o)),Tp=(o,r,a)=>{const l={x:r.x-o.x,y:r.y-o.y},c={x:a.x-o.x,y:a.y-o.y};return qr(c,l)/zr(c)/zr(l)},Lp=(o,r,a)=>{const l={x:r.x-o.x,y:r.y-o.y},c={x:a.x-o.x,y:a.y-o.y};return ul(c,l)/zr(c)/zr(l)},cl=(o,r,a)=>r.y===0?null:{x:o.x+r.x/r.y*(a-o.y),y:a},fl=(o,r,a)=>r.x===0?null:{x:a,y:o.y+r.y/r.x*(a-o.x)},Rp=(o,r,a,l)=>{if(r.x===0)return fl(a,l,o.x);if(l.x===0)return fl(o,r,a.x);if(r.y===0)return cl(a,l,o.y);if(l.y===0)return cl(o,r,a.y);const c=qr(r,l);if(c==0)return null;const h={x:a.x-o.x,y:a.y-o.y},v=qr(h,r)/c,p=qr(h,l)/c,_=o.x+p*r.x,x=a.x+v*l.x,S=o.y+p*r.y,m=a.y+v*l.y,E=(_+x)/2,k=(S+m)/2;return{x:E,y:k}};class Xe{static compare(r,a){const l=Xe.comparePoints(r.point,a.point);return l!==0?l:(r.point!==a.point&&r.link(a),r.isLeft!==a.isLeft?r.isLeft?1:-1:At.compare(r.segment,a.segment))}static comparePoints(r,a){return r.x<a.x?-1:r.x>a.x?1:r.y<a.y?-1:r.y>a.y?1:0}constructor(r,a){r.events===void 0?r.events=[this]:r.events.push(this),this.point=r,this.isLeft=a}link(r){if(r.point===this.point)throw new Error("Tried to link already linked events");const a=r.point.events;for(let l=0,c=a.length;l<c;l++){const h=a[l];this.point.events.push(h),h.point=this.point}this.checkForConsuming()}checkForConsuming(){const r=this.point.events.length;for(let a=0;a<r;a++){const l=this.point.events[a];if(l.segment.consumedBy===void 0)for(let c=a+1;c<r;c++){const h=this.point.events[c];h.consumedBy===void 0&&l.otherSE.point.events===h.otherSE.point.events&&l.segment.consume(h.segment)}}}getAvailableLinkedEvents(){const r=[];for(let a=0,l=this.point.events.length;a<l;a++){const c=this.point.events[a];c!==this&&!c.segment.ringOut&&c.segment.isInResult()&&r.push(c)}return r}getLeftmostComparator(r){const a=new Map,l=c=>{const h=c.otherSE;a.set(c,{sine:Tp(this.point,r.point,h.point),cosine:Lp(this.point,r.point,h.point)})};return(c,h)=>{a.has(c)||l(c),a.has(h)||l(h);const{sine:v,cosine:p}=a.get(c),{sine:_,cosine:x}=a.get(h);return v>=0&&_>=0?p<x?1:p>x?-1:0:v<0&&_<0?p<x?-1:p>x?1:0:_<v?-1:_>v?1:0}}}let Cp=0;class At{static compare(r,a){const l=r.leftSE.point.x,c=a.leftSE.point.x,h=r.rightSE.point.x,v=a.rightSE.point.x;if(v<l)return 1;if(h<c)return-1;const p=r.leftSE.point.y,_=a.leftSE.point.y,x=r.rightSE.point.y,S=a.rightSE.point.y;if(l<c){if(_<p&&_<x)return 1;if(_>p&&_>x)return-1;const m=r.comparePoint(a.leftSE.point);if(m<0)return 1;if(m>0)return-1;const E=a.comparePoint(r.rightSE.point);return E!==0?E:-1}if(l>c){if(p<_&&p<S)return-1;if(p>_&&p>S)return 1;const m=a.comparePoint(r.leftSE.point);if(m!==0)return m;const E=r.comparePoint(a.rightSE.point);return E<0?1:E>0?-1:1}if(p<_)return-1;if(p>_)return 1;if(h<v){const m=a.comparePoint(r.rightSE.point);if(m!==0)return m}if(h>v){const m=r.comparePoint(a.rightSE.point);if(m<0)return 1;if(m>0)return-1}if(h!==v){const m=x-p,E=h-l,k=S-_,w=v-c;if(m>E&&k<w)return 1;if(m<E&&k>w)return-1}return h>v?1:h<v||x<S?-1:x>S?1:r.id<a.id?-1:r.id>a.id?1:0}constructor(r,a,l,c){this.id=++Cp,this.leftSE=r,r.segment=this,r.otherSE=a,this.rightSE=a,a.segment=this,a.otherSE=r,this.rings=l,this.windings=c}static fromRing(r,a,l){let c,h,v;const p=Xe.comparePoints(r,a);if(p<0)c=r,h=a,v=1;else if(p>0)c=a,h=r,v=-1;else throw new Error(`Tried to create degenerate segment at [${r.x}, ${r.y}]`);const _=new Xe(c,!0),x=new Xe(h,!1);return new At(_,x,[l],[v])}replaceRightSE(r){this.rightSE=r,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const r=this.leftSE.point.y,a=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:r<a?r:a},ur:{x:this.rightSE.point.x,y:r>a?r:a}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(r){return r.x===this.leftSE.point.x&&r.y===this.leftSE.point.y||r.x===this.rightSE.point.x&&r.y===this.rightSE.point.y}comparePoint(r){if(this.isAnEndpoint(r))return 0;const a=this.leftSE.point,l=this.rightSE.point,c=this.vector();if(a.x===l.x)return r.x===a.x?0:r.x<a.x?1:-1;const h=(r.y-a.y)/c.y,v=a.x+h*c.x;if(r.x===v)return 0;const p=(r.x-a.x)/c.x,_=a.y+p*c.y;return r.y===_?0:r.y<_?-1:1}getIntersection(r){const a=this.bbox(),l=r.bbox(),c=Is(a,l);if(c===null)return null;const h=this.leftSE.point,v=this.rightSE.point,p=r.leftSE.point,_=r.rightSE.point,x=Bn(a,p)&&this.comparePoint(p)===0,S=Bn(l,h)&&r.comparePoint(h)===0,m=Bn(a,_)&&this.comparePoint(_)===0,E=Bn(l,v)&&r.comparePoint(v)===0;if(S&&x)return E&&!m?v:!E&&m?_:null;if(S)return m&&h.x===_.x&&h.y===_.y?null:h;if(x)return E&&v.x===p.x&&v.y===p.y?null:p;if(E&&m)return null;if(E)return v;if(m)return _;const k=Rp(h,this.vector(),p,r.vector());return k===null||!Bn(c,k)?null:$n.round(k.x,k.y)}split(r){const a=[],l=r.events!==void 0,c=new Xe(r,!0),h=new Xe(r,!1),v=this.rightSE;this.replaceRightSE(h),a.push(h),a.push(c);const p=new At(c,v,this.rings.slice(),this.windings.slice());return Xe.comparePoints(p.leftSE.point,p.rightSE.point)>0&&p.swapEvents(),Xe.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),l&&(c.checkForConsuming(),h.checkForConsuming()),a}swapEvents(){const r=this.rightSE;this.rightSE=this.leftSE,this.leftSE=r,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let a=0,l=this.windings.length;a<l;a++)this.windings[a]*=-1}consume(r){let a=this,l=r;for(;a.consumedBy;)a=a.consumedBy;for(;l.consumedBy;)l=l.consumedBy;const c=At.compare(a,l);if(c!==0){if(c>0){const h=a;a=l,l=h}if(a.prev===l){const h=a;a=l,l=h}for(let h=0,v=l.rings.length;h<v;h++){const p=l.rings[h],_=l.windings[h],x=a.rings.indexOf(p);x===-1?(a.rings.push(p),a.windings.push(_)):a.windings[x]+=_}l.rings=null,l.windings=null,l.consumedBy=a,l.leftSE.consumedBy=a.leftSE,l.rightSE.consumedBy=a.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const r=this.prev.consumedBy||this.prev;this._beforeState=r.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const r=this.beforeState();this._afterState={rings:r.rings.slice(0),windings:r.windings.slice(0),multiPolys:[]};const a=this._afterState.rings,l=this._afterState.windings,c=this._afterState.multiPolys;for(let p=0,_=this.rings.length;p<_;p++){const x=this.rings[p],S=this.windings[p],m=a.indexOf(x);m===-1?(a.push(x),l.push(S)):l[m]+=S}const h=[],v=[];for(let p=0,_=a.length;p<_;p++){if(l[p]===0)continue;const x=a[p],S=x.poly;if(v.indexOf(S)===-1)if(x.isExterior)h.push(S);else{v.indexOf(S)===-1&&v.push(S);const m=h.indexOf(x.poly);m!==-1&&h.splice(m,1)}}for(let p=0,_=h.length;p<_;p++){const x=h[p].multiPoly;c.indexOf(x)===-1&&c.push(x)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const r=this.beforeState().multiPolys,a=this.afterState().multiPolys;switch(et.type){case"union":{const l=r.length===0,c=a.length===0;this._isInResult=l!==c;break}case"intersection":{let l,c;r.length<a.length?(l=r.length,c=a.length):(l=a.length,c=r.length),this._isInResult=c===et.numMultiPolys&&l<c;break}case"xor":{const l=Math.abs(r.length-a.length);this._isInResult=l%2===1;break}case"difference":{const l=c=>c.length===1&&c[0].isSubject;this._isInResult=l(r)!==l(a);break}default:throw new Error(`Unrecognized operation type found ${et.type}`)}return this._isInResult}}class hl{constructor(r,a,l){if(!Array.isArray(r)||r.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=a,this.isExterior=l,this.segments=[],typeof r[0][0]!="number"||typeof r[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const c=$n.round(r[0][0],r[0][1]);this.bbox={ll:{x:c.x,y:c.y},ur:{x:c.x,y:c.y}};let h=c;for(let v=1,p=r.length;v<p;v++){if(typeof r[v][0]!="number"||typeof r[v][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let _=$n.round(r[v][0],r[v][1]);_.x===h.x&&_.y===h.y||(this.segments.push(At.fromRing(h,_,this)),_.x<this.bbox.ll.x&&(this.bbox.ll.x=_.x),_.y<this.bbox.ll.y&&(this.bbox.ll.y=_.y),_.x>this.bbox.ur.x&&(this.bbox.ur.x=_.x),_.y>this.bbox.ur.y&&(this.bbox.ur.y=_.y),h=_)}(c.x!==h.x||c.y!==h.y)&&this.segments.push(At.fromRing(h,c,this))}getSweepEvents(){const r=[];for(let a=0,l=this.segments.length;a<l;a++){const c=this.segments[a];r.push(c.leftSE),r.push(c.rightSE)}return r}}class Pp{constructor(r,a){if(!Array.isArray(r))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new hl(r[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let l=1,c=r.length;l<c;l++){const h=new hl(r[l],this,!1);h.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=h.bbox.ll.x),h.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=h.bbox.ll.y),h.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=h.bbox.ur.x),h.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=h.bbox.ur.y),this.interiorRings.push(h)}this.multiPoly=a}getSweepEvents(){const r=this.exteriorRing.getSweepEvents();for(let a=0,l=this.interiorRings.length;a<l;a++){const c=this.interiorRings[a].getSweepEvents();for(let h=0,v=c.length;h<v;h++)r.push(c[h])}return r}}class gl{constructor(r,a){if(!Array.isArray(r))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof r[0][0][0]=="number"&&(r=[r])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let l=0,c=r.length;l<c;l++){const h=new Pp(r[l],this);h.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=h.bbox.ll.x),h.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=h.bbox.ll.y),h.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=h.bbox.ur.x),h.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=h.bbox.ur.y),this.polys.push(h)}this.isSubject=a}getSweepEvents(){const r=[];for(let a=0,l=this.polys.length;a<l;a++){const c=this.polys[a].getSweepEvents();for(let h=0,v=c.length;h<v;h++)r.push(c[h])}return r}}class Yr{static factory(r){const a=[];for(let l=0,c=r.length;l<c;l++){const h=r[l];if(!h.isInResult()||h.ringOut)continue;let v=null,p=h.leftSE,_=h.rightSE;const x=[p],S=p.point,m=[];for(;v=p,p=_,x.push(p),p.point!==S;)for(;;){const E=p.getAvailableLinkedEvents();if(E.length===0){const T=x[0].point,C=x[x.length-1].point;throw new Error(`Unable to complete output ring starting at [${T.x}, ${T.y}]. Last matching segment found ends at [${C.x}, ${C.y}].`)}if(E.length===1){_=E[0].otherSE;break}let k=null;for(let T=0,C=m.length;T<C;T++)if(m[T].point===p.point){k=T;break}if(k!==null){const T=m.splice(k)[0],C=x.splice(T.index);C.unshift(C[0].otherSE),a.push(new Yr(C.reverse()));continue}m.push({index:x.length,point:p.point});const w=p.getLeftmostComparator(v);_=E.sort(w)[0].otherSE;break}a.push(new Yr(x))}return a}constructor(r){this.events=r;for(let a=0,l=r.length;a<l;a++)r[a].segment.ringOut=this;this.poly=null}getGeom(){let r=this.events[0].point;const a=[r];for(let x=1,S=this.events.length-1;x<S;x++){const m=this.events[x].point,E=this.events[x+1].point;ll(m,r,E)!==0&&(a.push(m),r=m)}if(a.length===1)return null;const l=a[0],c=a[1];ll(l,r,c)===0&&a.shift(),a.push(a[0]);const h=this.isExteriorRing()?1:-1,v=this.isExteriorRing()?0:a.length-1,p=this.isExteriorRing()?a.length:-1,_=[];for(let x=v;x!=p;x+=h)_.push([a[x].x,a[x].y]);return _}isExteriorRing(){if(this._isExteriorRing===void 0){const r=this.enclosingRing();this._isExteriorRing=r?!r.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let r=this.events[0];for(let c=1,h=this.events.length;c<h;c++){const v=this.events[c];Xe.compare(r,v)>0&&(r=v)}let a=r.segment.prevInResult(),l=a?a.prevInResult():null;for(;;){if(!a)return null;if(!l)return a.ringOut;if(l.ringOut!==a.ringOut)return l.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=l.prevInResult(),l=a?a.prevInResult():null}}}class yl{constructor(r){this.exteriorRing=r,r.poly=this,this.interiorRings=[]}addInterior(r){this.interiorRings.push(r),r.poly=this}getGeom(){const r=[this.exteriorRing.getGeom()];if(r[0]===null)return null;for(let a=0,l=this.interiorRings.length;a<l;a++){const c=this.interiorRings[a].getGeom();c!==null&&r.push(c)}return r}}class Ap{constructor(r){this.rings=r,this.polys=this._composePolys(r)}getGeom(){const r=[];for(let a=0,l=this.polys.length;a<l;a++){const c=this.polys[a].getGeom();c!==null&&r.push(c)}return r}_composePolys(r){const a=[];for(let l=0,c=r.length;l<c;l++){const h=r[l];if(!h.poly)if(h.isExteriorRing())a.push(new yl(h));else{const v=h.enclosingRing();v.poly||a.push(new yl(v)),v.poly.addInterior(h)}}return a}}class Mp{constructor(r){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:At.compare;this.queue=r,this.tree=new _s(a),this.segments=[]}process(r){const a=r.segment,l=[];if(r.consumedBy)return r.isLeft?this.queue.remove(r.otherSE):this.tree.remove(a),l;const c=r.isLeft?this.tree.add(a):this.tree.find(a);if(!c)throw new Error(`Unable to find segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.rightSE.point.y}] in SweepLine tree.`);let h=c,v=c,p,_;for(;p===void 0;)h=this.tree.prev(h),h===null?p=null:h.key.consumedBy===void 0&&(p=h.key);for(;_===void 0;)v=this.tree.next(v),v===null?_=null:v.key.consumedBy===void 0&&(_=v.key);if(r.isLeft){let x=null;if(p){const m=p.getIntersection(a);if(m!==null&&(a.isAnEndpoint(m)||(x=m),!p.isAnEndpoint(m))){const E=this._splitSafely(p,m);for(let k=0,w=E.length;k<w;k++)l.push(E[k])}}let S=null;if(_){const m=_.getIntersection(a);if(m!==null&&(a.isAnEndpoint(m)||(S=m),!_.isAnEndpoint(m))){const E=this._splitSafely(_,m);for(let k=0,w=E.length;k<w;k++)l.push(E[k])}}if(x!==null||S!==null){let m=null;x===null?m=S:S===null?m=x:m=Xe.comparePoints(x,S)<=0?x:S,this.queue.remove(a.rightSE),l.push(a.rightSE);const E=a.split(m);for(let k=0,w=E.length;k<w;k++)l.push(E[k])}l.length>0?(this.tree.remove(a),l.push(r)):(this.segments.push(a),a.prev=p)}else{if(p&&_){const x=p.getIntersection(_);if(x!==null){if(!p.isAnEndpoint(x)){const S=this._splitSafely(p,x);for(let m=0,E=S.length;m<E;m++)l.push(S[m])}if(!_.isAnEndpoint(x)){const S=this._splitSafely(_,x);for(let m=0,E=S.length;m<E;m++)l.push(S[m])}}}this.tree.remove(a)}return l}_splitSafely(r,a){this.tree.remove(r);const l=r.rightSE;this.queue.remove(l);const c=r.split(a);return c.push(l),r.consumedBy===void 0&&this.tree.add(r),c}}const vl=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Dp=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Fp{run(r,a,l){et.type=r,$n.reset();const c=[new gl(a,!0)];for(let m=0,E=l.length;m<E;m++)c.push(new gl(l[m],!1));if(et.numMultiPolys=c.length,et.type==="difference"){const m=c[0];let E=1;for(;E<c.length;)Is(c[E].bbox,m.bbox)!==null?E++:c.splice(E,1)}if(et.type==="intersection")for(let m=0,E=c.length;m<E;m++){const k=c[m];for(let w=m+1,T=c.length;w<T;w++)if(Is(k.bbox,c[w].bbox)===null)return[]}const h=new _s(Xe.compare);for(let m=0,E=c.length;m<E;m++){const k=c[m].getSweepEvents();for(let w=0,T=k.length;w<T;w++)if(h.insert(k[w]),h.size>vl)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const v=new Mp(h);let p=h.size,_=h.pop();for(;_;){const m=_.key;if(h.size===p){const k=m.segment;throw new Error(`Unable to pop() ${m.isLeft?"left":"right"} SweepEvent [${m.point.x}, ${m.point.y}] from segment #${k.id} [${k.leftSE.point.x}, ${k.leftSE.point.y}] -> [${k.rightSE.point.x}, ${k.rightSE.point.y}] from queue.`)}if(h.size>vl)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(v.segments.length>Dp)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const E=v.process(m);for(let k=0,w=E.length;k<w;k++){const T=E[k];T.consumedBy===void 0&&h.insert(T)}p=h.size,_=h.pop()}$n.reset();const x=Yr.factory(v.segments);return new Ap(x).getGeom()}}const et=new Fp;var Gp={union:function(o){for(var r=arguments.length,a=new Array(r>1?r-1:0),l=1;l<r;l++)a[l-1]=arguments[l];return et.run("union",o,a)},intersection:function(o){for(var r=arguments.length,a=new Array(r>1?r-1:0),l=1;l<r;l++)a[l-1]=arguments[l];return et.run("intersection",o,a)},xor:function(o){for(var r=arguments.length,a=new Array(r>1?r-1:0),l=1;l<r;l++)a[l-1]=arguments[l];return et.run("xor",o,a)},difference:function(o){for(var r=arguments.length,a=new Array(r>1?r-1:0),l=1;l<r;l++)a[l-1]=arguments[l];return et.run("difference",o,a)}},Bp=Object.defineProperty,$p=(o,r)=>Bp(o,"name",{value:r,configurable:!0});function pl(o){const r=[];if(un(o,c=>{r.push(c.coordinates)}),r.length<2)throw new Error("Must have at least two features");const a=o.features[0].properties||{},l=Gp.difference(r[0],...r.slice(1));return l.length===0?null:l.length===1?Pn(l[0],a):is(l,a)}$p(pl,"difference");var qp=pl;function ml(o){let r;for(const a of o)r&&a[0]-r[0]>=180?a[0]-=360:r&&a[0]-r[0]<-180&&(a[0]+=360),r=a}function dl(o,r){const a=qp(mt([Pn([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),o]));if(!a)return;a.properties={isMask:"y"};const l=gp(o,0);if(l){if(l.geometry.type==="Polygon")for(const c of l.geometry.coordinates)ml(c);else for(const c of l.geometry.coordinates)for(const h of c)ml(h);r(mt([l,a]))}}const _l="EPSG:4326";function zp(o){var h;const r=o.getProperties(),{isMask:a}=r,l=(h=o.getGeometry())==null?void 0:h.getType(),c=a?0:l==="LineString"||l==="MultiLineString"?3:2;return new yc({stroke:a?void 0:new Vs({color:"#3170fe",lineDash:[c,c],width:c,lineCap:"butt"}),fill:a?new js({color:"#00000020"}):void 0,image:new gc({src:`/icons/marker_${r.isReverse?"reverse":r.isSelected?"selected":"unselected"}.svg`,anchor:[.5,1]}),zIndex:r.isSelected?2:r.isReverse?0:1,text:r.isSelected&&r.tooltip?new vc({backgroundFill:new js({color:"white"}),text:r.tooltip,offsetY:-40,backgroundStroke:new Vs({color:"white",lineJoin:"round",width:3}),padding:[2,0,0,2]}):void 0})}function Yp(o,r={},a={},l=zp){let c=-1,h,v,p,_=!1;const x=new fc({updateWhileAnimating:!0});o.addLayer(x);const S=new hc({});x.setSource(S),x.setStyle(l),o.on("click",w=>{o.forEachFeatureAtPixel(w.pixel,T=>{const C=T.getId();if(C)return w.stopPropagation(),v==null||v({type:"markerClick",id:C}),T})}),o.on("pointermove",w=>{const T=o.forEachFeatureAtPixel(w.pixel,C=>C.getId());h!==T&&(h&&(v==null||v({type:"markerMouseLeave",id:h})),T&&(v==null||v({type:"markerMouseEnter",id:T})),o.getTargetElement().style.cursor=T?"pointer":_?"crosshair":"",h=T)});function m(){return It.getUserProjection()??o.getView().getProjection()}function E(w){return w.transform(_l,m())}const k=w=>{v==null||v({type:"mapClick",coordinates:It.toLonLat(w.coordinate,m())})};return{setEventHandler(w){w?(v=w,o.on("click",k)):(v=void 0,o.un("click",k))},flyTo(w,T){o.getView().animate({center:It.fromLonLat(w,m()),zoom:T,duration:2e3,...r})},fitBounds(w,T,C){o.getView().fit(It.transformExtent(w,_l,m()),{padding:[T,T,T,T],maxZoom:C,duration:2e3,...a})},indicateReverse(w){_=w,o.getTargetElement().style.cursor=w?"crosshair":""},setReverseMarker(w){p?w?p.getGeometry().setCoordinates(It.fromLonLat(w,m())):(S.removeFeature(p),p.dispose(),p=void 0):w&&(p=new Fe.Feature(new ze.Point(It.fromLonLat(w,m()))),p.setProperties({isReverse:!0}),S.addFeature(p))},setMarkers(w,T){function C(P){var A;if(P)for(const R of P.features){const G=R.geometry.type==="Polygon"?new ze.Polygon(R.geometry.coordinates):R.geometry.type==="MultiPolygon"?new ze.MultiPolygon(R.geometry.coordinates):null;G&&S.addFeature(new Fe.Feature({isMask:!!((A=R.properties)!=null&&A.isMask),geometry:E(G)}))}}if(S.clear(),p&&S.addFeature(p),C(),T){let P=!1;if(T.geometry.type==="GeometryCollection"){const A=T.geometry.geometries.map(R=>R.type==="Polygon"?new ze.Polygon(R.coordinates):R.type==="MultiPolygon"?new ze.MultiPolygon(R.coordinates):null).filter(R=>!!R);if(A.length>0)S.addFeature(new Fe.Feature(E(new ze.GeometryCollection(A)))),P=!0;else for(const R of T.geometry.geometries)R.type==="LineString"?(S.addFeature(new Fe.Feature(E(new ze.LineString(R.coordinates)))),P=!0):R.type==="MultiLineString"&&S.addFeature(new Fe.Feature(E(new ze.MultiLineString(R.coordinates)))),P=!0}if(!P){if(T.geometry.type==="Polygon")dl(T,C);else if(T.geometry.type==="MultiPolygon")dl(T,C);else if(T.geometry.type==="LineString"){S.addFeature(new Fe.Feature(E(new ze.LineString(T.geometry.coordinates))));return}else if(T.geometry.type==="MultiLineString"){S.addFeature(new Fe.Feature(E(new ze.MultiLineString(T.geometry.coordinates))));return}}S.addFeature(new Fe.Feature(E(new ze.Point(T.center))))}for(const P of w??[]){if(P===T)continue;const A=new Fe.Feature(new ze.Point(It.fromLonLat(P.center,m())));A.setId(P.id),A.setProperties({fuzzy:!!P.matching_text,tooltip:P.place_type[0]==="reverse"?P.place_name:P.place_name.replace(/,.*/,"")}),S.addFeature(A)}},setSelectedMarker(w){var P,A,R;const T=S.getFeatures(),C=(P=T[0])!=null&&P.getProperties().isReverse?1:0;c>-1&&((A=T[c+C])==null||A.setProperties({isSelected:!1})),w>-1&&((R=T[w+C])==null||R.setProperties({isSelected:!0})),c=w},getCenterAndZoom(){const w=o.getView(),T=w.getCenter(),C=w.getZoom();if(!(!T||C===void 0))return[C,...It.toLonLat(T,m())]}}}Oe.createOpenLayersMapController=Yp,Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"})});
19
+ See the Apache Version 2.0 License for specific language governing permissions
20
+ and limitations under the License.
21
+ ***************************************************************************** */function Tt(o,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,u;return u={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function l(f){return function(a){return c([f,a])}}function c(f){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,r&&(i=f[0]&2?r.return:f[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,f[1])).done)return i;switch(r=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return e.label++,{value:f[1],done:!1};case 5:e.label++,r=f[1],f=[0];continue;case 7:f=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){e=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){e.label=f[1];break}if(f[0]===6&&e.label<i[1]){e.label=i[1],i=f;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(f);break}i[2]&&e.ops.pop(),e.trys.pop();continue}f=t.call(o,e)}catch(a){f=[6,a],r=0}finally{n=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}var T=function(){function o(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return o}();function zt(o,t){return o>t?1:o<t?-1:0}function z(o,t,e){for(var n=new T(null,null),r=n,i=n;;){var u=e(o,t.key);if(u<0){if(t.left===null)break;if(e(o,t.left.key)<0){var l=t.left;if(t.left=l.right,l.right=t,t=l,t.left===null)break}i.left=t,i=t,t=t.left}else if(u>0){if(t.right===null)break;if(e(o,t.right.key)>0){var l=t.right;if(t.right=l.left,l.left=t,t=l,t.right===null)break}r.right=t,r=t,t=t.right}else break}return r.right=t.left,i.left=t.right,t.left=n.right,t.right=n.left,t}function et(o,t,e,n){var r=new T(o,t);if(e===null)return r.left=r.right=null,r;e=z(o,e,n);var i=n(o,e.key);return i<0?(r.left=e.left,r.right=e,e.left=null):i>=0&&(r.right=e.right,r.left=e,e.right=null),r}function pt(o,t,e){var n=null,r=null;if(t){t=z(o,t,e);var i=e(t.key,o);i===0?(n=t.left,r=t.right):i<0?(r=t.right,t.right=null,n=t):(n=t.left,t.left=null,r=t)}return{left:n,right:r}}function qt(o,t,e){return t===null?o:(o===null||(t=z(o.key,t,e),t.left=o),t)}function nt(o,t,e,n,r){if(o){n(""+t+(e?"└── ":"├── ")+r(o)+`
22
+ `);var i=t+(e?" ":"│ ");o.left&&nt(o.left,i,!1,n,r),o.right&&nt(o.right,i,!0,n,r)}}var rt=function(){function o(t){t===void 0&&(t=zt),this._root=null,this._size=0,this._comparator=t}return o.prototype.insert=function(t,e){return this._size++,this._root=et(t,e,this._root,this._comparator)},o.prototype.add=function(t,e){var n=new T(t,e);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var r=this._comparator,i=z(t,this._root,r),u=r(t,i.key);return u===0?this._root=i:(u<0?(n.left=i.left,n.right=i,i.left=null):u>0&&(n.right=i.right,n.left=i,i.right=null),this._size++,this._root=n),this._root},o.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},o.prototype._remove=function(t,e,n){var r;if(e===null)return null;e=z(t,e,n);var i=n(t,e.key);return i===0?(e.left===null?r=e.right:(r=z(t,e.left,n),r.right=e.right),this._size--,r):e},o.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=z(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},o.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(r===0)return e;r<0?e=e.left:e=e.right}return null},o.prototype.find=function(t){return this._root&&(this._root=z(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},o.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(r===0)return!0;r<0?e=e.left:e=e.right}return!1},o.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)n!==null?(r.push(n),n=n.left):r.length!==0?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},o.prototype.range=function(t,e,n,r){for(var i=[],u=this._comparator,l=this._root,c;i.length!==0||l;)if(l)i.push(l),l=l.left;else{if(l=i.pop(),c=u(l.key,e),c>0)break;if(u(l.key,t)>=0&&n.call(r,l))return this;l=l.right}return this},o.prototype.keys=function(){var t=[];return this.forEach(function(e){var n=e.key;return t.push(n)}),t},o.prototype.values=function(){var t=[];return this.forEach(function(e){var n=e.data;return t.push(n)}),t},o.prototype.min=function(){return this._root?this.minNode(this._root).key:null},o.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},o.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},o.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},o.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},o.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(i===0)break;i<0?(n=e,e=e.left):e=e.right}return n},o.prototype.prev=function(t){var e=this._root,n=null;if(t.left!==null){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(i===0)break;i<0?e=e.left:(n=e,e=e.right)}return n},o.prototype.clear=function(){return this._root=null,this._size=0,this},o.prototype.toList=function(){return Qt(this._root)},o.prototype.load=function(t,e,n){e===void 0&&(e=[]),n===void 0&&(n=!1);var r=t.length,i=this._comparator;if(n&&st(t,e,0,r-1,i),this._root===null)this._root=it(t,e,0,r),this._size=r;else{var u=Ut(this.toList(),Vt(t,e),i);r=this._size+r,this._root=ot({head:u},0,r)}return this},o.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(o.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),o.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var e=[];return nt(this._root,"",!0,function(n){return e.push(n)},t),e.join("")},o.prototype.update=function(t,e,n){var r=this._comparator,i=pt(t,this._root,r),u=i.left,l=i.right;r(t,e)<0?l=et(e,n,l,r):u=et(e,n,u,r),this._root=qt(u,l,r)},o.prototype.split=function(t){return pt(t,this._root,this._comparator)},o.prototype[Symbol.iterator]=function(){var t,e,n;return Tt(this,function(r){switch(r.label){case 0:t=this._root,e=[],n=!1,r.label=1;case 1:return n?[3,6]:t===null?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return e.length===0?[3,4]:(t=e.pop(),[4,t]);case 3:return r.sent(),t=t.right,[3,5];case 4:n=!0,r.label=5;case 5:return[3,1];case 6:return[2]}})},o}();function it(o,t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),u=o[i],l=t[i],c=new T(u,l);return c.left=it(o,t,e,i),c.right=it(o,t,i+1,n),c}return null}function Vt(o,t){for(var e=new T(null,null),n=e,r=0;r<o.length;r++)n=n.next=new T(o[r],t[r]);return n.next=null,e.next}function Qt(o){for(var t=o,e=[],n=!1,r=new T(null,null),i=r;!n;)t?(e.push(t),t=t.left):e.length>0?(t=i=i.next=e.pop(),t=t.right):n=!0;return i.next=null,r.next}function ot(o,t,e){var n=e-t;if(n>0){var r=t+Math.floor(n/2),i=ot(o,t,r),u=o.head;return u.left=i,o.head=o.head.next,u.right=ot(o,r+1,e),u}return null}function Ut(o,t,e){for(var n=new T(null,null),r=n,i=o,u=t;i!==null&&u!==null;)e(i.key,u.key)<0?(r.next=i,i=i.next):(r.next=u,u=u.next),r=r.next;return i!==null?r.next=i:u!==null&&(r.next=u),n.next}function st(o,t,e,n,r){if(!(e>=n)){for(var i=o[e+n>>1],u=e-1,l=n+1;;){do u++;while(r(o[u],i)<0);do l--;while(r(o[l],i)>0);if(u>=l)break;var c=o[u];o[u]=o[l],o[l]=c,c=t[u],t[u]=t[l],t[l]=c}st(o,t,e,l,r),st(o,t,l+1,n,r)}}const G=11102230246251565e-32,b=134217729,Yt=(3+8*G)*G;function lt(o,t,e,n,r){let i,u,l,c,f=t[0],a=n[0],s=0,h=0;a>f==a>-f?(i=f,f=t[++s]):(i=a,a=n[++h]);let g=0;if(s<o&&h<e)for(a>f==a>-f?(u=f+i,l=i-(u-f),f=t[++s]):(u=a+i,l=i-(u-a),a=n[++h]),i=u,l!==0&&(r[g++]=l);s<o&&h<e;)a>f==a>-f?(u=i+f,c=u-i,l=i-(u-c)+(f-c),f=t[++s]):(u=i+a,c=u-i,l=i-(u-c)+(a-c),a=n[++h]),i=u,l!==0&&(r[g++]=l);for(;s<o;)u=i+f,c=u-i,l=i-(u-c)+(f-c),f=t[++s],i=u,l!==0&&(r[g++]=l);for(;h<e;)u=i+a,c=u-i,l=i-(u-c)+(a-c),a=n[++h],i=u,l!==0&&(r[g++]=l);return(i!==0||g===0)&&(r[g++]=i),g}function Dt(o,t){let e=t[0];for(let n=1;n<o;n++)e+=t[n];return e}function U(o){return new Float64Array(o)}const Xt=(3+16*G)*G,jt=(2+12*G)*G,Wt=(9+64*G)*G*G,Q=U(4),yt=U(8),xt=U(12),dt=U(16),M=U(4);function Zt(o,t,e,n,r,i,u){let l,c,f,a,s,h,g,y,p,d,x,w,v,m,E,_,k,P;const A=o-r,O=e-r,F=t-i,N=n-i;m=A*N,h=b*A,g=h-(h-A),y=A-g,h=b*N,p=h-(h-N),d=N-p,E=y*d-(m-g*p-y*p-g*d),_=F*O,h=b*F,g=h-(h-F),y=F-g,h=b*O,p=h-(h-O),d=O-p,k=y*d-(_-g*p-y*p-g*d),x=E-k,s=E-x,Q[0]=E-(x+s)+(s-k),w=m+x,s=w-m,v=m-(w-s)+(x-s),x=v-_,s=v-x,Q[1]=v-(x+s)+(s-_),P=w+x,s=P-w,Q[2]=w-(P-s)+(x-s),Q[3]=P;let B=Dt(4,Q),X=jt*u;if(B>=X||-B>=X||(s=o-A,l=o-(A+s)+(s-r),s=e-O,f=e-(O+s)+(s-r),s=t-F,c=t-(F+s)+(s-i),s=n-N,a=n-(N+s)+(s-i),l===0&&c===0&&f===0&&a===0)||(X=Wt*u+Yt*Math.abs(B),B+=A*a+N*l-(F*f+O*c),B>=X||-B>=X))return B;m=l*N,h=b*l,g=h-(h-l),y=l-g,h=b*N,p=h-(h-N),d=N-p,E=y*d-(m-g*p-y*p-g*d),_=c*O,h=b*c,g=h-(h-c),y=c-g,h=b*O,p=h-(h-O),d=O-p,k=y*d-(_-g*p-y*p-g*d),x=E-k,s=E-x,M[0]=E-(x+s)+(s-k),w=m+x,s=w-m,v=m-(w-s)+(x-s),x=v-_,s=v-x,M[1]=v-(x+s)+(s-_),P=w+x,s=P-w,M[2]=w-(P-s)+(x-s),M[3]=P;const de=lt(4,Q,4,M,yt);m=A*a,h=b*A,g=h-(h-A),y=A-g,h=b*a,p=h-(h-a),d=a-p,E=y*d-(m-g*p-y*p-g*d),_=F*f,h=b*F,g=h-(h-F),y=F-g,h=b*f,p=h-(h-f),d=f-p,k=y*d-(_-g*p-y*p-g*d),x=E-k,s=E-x,M[0]=E-(x+s)+(s-k),w=m+x,s=w-m,v=m-(w-s)+(x-s),x=v-_,s=v-x,M[1]=v-(x+s)+(s-_),P=w+x,s=P-w,M[2]=w-(P-s)+(x-s),M[3]=P;const ve=lt(de,yt,4,M,xt);m=l*a,h=b*l,g=h-(h-l),y=l-g,h=b*a,p=h-(h-a),d=a-p,E=y*d-(m-g*p-y*p-g*d),_=c*f,h=b*c,g=h-(h-c),y=c-g,h=b*f,p=h-(h-f),d=f-p,k=y*d-(_-g*p-y*p-g*d),x=E-k,s=E-x,M[0]=E-(x+s)+(s-k),w=m+x,s=w-m,v=m-(w-s)+(x-s),x=v-_,s=v-x,M[1]=v-(x+s)+(s-_),P=w+x,s=P-w,M[2]=w-(P-s)+(x-s),M[3]=P;const we=lt(ve,xt,4,M,dt);return dt[we-1]}function Jt(o,t,e,n,r,i){const u=(t-i)*(e-r),l=(o-r)*(n-i),c=u-l,f=Math.abs(u+l);return Math.abs(c)>=Xt*f?c:-Zt(o,t,e,n,r,i,f)}const Y=(o,t)=>o.ll.x<=t.x&&t.x<=o.ur.x&&o.ll.y<=t.y&&t.y<=o.ur.y,ut=(o,t)=>{if(t.ur.x<o.ll.x||o.ur.x<t.ll.x||t.ur.y<o.ll.y||o.ur.y<t.ll.y)return null;const e=o.ll.x<t.ll.x?t.ll.x:o.ll.x,n=o.ur.x<t.ur.x?o.ur.x:t.ur.x,r=o.ll.y<t.ll.y?t.ll.y:o.ll.y,i=o.ur.y<t.ur.y?o.ur.y:t.ur.y;return{ll:{x:e,y:r},ur:{x:n,y:i}}};let q=Number.EPSILON;q===void 0&&(q=Math.pow(2,-52));const Kt=q*q,vt=(o,t)=>{if(-q<o&&o<q&&-q<t&&t<q)return 0;const e=o-t;return e*e<Kt*o*t?0:o<t?-1:1};class Ht{constructor(){this.reset()}reset(){this.xRounder=new wt,this.yRounder=new wt}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class wt{constructor(){this.tree=new rt,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(n!==null&&vt(e.key,n.key)===0)return this.tree.remove(t),n.key;const r=this.tree.next(e);return r!==null&&vt(e.key,r.key)===0?(this.tree.remove(t),r.key):t}}const D=new Ht,W=(o,t)=>o.x*t.y-o.y*t.x,mt=(o,t)=>o.x*t.x+o.y*t.y,Et=(o,t,e)=>{const n=Jt(o.x,o.y,t.x,t.y,e.x,e.y);return n>0?-1:n<0?1:0},Z=o=>Math.sqrt(mt(o,o)),te=(o,t,e)=>{const n={x:t.x-o.x,y:t.y-o.y},r={x:e.x-o.x,y:e.y-o.y};return W(r,n)/Z(r)/Z(n)},ee=(o,t,e)=>{const n={x:t.x-o.x,y:t.y-o.y},r={x:e.x-o.x,y:e.y-o.y};return mt(r,n)/Z(r)/Z(n)},St=(o,t,e)=>t.y===0?null:{x:o.x+t.x/t.y*(e-o.y),y:e},bt=(o,t,e)=>t.x===0?null:{x:e,y:o.y+t.y/t.x*(e-o.x)},ne=(o,t,e,n)=>{if(t.x===0)return bt(e,n,o.x);if(n.x===0)return bt(o,t,e.x);if(t.y===0)return St(e,n,o.y);if(n.y===0)return St(o,t,e.y);const r=W(t,n);if(r==0)return null;const i={x:e.x-o.x,y:e.y-o.y},u=W(i,t)/r,l=W(i,n)/r,c=o.x+l*t.x,f=e.x+u*n.x,a=o.y+l*t.y,s=e.y+u*n.y,h=(c+f)/2,g=(a+s)/2;return{x:h,y:g}};class I{static compare(t,e){const n=I.comparePoints(t.point,e.point);return n!==0?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:V.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let n=0,r=e.length;n<r;n++){const i=e[n];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(n.segment.consumedBy===void 0)for(let r=e+1;r<t;r++){const i=this.point.events[r];i.consumedBy===void 0&&n.otherSE.point.events===i.otherSE.point.events&&n.segment.consume(i.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}getLeftmostComparator(t){const e=new Map,n=r=>{const i=r.otherSE;e.set(r,{sine:te(this.point,t.point,i.point),cosine:ee(this.point,t.point,i.point)})};return(r,i)=>{e.has(r)||n(r),e.has(i)||n(i);const{sine:u,cosine:l}=e.get(r),{sine:c,cosine:f}=e.get(i);return u>=0&&c>=0?l<f?1:l>f?-1:0:u<0&&c<0?l<f?-1:l>f?1:0:c<u?-1:c>u?1:0}}}let re=0;class V{static compare(t,e){const n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,u=e.rightSE.point.x;if(u<n)return 1;if(i<r)return-1;const l=t.leftSE.point.y,c=e.leftSE.point.y,f=t.rightSE.point.y,a=e.rightSE.point.y;if(n<r){if(c<l&&c<f)return 1;if(c>l&&c>f)return-1;const s=t.comparePoint(e.leftSE.point);if(s<0)return 1;if(s>0)return-1;const h=e.comparePoint(t.rightSE.point);return h!==0?h:-1}if(n>r){if(l<c&&l<a)return-1;if(l>c&&l>a)return 1;const s=e.comparePoint(t.leftSE.point);if(s!==0)return s;const h=t.comparePoint(e.rightSE.point);return h<0?1:h>0?-1:1}if(l<c)return-1;if(l>c)return 1;if(i<u){const s=e.comparePoint(t.rightSE.point);if(s!==0)return s}if(i>u){const s=t.comparePoint(e.rightSE.point);if(s<0)return 1;if(s>0)return-1}if(i!==u){const s=f-l,h=i-n,g=a-c,y=u-r;if(s>h&&g<y)return 1;if(s<h&&g>y)return-1}return i>u?1:i<u||f<a?-1:f>a?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,r){this.id=++re,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=r}static fromRing(t,e,n){let r,i,u;const l=I.comparePoints(t,e);if(l<0)r=t,i=e,u=1;else if(l>0)r=e,i=t,u=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const c=new I(r,!0),f=new I(i,!1);return new V(c,f,[n],[u])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const i=(t.y-e.y)/r.y,u=e.x+i*r.x;if(t.x===u)return 0;const l=(t.x-e.x)/r.x,c=e.y+l*r.y;return t.y===c?0:t.y<c?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),r=ut(e,n);if(r===null)return null;const i=this.leftSE.point,u=this.rightSE.point,l=t.leftSE.point,c=t.rightSE.point,f=Y(e,l)&&this.comparePoint(l)===0,a=Y(n,i)&&t.comparePoint(i)===0,s=Y(e,c)&&this.comparePoint(c)===0,h=Y(n,u)&&t.comparePoint(u)===0;if(a&&f)return h&&!s?u:!h&&s?c:null;if(a)return s&&i.x===c.x&&i.y===c.y?null:i;if(f)return h&&u.x===l.x&&u.y===l.y?null:l;if(h&&s)return null;if(h)return u;if(s)return c;const g=ne(i,this.vector(),l,t.vector());return g===null||!Y(r,g)?null:D.round(g.x,g.y)}split(t){const e=[],n=t.events!==void 0,r=new I(t,!0),i=new I(t,!1),u=this.rightSE;this.replaceRightSE(i),e.push(i),e.push(r);const l=new V(r,u,this.rings.slice(),this.windings.slice());return I.comparePoints(l.leftSE.point,l.rightSE.point)>0&&l.swapEvents(),I.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),i.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const r=V.compare(e,n);if(r!==0){if(r>0){const i=e;e=n,n=i}if(e.prev===n){const i=e;e=n,n=i}for(let i=0,u=n.rings.length;i<u;i++){const l=n.rings[i],c=n.windings[i],f=e.rings.indexOf(l);f===-1?(e.rings.push(l),e.windings.push(c)):e.windings[f]+=c}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let l=0,c=this.rings.length;l<c;l++){const f=this.rings[l],a=this.windings[l],s=e.indexOf(f);s===-1?(e.push(f),n.push(a)):n[s]+=a}const i=[],u=[];for(let l=0,c=e.length;l<c;l++){if(n[l]===0)continue;const f=e[l],a=f.poly;if(u.indexOf(a)===-1)if(f.isExterior)i.push(a);else{u.indexOf(a)===-1&&u.push(a);const s=i.indexOf(f.poly);s!==-1&&i.splice(s,1)}}for(let l=0,c=i.length;l<c;l++){const f=i[l].multiPoly;r.indexOf(f)===-1&&r.push(f)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(C.type){case"union":{const n=t.length===0,r=e.length===0;this._isInResult=n!==r;break}case"intersection":{let n,r;t.length<e.length?(n=t.length,r=e.length):(n=e.length,r=t.length),this._isInResult=r===C.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2===1;break}case"difference":{const n=r=>r.length===1&&r[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${C.type}`)}return this._isInResult}}class _t{constructor(t,e,n){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=D.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let u=1,l=t.length;u<l;u++){if(typeof t[u][0]!="number"||typeof t[u][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let c=D.round(t[u][0],t[u][1]);c.x===i.x&&c.y===i.y||(this.segments.push(V.fromRing(i,c,this)),c.x<this.bbox.ll.x&&(this.bbox.ll.x=c.x),c.y<this.bbox.ll.y&&(this.bbox.ll.y=c.y),c.x>this.bbox.ur.x&&(this.bbox.ur.x=c.x),c.y>this.bbox.ur.y&&(this.bbox.ur.y=c.y),i=c)}(r.x!==i.x||r.y!==i.y)&&this.segments.push(V.fromRing(i,r,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}class ie{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new _t(t[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let n=1,r=t.length;n<r;n++){const i=new _t(t[n],this,!1);i.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=i.bbox.ll.x),i.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=i.bbox.ll.y),i.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=i.bbox.ur.y),this.interiorRings.push(i)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const r=this.interiorRings[e].getSweepEvents();for(let i=0,u=r.length;i<u;i++)t.push(r[i])}return t}}class Pt{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let n=0,r=t.length;n<r;n++){const i=new ie(t[n],this);i.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=i.bbox.ll.x),i.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=i.bbox.ll.y),i.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=i.bbox.ur.y),this.polys.push(i)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const r=this.polys[e].getSweepEvents();for(let i=0,u=r.length;i<u;i++)t.push(r[i])}return t}}class J{static factory(t){const e=[];for(let n=0,r=t.length;n<r;n++){const i=t[n];if(!i.isInResult()||i.ringOut)continue;let u=null,l=i.leftSE,c=i.rightSE;const f=[l],a=l.point,s=[];for(;u=l,l=c,f.push(l),l.point!==a;)for(;;){const h=l.getAvailableLinkedEvents();if(h.length===0){const p=f[0].point,d=f[f.length-1].point;throw new Error(`Unable to complete output ring starting at [${p.x}, ${p.y}]. Last matching segment found ends at [${d.x}, ${d.y}].`)}if(h.length===1){c=h[0].otherSE;break}let g=null;for(let p=0,d=s.length;p<d;p++)if(s[p].point===l.point){g=p;break}if(g!==null){const p=s.splice(g)[0],d=f.splice(p.index);d.unshift(d[0].otherSE),e.push(new J(d.reverse()));continue}s.push({index:f.length,point:l.point});const y=l.getLeftmostComparator(u);c=h.sort(y)[0].otherSE;break}e.push(new J(f))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let f=1,a=this.events.length-1;f<a;f++){const s=this.events[f].point,h=this.events[f+1].point;Et(s,t,h)!==0&&(e.push(s),t=s)}if(e.length===1)return null;const n=e[0],r=e[1];Et(n,t,r)===0&&e.shift(),e.push(e[0]);const i=this.isExteriorRing()?1:-1,u=this.isExteriorRing()?0:e.length-1,l=this.isExteriorRing()?e.length:-1,c=[];for(let f=u;f!=l;f+=i)c.push([e[f].x,e[f].y]);return c}isExteriorRing(){if(this._isExteriorRing===void 0){const t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let r=1,i=this.events.length;r<i;r++){const u=this.events[r];I.compare(t,u)>0&&(t=u)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class Mt{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const r=this.interiorRings[e].getGeom();r!==null&&t.push(r)}return t}}class oe{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const r=this.polys[e].getGeom();r!==null&&t.push(r)}return t}_composePolys(t){const e=[];for(let n=0,r=t.length;n<r;n++){const i=t[n];if(!i.poly)if(i.isExteriorRing())e.push(new Mt(i));else{const u=i.enclosingRing();u.poly||e.push(new Mt(u)),u.poly.addInterior(i)}}return e}}class se{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:V.compare;this.queue=t,this.tree=new rt(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const r=t.isLeft?this.tree.add(e):this.tree.find(e);if(!r)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let i=r,u=r,l,c;for(;l===void 0;)i=this.tree.prev(i),i===null?l=null:i.key.consumedBy===void 0&&(l=i.key);for(;c===void 0;)u=this.tree.next(u),u===null?c=null:u.key.consumedBy===void 0&&(c=u.key);if(t.isLeft){let f=null;if(l){const s=l.getIntersection(e);if(s!==null&&(e.isAnEndpoint(s)||(f=s),!l.isAnEndpoint(s))){const h=this._splitSafely(l,s);for(let g=0,y=h.length;g<y;g++)n.push(h[g])}}let a=null;if(c){const s=c.getIntersection(e);if(s!==null&&(e.isAnEndpoint(s)||(a=s),!c.isAnEndpoint(s))){const h=this._splitSafely(c,s);for(let g=0,y=h.length;g<y;g++)n.push(h[g])}}if(f!==null||a!==null){let s=null;f===null?s=a:a===null?s=f:s=I.comparePoints(f,a)<=0?f:a,this.queue.remove(e.rightSE),n.push(e.rightSE);const h=e.split(s);for(let g=0,y=h.length;g<y;g++)n.push(h[g])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=l)}else{if(l&&c){const f=l.getIntersection(c);if(f!==null){if(!l.isAnEndpoint(f)){const a=this._splitSafely(l,f);for(let s=0,h=a.length;s<h;s++)n.push(a[s])}if(!c.isAnEndpoint(f)){const a=this._splitSafely(c,f);for(let s=0,h=a.length;s<h;s++)n.push(a[s])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const r=t.split(e);return r.push(n),t.consumedBy===void 0&&this.tree.add(t),r}}const Lt=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,le=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class ue{run(t,e,n){C.type=t,D.reset();const r=[new Pt(e,!0)];for(let s=0,h=n.length;s<h;s++)r.push(new Pt(n[s],!1));if(C.numMultiPolys=r.length,C.type==="difference"){const s=r[0];let h=1;for(;h<r.length;)ut(r[h].bbox,s.bbox)!==null?h++:r.splice(h,1)}if(C.type==="intersection")for(let s=0,h=r.length;s<h;s++){const g=r[s];for(let y=s+1,p=r.length;y<p;y++)if(ut(g.bbox,r[y].bbox)===null)return[]}const i=new rt(I.compare);for(let s=0,h=r.length;s<h;s++){const g=r[s].getSweepEvents();for(let y=0,p=g.length;y<p;y++)if(i.insert(g[y]),i.size>Lt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const u=new se(i);let l=i.size,c=i.pop();for(;c;){const s=c.key;if(i.size===l){const g=s.segment;throw new Error(`Unable to pop() ${s.isLeft?"left":"right"} SweepEvent [${s.point.x}, ${s.point.y}] from segment #${g.id} [${g.leftSE.point.x}, ${g.leftSE.point.y}] -> [${g.rightSE.point.x}, ${g.rightSE.point.y}] from queue.`)}if(i.size>Lt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(u.segments.length>le)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const h=u.process(s);for(let g=0,y=h.length;g<y;g++){const p=h[g];p.consumedBy===void 0&&i.insert(p)}l=i.size,c=i.pop()}D.reset();const f=J.factory(u.segments);return new oe(f).getGeom()}}const C=new ue;var Rt={union:function(o){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("union",o,e)},intersection:function(o){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("intersection",o,e)},xor:function(o){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("xor",o,e)},difference:function(o){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("difference",o,e)}};function fe(o){const t=[];if(tt(o,r=>{t.push(r.coordinates)}),t.length<2)throw new Error("Must have at least two features");const e=o.features[0].properties||{},n=Rt.difference(t[0],...t.slice(1));return n.length===0?null:n.length===1?K(n[0],e):ht(n,e)}var ce=fe;function he(o){if(!o)throw new Error("geojson is required");var t=[];return Bt(o,function(e){t.push(e)}),H(t)}var ae=he;function ge(o,t={}){const e=[];if(tt(o,r=>{e.push(r.coordinates)}),e.length<2)throw new Error("Must have at least 2 geometries");const n=Rt.union(e[0],...e.slice(1));return n.length===0?null:n.length===1?K(n[0],t.properties):ht(n,t.properties)}var pe=ge;function It(o){const t=[...o];return t[2]<t[0]&&(Math.abs((t[0]+t[2]+360)/2)>Math.abs((t[0]-360+t[2])/2)?t[0]-=360:t[2]+=360),t}function kt(o,t){const e=ce(H([K([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),o]));if(!e)return;e.properties={isMask:!0};const n=It(gt(o)),r=(n[2]-n[0])/360/1e3,i=n[0]<-180,u=n[2]>180,l=ae(o);if(l.features.length>1&&(i||u))for(const c of l.features){const f=It(gt(c));if(u&&f[0]<-180+r)for(const a of c.geometry.coordinates)for(const s of a)s[0]+=360-r;if(i&&f[2]>180-r)for(const a of c.geometry.coordinates)for(const s of a)s[0]-=360-r}t(H([l.features.length<2?o:pe(l)??o,e]))}const Ct="EPSG:4326";function ye(o){var i;const t=o.getProperties(),{isMask:e}=t,n=(i=o.getGeometry())==null?void 0:i.getType(),r=e?0:n==="LineString"||n==="MultiLineString"?3:2;return new Nt({stroke:e?void 0:new ct({color:"#3170fe",lineDash:[r,r],width:r,lineCap:"butt"}),fill:e?new ft({color:"#00000020"}):void 0,image:new Ft({src:`/icons/marker_${t.isReverse?"reverse":t.isSelected?"selected":"unselected"}.svg`,anchor:[.5,1]}),zIndex:t.isSelected?2:t.isReverse?0:1,text:t.isSelected&&t.tooltip?new Gt({backgroundFill:new ft({color:"white"}),text:t.tooltip,offsetY:-40,backgroundStroke:new ct({color:"white",lineJoin:"round",width:3}),padding:[2,0,0,2]}):void 0})}function xe(o,t={},e={},n=ye){let r=-1,i,u,l,c=!1;const f=new At({updateWhileAnimating:!0});o.addLayer(f);const a=new Ot({});f.setSource(a),f.setStyle(n),o.on("click",y=>{o.forEachFeatureAtPixel(y.pixel,p=>{const d=p.getId();if(d)return y.stopPropagation(),u==null||u({type:"markerClick",id:d}),p})}),o.on("pointermove",y=>{const p=o.forEachFeatureAtPixel(y.pixel,d=>d.getId());i!==p&&(i&&(u==null||u({type:"markerMouseLeave",id:i})),p&&(u==null||u({type:"markerMouseEnter",id:p})),o.getTargetElement().style.cursor=p?"pointer":c?"crosshair":"",i=p)});function s(){return $.getUserProjection()??o.getView().getProjection()}function h(y){return y.transform(Ct,s())}const g=y=>{u==null||u({type:"mapClick",coordinates:$.toLonLat(y.coordinate,s())})};return{setEventHandler(y){y?(u=y,o.on("click",g)):(u=void 0,o.un("click",g))},flyTo(y,p){o.getView().animate({center:$.fromLonLat(y,s()),...p?{zoom:p}:{},duration:2e3,...t})},fitBounds(y,p,d){o.getView().fit($.transformExtent(y,Ct,s()),{padding:[p,p,p,p],...d?{maxZoom:d}:{},duration:2e3,...e})},indicateReverse(y){c=y,o.getTargetElement().style.cursor=y?"crosshair":""},setReverseMarker(y){l?y?l.getGeometry().setCoordinates($.fromLonLat(y,s())):(a.removeFeature(l),l.dispose(),l=void 0):y&&(l=new L.Feature(new R.Point($.fromLonLat(y,s()))),l.setProperties({isReverse:!0}),a.addFeature(l))},setMarkers(y,p){function d(x){var w;if(x)for(const v of x.features){const m=v.geometry.type==="Polygon"?new R.Polygon(v.geometry.coordinates):v.geometry.type==="MultiPolygon"?new R.MultiPolygon(v.geometry.coordinates):null;m&&a.addFeature(new L.Feature({isMask:!!((w=v.properties)!=null&&w.isMask),geometry:h(m)}))}}if(a.clear(),l&&a.addFeature(l),p){let x=!1;if(p.geometry.type==="GeometryCollection"){const w=p.geometry.geometries.map(v=>v.type==="Polygon"?new R.Polygon(v.coordinates):v.type==="MultiPolygon"?new R.MultiPolygon(v.coordinates):null).filter(v=>!!v);if(w.length>0)a.addFeature(new L.Feature(h(new R.GeometryCollection(w)))),x=!0;else for(const v of p.geometry.geometries)v.type==="LineString"?(a.addFeature(new L.Feature(h(new R.LineString(v.coordinates)))),x=!0):v.type==="MultiLineString"&&a.addFeature(new L.Feature(h(new R.MultiLineString(v.coordinates)))),x=!0}if(!x){if(p.geometry.type==="Polygon")kt(p,d);else if(p.geometry.type==="MultiPolygon")kt(p,d);else if(p.geometry.type==="LineString"){a.addFeature(new L.Feature(h(new R.LineString(p.geometry.coordinates))));return}else if(p.geometry.type==="MultiLineString"){a.addFeature(new L.Feature(h(new R.MultiLineString(p.geometry.coordinates))));return}}a.addFeature(new L.Feature(h(new R.Point(p.center))))}for(const x of y??[]){if(x===p)continue;const w=new L.Feature(new R.Point($.fromLonLat(x.center,s())));w.setId(x.id),w.setProperties({fuzzy:!!x.matching_text,tooltip:x.place_type[0]==="reverse"?x.place_name:x.place_name.replace(/,.*/,"")}),a.addFeature(w)}},setSelectedMarker(y){var x,w,v;const p=a.getFeatures(),d=(x=p[0])!=null&&x.getProperties().isReverse?1:0;r>-1&&((w=p[r+d])==null||w.setProperties({isSelected:!1})),y>-1&&((v=p[y+d])==null||v.setProperties({isSelected:!0})),r=y},getCenterAndZoom(){const y=o.getView(),p=y.getCenter(),d=y.getZoom();if(!(!p||d===void 0))return[d,...$.toLonLat(p,s())]}}}S.createOpenLayersMapController=xe,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
32
23
  //# sourceMappingURL=openlayers-controller.umd.js.map