u?s:u)+(l0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=Is.orientationIndex(n,r,e),l=Is.orientationIndex(n,r,i);return a>0&&l>0||a<0&&l<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===l?this.computeCollinearIntersection(e,i,n,r):(0===o||0===s||0===a||0===l?(this._isProper=!1,e.equals2D(n)||e.equals2D(r)?this._intPt[0]=e:i.equals2D(n)||i.equals2D(r)?this._intPt[0]=i:0===o?this._intPt[0]=new Wo(n):0===s?this._intPt[0]=new Wo(r):0===a?this._intPt[0]=new Wo(e):0===l&&(this._intPt[0]=new Wo(i))):(this._isProper=!0,this._intPt[0]=this.intersection(e,i,n,r)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,i,n){var r=t,o=Is.distancePointLine(t,i,n),s=Is.distancePointLine(e,i,n);return s0?i>0?-r:r:i>0?r:-r;if(0===e||0===i)return n>0?t>0?r:-r:t>0?-r:r;if(e>0?n>0?e<=n||(r=-r,o=t,t=i,i=o,o=e,e=n,n=o):e<=-n?(r=-r,i=-i,n=-n):(o=t,t=-i,i=o,o=e,e=-n,n=o):n>0?-e<=n?(r=-r,t=-t,e=-e):(o=-t,t=i,i=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,i=-i,n=-n):(r=-r,o=-t,t=-i,i=o,o=-e,e=-n,n=o),t>0){if(!(i>0))return r;if(!(t<=i))return r}else{if(i>0)return-r;if(!(t>=i))return-r;r=-r,t=-t,i=-i}for(;;){if((n-=(s=Math.floor(i/t))*e)<0)return-r;if(n>e)return r;if(t>(i-=s*t)+i){if(en+n)return-r;i=t-i,n=e-n,r=-r}if(0===n)return 0===i?0:-r;if(0===i)return r;if((e-=(s=Math.floor(t/i))*n)<0)return r;if(e>n)return-r;if(i>(t-=s*i)+t){if(ne+e)return r;t=i-t,e=n-e,r=-r}if(0===e)return 0===t?0:r;if(0===t)return-r}};var Ts=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};Ts.prototype.countSegment=function(t,e){if(t.xn&&(i=e.x,n=t.x),this._p.x>=i&&this._p.x<=n&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var r=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,l=Ms.signOfDet2x2(r,o,s,a);if(0===l)return this._isPointOnSegment=!0,null;a0&&this._crossingCount++}},Ts.prototype.isPointInPolygon=function(){return this.getLocation()!==Yo.EXTERIOR},Ts.prototype.getLocation=function(){return this._isPointOnSegment?Yo.BOUNDARY:this._crossingCount%2==1?Yo.INTERIOR:Yo.EXTERIOR},Ts.prototype.isOnSegment=function(){return this._isPointOnSegment},Ts.prototype.interfaces_=function(){return[]},Ts.prototype.getClass=function(){return Ts},Ts.locatePointInRing=function(){if(arguments[0]instanceof Wo&&Jo(arguments[1],as)){for(var t=arguments[1],e=new Ts(arguments[0]),i=new Wo,n=new Wo,r=1;r1||a<0||a>1)&&(r=!0)}}else r=!0;return r?Ko.min(Is.distancePointLine(t,i,n),Is.distancePointLine(e,i,n),Is.distancePointLine(i,t,e),Is.distancePointLine(n,t,e)):0},Is.isPointInRing=function(t,e){return Is.locatePointInRing(t,e)!==Yo.EXTERIOR},Is.computeLength=function(t){var e=t.size();if(e<=1)return 0;var i=0,n=new Wo;t.getCoordinate(0,n);for(var r=n.x,o=n.y,s=1;si.y&&(i=o,n=r)}var s=n;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(i)&&s!==n);var a=n;do{a=(a+1)%e}while(t[a].equals2D(i)&&a!==n);var l=t[s],c=t[a];if(l.equals2D(i)||c.equals2D(i)||l.equals2D(c))return!1;var u=Is.computeOrientation(l,i,c),h=!1;return h=0===u?l.x>c.x:u>0,h},Is.locatePointInRing=function(t,e){return Ts.locatePointInRing(t,e)},Is.distancePointLinePerpendicular=function(t,e,i){var n=(i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y),r=((e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y))/n;return Math.abs(r)*Math.sqrt(n)},Is.computeOrientation=function(t,e,i){return Is.orientationIndex(t,e,i)},Is.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new zo("Line array must contain at least one vertex");for(var i=t.distance(e[0]),n=0;n=1)return o.distance(a);var u=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/l;return Math.abs(u)*Math.sqrt(l)}},Is.isOnLine=function(t,e){for(var i=new Ss,n=1;n0},zs.prototype.interfaces_=function(){return[ks]},zs.prototype.getClass=function(){return zs};var Fs=function(){};Fs.prototype.isInBoundary=function(t){return t>1},Fs.prototype.interfaces_=function(){return[ks]},Fs.prototype.getClass=function(){return Fs};var Vs=function(){};Vs.prototype.isInBoundary=function(t){return 1===t},Vs.prototype.interfaces_=function(){return[ks]},Vs.prototype.getClass=function(){return Vs};var Us=function(){};function Gs(t){this.message=t||""}Us.prototype.add=function(){},Us.prototype.addAll=function(){},Us.prototype.isEmpty=function(){},Us.prototype.iterator=function(){},Us.prototype.size=function(){},Us.prototype.toArray=function(){},Us.prototype.remove=function(){},Gs.prototype=new Error,Gs.prototype.name="IndexOutOfBoundsException";var js=function(){};js.prototype.hasNext=function(){},js.prototype.next=function(){},js.prototype.remove=function(){};var Hs=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Us);function Ws(t){this.message=t||""}Ws.prototype=new Error,Ws.prototype.name="NoSuchElementException";var qs=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Us&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,Us]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var i=this.array_[t];return this.array_[t]=e,i},e.prototype.iterator=function(){return new Xs(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new Gs;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,i=this.array_.length;e=1)if(this.get(this.size()-1).equals2D(o))return null;t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var s=arguments[0],a=arguments[1];return this.add(s,a),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var l=arguments[0],c=arguments[1];if(arguments[2])for(var u=0;u=0;h--)e.add(l[h],c);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof Wo){var p=arguments[0],d=arguments[1];if(!arguments[2]){var f=this.size();if(f>0){if(p>0)if(this.get(p-1).equals2D(d))return null;if(pv&&(_=-1);for(var x=y;x!==v;x+=_)e.add(m[x],g);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Wo(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,i),e}(qs),Ys=function(){},Qs={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Qs.ForwardComparator.get=function(){return Js},Qs.BidirectionalComparator.get=function(){return Ks},Qs.coordArrayType.get=function(){return new Array(0).fill(null)},Ys.prototype.interfaces_=function(){return[]},Ys.prototype.getClass=function(){return Ys},Ys.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},Ys.ptNotInList=function(t,e){for(var i=0;i=t?e:[]},Ys.indexOf=function(t,e){for(var i=0;i0)&&(e=t[i]);return e},Ys.extract=function(t,e,i){e=Ko.clamp(e,0,t.length);var n=(i=Ko.clamp(i,-1,t.length))-e+1;i<0&&(n=0),e>=t.length&&(n=0),in.length)return 1;if(0===i.length)return 0;var r=Ys.compare(i,n);return Ys.isEqualReversed(i,n)?0:r},Ks.prototype.OLDcompare=function(t,e){var i=t,n=e;if(i.lengthn.length)return 1;if(0===i.length)return 0;for(var r=Ys.increasingDirection(i),o=Ys.increasingDirection(n),s=r>0?0:i.length-1,a=o>0?0:i.length-1,l=0;l0))return e.value;e=e.right}}return null},ua.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var i,n,r=this.root_;do{if(i=r,(n=t.compareTo(r.key))<0)r=r.left;else{if(!(n>0)){var o=r.value;return r.value=e,o}r=r.right}}while(null!==r);var s={key:t,left:null,right:null,value:e,parent:i,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?i.left=s:i.right=s,this.fixAfterInsertion(s),this.size_++,null},ua.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(sa(t)===la(sa(sa(t)))){var i=ca(sa(sa(t)));1===oa(i)?(aa(sa(t),0),aa(i,0),aa(sa(sa(t)),1),t=sa(sa(t))):(t===ca(sa(t))&&(t=sa(t),e.rotateLeft(t)),aa(sa(t),0),aa(sa(sa(t)),1),e.rotateRight(sa(sa(t))))}else{var n=la(sa(sa(t)));1===oa(n)?(aa(sa(t),0),aa(n,0),aa(sa(sa(t)),1),t=sa(sa(t))):(t===la(sa(t))&&(t=sa(t),e.rotateRight(t)),aa(sa(t),0),aa(sa(sa(t)),1),e.rotateLeft(sa(sa(t))))}this.root_.color=0},ua.prototype.values=function(){var t=new qs,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=ua.successor(e));)t.add(e.value);return t},ua.prototype.entrySet=function(){var t=new na,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=ua.successor(e));)t.add(e);return t},ua.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},ua.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},ua.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},ua.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var i=t.parent,n=t;null!==i&&n===i.right;)n=i,i=i.parent;return i},ua.prototype.size=function(){return this.size_};var ha=function(){};function pa(){}function da(){this.array_=[],arguments[0]instanceof Us&&this.addAll(arguments[0])}ha.prototype.interfaces_=function(){return[]},ha.prototype.getClass=function(){return ha},pa.prototype=new ia,da.prototype=new pa,da.prototype.contains=function(t){for(var e=0,i=this.array_.length;e=0;){var s=r.substring(0,o);n.add(s),o=(r=r.substring(o+i)).indexOf(e)}r.length>0&&n.add(r);for(var a=new Array(n.size()).fill(null),l=0;l0)for(var o=r;o0&&n.append(" ");for(var o=0;o0&&n.append(","),n.append(Pa.toString(t.getOrdinate(r,o)))}return n.append(")"),n.toString()}},Da.ensureValidRing=function(t,e){var i=e.size();return 0===i?e:i<=3?Da.createClosedRing(t,e,4):e.getOrdinate(0,as.X)===e.getOrdinate(i-1,as.X)&&e.getOrdinate(0,as.Y)===e.getOrdinate(i-1,as.Y)?e:Da.createClosedRing(t,e,i+1)},Da.createClosedRing=function(t,e,i){var n=t.create(i,e.getDimension()),r=e.size();Da.copy(e,0,n,0,r);for(var o=r;o0&&Da.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?ga.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return Is.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return Da.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,i=0;e= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},i.MINIMUM_VALID_SIZE.get=function(){return 4},i.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,i),e}(Ra),Va=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Ls.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],i=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,i)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),i=0;i0?e.createPoint(i[0]):e.createPoint():t},Ha.prototype.interfaces_=function(){return[Ua.GeometryEditorOperation]},Ha.prototype.getClass=function(){return Ha};var Wa=function(){};Wa.prototype.edit=function(t,e){return t instanceof Fa?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Ra?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof ka?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},Wa.prototype.interfaces_=function(){return[Ua.GeometryEditorOperation]},Wa.prototype.getClass=function(){return Wa};var qa=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var i=0;i0){var t=new ts(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e3&&(e=3),e<2?new qa(t):new qa(t,e)}},Za.prototype.interfaces_=function(){return[Zo,Ho]},Za.prototype.getClass=function(){return Za},Za.instance=function(){return Za.instanceObject},Ya.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Ya.instanceObject.get=function(){return new Za},Object.defineProperties(Za,Ya);var Qa=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new qs,e=this.map_.values(),i=e.next();!i.done;)t.add(i.value),i=e.next();return t},e.prototype.entrySet=function(){var t=new na;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}($s),Ja=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof $a){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var i=arguments[0];this._modelType=t.FIXED,this.setScale(i)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},Ka={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Ja.prototype.equals=function(t){if(!(t instanceof Ja))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},Ja.prototype.compareTo=function(t){var e=t,i=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new es(i).compareTo(new es(n))},Ja.prototype.getScale=function(){return this._scale},Ja.prototype.isFloating=function(){return this._modelType===Ja.FLOATING||this._modelType===Ja.FLOATING_SINGLE},Ja.prototype.getType=function(){return this._modelType},Ja.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Ja.FLOATING?t="Floating":this._modelType===Ja.FLOATING_SINGLE?t="Floating-Single":this._modelType===Ja.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},Ja.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return Fo.isNaN(t)||this._modelType===Ja.FLOATING_SINGLE?t:this._modelType===Ja.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof Wo){var e=arguments[0];if(this._modelType===Ja.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},Ja.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Ja.FLOATING?t=16:this._modelType===Ja.FLOATING_SINGLE?t=6:this._modelType===Ja.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},Ja.prototype.setScale=function(t){this._scale=Math.abs(t)},Ja.prototype.interfaces_=function(){return[Ho,Uo]},Ja.prototype.getClass=function(){return Ja},Ja.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Ka.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},Ka.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Ja,Ka);var $a=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},tl={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};$a.prototype.readResolve=function(){return $a.nameToTypeMap.get(this._name)},$a.prototype.toString=function(){return this._name},$a.prototype.interfaces_=function(){return[Ho]},$a.prototype.getClass=function(){return $a},tl.serialVersionUID.get=function(){return-552860263173159e4},tl.nameToTypeMap.get=function(){return new Qa},Object.defineProperties($a,tl),Ja.Type=$a,Ja.FIXED=new $a("FIXED"),Ja.FLOATING=new $a("FLOATING"),Ja.FLOATING_SINGLE=new $a("FLOATING SINGLE");var el=function t(){this._precisionModel=new Ja,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?Jo(arguments[0],Zo)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Ja&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},il={serialVersionUID:{configurable:!0}};el.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Wo(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Wo(t.getMinX(),t.getMinY()),new Wo(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Wo(t.getMinX(),t.getMinY()),new Wo(t.getMinX(),t.getMaxY()),new Wo(t.getMaxX(),t.getMaxY()),new Wo(t.getMaxX(),t.getMinY()),new Wo(t.getMinX(),t.getMinY())]),null)},el.prototype.createLineString=function(t){return t?t instanceof Array?new Ra(this.getCoordinateSequenceFactory().create(t),this):Jo(t,as)?new Ra(t,this):void 0:new Ra(this.getCoordinateSequenceFactory().create([]),this)},el.prototype.createMultiLineString=function(){return 0===arguments.length?new ba(null,this):1===arguments.length?new ba(arguments[0],this):void 0},el.prototype.buildGeometry=function(t){for(var e=null,i=!1,n=!1,r=t.iterator();r.hasNext();){var o=r.next(),s=o.getClass();null===e&&(e=s),s!==e&&(i=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(i||n)return this.createGeometryCollection(el.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Ba)return this.createMultiPolygon(el.toPolygonArray(t));if(a instanceof Ra)return this.createMultiLineString(el.toLineStringArray(t));if(a instanceof ka)return this.createMultiPoint(el.toPointArray(t));ws.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},el.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},el.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Wo){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(Jo(arguments[0],as))return new ka(arguments[0],this)}},el.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},el.prototype.createPolygon=function(){if(0===arguments.length)return new Ba(null,null,this);if(1===arguments.length){if(Jo(arguments[0],as)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Fa){var i=arguments[0];return this.createPolygon(i,null)}}else if(2===arguments.length){return new Ba(arguments[0],arguments[1],this)}},el.prototype.getSRID=function(){return this._SRID},el.prototype.createGeometryCollection=function(){return 0===arguments.length?new xa(null,this):1===arguments.length?new xa(arguments[0],this):void 0},el.prototype.createGeometry=function(t){return new Ua(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},el.prototype.getPrecisionModel=function(){return this._precisionModel},el.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(Jo(arguments[0],as))return new Fa(arguments[0],this)}},el.prototype.createMultiPolygon=function(){return 0===arguments.length?new Va(null,this):1===arguments.length?new Va(arguments[0],this):void 0},el.prototype.createMultiPoint=function(){if(0===arguments.length)return new za(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new za(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(Jo(arguments[0],as)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(e.size()).fill(null),n=0;n=this.size())throw new Error;return this.array_[t]},pl.prototype.push=function(t){return this.array_.push(t),t},pl.prototype.pop=function(t){if(0===this.array_.length)throw new hl;return this.array_.pop()},pl.prototype.peek=function(){if(0===this.array_.length)throw new hl;return this.array_[this.array_.length-1]},pl.prototype.empty=function(){return 0===this.array_.length},pl.prototype.isEmpty=function(){return this.empty()},pl.prototype.search=function(t){return this.array_.indexOf(t)},pl.prototype.size=function(){return this.array_.length},pl.prototype.toArray=function(){for(var t=[],e=0,i=this.array_.length;e0&&this._minIndexthis._minCoord.y&&i.y>this._minCoord.y&&n===Is.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)},dl.prototype.getRightmostSideOfSegment=function(t,e){var i=t.getEdge().getCoordinates();if(e<0||e+1>=i.length)return-1;if(i[e].y===i[e+1].y)return-1;var n=cl.LEFT;return i[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=i[n])},dl.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},dl.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var i=e.next();i.isForward()&&this.checkForRightmostCoordinate(i)}ws.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===cl.LEFT&&(this._orientedDe=this._minDe.getSym())},dl.prototype.interfaces_=function(){return[]},dl.prototype.getClass=function(){return dl};var fl=function(t){function e(i,n){t.call(this,e.msgWithCoord(i,n)),this.pt=n?new Wo(n):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(xs),ml=function(){this.array_=[]};ml.prototype.addLast=function(t){this.array_.push(t)},ml.prototype.removeFirst=function(){return this.array_.shift()},ml.prototype.isEmpty=function(){return 0===this.array_.length};var gl=function(){this._finder=null,this._dirEdgeList=new qs,this._nodes=new qs,this._rightMostCoord=null,this._env=null,this._finder=new dl};gl.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},gl.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},gl.prototype.computeNodeDepth=function(t){for(var e=null,i=t.getEdges().iterator();i.hasNext();){var n=i.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new fl("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var r=t.getEdges().iterator();r.hasNext();){var o=r.next();o.setVisited(!0),this.copySymDepths(o)}},gl.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(cl.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},gl.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},gl.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(cl.RIGHT)>=1&&e.getDepth(cl.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},gl.prototype.computeDepths=function(t){var e=new na,i=new ml,n=t.getNode();for(i.addLast(n),e.add(n),t.setVisited(!0);!i.isEmpty();){var r=i.removeFirst();e.add(r),this.computeNodeDepth(r);for(var o=r.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(i.addLast(a),e.add(a))}}}},gl.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0},gl.prototype.getEnvelope=function(){if(null===this._env){for(var t=new ds,e=this._dirEdgeList.iterator();e.hasNext();)for(var i=e.next().getEdge().getCoordinates(),n=0;nthis.location.length){var e=new Array(3).fill(null);e[cl.ON]=this.location[cl.ON],e[cl.LEFT]=Yo.NONE,e[cl.RIGHT]=Yo.NONE,this.location=e}for(var i=0;i1&&t.append(Yo.toLocationSymbol(this.location[cl.LEFT])),t.append(Yo.toLocationSymbol(this.location[cl.ON])),this.location.length>1&&t.append(Yo.toLocationSymbol(this.location[cl.RIGHT])),t.toString()},yl.prototype.setLocations=function(t,e,i){this.location[cl.ON]=t,this.location[cl.LEFT]=e,this.location[cl.RIGHT]=i},yl.prototype.get=function(t){return t1},yl.prototype.isAnyNull=function(){for(var t=0;tt._maxNodeDegree&&(t._maxNodeDegree=i),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},_l.prototype.addPoints=function(t,e,i){var n=t.getCoordinates();if(e){var r=1;i&&(r=0);for(var o=r;o=0;a--)this._pts.add(n[a])}},_l.prototype.isHole=function(){return this._isHole},_l.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},_l.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!Is.isPointInRing(t,e.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){if(i.next().containsPoint(t))return!1}return!0},_l.prototype.addHole=function(t){this._holes.add(t)},_l.prototype.isShell=function(){return null===this._shell},_l.prototype.getLabel=function(){return this._label},_l.prototype.getEdges=function(){return this._edges},_l.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},_l.prototype.getShell=function(){return this._shell},_l.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],i=arguments[0].getLocation(e,cl.RIGHT);if(i===Yo.NONE)return null;if(this._label.getLocation(e)===Yo.NONE)return this._label.setLocation(e,i),null}},_l.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},_l.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),i=0;i=2,"found partial label"),this.computeIM(t)},wl.prototype.isInResult=function(){return this._isInResult},wl.prototype.isVisited=function(){return this._isVisited},wl.prototype.interfaces_=function(){return[]},wl.prototype.getClass=function(){return wl};var Al=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],i=arguments[1];this._coord=e,this._edges=i,this._label=new vl(0,Yo.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();){if(t.next().getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var i=Yo.NONE;if(i=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);i!==Yo.BOUNDARY&&(i=n)}return i},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],i=arguments[1];null===this._label?this._label=new vl(e,i):this._label.setLocation(e,i)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof vl)for(var n=arguments[0],r=0;r<2;r++){var o=t.computeMergedLocation(n,r);t._label.getLocation(r)===Yo.NONE&&t._label.setLocation(r,o)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=Yo.NONE;null!==this._label&&(e=this._label.getLocation(t));var i=null;if(e===Yo.BOUNDARY)i=Yo.INTERIOR;else i=Yo.BOUNDARY;this._label.setLocation(t,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wl),El=function(){this.nodeMap=new ua,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};El.prototype.find=function(t){return this.nodeMap.get(t)},El.prototype.addNode=function(){if(arguments[0]instanceof Wo){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof Al){var i=arguments[0],n=this.nodeMap.get(i.getCoordinate());return null===n?(this.nodeMap.put(i.getCoordinate(),i),i):(n.mergeLabel(i),n)}},El.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},El.prototype.iterator=function(){return this.nodeMap.values().iterator()},El.prototype.values=function(){return this.nodeMap.values()},El.prototype.getBoundaryNodes=function(t){for(var e=new qs,i=this.iterator();i.hasNext();){var n=i.next();n.getLabel().getLocation(t)===Yo.BOUNDARY&&e.add(n)}return e},El.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},El.prototype.interfaces_=function(){return[]},El.prototype.getClass=function(){return El};var Sl=function(){},Ml={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Sl.prototype.interfaces_=function(){return[]},Sl.prototype.getClass=function(){return Sl},Sl.isNorthern=function(t){return t===Sl.NE||t===Sl.NW},Sl.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},Sl.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var i=te?t:e)?3:i},Sl.isInHalfPlane=function(t,e){return e===Sl.SE?t===Sl.SE||t===Sl.SW:t===e||t===e+1},Sl.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new zo("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Sl.NE:Sl.SE:e>=0?Sl.NW:Sl.SW}if(arguments[0]instanceof Wo&&arguments[1]instanceof Wo){var i=arguments[0],n=arguments[1];if(n.x===i.x&&n.y===i.y)throw new zo("Cannot compute the quadrant for two identical points "+i);return n.x>=i.x?n.y>=i.y?Sl.NE:Sl.SE:n.y>=i.y?Sl.NW:Sl.SW}},Ml.NE.get=function(){return 0},Ml.NW.get=function(){return 1},Ml.SW.get=function(){return 2},Ml.SE.get=function(){return 3},Object.defineProperties(Sl,Ml);var Tl=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,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],i=arguments[1],n=arguments[2];this._edge=e,this.init(i,n),this._label=null}else if(4===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=r,this.init(o,s),this._label=a}};Tl.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):i.addAll(s)}else n.add(o)}return n},Ll.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},Ll.prototype.buildMaximalEdgeRings=function(t){for(var e=new qs,i=t.iterator();i.hasNext();){var n=i.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var r=new bl(n,this._geometryFactory);e.add(r),r.setInResult()}}return e},Ll.prototype.placePolygonHoles=function(t,e){for(var i=e.iterator();i.hasNext();){var n=i.next();n.isHole()&&n.setShell(t)}},Ll.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Ll.prototype.findEdgeRingContaining=function(t,e){for(var i=t.getLinearRing(),n=i.getEnvelopeInternal(),r=i.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var l=a.next(),c=l.getLinearRing(),u=c.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var h=!1;u.contains(n)&&Is.isPointInRing(r,c.getCoordinates())&&(h=!0),h&&(null===o||s.contains(u))&&(o=l)}return o},Ll.prototype.findShell=function(t){for(var e=0,i=null,n=t.iterator();n.hasNext();){var r=n.next();r.isHole()||(i=r,e++)}return ws.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),i},Ll.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0];Pl.linkResultDirectedEdges(arguments[1]);var i=this.buildMaximalEdgeRings(e),n=new qs,r=this.buildMinimalEdgeRings(i,this._shellList,n);this.sortShellsAndHoles(r,this._shellList,n),this.placeFreeHoles(this._shellList,n)}},Ll.prototype.interfaces_=function(){return[]},Ll.prototype.getClass=function(){return Ll};var Dl=function(){};Dl.prototype.getBounds=function(){},Dl.prototype.interfaces_=function(){return[]},Dl.prototype.getClass=function(){return Dl};var Rl=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Rl.prototype.getItem=function(){return this._item},Rl.prototype.getBounds=function(){return this._bounds},Rl.prototype.interfaces_=function(){return[Dl,Ho]},Rl.prototype.getClass=function(){return Rl};var Ol=function(){this._size=null,this._items=null,this._size=0,this._items=new qs,this._items.add(null)};Ol.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},Ol.prototype.size=function(){return this._size},Ol.prototype.reorder=function(t){for(var e=this,i=null,n=this._items.get(t);2*t<=this._size&&((i=2*t)!==e._size&&e._items.get(i+1).compareTo(e._items.get(i))<0&&i++,e._items.get(i).compareTo(n)<0);t=i)e._items.set(t,e._items.get(i));this._items.set(t,n)},Ol.prototype.clear=function(){this._size=0,this._items.clear()},Ol.prototype.isEmpty=function(){return 0===this._size},Ol.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},Ol.prototype.interfaces_=function(){return[]},Ol.prototype.getClass=function(){return Ol};var kl=function(){};kl.prototype.visitItem=function(t){},kl.prototype.interfaces_=function(){return[]},kl.prototype.getClass=function(){return kl};var Nl=function(){};Nl.prototype.insert=function(t,e){},Nl.prototype.remove=function(t,e){},Nl.prototype.query=function(){},Nl.prototype.interfaces_=function(){return[]},Nl.prototype.getClass=function(){return Nl};var Bl=function(){if(this._childBoundables=new qs,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},zl={serialVersionUID:{configurable:!0}};Bl.prototype.getLevel=function(){return this._level},Bl.prototype.size=function(){return this._childBoundables.size()},Bl.prototype.getChildBoundables=function(){return this._childBoundables},Bl.prototype.addChildBoundable=function(t){ws.isTrue(null===this._bounds),this._childBoundables.add(t)},Bl.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Bl.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Bl.prototype.interfaces_=function(){return[Dl,Ho]},Bl.prototype.getClass=function(){return Bl},zl.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Bl,zl);var Fl=function(){};Fl.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Fl.min=function(t){return Fl.sort(t),t.get(0)},Fl.sort=function(t,e){var i=t.toArray();e?ma.sort(i,e):ma.sort(i);for(var n=t.iterator(),r=0,o=i.length;rVl.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(i)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new zo("neither boundable is composite")},Vl.prototype.isLeaves=function(){return!(Vl.isComposite(this._boundable1)||Vl.isComposite(this._boundable2))},Vl.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0},Vl.prototype.expand=function(t,e,i,n){for(var r=t.getChildBoundables().iterator();r.hasNext();){var o=r.next(),s=new Vl(o,e,this._itemDistance);s.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=i}},Gl={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Ul.prototype.getNodeCapacity=function(){return this._nodeCapacity},Ul.prototype.lastNode=function(t){return t.get(t.size()-1)},Ul.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var i=e.next();i instanceof Bl?t+=this.size(i):i instanceof Rl&&(t+=1)}return t}},Ul.prototype.removeItem=function(t,e){for(var i=null,n=t.getChildBoundables().iterator();n.hasNext();){var r=n.next();r instanceof Rl&&r.getItem()===e&&(i=r)}return null!==i&&(t.getChildBoundables().remove(i),!0)},Ul.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new qs:t}if(1===arguments.length){for(var e=arguments[0],i=new qs,n=e.getChildBoundables().iterator();n.hasNext();){var r=n.next();if(r instanceof Bl){var o=this.itemsTree(r);null!==o&&i.add(o)}else r instanceof Rl?i.add(r.getItem()):ws.shouldNeverReachHere()}return i.size()<=0?null:i}},Ul.prototype.insert=function(t,e){ws.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Rl(t,e))},Ul.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new qs;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var i=arguments[0],n=arguments[1],r=arguments[2];if(ws.isTrue(i>-2),n.getLevel()===i)return r.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof Bl?this.boundablesAtLevel(i,s,r):(ws.isTrue(s instanceof Rl),-1===i&&r.add(s))}return null}},Ul.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var i=new qs;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,i),i}if(2===arguments.length){var n=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,r)}else if(3===arguments.length)if(Jo(arguments[2],kl)&&arguments[0]instanceof Object&&arguments[1]instanceof Bl)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),l=0;lt&&(t=n)}}return t+1}},Ul.prototype.createParentBoundables=function(t,e){var i=this;ws.isTrue(!t.isEmpty());var n=new qs;n.add(this.createNode(e));var r=new qs(t);Fl.sort(r,this.getComparator());for(var o=r.iterator();o.hasNext();){var s=o.next();i.lastNode(n).getChildBoundables().size()===i.getNodeCapacity()&&n.add(i.createNode(e)),i.lastNode(n).addChildBoundable(s)}return n},Ul.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Ul.prototype.interfaces_=function(){return[Ho]},Ul.prototype.getClass=function(){return Ul},Ul.compareDoubles=function(t,e){return t>e?1:t0);for(var i=new qs,n=0;n0;){var h=u.poll(),p=h.getDistance();if(p>=l)break;h.isLeaves()?(l=p,c=h):h.expandToQueue(u,l)}return[c.getBoundable(0).getItem(),c.getBoundable(1).getItem()]}}else if(3===arguments.length){var d=arguments[2],f=new Rl(arguments[0],arguments[1]),m=new Vl(this.getRoot(),f,d);return this.nearestNeighbour(m)[0]}},e.prototype.interfaces_=function(){return[Nl,Ho]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},i.STRtreeNode.get=function(){return ql},i.serialVersionUID.get=function(){return 0x39920f7d5f261e0},i.xComparator.get=function(){return{interfaces_:function(){return[jo]},compare:function(i,n){return t.compareDoubles(e.centreX(i.getBounds()),e.centreX(n.getBounds()))}}},i.yComparator.get=function(){return{interfaces_:function(){return[jo]},compare:function(i,n){return t.compareDoubles(e.centreY(i.getBounds()),e.centreY(n.getBounds()))}}},i.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},i.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,i),e}(Ul),ql=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var i=e.next();null===t?t=new ds(i.getBounds()):t.expandToInclude(i.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Bl),Xl=function(){};Xl.prototype.interfaces_=function(){return[]},Xl.prototype.getClass=function(){return Xl},Xl.relativeSign=function(t,e){return te?1:0},Xl.compare=function(t,e,i){if(e.equals2D(i))return 0;var n=Xl.relativeSign(e.x,i.x),r=Xl.relativeSign(e.y,i.y);switch(t){case 0:return Xl.compareValue(n,r);case 1:return Xl.compareValue(r,n);case 2:return Xl.compareValue(r,-n);case 3:return Xl.compareValue(-n,r);case 4:return Xl.compareValue(-n,-r);case 5:return Xl.compareValue(-r,-n);case 6:return Xl.compareValue(-r,n);case 7:return Xl.compareValue(n,-r)}return ws.shouldNeverReachHere("invalid octant value"),0},Xl.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Zl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];this._segString=t,this.coord=new Wo(e),this.segmentIndex=i,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(i))};Zl.prototype.getCoordinate=function(){return this.coord},Zl.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},Zl.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:Xl.compare(this._segmentOctant,this.coord,e.coord)},Zl.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},Zl.prototype.isInterior=function(){return this._isInterior},Zl.prototype.interfaces_=function(){return[Uo]},Zl.prototype.getClass=function(){return Zl};var Yl=function(){this._nodeMap=new ua,this._edge=null;var t=arguments[0];this._edge=t};Yl.prototype.getSplitCoordinates=function(){var t=new Zs;this.addEndpoints();for(var e=this.iterator(),i=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(i,n,t),i=n}return t.toCoordinateArray()},Yl.prototype.addCollapsedNodes=function(){var t=new qs;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var i=e.next().intValue();this.add(this._edge.getCoordinate(i),i)}},Yl.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Yl.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e=0?e>=0?i>=n?0:1:i>=n?7:6:e>=0?i>=n?3:2:i>=n?4:5}if(arguments[0]instanceof Wo&&arguments[1]instanceof Wo){var r=arguments[0],o=arguments[1],s=o.x-r.x,a=o.y-r.y;if(0===s&&0===a)throw new zo("Cannot compute the octant for two identical points "+r);return Ql.octant(s,a)}};var Jl=function(){};Jl.prototype.getCoordinates=function(){},Jl.prototype.size=function(){},Jl.prototype.getCoordinate=function(t){},Jl.prototype.isClosed=function(){},Jl.prototype.setData=function(t){},Jl.prototype.getData=function(){},Jl.prototype.interfaces_=function(){return[]},Jl.prototype.getClass=function(){return Jl};var Kl=function(){};Kl.prototype.addIntersection=function(t,e){},Kl.prototype.interfaces_=function(){return[Jl]},Kl.prototype.getClass=function(){return Kl};var $l=function(){this._nodeList=new Yl(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};$l.prototype.getCoordinates=function(){return this._pts},$l.prototype.size=function(){return this._pts.length},$l.prototype.getCoordinate=function(t){return this._pts[t]},$l.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},$l.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},$l.prototype.setData=function(t){this._data=t},$l.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Ql.octant(t,e)},$l.prototype.getData=function(){return this._data},$l.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var i=arguments[1],n=arguments[3],r=new Wo(arguments[0].getIntersection(n));this.addIntersection(r,i)}},$l.prototype.toString=function(){return _s.toLineString(new qa(this._pts))},$l.prototype.getNodeList=function(){return this._nodeList},$l.prototype.addIntersectionNode=function(t,e){var i=e,n=i+1;if(n=0&&i>=0||e<=0&&i<=0?Math.max(e,i):0}if(arguments[0]instanceof Wo){var n=arguments[0];return Is.orientationIndex(this.p0,this.p1,n)}},tc.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},tc.prototype.isVertical=function(){return this.p0.x===this.p1.x},tc.prototype.equals=function(t){if(!(t instanceof tc))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},tc.prototype.intersection=function(t){var e=new Ss;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},tc.prototype.project=function(){if(arguments[0]instanceof Wo){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Wo(t);var e=this.projectionFactor(t),i=new Wo;return i.x=this.p0.x+e*(this.p1.x-this.p0.x),i.y=this.p0.y+e*(this.p1.y-this.p0.y),i}if(arguments[0]instanceof tc){var n=arguments[0],r=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(r>=1&&o>=1)return null;if(r<=0&&o<=0)return null;var s=this.project(n.p0);r<0&&(s=this.p0),r>1&&(s=this.p1);var a=this.project(n.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new tc(s,a)}},tc.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},tc.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},tc.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},tc.prototype.distancePerpendicular=function(t){return Is.distancePointLinePerpendicular(t,this.p0,this.p1)},tc.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},tc.prototype.midPoint=function(){return tc.midPoint(this.p0,this.p1)},tc.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,i=this.p1.y-this.p0.y,n=e*e+i*i;return n<=0?Fo.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*i)/n},tc.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var i=new Array(2).fill(null),n=Fo.MAX_VALUE,r=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),i[0]=o,i[1]=t.p0;var s=this.closestPoint(t.p1);(r=s.distance(t.p1))0&&e<1?this.project(t):this.p0.distance(t)1||Fo.isNaN(e))&&(e=1),e},tc.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},tc.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},tc.prototype.distance=function(){if(arguments[0]instanceof tc){var t=arguments[0];return Is.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof Wo){var e=arguments[0];return Is.distancePointLine(e,this.p0,this.p1)}},tc.prototype.pointAlong=function(t){var e=new Wo;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},tc.prototype.hashCode=function(){var t=Fo.doubleToLongBits(this.p0.x);t^=31*Fo.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),i=Fo.doubleToLongBits(this.p1.x);return i^=31*Fo.doubleToLongBits(this.p1.y),e^(Math.trunc(i)^Math.trunc(i>>32))},tc.prototype.interfaces_=function(){return[Uo,Ho]},tc.prototype.getClass=function(){return tc},tc.midPoint=function(t,e){return new Wo((t.x+e.x)/2,(t.y+e.y)/2)},ec.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(tc,ec);var ic=function(){this.tempEnv1=new ds,this.tempEnv2=new ds,this._overlapSeg1=new tc,this._overlapSeg2=new tc};ic.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],i=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},ic.prototype.interfaces_=function(){return[]},ic.prototype.getClass=function(){return ic};var nc=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=i,this._context=n};nc.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},nc.prototype.computeSelect=function(t,e,i,n){var r=this._pts[e],o=this._pts[i];if(n.tempEnv1.init(r,o),i-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var s=Math.trunc((e+i)/2);e=t.length-1)return t.length-1;for(var n=Sl.quadrant(t[i],t[i+1]),r=e+1;rn.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},i.SegmentOverlapAction.get=function(){return lc},Object.defineProperties(e,i),e}(sc),lc=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],i=arguments[2],n=arguments[3],r=arguments[0].getContext(),o=i.getContext();this._si.processIntersections(r,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ic),cc=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var i=arguments[0],n=arguments[1];this.setQuadrantSegments(i),this.setEndCapStyle(n)}else if(4===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(r),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},uc={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};cc.prototype.getEndCapStyle=function(){return this._endCapStyle},cc.prototype.isSingleSided=function(){return this._isSingleSided},cc.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=cc.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=cc.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==cc.JOIN_ROUND&&(this._quadrantSegments=cc.DEFAULT_QUADRANT_SEGMENTS)},cc.prototype.getJoinStyle=function(){return this._joinStyle},cc.prototype.setJoinStyle=function(t){this._joinStyle=t},cc.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},cc.prototype.getSimplifyFactor=function(){return this._simplifyFactor},cc.prototype.getQuadrantSegments=function(){return this._quadrantSegments},cc.prototype.setEndCapStyle=function(t){this._endCapStyle=t},cc.prototype.getMitreLimit=function(){return this._mitreLimit},cc.prototype.setMitreLimit=function(t){this._mitreLimit=t},cc.prototype.setSingleSided=function(t){this._isSingleSided=t},cc.prototype.interfaces_=function(){return[]},cc.prototype.getClass=function(){return cc},cc.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},uc.CAP_ROUND.get=function(){return 1},uc.CAP_FLAT.get=function(){return 2},uc.CAP_SQUARE.get=function(){return 3},uc.JOIN_ROUND.get=function(){return 1},uc.JOIN_MITRE.get=function(){return 2},uc.JOIN_BEVEL.get=function(){return 3},uc.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},uc.DEFAULT_MITRE_LIMIT.get=function(){return 5},uc.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(cc,uc);var hc=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Is.COUNTERCLOCKWISE,this._inputLine=t||null},pc={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};hc.prototype.isDeletable=function(t,e,i,n){var r=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[i];return!!this.isConcave(r,o,s)&&(!!this.isShallow(r,o,s,n)&&this.isShallowSampled(r,o,t,i,n))},hc.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,i=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(i),r=!1;n=0;n--)this.addPt(t[n])},dc.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)Math.PI;)t-=mc.PI_TIMES_2;for(;t<=-Math.PI;)t+=mc.PI_TIMES_2;return t},mc.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],i=arguments[1],n=i.x-e.x,r=i.y-e.y;return Math.atan2(r,n)}},mc.isAcute=function(t,e,i){var n=t.x-e.x,r=t.y-e.y;return n*(i.x-e.x)+r*(i.y-e.y)>0},mc.isObtuse=function(t,e,i){var n=t.x-e.x,r=t.y-e.y;return n*(i.x-e.x)+r*(i.y-e.y)<0},mc.interiorAngle=function(t,e,i){var n=mc.angle(e,t),r=mc.angle(e,i);return Math.abs(r-n)},mc.normalizePositive=function(t){if(t<0){for(;t<0;)t+=mc.PI_TIMES_2;t>=mc.PI_TIMES_2&&(t=0)}else{for(;t>=mc.PI_TIMES_2;)t-=mc.PI_TIMES_2;t<0&&(t=0)}return t},mc.angleBetween=function(t,e,i){var n=mc.angle(e,t),r=mc.angle(e,i);return mc.diff(n,r)},mc.diff=function(t,e){var i=null;return(i=tMath.PI&&(i=2*Math.PI-i),i},mc.toRadians=function(t){return t*Math.PI/180},mc.getTurn=function(t,e){var i=Math.sin(e-t);return i>0?mc.COUNTERCLOCKWISE:i<0?mc.CLOCKWISE:mc.NONE},mc.angleBetweenOriented=function(t,e,i){var n=mc.angle(e,t),r=mc.angle(e,i)-n;return r<=-Math.PI?r+mc.PI_TIMES_2:r>Math.PI?r-mc.PI_TIMES_2:r},gc.PI_TIMES_2.get=function(){return 2*Math.PI},gc.PI_OVER_2.get=function(){return Math.PI/2},gc.PI_OVER_4.get=function(){return Math.PI/4},gc.COUNTERCLOCKWISE.get=function(){return Is.COUNTERCLOCKWISE},gc.CLOCKWISE.get=function(){return Is.CLOCKWISE},gc.NONE.get=function(){return Is.COLLINEAR},Object.defineProperties(mc,gc);var yc=function t(){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 tc,this._seg1=new tc,this._offset0=new tc,this._offset1=new tc,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],i=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=i,this._li=new Ss,this._filletAngleQuantum=Math.PI/2/i.getQuadrantSegments(),i.getQuadrantSegments()>=8&&i.getJoinStyle()===cc.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},vc={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};yc.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,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 i=Is.computeOrientation(this._s0,this._s1,this._s2),n=i===Is.CLOCKWISE&&this._side===cl.LEFT||i===Is.COUNTERCLOCKWISE&&this._side===cl.RIGHT;0===i?this.addCollinear(e):n?this.addOutsideTurn(i,e):this.addInsideTurn(i,e)},yc.prototype.addLineEndCap=function(t,e){var i=new tc(t,e),n=new tc;this.computeOffsetSegment(i,cl.LEFT,this._distance,n);var r=new tc;this.computeOffsetSegment(i,cl.RIGHT,this._distance,r);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case cc.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,Is.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case cc.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(r.p1);break;case cc.CAP_SQUARE:var l=new Wo;l.x=Math.abs(this._distance)*Math.cos(a),l.y=Math.abs(this._distance)*Math.sin(a);var c=new Wo(n.p1.x+l.x,n.p1.y+l.y),u=new Wo(r.p1.x+l.x,r.p1.y+l.y);this._segList.addPt(c),this._segList.addPt(u)}},yc.prototype.getCoordinates=function(){return this._segList.getCoordinates()},yc.prototype.addMitreJoin=function(t,e,i,n){var r=!0,o=null;try{o=ps.intersection(e.p0,e.p1,i.p0,i.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(r=!1)}catch(t){if(!(t instanceof us))throw t;o=new Wo(0,0),r=!1}r?this._segList.addPt(o):this.addLimitedMitreJoin(e,i,n,this._bufParams.getMitreLimit())},yc.prototype.addFilletCorner=function(t,e,i,n,r){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),l=i.x-t.x,c=i.y-t.y,u=Math.atan2(c,l);n===Is.CLOCKWISE?a<=u&&(a+=2*Math.PI):a>=u&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,u,n,r),this._segList.addPt(i)},yc.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var i=new Wo((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(i);var n=new Wo((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(n)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},yc.prototype.createCircle=function(t){var e=new Wo(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},yc.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},yc.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new dc,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*yc.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},yc.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===cc.JOIN_BEVEL||this._bufParams.getJoinStyle()===cc.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,Is.CLOCKWISE,this._distance))},yc.prototype.closeRing=function(){this._segList.closeRing()},yc.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},yc.prototype.interfaces_=function(){return[]},yc.prototype.getClass=function(){return yc},vc.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},vc.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},vc.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},vc.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(yc,vc);var _c=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};_c.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var i=e<0,n=Math.abs(e),r=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],r):this.computeOffsetCurve(t,i,r);var o=r.getCoordinates();return i&&Ys.reverse(o),o},_c.prototype.computeSingleSidedBufferCurve=function(t,e,i){var n=this.simplifyTolerance(this._distance);if(e){i.addSegments(t,!0);var r=hc.simplify(t,-n),o=r.length-1;i.initSideSegments(r[o],r[o-1],cl.LEFT),i.addFirstSegment();for(var s=o-2;s>=0;s--)i.addNextSegment(r[s],!0)}else{i.addSegments(t,!1);var a=hc.simplify(t,n),l=a.length-1;i.initSideSegments(a[0],a[1],cl.LEFT),i.addFirstSegment();for(var c=2;c<=l;c++)i.addNextSegment(a[c],!0)}i.addLastSegment(),i.closeRing()},_c.prototype.computeRingBufferCurve=function(t,e,i){var n=this.simplifyTolerance(this._distance);e===cl.RIGHT&&(n=-n);var r=hc.simplify(t,n),o=r.length-1;i.initSideSegments(r[o-1],r[0],e);for(var s=1;s<=o;s++){var a=1!==s;i.addNextSegment(r[s],a)}i.closeRing()},_c.prototype.computeLineBufferCurve=function(t,e){var i=this.simplifyTolerance(this._distance),n=hc.simplify(t,i),r=n.length-1;e.initSideSegments(n[0],n[1],cl.LEFT);for(var o=2;o<=r;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[r-1],n[r]);var s=hc.simplify(t,-i),a=s.length-1;e.initSideSegments(s[a],s[a-1],cl.LEFT);for(var l=a-2;l>=0;l--)e.addNextSegment(s[l],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},_c.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case cc.CAP_ROUND:e.createCircle(t);break;case cc.CAP_SQUARE:e.createSquare(t)}},_c.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var i=Math.abs(e),n=this.getSegGen(i);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var r=e<0;this.computeSingleSidedBufferCurve(t,r,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},_c.prototype.getBufferParameters=function(){return this._bufParams},_c.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},_c.prototype.getRingCurve=function(t,e,i){if(this._distance=i,t.length<=2)return this.getLineCurve(t,i);if(0===i)return _c.copyCoordinates(t);var n=this.getSegGen(i);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},_c.prototype.computeOffsetCurve=function(t,e,i){var n=this.simplifyTolerance(this._distance);if(e){var r=hc.simplify(t,-n),o=r.length-1;i.initSideSegments(r[o],r[o-1],cl.LEFT),i.addFirstSegment();for(var s=o-2;s>=0;s--)i.addNextSegment(r[s],!0)}else{var a=hc.simplify(t,n),l=a.length-1;i.initSideSegments(a[0],a[1],cl.LEFT),i.addFirstSegment();for(var c=2;c<=l;c++)i.addNextSegment(a[c],!0)}i.addLastSegment()},_c.prototype.getSegGen=function(t){return new yc(this._precisionModel,this._bufParams,t)},_c.prototype.interfaces_=function(){return[]},_c.prototype.getClass=function(){return _c},_c.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),i=0;io.getMaxY()||t.findStabbedSegments(e,r.getDirectedEdges(),i)}return i}if(3===arguments.length)if(Jo(arguments[2],Hs)&&arguments[0]instanceof Wo&&arguments[1]instanceof Il)for(var s=arguments[0],a=arguments[1],l=arguments[2],c=a.getEdge().getCoordinates(),u=0;ut._seg.p1.y&&t._seg.reverse(),!(Math.max(t._seg.p0.x,t._seg.p1.x)t._seg.p1.y||Is.computeOrientation(t._seg.p0,t._seg.p1,s)===Is.RIGHT)){var h=a.getDepth(cl.LEFT);t._seg.p0.equals(c[u])||(h=a.getDepth(cl.RIGHT));var p=new wc(t._seg,h);l.add(p)}}else if(Jo(arguments[2],Hs)&&arguments[0]instanceof Wo&&Jo(arguments[1],Hs))for(var d=arguments[0],f=arguments[2],m=arguments[1].iterator();m.hasNext();){var g=m.next();g.isForward()&&t.findStabbedSegments(d,g,f)}},xc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Fl.min(e)._leftDepth},xc.prototype.interfaces_=function(){return[]},xc.prototype.getClass=function(){return xc},bc.DepthSegment.get=function(){return wc},Object.defineProperties(xc,bc);var wc=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new tc(t),this._leftDepth=e};wc.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var i=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==i||0!==(i=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?i:this._upwardSeg.compareTo(e._upwardSeg)},wc.prototype.compareX=function(t,e){var i=t.p0.compareTo(e.p0);return 0!==i?i:t.p1.compareTo(e.p1)},wc.prototype.toString=function(){return this._upwardSeg.toString()},wc.prototype.interfaces_=function(){return[Uo]},wc.prototype.getClass=function(){return wc};var Ac=function(t,e,i){this.p0=t||null,this.p1=e||null,this.p2=i||null};Ac.prototype.area=function(){return Ac.area(this.p0,this.p1,this.p2)},Ac.prototype.signedArea=function(){return Ac.signedArea(this.p0,this.p1,this.p2)},Ac.prototype.interpolateZ=function(t){if(null===t)throw new zo("Supplied point is null.");return Ac.interpolateZ(t,this.p0,this.p1,this.p2)},Ac.prototype.longestSideLength=function(){return Ac.longestSideLength(this.p0,this.p1,this.p2)},Ac.prototype.isAcute=function(){return Ac.isAcute(this.p0,this.p1,this.p2)},Ac.prototype.circumcentre=function(){return Ac.circumcentre(this.p0,this.p1,this.p2)},Ac.prototype.area3D=function(){return Ac.area3D(this.p0,this.p1,this.p2)},Ac.prototype.centroid=function(){return Ac.centroid(this.p0,this.p1,this.p2)},Ac.prototype.inCentre=function(){return Ac.inCentre(this.p0,this.p1,this.p2)},Ac.prototype.interfaces_=function(){return[]},Ac.prototype.getClass=function(){return Ac},Ac.area=function(t,e,i){return Math.abs(((i.x-t.x)*(e.y-t.y)-(e.x-t.x)*(i.y-t.y))/2)},Ac.signedArea=function(t,e,i){return((i.x-t.x)*(e.y-t.y)-(e.x-t.x)*(i.y-t.y))/2},Ac.det=function(t,e,i,n){return t*n-e*i},Ac.interpolateZ=function(t,e,i,n){var r=e.x,o=e.y,s=i.x-r,a=n.x-r,l=i.y-o,c=n.y-o,u=s*c-a*l,h=t.x-r,p=t.y-o,d=(c*h-a*p)/u,f=(-l*h+s*p)/u;return e.z+d*(i.z-e.z)+f*(n.z-e.z)},Ac.longestSideLength=function(t,e,i){var n=t.distance(e),r=e.distance(i),o=i.distance(t),s=n;return r>s&&(s=r),o>s&&(s=o),s},Ac.isAcute=function(t,e,i){return!!mc.isAcute(t,e,i)&&(!!mc.isAcute(e,i,t)&&!!mc.isAcute(i,t,e))},Ac.circumcentre=function(t,e,i){var n=i.x,r=i.y,o=t.x-n,s=t.y-r,a=e.x-n,l=e.y-r,c=2*Ac.det(o,s,a,l),u=Ac.det(s,o*o+s*s,l,a*a+l*l),h=Ac.det(o,o*o+s*s,a,a*a+l*l);return new Wo(n-u/c,r+h/c)},Ac.perpendicularBisector=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=new ps(t.x+i/2,t.y+n/2,1),o=new ps(t.x-n+i/2,t.y+i+n/2,1);return new ps(r,o)},Ac.angleBisector=function(t,e,i){var n=e.distance(t),r=n/(n+e.distance(i)),o=i.x-t.x,s=i.y-t.y;return new Wo(t.x+r*o,t.y+r*s)},Ac.area3D=function(t,e,i){var n=e.x-t.x,r=e.y-t.y,o=e.z-t.z,s=i.x-t.x,a=i.y-t.y,l=i.z-t.z,c=r*l-o*a,u=o*s-n*l,h=n*a-r*s,p=c*c+u*u+h*h,d=Math.sqrt(p)/2;return d},Ac.centroid=function(t,e,i){var n=(t.x+e.x+i.x)/3,r=(t.y+e.y+i.y)/3;return new Wo(n,r)},Ac.inCentre=function(t,e,i){var n=e.distance(i),r=t.distance(i),o=t.distance(e),s=n+r+o,a=(n*t.x+r*e.x+o*i.x)/s,l=(n*t.y+r*e.y+o*i.y)/s;return new Wo(a,l)};var Ec=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new qs;var t=arguments[0],e=arguments[1],i=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=i};Ec.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),i=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(i,Yo.EXTERIOR,Yo.INTERIOR)},Ec.prototype.addPolygon=function(t){var e=this,i=this._distance,n=cl.LEFT;this._distance<0&&(i=-this._distance,n=cl.RIGHT);var r=t.getExteriorRing(),o=Ys.removeRepeatedPoints(r.getCoordinates());if(this._distance<0&&this.isErodedCompletely(r,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,i,n,Yo.EXTERIOR,Yo.INTERIOR);for(var s=0;s0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(l,i,cl.opposite(n),Yo.INTERIOR,Yo.EXTERIOR)}},Ec.prototype.isTriangleErodedCompletely=function(t,e){var i=new Ac(t[0],t[1],t[2]),n=i.inCentre();return Is.distancePointLine(n,i.p0,i.p1)=Fa.MINIMUM_VALID_SIZE&&Is.isCCW(t)&&(o=r,s=n,i=cl.opposite(i));var a=this._curveBuilder.getRingCurve(t,i,e);this.addCurve(a,o,s)},Ec.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Ba?this.addPolygon(t):t instanceof Ra?this.addLineString(t):t instanceof ka?this.addPoint(t):(t instanceof za||t instanceof ba||t instanceof Va||t instanceof xa)&&this.addCollection(t)},Ec.prototype.isErodedCompletely=function(t,e){var i=t.getCoordinates();if(i.length<4)return e<0;if(4===i.length)return this.isTriangleErodedCompletely(i,e);var n=t.getEnvelopeInternal(),r=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>r},Ec.prototype.addCollection=function(t){for(var e=0;e=this._max)throw new Ws;var t=this._parent.getGeometryN(this._index++);return t instanceof xa?(this._subcollectionIterator=new Mc(t),this._subcollectionIterator.next()):t},Mc.prototype.remove=function(){throw new Error(this.getClass().getName())},Mc.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Mc.prototype.interfaces_=function(){return[js]},Mc.prototype.getClass=function(){return Mc},Mc.isAtomic=function(t){return!(t instanceof xa)};var Tc=function(){this._geom=null;var t=arguments[0];this._geom=t};Tc.prototype.locate=function(t){return Tc.locate(t,this._geom)},Tc.prototype.interfaces_=function(){return[Sc]},Tc.prototype.getClass=function(){return Tc},Tc.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&Is.isPointInRing(t,e.getCoordinates())},Tc.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var i=e.getExteriorRing();if(!Tc.isPointInRing(t,i))return!1;for(var n=0;n=0;i--){var n=this._edgeList.get(i),r=n.getSym();null===e&&(e=r),null!==t&&r.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),i=t.getDepth(cl.LEFT),n=t.getDepth(cl.RIGHT),r=this.computeDepths(e+1,this._edgeList.size(),i);if(this.computeDepths(0,e,r)!==n)throw new fl("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===i&&s.getEdgeRing()===t&&(i=s),r){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,r=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),r=e._SCANNING_FOR_INCOMING}}r===this._LINKING_TO_OUTGOING&&(ws.isTrue(null!==i,"found null for first outgoing dirEdge"),ws.isTrue(i.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(i))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){e.next().isInResult()&&t++}return t}if(1===arguments.length){for(var i=arguments[0],n=0,r=this.iterator();r.hasNext();){r.next().getEdgeRing()===i&&n++}return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=Yo.NONE,e=this.iterator();e.hasNext();){var i=e.next(),n=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){t=Yo.INTERIOR;break}if(n.isInResult()){t=Yo.EXTERIOR;break}}}if(t===Yo.NONE)return null;for(var r=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(r===Yo.INTERIOR):(s.isInResult()&&(r=Yo.EXTERIOR),a.isInResult()&&(r=Yo.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new vl(Yo.NONE);for(var i=this.iterator();i.hasNext();)for(var n=i.next().getEdge().getLabel(),r=0;r<2;r++){var o=n.getLocation(r);o!==Yo.INTERIOR&&o!==Yo.BOUNDARY||this._label.setLocation(r,Yo.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ic),Pc=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new Al(t,new Cc)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Cl),Lc=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Lc.prototype.compareTo=function(t){var e=t;return Lc.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Lc.prototype.interfaces_=function(){return[Uo]},Lc.prototype.getClass=function(){return Lc},Lc.orientation=function(t){return 1===Ys.increasingDirection(t)},Lc.compareOriented=function(t,e,i,n){for(var r=e?1:-1,o=n?1:-1,s=e?t.length:-1,a=n?i.length:-1,l=e?0:t.length-1,c=n?0:i.length-1;;){var u=t[l].compareTo(i[c]);if(0!==u)return u;var h=(l+=r)===s,p=(c+=o)===a;if(h&&!p)return-1;if(!h&&p)return 1;if(h&&p)return 0}};var Dc=function(){this._edges=new qs,this._ocaMap=new ua};Dc.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e0&&t.print(","),t.print("(");for(var n=i.getCoordinates(),r=0;r0&&t.print(","),t.print(n[r].x+" "+n[r].y);t.println(")")}t.print(") ")},Dc.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Dc.prototype.findEdgeIndex=function(t){for(var e=0;e0||!e.coord.equals2D(n);r||i--;var o=new Array(i).fill(null),s=0;o[s++]=new Wo(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return r&&(o[s]=e.coord),new Uc(o,new vl(this.edge._label))},Nc.prototype.add=function(t,e,i){var n=new kc(t,e,i),r=this._nodeMap.get(n);return null!==r?r:(this._nodeMap.put(n,n),n)},Nc.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},Nc.prototype.interfaces_=function(){return[]},Nc.prototype.getClass=function(){return Nc};var Bc=function(){};Bc.prototype.getChainStartIndices=function(t){var e=0,i=new qs;i.add(new es(e));do{var n=this.findChainEnd(t,e);i.add(new es(n)),e=n}while(ei?e:i},zc.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,i=this.pts[this.startIndex[t+1]].x;return ei&&(r=1),t._depth[e][n]=r}}},Fc.prototype.getDelta=function(t){return this._depth[t][cl.RIGHT]-this._depth[t][cl.LEFT]},Fc.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Yo.EXTERIOR:Yo.INTERIOR},Fc.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Fc.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],i=0;i<2;i++)for(var n=1;n<3;n++){var r=e.getLocation(i,n);r!==Yo.EXTERIOR&&r!==Yo.INTERIOR||(t.isNull(i,n)?t._depth[i][n]=Fc.depthAtLocation(r):t._depth[i][n]+=Fc.depthAtLocation(r))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===Yo.INTERIOR&&this._depth[o][s]++}},Fc.prototype.interfaces_=function(){return[]},Fc.prototype.getClass=function(){return Fc},Fc.depthAtLocation=function(t){return t===Yo.EXTERIOR?0:t===Yo.INTERIOR?1:Fc.NULL_VALUE},Vc.NULL_VALUE.get=function(){return-1},Object.defineProperties(Fc,Vc);var Uc=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Nc(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Fc,this._depthDelta=0,1===arguments.length){var i=arguments[0];e.call(this,i,null)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.pts=n,this._label=r}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,vl.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var i=t;if(this.pts.length!==i.pts.length)return!1;for(var n=!0,r=!0,o=this.pts.length,s=0;s0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new zc(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new ds;for(var t=0;t0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;en||this._maxyo;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return ws.isTrue(!(s&&a),"Found bad envelope test"),a},qc.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new Wo(this._maxx,this._maxy),this._corner[1]=new Wo(this._minx,this._maxy),this._corner[2]=new Wo(this._minx,this._miny),this._corner[3]=new Wo(this._maxx,this._miny)},qc.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},qc.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},qc.prototype.getCoordinate=function(){return this._originalPt},qc.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},qc.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=qc.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new ds(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},qc.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},qc.prototype.intersectsToleranceSquare=function(t,e){var i=!1,n=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||(!(!i||!n)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},qc.prototype.addSnappedNode=function(t,e){var i=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(i,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},qc.prototype.interfaces_=function(){return[]},qc.prototype.getClass=function(){return qc},Xc.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(qc,Xc);var Zc=function(){this.tempEnv1=new ds,this.selectedSegment=new tc};Zc.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},Zc.prototype.interfaces_=function(){return[]},Zc.prototype.getClass=function(){return Zc};var Yc=function(){this._index=null;var t=arguments[0];this._index=t},Qc={HotPixelSnapAction:{configurable:!0}};Yc.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],i=arguments[1],n=arguments[2],r=e.getSafeEnvelope(),o=new Jc(e,i,n);return this._index.query(r,{interfaces_:function(){return[kl]},visitItem:function(t){t.select(r,o)}}),o.isNodeAdded()}},Yc.prototype.interfaces_=function(){return[]},Yc.prototype.getClass=function(){return Yc},Qc.HotPixelSnapAction.get=function(){return Jc},Object.defineProperties(Yc,Qc);var Jc=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],i=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=i,this._hotPixelVertexIndex=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],i=arguments[0].getContext();if(null!==this._parentEdge&&i===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Zc),Kc=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new qs};Kc.prototype.processIntersections=function(t,e,i,n){if(t===i&&e===n)return null;var r=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=i.getCoordinates()[n],a=i.getCoordinates()[n+1];if(this._li.computeIntersection(r,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var l=0;l=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof fl))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var i=arguments[0],n=tu.precisionScaleFactor(this._argGeom,this._distance,i),r=new Ja(n);this.bufferFixedPrecision(r)}},tu.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Ja.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},tu.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},tu.prototype.bufferOriginalPrecision=function(){try{var t=new Gc(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof xs))throw t;this._saveException=t}},tu.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},tu.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},tu.prototype.interfaces_=function(){return[]},tu.prototype.getClass=function(){return tu},tu.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new tu(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ls&&"number"==typeof arguments[1]){var e=arguments[1],i=arguments[2],n=new tu(arguments[0]);return n.setQuadrantSegments(i),n.getResultGeometry(e)}if(arguments[2]instanceof cc&&arguments[0]instanceof Ls&&"number"==typeof arguments[1]){var r=arguments[1];return new tu(arguments[0],arguments[2]).getResultGeometry(r)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],l=new tu(arguments[0]);return l.setQuadrantSegments(s),l.setEndCapStyle(a),l.getResultGeometry(o)}},tu.precisionScaleFactor=function(t,e,i){var n=t.getEnvelopeInternal(),r=Ko.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=i-Math.trunc(Math.log(r)/Math.log(10)+1);return Math.pow(10,o)},eu.CAP_ROUND.get=function(){return cc.CAP_ROUND},eu.CAP_BUTT.get=function(){return cc.CAP_FLAT},eu.CAP_FLAT.get=function(){return cc.CAP_FLAT},eu.CAP_SQUARE.get=function(){return cc.CAP_SQUARE},eu.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(tu,eu);var iu=function(){this._pt=[new Wo,new Wo],this._distance=Fo.NaN,this._isNull=!0};iu.prototype.getCoordinates=function(){return this._pt},iu.prototype.getCoordinate=function(t){return this._pt[t]},iu.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],i=arguments[1];if(this._isNull)return this.initialize(e,i),null;var n=e.distance(i);nthis._distance&&this.initialize(e,i,n)}},iu.prototype.interfaces_=function(){return[]},iu.prototype.getClass=function(){return iu};var nu=function(){};nu.prototype.interfaces_=function(){return[]},nu.prototype.getClass=function(){return nu},nu.computeDistance=function(){if(arguments[2]instanceof iu&&arguments[0]instanceof Ra&&arguments[1]instanceof Wo)for(var t=arguments[1],e=arguments[2],i=arguments[0].getCoordinates(),n=new tc,r=0;r0||this._isIn?Yo.INTERIOR:Yo.EXTERIOR)},uu.prototype.interfaces_=function(){return[]},uu.prototype.getClass=function(){return uu};var hu=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],i=arguments[1],n=arguments[2];this._component=e,this._segIndex=i,this._pt=n}},pu={INSIDE_AREA:{configurable:!0}};hu.prototype.isInsideArea=function(){return this._segIndex===hu.INSIDE_AREA},hu.prototype.getCoordinate=function(){return this._pt},hu.prototype.getGeometryComponent=function(){return this._component},hu.prototype.getSegmentIndex=function(){return this._segIndex},hu.prototype.interfaces_=function(){return[]},hu.prototype.getClass=function(){return hu},pu.INSIDE_AREA.get=function(){return-1},Object.defineProperties(hu,pu);var du=function(t){this._pts=t||null};du.prototype.filter=function(t){t instanceof ka&&this._pts.add(t)},du.prototype.interfaces_=function(){return[va]},du.prototype.getClass=function(){return du},du.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof ka?Fl.singletonList(t):du.getPoints(t,new qs)}if(2===arguments.length){var e=arguments[0],i=arguments[1];return e instanceof ka?i.add(e):e instanceof xa&&e.apply(new du(i)),i}};var fu=function(){this._locations=null;var t=arguments[0];this._locations=t};fu.prototype.filter=function(t){(t instanceof ka||t instanceof Ra||t instanceof Ba)&&this._locations.add(new hu(t,0,t.getCoordinate()))},fu.prototype.interfaces_=function(){return[va]},fu.prototype.getClass=function(){return fu},fu.getLocations=function(t){var e=new qs;return t.apply(new fu(e)),e};var mu=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new uu,this._minDistanceLocation=null,this._minDistance=Fo.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var i=arguments[0],n=arguments[1],r=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=i,this._geom[1]=n,this._terminateDistance=r}};mu.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var i=arguments[0],n=arguments[1],r=1-i,o=lu.getPolygons(this._geom[i]);if(o.size()>0){var s=fu.getLocations(this._geom[r]);if(this.computeContainmentDistance(s,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=n[0],this._minDistanceLocation[i]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&Jo(arguments[0],Hs)&&Jo(arguments[1],Hs)){for(var a=arguments[0],l=arguments[1],c=arguments[2],u=0;uthis._minDistance)return null;for(var r=e.getCoordinates(),o=i.getCoordinate(),s=0;sthis._minDistance)return null;for(var p=c.getCoordinates(),d=u.getCoordinates(),f=0;fthis._distance&&this.initialize(e,i,n)}},gu.prototype.interfaces_=function(){return[]},gu.prototype.getClass=function(){return gu};var yu=function(){};yu.prototype.interfaces_=function(){return[]},yu.prototype.getClass=function(){return yu},yu.computeDistance=function(){if(arguments[2]instanceof gu&&arguments[0]instanceof Ra&&arguments[1]instanceof Wo)for(var t=arguments[0],e=arguments[1],i=arguments[2],n=new tc,r=t.getCoordinates(),o=0;o1||t<=0)throw new zo("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},vu.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},vu.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},vu.prototype.computeOrientedDistance=function(t,e,i){var n=new xu(e);if(t.apply(n),i.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var r=new bu(e,this._densifyFrac);t.apply(r),i.setMaximum(r.getMaxPointDistance())}},vu.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},vu.prototype.interfaces_=function(){return[]},vu.prototype.getClass=function(){return vu},vu.distance=function(){if(2===arguments.length)return new vu(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new vu(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},_u.MaxPointDistanceFilter.get=function(){return xu},_u.MaxDensifiedByFractionDistanceFilter.get=function(){return bu},Object.defineProperties(vu,_u);var xu=function(){this._maxPtDist=new gu,this._minPtDist=new gu,this._euclideanDist=new yu,this._geom=null;var t=arguments[0];this._geom=t};xu.prototype.filter=function(t){this._minPtDist.initialize(),yu.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},xu.prototype.getMaxPointDistance=function(){return this._maxPtDist},xu.prototype.interfaces_=function(){return[Os]},xu.prototype.getClass=function(){return xu};var bu=function(){this._maxPtDist=new gu,this._minPtDist=new gu,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};bu.prototype.filter=function(t,e){var i=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),r=t.getCoordinate(e),o=(r.x-n.x)/this._numSubSegs,s=(r.y-n.y)/this._numSubSegs,a=0;ai){this._isValid=!1;var r=n.getCoordinates();this._errorLocation=r[1],this._errorIndicator=t.getFactory().createLineString(r),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+_s.toLineString(r[0],r[1])+")"}},wu.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=wu.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),wu.VERBOSE&&hs.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},wu.prototype.checkNegativeValid=function(){if(!(this._input instanceof Ba||this._input instanceof Va||this._input instanceof xa))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},wu.prototype.getErrorIndicator=function(){return this._errorIndicator},wu.prototype.checkMinimumDistance=function(t,e,i){var n=new mu(t,e,i);if(this._minDistanceFound=n.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Eu.prototype.report=function(t){if(!Eu.VERBOSE)return null;hs.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Eu.prototype.getErrorMessage=function(){return this._errorMsg},Eu.prototype.interfaces_=function(){return[]},Eu.prototype.getClass=function(){return Eu},Eu.isValidMsg=function(t,e,i){var n=new Eu(t,e,i);return n.isValid()?null:n.getErrorMessage()},Eu.isValid=function(t,e,i){return!!new Eu(t,e,i).isValid()},Su.VERBOSE.get=function(){return!1},Su.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Eu,Su);var Mu=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Mu.prototype.getCoordinates=function(){return this._pts},Mu.prototype.size=function(){return this._pts.length},Mu.prototype.getCoordinate=function(t){return this._pts[t]},Mu.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Mu.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Ql.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Mu.prototype.setData=function(t){this._data=t},Mu.prototype.getData=function(){return this._data},Mu.prototype.toString=function(){return _s.toLineString(new qa(this._pts))},Mu.prototype.interfaces_=function(){return[Jl]},Mu.prototype.getClass=function(){return Mu};var Tu=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new qs,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Tu.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Tu.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},Tu.prototype.getIntersectionSegments=function(){return this._intSegments},Tu.prototype.count=function(){return this._intersectionCount},Tu.prototype.getIntersections=function(){return this._intersections},Tu.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Tu.prototype.setKeepIntersections=function(t){this._keepIntersections=t},Tu.prototype.processIntersections=function(t,e,i,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===i&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(i,n)))return null;var r=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=i.getCoordinates()[n],a=i.getCoordinates()[n+1];this._li.computeIntersection(r,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=r,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Tu.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},Tu.prototype.hasIntersection=function(){return null!==this._interiorIntersection},Tu.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},Tu.prototype.interfaces_=function(){return[Rc]},Tu.prototype.getClass=function(){return Tu},Tu.createAllIntersectionsFinder=function(t){var e=new Tu(t);return e.setFindAllIntersections(!0),e},Tu.createAnyIntersectionFinder=function(t){return new Tu(t)},Tu.createIntersectionCounter=function(t){var e=new Tu(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Iu=function(){this._li=new Ss,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Iu.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Iu.prototype.getIntersections=function(){return this._segInt.getIntersections()},Iu.prototype.isValid=function(){return this.execute(),this._isValid},Iu.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Iu.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Tu(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new ac;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Iu.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new fl(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Iu.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+_s.toLineString(t[0],t[1])+" and "+_s.toLineString(t[2],t[3])},Iu.prototype.interfaces_=function(){return[]},Iu.prototype.getClass=function(){return Iu},Iu.computeIntersections=function(t){var e=new Iu(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Cu=function t(){this._nv=null;var e=arguments[0];this._nv=new Iu(t.toSegmentStrings(e))};Cu.prototype.checkValid=function(){this._nv.checkValid()},Cu.prototype.interfaces_=function(){return[]},Cu.prototype.getClass=function(){return Cu},Cu.toSegmentStrings=function(t){for(var e=new qs,i=t.iterator();i.hasNext();){var n=i.next();e.add(new Mu(n.getCoordinates(),n))}return e},Cu.checkValid=function(t){new Cu(t).checkValid()};var Pu=function(t){this._mapOp=t};Pu.prototype.map=function(t){for(var e=new qs,i=0;i0&&n<4&&!this._preserveType?this._factory.createLineString(i):this._factory.createLinearRing(i)},Ru.prototype.interfaces_=function(){return[]},Ru.prototype.getClass=function(){return Ru};var Ou=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new tc,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Ra&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var i=arguments[0],n=arguments[1];this._srcPts=i,this._isClosed=t.isClosed(i),this._snapTolerance=n}};Ou.prototype.snapVertices=function(t,e){for(var i=this._isClosed?t.size()-1:t.size(),n=0;n=0&&t.add(o+1,new Wo(r),!1)}},Ou.prototype.findSegmentIndexToSnap=function(t,e){for(var i=this,n=Fo.MAX_VALUE,r=-1,o=0;oe&&(e=n)}return e}if(2===arguments.length){var r=arguments[0],o=arguments[1];return Math.min(ku.computeOverlaySnapTolerance(r),ku.computeOverlaySnapTolerance(o))}},ku.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*ku.SNAP_PRECISION_FACTOR},ku.snapToSelf=function(t,e,i){return new ku(t).snapToSelf(e,i)},Nu.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(ku,Nu);var Bu=function(t){function e(e,i,n){t.call(this),this._snapTolerance=e||null,this._snapPts=i||null,this._isSelfSnap=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var i=new Ou(t,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var i=t.toCoordinateArray(),n=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ru),zu=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};zu.prototype.getCommon=function(){return Fo.longBitsToDouble(this._commonBits)},zu.prototype.add=function(t){var e=Fo.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=zu.signExpBits(this._commonBits),this._isFirst=!1,null):zu.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=zu.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=zu.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},zu.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=Fo.longBitsToDouble(t),i="0000000000000000000000000000000000000000000000000000000000000000"+Fo.toBinaryString(t),n=i.substring(i.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},zu.prototype.interfaces_=function(){return[]},zu.prototype.getClass=function(){return zu},zu.getBit=function(t,e){return 0!=(t&1<>52},zu.zeroLowerBits=function(t,e){return t&~((1<=0;n--){if(zu.getBit(t,n)!==zu.getBit(e,n))return i;i++}return 52};var Fu=function(){this._commonCoord=null,this._ccFilter=new Uu},Vu={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Fu.prototype.addCommonBits=function(t){var e=new Gu(this._commonCoord);t.apply(e),t.geometryChanged()},Fu.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new Wo(this._commonCoord);e.x=-e.x,e.y=-e.y;var i=new Gu(e);return t.apply(i),t.geometryChanged(),t},Fu.prototype.getCommonCoordinate=function(){return this._commonCoord},Fu.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Fu.prototype.interfaces_=function(){return[]},Fu.prototype.getClass=function(){return Fu},Vu.CommonCoordinateFilter.get=function(){return Uu},Vu.Translater.get=function(){return Gu},Object.defineProperties(Fu,Vu);var Uu=function(){this._commonBitsX=new zu,this._commonBitsY=new zu};Uu.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Uu.prototype.getCommonCoordinate=function(){return new Wo(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Uu.prototype.interfaces_=function(){return[Os]},Uu.prototype.getClass=function(){return Uu};var Gu=function(){this.trans=null;var t=arguments[0];this.trans=t};Gu.prototype.filter=function(t,e){var i=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,i),t.setOrdinate(e,1,n)},Gu.prototype.isDone=function(){return!1},Gu.prototype.isGeometryChanged=function(){return!0},Gu.prototype.interfaces_=function(){return[_a]},Gu.prototype.getClass=function(){return Gu};var ju=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};ju.prototype.selfSnap=function(t){return new ku(t).snapTo(t,this._snapTolerance)},ju.prototype.removeCommonBits=function(t){this._cbr=new Fu,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},ju.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},ju.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),i=hh.overlayOp(e[0],e[1],t);return this.prepareResult(i)},ju.prototype.checkValid=function(t){t.isValid()||hs.out.println("Snapped geometry is invalid")},ju.prototype.computeSnapTolerance=function(){this._snapTolerance=ku.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},ju.prototype.snap=function(t){var e=this.removeCommonBits(t);return ku.snap(e[0],e[1],this._snapTolerance)},ju.prototype.interfaces_=function(){return[]},ju.prototype.getClass=function(){return ju},ju.overlayOp=function(t,e,i){return new ju(t,e).getResultGeometry(i)},ju.union=function(t,e){return ju.overlayOp(t,e,hh.UNION)},ju.intersection=function(t,e){return ju.overlayOp(t,e,hh.INTERSECTION)},ju.symDifference=function(t,e){return ju.overlayOp(t,e,hh.SYMDIFFERENCE)},ju.difference=function(t,e){return ju.overlayOp(t,e,hh.DIFFERENCE)};var Hu=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Hu.prototype.getResultGeometry=function(t){var e=null,i=!1,n=null;try{e=hh.overlayOp(this._geom[0],this._geom[1],t);i=!0}catch(t){if(!(t instanceof xs))throw t;n=t}if(!i)try{e=ju.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof xs?n:t}return e},Hu.prototype.interfaces_=function(){return[]},Hu.prototype.getClass=function(){return Hu},Hu.overlayOp=function(t,e,i){return new Hu(t,e).getResultGeometry(i)},Hu.union=function(t,e){return Hu.overlayOp(t,e,hh.UNION)},Hu.intersection=function(t,e){return Hu.overlayOp(t,e,hh.INTERSECTION)},Hu.symDifference=function(t,e){return Hu.overlayOp(t,e,hh.SYMDIFFERENCE)},Hu.difference=function(t,e){return Hu.overlayOp(t,e,hh.DIFFERENCE)};var Wu=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Wu.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},Wu.prototype.interfaces_=function(){return[]},Wu.prototype.getClass=function(){return Wu};var qu=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],i=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=i}else if(3===arguments.length){var n=arguments[0],r=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=r,this._obj=o}},Xu={INSERT:{configurable:!0},DELETE:{configurable:!0}};qu.prototype.isDelete=function(){return this._eventType===qu.DELETE},qu.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},qu.prototype.getObject=function(){return this._obj},qu.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0},qu.prototype.getInsertEvent=function(){return this._insertEvent},qu.prototype.isInsert=function(){return this._eventType===qu.INSERT},qu.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},qu.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},qu.prototype.interfaces_=function(){return[Uo]},qu.prototype.getClass=function(){return qu},Xu.INSERT.get=function(){return 1},Xu.DELETE.get=function(){return 2},Object.defineProperties(qu,Xu);var Zu=function(){};Zu.prototype.interfaces_=function(){return[]},Zu.prototype.getClass=function(){return Zu};var Yu=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],i=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=i};Yu.prototype.isTrivialIntersection=function(t,e,i,n){if(t===i&&1===this._li.getIntersectionNum()){if(Yu.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var r=t.getNumPoints()-1;if(0===e&&n===r||0===n&&e===r)return!0}}return!1},Yu.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Yu.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},Yu.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Yu.prototype.isBoundaryPointInternal=function(t,e){for(var i=e.iterator();i.hasNext();){var n=i.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},Yu.prototype.hasProperIntersection=function(){return this._hasProper},Yu.prototype.hasIntersection=function(){return this._hasIntersection},Yu.prototype.isDone=function(){return this._isDone},Yu.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},Yu.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},Yu.prototype.addIntersections=function(t,e,i,n){if(t===i&&e===n)return null;this.numTests++;var r=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=i.getCoordinates()[n],a=i.getCoordinates()[n+1];this._li.computeIntersection(r,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),i.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,i,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),i.addIntersections(this._li,n,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},Yu.prototype.interfaces_=function(){return[]},Yu.prototype.getClass=function(){return Yu},Yu.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Qu=function(t){function e(){t.call(this),this.events=new qs,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Fl.sort(this.events);for(var t=0;te||this._maxo?1:0},$u.prototype.interfaces_=function(){return[jo]},$u.prototype.getClass=function(){return $u};var th=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],i=arguments[1],n=arguments[2];this._min=e,this._max=i,this._item=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,i){if(!this.intersects(t,e))return null;i.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ju),eh=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],i=arguments[1];this._node1=e,this._node2=i,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,i){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,i),null!==this._node2&&this._node2.query(t,e,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ju),ih=function(){this._leaves=new qs,this._root=null,this._level=0};ih.prototype.buildTree=function(){Fl.sort(this._leaves,new Ju.NodeComparator);for(var t=this._leaves,e=null,i=new qs;;){if(this.buildLevel(t,i),1===i.size())return i.get(0);e=t,t=i,i=e}},ih.prototype.insert=function(t,e,i){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new th(t,e,i))},ih.prototype.query=function(t,e,i){this.init(),this._root.query(t,e,i)},ih.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},ih.prototype.printNode=function(t){hs.out.println(_s.toLineString(new Wo(t._min,this._level),new Wo(t._max,this._level)))},ih.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},ih.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var i=0;i=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),i=0,n=t.iterator();n.hasNext();){var r=n.next();e[i++]=r.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,i){if(this.isBoundaryNode(t,e))return null;i===Yo.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,i)},e.prototype.addPolygonRing=function(t,e,i){if(t.isEmpty())return null;var n=Ys.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var r=e,o=i;Is.isCCW(n)&&(r=i,o=e);var s=new Uc(n,new vl(this._argIndex,Yo.BOUNDARY,r,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,n[0],Yo.BOUNDARY)},e.prototype.insertPoint=function(t,e,i){var n=this._nodes.addNode(e),r=n.getLabel();null===r?n._label=new vl(t,i):r.setLocation(t,i)},e.prototype.createEdgeSetIntersector=function(){return new Qu},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var i=e.next(),n=i.getLabel().getLocation(t),r=i.eiList.iterator();r.hasNext();){var o=r.next();this.addSelfIntersectionNode(t,o.coord,n)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof Va&&(this._useBoundaryDeterminationRule=!1),e instanceof Ba)this.addPolygon(e);else if(e instanceof Ra)this.addLineString(e);else if(e instanceof ka)this.addPoint(e);else if(e instanceof za)this.addCollection(e);else if(e instanceof ba)this.addCollection(e);else if(e instanceof Va)this.addCollection(e);else{if(!(e instanceof xa))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e50?(null===this._areaPtLocator&&(this._areaPtLocator=new rh(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?Yo.BOUNDARY:Yo.INTERIOR},e}(Pl),ch=function(){if(this._li=new Ss,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new lh(0,t)}else if(2===arguments.length){var e=arguments[0],i=arguments[1],n=ks.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(i.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(i.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new lh(0,e,n),this._arg[1]=new lh(1,i,n)}else if(3===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2];r.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(r.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new lh(0,r,s),this._arg[1]=new lh(1,o,s)}};ch.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},ch.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},ch.prototype.interfaces_=function(){return[]},ch.prototype.getClass=function(){return ch};var uh=function(){};uh.prototype.interfaces_=function(){return[]},uh.prototype.getClass=function(){return uh},uh.map=function(){if(arguments[0]instanceof Ls&&Jo(arguments[1],uh.MapOp)){for(var t=arguments[0],e=arguments[1],i=new qs,n=0;n=t.size()?null:t.get(e)},vh.union=function(t){return new vh(t).union()},_h.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(vh,_h);var xh=function(){};function bh(){return new wh}function wh(){this.reset()}xh.prototype.interfaces_=function(){return[]},xh.prototype.getClass=function(){return xh},xh.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return hh.createEmptyResult(hh.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Hu.overlayOp(t,e,hh.UNION)},wh.prototype={constructor:wh,reset:function(){this.s=this.t=0},add:function(t){Eh(Ah,t,this.t),Eh(this,Ah.s,this.s),this.s?this.t+=Ah.t:this.s=Ah.t},valueOf:function(){return this.s}};var Ah=new wh;function Eh(t,e,i){var n=t.s=e+i,r=n-e,o=n-r;t.t=e-o+(i-r)}var Sh=1e-6,Mh=Math.PI,Th=Mh/2,Ih=Mh/4,Ch=2*Mh,Ph=180/Mh,Lh=Mh/180,Dh=Math.abs,Rh=Math.atan,Oh=Math.atan2,kh=Math.cos,Nh=Math.sin,Bh=Math.sqrt;function zh(t){return t>1?0:t<-1?Mh:Math.acos(t)}function Fh(t){return t>1?Th:t<-1?-Th:Math.asin(t)}function Vh(){}function Uh(t,e){t&&jh.hasOwnProperty(t.type)&&jh[t.type](t,e)}var Gh={Feature:function(t,e){Uh(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,r=i.length;++nMh?t-Ch:t<-Mh?t+Ch:t,e]}function ep(t){return function(e,i){return[(e+=t)>Mh?e-Ch:e<-Mh?e+Ch:e,i]}}function ip(t){var e=ep(t);return e.invert=ep(-t),e}function np(t,e){var i=kh(t),n=Nh(t),r=kh(e),o=Nh(e);function s(t,e){var s=kh(e),a=kh(t)*s,l=Nh(t)*s,c=Nh(e),u=c*i+a*n;return[Oh(l*r-u*o,a*i-c*n),Fh(u*r+l*o)]}return s.invert=function(t,e){var s=kh(e),a=kh(t)*s,l=Nh(t)*s,c=Nh(e),u=c*r-l*o;return[Oh(l*r+c*o,a*i+u*n),Fh(u*i-a*n)]},s}function rp(t,e){(e=Xh(e))[0]-=t,Kh(e);var i=zh(-e[1]);return((-e[2]<0?-i:i)+Ch-Sh)%Ch}function op(){var t,e=[];return{point:function(e,i){t.push([e,i])},lineStart:function(){e.push(t=[])},lineEnd:Vh,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function sp(t,e){return Dh(t[0]-e[0])=0;--o)r.point((u=c[o])[0],u[1]);else n(p.x,p.p.x,-1,r);p=p.p}c=(p=p.o).z,d=!d}while(!p.v);r.lineEnd()}}}function cp(t){if(e=t.length){for(var e,i,n=0,r=t[0];++ne?1:t>=e?0:NaN}function hp(t){for(var e,i,n,r=t.length,o=-1,s=0;++o=0;)for(e=(n=t[r]).length;--e>=0;)i[--s]=n[e];return i}bh(),bh(),bh(),tp.invert=tp,function(t){1===t.length&&(t=function(t){return function(e,i){return up(t(e),i)}}(t))}(up);var pp=1e9,dp=-pp;function fp(t,e,i,n){function r(r,o){return t<=r&&r<=i&&e<=o&&o<=n}function o(r,o,a,c){var u=0,h=0;if(null==r||(u=s(r,a))!==(h=s(o,a))||l(r,o)<0^a>0)do{c.point(0===u||3===u?t:i,u>1?n:e)}while((u=(u+a+4)%4)!==h);else c.point(o[0],o[1])}function s(n,r){return Dh(n[0]-t)0?0:3:Dh(n[0]-i)0?2:1:Dh(n[1]-e)0?1:0:r>0?3:2}function a(t,e){return l(t.x,e.x)}function l(t,e){var i=s(t,1),n=s(e,1);return i!==n?i-n:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(s){var l,c,u,h,p,d,f,m,g,y,v,_=s,x=op(),b={point:w,lineStart:function(){b.point=A,c&&c.push(u=[]);y=!0,g=!1,f=m=NaN},lineEnd:function(){l&&(A(h,p),d&&g&&x.rejoin(),l.push(x.result()));b.point=w,g&&_.lineEnd()},polygonStart:function(){_=x,l=[],c=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,r=c.length;in&&(p-o)*(n-s)>(d-s)*(t-o)&&++e:d<=n&&(p-o)*(n-s)<(d-s)*(t-o)&&--e;return e}(),i=v&&e,r=(l=hp(l)).length;(i||r)&&(s.polygonStart(),i&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),r&&lp(l,a,e,o,s),s.polygonEnd());_=s,l=c=u=null}};function w(t,e){r(t,e)&&_.point(t,e)}function A(o,s){var a=r(o,s);if(c&&u.push([o,s]),y)h=o,p=s,d=a,y=!1,a&&(_.lineStart(),_.point(o,s));else if(a&&g)_.point(o,s);else{var l=[f=Math.max(dp,Math.min(pp,f)),m=Math.max(dp,Math.min(pp,m))],x=[o=Math.max(dp,Math.min(pp,o)),s=Math.max(dp,Math.min(pp,s))];!function(t,e,i,n,r,o){var s,a=t[0],l=t[1],c=0,u=1,h=e[0]-a,p=e[1]-l;if(s=i-a,h||!(s>0)){if(s/=h,h<0){if(s0){if(s>u)return;s>c&&(c=s)}if(s=r-a,h||!(s<0)){if(s/=h,h<0){if(s>u)return;s>c&&(c=s)}else if(h>0){if(s0)){if(s/=p,p<0){if(s0){if(s>u)return;s>c&&(c=s)}if(s=o-l,p||!(s<0)){if(s/=p,p<0){if(s>u)return;s>c&&(c=s)}else if(p>0){if(s0&&(t[0]=a+c*h,t[1]=l+c*p),u<1&&(e[0]=a+u*h,e[1]=l+u*p),!0}}}}}(l,x,t,e,i,n)?a&&(_.lineStart(),_.point(o,s),v=!1):(g||(_.lineStart(),_.point(l[0],l[1])),_.point(x[0],x[1]),a||_.lineEnd(),v=!1)}f=o,m=s,g=a}return b}}var mp=bh();function gp(t){return t}bh(),bh(),bh();var yp=1/0,vp=yp,_p=-yp,xp=_p,bp={point:function(t,e){t_p&&(_p=t);exp&&(xp=e)},lineStart:Vh,lineEnd:Vh,polygonStart:Vh,polygonEnd:Vh,result:function(){var t=[[yp,vp],[_p,xp]];return _p=xp=-(vp=yp=1/0),t}};function wp(t,e,i,n){return function(r,o){var s,a,l,c=e(o),u=r.invert(n[0],n[1]),h=op(),p=e(h),d=!1,f={point:m,lineStart:y,lineEnd:v,polygonStart:function(){f.point=_,f.lineStart=x,f.lineEnd=b,a=[],s=[]},polygonEnd:function(){f.point=m,f.lineStart=y,f.lineEnd=v,a=hp(a);var t=function(t,e){var i=e[0],n=e[1],r=[Nh(i),-kh(i),0],o=0,s=0;mp.reset();for(var a=0,l=t.length;a=0?1:-1,E=A*w,S=E>Mh,M=f*x;if(mp.add(Oh(M*A*Nh(E),m*b+M*kh(E))),o+=S?w+A*Ch:w,S^p>=i^v>=i){var T=Yh(Xh(h),Xh(y));Kh(T);var I=Yh(r,T);Kh(I);var C=(S^w>=0?-1:1)*Fh(I[2]);(n>C||n===C&&(T[0]||T[1]))&&(s+=S^w>=0?1:-1)}}return(o<-Sh||o0){for(d||(o.polygonStart(),d=!0),o.lineStart(),t=0;t1&&2&r&&c.push(c.pop().concat(c.shift())),a.push(c.filter(Ap))}return f}}function Ap(t){return t.length>1}function Ep(t,e){return((t=t.x)[0]<0?t[1]-Th-Sh:Th-t[1])-((e=e.x)[0]<0?e[1]-Th-Sh:Th-e[1])}bh();var Sp=wp((function(){return!0}),(function(t){var e,i=NaN,n=NaN,r=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?Mh:-Mh,l=Dh(o-i);Dh(l-Mh)0?Th:-Th),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):r!==a&&l>=Mh&&(Dh(i-r)Sh?Rh((Nh(e)*(o=kh(n))*Nh(i)-Nh(n)*(r=kh(e))*Nh(t))/(r*o*s)):(e+n)/2}(i,n,o,s),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(i=o,n=s),r=a},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var r;if(null==t)r=i*Th,n.point(-Mh,r),n.point(0,r),n.point(Mh,r),n.point(Mh,0),n.point(Mh,-r),n.point(0,-r),n.point(-Mh,-r),n.point(-Mh,0),n.point(-Mh,r);else if(Dh(t[0]-e[0])>Sh){var o=t[0]0,r=Dh(i)>Sh;function o(t,e){return kh(t)*kh(e)>i}function s(t,e,n){var r=[1,0,0],o=Yh(Xh(t),Xh(e)),s=Zh(o,o),a=o[0],l=s-a*a;if(!l)return!n&&t;var c=i*s/l,u=-i*a/l,h=Yh(r,o),p=Jh(r,c);Qh(p,Jh(o,u));var d=h,f=Zh(p,d),m=Zh(d,d),g=f*f-m*(Zh(p,p)-1);if(!(g<0)){var y=Bh(g),v=Jh(d,(-f-y)/m);if(Qh(v,p),v=qh(v),!n)return v;var _,x=t[0],b=e[0],w=t[1],A=e[1];b0^v[1]<(Dh(v[0]-x)Mh^(x<=v[0]&&v[0]<=b)){var M=Jh(d,(-f+y)/m);return Qh(M,p),[v,qh(M)]}}}function a(e,i){var r=n?t:Mh-t,o=0;return e<-r?o|=1:e>r&&(o|=2),i<-r?o|=4:i>r&&(o|=8),o}return wp(o,(function(t){var e,i,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,p){var d,f=[h,p],m=o(h,p),g=n?m?0:a(h,p):m?a(h+(h<0?Mh:-Mh),p):0;if(!e&&(c=l=m)&&t.lineStart(),m!==l&&(!(d=s(e,f))||sp(e,d)||sp(f,d))&&(f[0]+=Sh,f[1]+=Sh,m=o(f[0],f[1])),m!==l)u=0,m?(t.lineStart(),d=s(f,e),t.point(d[0],d[1])):(d=s(e,f),t.point(d[0],d[1]),t.lineEnd()),e=d;else if(r&&e&&n^m){var y;g&i||!(y=s(f,e,!0))||(u=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!m||e&&sp(e,f)||t.point(f[0],f[1]),e=f,l=m,i=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}}),(function(i,n,r,o){!function(t,e,i,n,r,o){if(i){var s=kh(e),a=Nh(e),l=n*i;null==r?(r=e+n*Ch,o=e-l/2):(r=rp(s,r),o=rp(s,o),(n>0?ro)&&(r+=n*Ch));for(var c,u=r;n>0?u>o:u4*e&&m--){var x=s+p,b=a+d,w=l+f,A=Bh(x*x+b*b+w*w),E=Fh(w/=A),S=Dh(Dh(w)-1)e||Dh((y*C+v*P)/_-.5)>.3||s*p+a*d+l*f2?t[2]%360*Lh:0,I()):[g*Ph,y*Ph,v*Ph]},S.precision=function(t){return arguments.length?(E=Dp(T,A=t*t),C()):Bh(A)},S.fitExtent=function(t,e){return Cp(S,t,e)},S.fitSize=function(t,e){return function(t,e,i){return Cp(t,[[0,0],e],i)}(S,t,e)},function(){return e=t.apply(this,arguments),S.invert=e.invert&&M,I()}}((function(){return t}))()}function kp(t){return function(e,i){var n=kh(e),r=kh(i),o=t(n*r);return[o*r*Nh(e),o*Nh(i)]}}function Np(t){return function(e,i){var n=Bh(e*e+i*i),r=t(n),o=Nh(r),s=kh(r);return[Oh(e*o,n*s),Fh(n&&i*o/n)]}}kp((function(t){return Bh(2/(1+t))})).invert=Np((function(t){return 2*Fh(t/2)}));var Bp,zp=kp((function(t){return(t=zh(t))&&t/Nh(t)}));function Fp(){return Op(zp).scale(79.4188).clipAngle(179.999)}function Vp(t,e){return[t,e]}function Up(t,e,i){var n=(i=i||{}).units||"kilometers",r=i.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof i)throw new Error("options must be an object");if("number"!=typeof r)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(r<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return Y(t,(function(t){var i=Gp(t,e,n,r);i&&o.push(i)})),N(o);case"FeatureCollection":return X(t,(function(t){var i=Gp(t,e,n,r);i&&X(i,(function(t){t&&o.push(t)}))})),N(o)}return Gp(t,e,n,r)}function Gp(t,e,i,n){var r=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return Y(t,(function(t){var r=Gp(t,e,i,n);r&&s.push(r)})),N(s)}var a=function(t){var e=bt(t).geometry.coordinates,i=[-e[0],-e[1]];return Fp().rotate(i).scale(P)}(o),l={type:o.type,coordinates:Hp(o.coordinates,a)},c=(new al).read(l),u=V(U(e,i),"meters"),h=tu.bufferOp(c,u,n);if(!jp((h=(new ll).write(h)).coordinates))return D({type:h.type,coordinates:Wp(h.coordinates,a)},r)}function jp(t){return Array.isArray(t[0])?jp(t[0]):isNaN(t[0])}function Hp(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return Hp(t,e)}))}function Wp(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return Wp(t,e)}))}function qp(t,e,i){void 0===i&&(i={});var n=et(t),r=et(e),o=No.intersection(n.coordinates,r.coordinates);return 0===o.length?null:1===o.length?O(o[0],i.properties):F(o,i.properties)}function Xp(t,e,i,n,r,o){for(var s=[],a=0;a<6;a++){var l=t[0]+e*r[a],c=t[1]+i*o[a];s.push([l,c])}return s.push(s[0].slice()),O([s],n)}function Zp(t,e,i,n,r,o){for(var s=[],a=0;a<6;a++){var l=[];l.push(t),l.push([t[0]+e*r[a],t[1]+i*o[a]]),l.push([t[0]+e*r[(a+1)%6],t[1]+i*o[(a+1)%6]]),l.push(t),s.push(O([l],n))}return s}function Yp(t,e,i){return void 0===i&&(i={}),function(t,e,i,n){void 0===n&&(n={});for(var r=[],o=t[0],s=t[1],a=t[2],l=t[3],c=e/pt([o,s],[a,s],n)*(a-o),u=i/pt([o,s],[o,l],n)*(l-s),h=a-o,p=l-s,d=Math.floor(h/c),f=Math.floor(p/u),m=(p-f*u)/2,g=o+(h-d*c)/2,y=0;yf/2;E&&(A-=f/4);for(var S=[],M=[],T=0;T<6;T++){var I=2*Math.PI/6*T;S.push(Math.cos(I)),M.push(Math.sin(I))}for(var C=[],P=0;P<=x;P++)for(var L=0;L<=w;L++){var D=P%2==1;if(!(0===L&&D||0===L&&E)){var R=P*y+r-b,O=L*v+o+A;if(D&&(O-=f/2),!0===i.triangles)Zp([R,O],u/2,h/2,JSON.parse(n),S,M).forEach((function(t){i.mask?qp(i.mask,t)&&C.push(t):C.push(t)}));else{var k=Xp([R,O],u/2,h/2,JSON.parse(n),S,M);i.mask?qp(i.mask,k)&&C.push(k):C.push(k)}}}return N(C)}(a,e,i);break;case"triangle":case"triangles":s=function(t,e,i){void 0===i&&(i={});for(var n=[],r=e/pt([t[0],t[1]],[t[2],t[1]],i)*(t[2]-t[0]),o=e/pt([t[0],t[1]],[t[0],t[3]],i)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var l=0,c=t[1];c<=t[3];){var u=null,h=null;s%2==0&&l%2==0?(u=O([[[a,c],[a,c+o],[a+r,c],[a,c]]],i.properties),h=O([[[a,c+o],[a+r,c+o],[a+r,c],[a,c+o]]],i.properties)):s%2==0&&l%2==1?(u=O([[[a,c],[a+r,c+o],[a+r,c],[a,c]]],i.properties),h=O([[[a,c],[a,c+o],[a+r,c+o],[a,c]]],i.properties)):l%2==0&&s%2==1?(u=O([[[a,c],[a,c+o],[a+r,c+o],[a,c]]],i.properties),h=O([[[a,c],[a+r,c+o],[a+r,c],[a,c]]],i.properties)):l%2==1&&s%2==1&&(u=O([[[a,c],[a,c+o],[a+r,c],[a,c]]],i.properties),h=O([[[a,c+o],[a+r,c+o],[a+r,c],[a,c+o]]],i.properties)),i.mask?(qp(i.mask,u)&&n.push(u),qp(i.mask,h)&&n.push(h)):(n.push(u),n.push(h)),c+=o,l++}s++,a+=r}return N(n)}(a,e,i);break;default:throw new Error("invalid gridType")}var l=[];return X(s,(function(e){var s=0,a=0;X(t,(function(t){var l,c=pt("point"===n?e:wt(e),t,i);if(void 0!==r&&(l=t.properties[r]),void 0===l&&(l=t.geometry.coordinates[2]),void 0===l)throw new Error("zValue is missing");0===c&&(s=l);var u=1/Math.pow(c,o);a+=u,s+=u*l}));var c=dt(e);c.properties[r]=s/a,l.push(c)})),N(l)}zp.invert=Np((function(t){return t})),Vp.invert=Vp;class Jp{_data;constructor(t,e){const i=[];t.forEach((t=>{let n=t.position||[t.lng,t.lat];"multiPoint"!=e&&"multiLineString"!=e&&"multiPolygon"!=e||(n=[n]);const r={point:R,lineString:k,polygon:O,multiPoint:z,multiLineString:B,multiPolygon:F}[e](n,{...t.userData,...t});!function(t,e,i){if(!t)throw new Error("No feature passed");if(!i)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+i+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+i+": must be a "+e+", given "+t.geometry.type)}(r,e.charAt(0).toUpperCase()+e.slice(1),"a"),i.push(r)})),this._data=N(i)}}function Kp(t){const e=K(t);return[[e[0],e[1]],[e[2],e[3]]]}function $p(t,e){return new Jp(t,e)._data}async function td(t,e){const i=[],n=t=>{const n=K(t);if(i.push([n[0],n[1]],[n[2],n[3]]),e)if(hNt.value){const t=cNt.value.cameraForBounds(i);cNt.value.flyTo({center:t.center,zoom:Math.floor(t.zoom)})}else cNt.value.fitBounds(i)};if("string"==typeof t){n(cNt.value.getSource(t)._data)}else n(t);return i}!function(t){t[t.solid=0]="solid",t[t.dash=1]="dash",t[t.glowPower=2]="glowPower",t[t.FlowColor=3]="FlowColor",t[t.FlowColorLight=4]="FlowColorLight",t[t.RoadLine=5]="RoadLine",t[t.VerticalFlyingLine=6]="VerticalFlyingLine"}(Bp||(Bp={}));class ed extends(m(C)){options;id;step=200;arcs=[];bbox;defaultStyle;FlowColorLightPercent=.4;constructor(t,e,i){super(),this.id=i||d(0,3),this.options=Object.assign({width:1,color:"#ffffff",labelOption:{},speed:10,type:"solid",isShow:!0},e),this.step=this.options.flowAnimationSpeed?100*(1-this.options.flowAnimationSpeed)*5:300,this.bbox=Kp(t),this.options.image&&cNt.value.loadImage(this.options.image,((t,e)=>{if(t)throw t;cNt.value.hasImage(this.id+"icon")||cNt.value.addImage(this.id+"icon",e)})),"RoadLine"==this.options.type?(this.FlowColorLightPercent=this.options.FlowColorLightPercent?1-this.options.FlowColorLightPercent:.4,cNt.value.addSource(this.id+"source",{type:"geojson",lineMetrics:!0,data:null}),this._split(t),setTimeout((()=>{this._animation()}))):cNt.value.addSource(this.id+"source",{type:"geojson",lineMetrics:!0,data:t});let n=[];"FlowColor"==this.options.type?n=["interpolate",["linear"],["line-progress"],.14,"red",.28,"orange",.42,"yellow",.56,"green",.7,"blue",.84,"cyan",1,"purple"]:"RoadLine"==this.options.type&&(n=["interpolate",["linear"],["line-progress"],0,"rgba(255, 255, 255, 0)",this.FlowColorLightPercent,"rgba(255, 255, 255, 0.1)",1,this.options.color]),this.defaultStyle=n;let r={"line-pattern":this.options.image?this.id+"icon":"","line-width":this.options.width,"line-dasharray":"dash"==this.options.type?[2,2]:[2,0]};0!=n.length?r["line-gradient"]=n:r["line-color"]=this.options.color,!uNt.value||"EPSG:4326"!=uNt.value&&"EPSG:4490"!=uNt.value||(r={"line-width":this.options.width,"line-dasharray":"dash"==this.options.type?[2,2]:[2,0],"line-color":this.options.color}),cNt.value.addLayer({id:this.id,source:this.id+"source",type:"line",layout:{visibility:this.options.isShow?"visible":"none","line-join":"round","line-cap":"round"},paint:r}),this.options.highlightColor&&(cNt.value.getLayer(this.id+"Highlight")||(cNt.value.addSource(this.id+"Highlightsource",{type:"geojson",lineMetrics:!0,data:t}),cNt.value.addLayer({id:this.id+"Highlight",source:this.id+"Highlightsource",type:"line",filter:["in","id",""],layout:{visibility:this.options.isShow?"visible":"none","line-join":"round","line-cap":"round"},paint:{"line-color":this.options.highlightColor,"line-width":this.options.width}})))}_split(t){for(const e of t.features){const t=Me(e,ye(e)/this.step);this.arcs.push(t)}}_animation(){const t={type:"FeatureCollection",features:[]};let e=0;const i=cNt.value.getSource(this.id+"source"),n=()=>{e>=this.step&&(e=0,t.features.forEach((t=>t.geometry.coordinates.length=0))),this.arcs.forEach(((i,n)=>{t.features[n]||(t.features[n]={type:"Feature",geometry:{type:"LineString",coordinates:[]}});t.features[n].geometry.coordinates.push(...i.features[e].geometry.coordinates)})),i.setData(t),requestAnimationFrame(n),e++};n()}highlight(t){cNt.value.getLayer(this.id+"Highlight")&&cNt.value.setFilter(this.id+"Highlight",["in","id",t])}removeHighlight(){cNt.value.getLayer(this.id+"Highlight")&&cNt.value.setFilter(this.id+"Highlight",["in","id",""])}update(t){let e=t;this._isFeatureCollectionData(t)&&(e=$p(t,"multiLineString")),this.bbox=Kp(e),this.updateSource("source",e),this.updateSource("Highlightsource",e)}updateSource(t,e){const i=cNt.value.getSource(this.id+t);i&&i.setData(e)}_isFeatureCollectionData(t){return t instanceof Array}}class id extends(m(C)){id;sourceId;_options;_data;bbox;_loadImagesList;_layout;_paint;hoveredPolygonId;constructor(t,e,i){super(),this.id=i||d(0,5),this.sourceId=this.id+"source",this._data=t,this.hoveredPolygonId=null,this.bbox=Kp(t),this._options=Object.assign({scale:1,color:"#ffffff",imageName:"",highlightImageName:"",cluster:!1,clusterRadius:0,clusterProperties:{},clusterMinPoints:2,iconOffset:[0,0],symbolPlacement:"point",symbolSpacing:250,isShow:!0,minimumLevel:0,maximumLevel:24},e);const n={...e,...e?e.labelOption:{}};this._options.labelOption=Object.assign({pixelOffset:[0,0],allShow:!0,fontSize:"30px",fontColor:"#fff",fontFamily:["Microsoft YaHei"],horizontalOrigin:"center",verticalOrigin:"center",outlineColor:"rgba(0, 0, 0, 0)",outlineWidth:0,outlineBlur:0,iconOverlap:!1,textOverlap:!1},n||{}),this._layout={visibility:this._options.isShow?"visible":"none","icon-size":this._options.scale,"text-field":["get","text"],"text-size":this.getTextSize(),"text-offset":this._options.labelOption.pixelOffset,"icon-offset":this._options.iconOffset,"text-font":this._options.labelOption.fontFamily,"text-justify":this._options.labelOption.horizontalOrigin,"text-anchor":this._options.labelOption.verticalOrigin,"icon-allow-overlap":this.getOver("iconOverlap"),"text-allow-overlap":this.getOver("textOverlap"),"symbol-placement":this._options.symbolPlacement,"symbol-spacing":this._options.symbolSpacing},this._paint={"text-color":this._options.labelOption.fontColor,"text-opacity":this._options.labelOption.allShow?1:0,"text-halo-color":this._options.labelOption.outlineColor,"text-halo-width":this._options.labelOption.outlineWidth,"text-halo-blur":this._options.labelOption.outlineBlur},this.renderSource(),this._loadImagesList=[],this._options.highlightImage&&this.addImage("highlightImage"),this._options.image&&this.addImage("image"),this._options.highlightImage||this._options.image||this.render()}addImage(t){let e=[];const i="string"==typeof this._options[t];if(i){e=[{[d(0,2)]:this._options[t]}]}else this._options[t].length&&(e=this._options[t]);const n=[];e.forEach((e=>{const r=new Promise(((n,r)=>{const o=Object.keys(e).length?Object.keys(e)[0]:d(0,2),s=e[o]?e[o]:e;"image"==t?this._layout["icon-image"]=i?o:["get","imageName"]:this._options.highlightImageName=i?o:["get","highlightImageName"],cNt.value.loadImage(s,((t,e)=>{t?r(t):cNt.value.hasImage(o)?r(`An image name named "${o}" already exists`):(cNt.value.addImage(o,e),this._loadImagesList.push(o),n())}))}));n.push(r)})),Promise.all(n).then((()=>{"image"==t&&this.render()})).catch((t=>{console.error("Error loading images:",t)}))}renderSource(){const t={type:"geojson",data:this._data,cluster:this._options.cluster,clusterRadius:this._options.clusterRadius,clusterProperties:this._options.clusterProperties,clusterMinPoints:this._options.clusterMinPoints};this._options.clusterMaxZoom&&(t.clusterMaxZoom=this._options.clusterMaxZoom),"massivePoints"==this._options.type&&(t.cluster=!0,t.clusterRadius=0),cNt.value.addSource(this.sourceId,t)}render(){const t={id:this.id,source:this.sourceId,type:"symbol",layout:this._layout,paint:this._paint,minzoom:this._options.minimumLevel,maxzoom:this._options.maximumLevel};"assemblage"==this._options.type&&(t.filter=["!",["has","point_count"]]),cNt.value.addLayer(t),this._options.labelOption&&0==this._options.labelOption.allShow&&(cNt.value.on("mouseenter",this.id,(t=>this.mouseenter(t))),cNt.value.on("mouseleave",this.id,(()=>this.mouseleave())))}mouseenter(t){this.hoveredPolygonId=t.features[0].properties.id;cNt.value.queryRenderedFeatures(t.point,{layers:[this.id]})[0].properties.text&&this.hoveredPolygonId?null!=cNt.value.getPaintProperty(this.id,"text-opacity")&&cNt.value.setPaintProperty(this.id,"text-opacity",["case",["boolean",["==",["get","id"],this.hoveredPolygonId],!1],1,0]):this.hoveredPolygonId}mouseleave(){null!==this.hoveredPolygonId&&cNt.value.setPaintProperty(this.id,"text-opacity",0),this.hoveredPolygonId=null}highlight(t){if(this._options.highlightImageName){const e=cNt.value.querySourceFeatures(this.sourceId,{filter:["in","id",t]});if(!e.length)throw new Error(`The highlight id is ${t} does not exist`);{const t=e[0];cNt.value.addSource(this.id+"Highlightsource",{type:"geojson",data:t});let i={visibility:this._options.isShow?"visible":"none","icon-image":this._options.highlightImageName,"icon-size":this._options.scale,"text-field":["get","text"],"text-size":this.getTextSize(),"icon-offset":this._options.iconOffset,"icon-allow-overlap":this.getOver("iconOverlap"),"text-allow-overlap":this.getOver("textOverlap"),"symbol-placement":this._options.symbolPlacement,"symbol-spacing":this._options.symbolSpacing};this._options.labelOption&&(i={visibility:this._options.isShow?"visible":"none","icon-image":this._options.highlightImageName,"icon-size":this._options.scale,"text-field":["get","text"],"text-size":this.getTextSize(),"text-offset":this._options.labelOption.pixelOffset,"icon-offset":this._options.iconOffset,"text-font":this._options.labelOption.fontFamily,"text-justify":this._options.labelOption.horizontalOrigin,"text-anchor":this._options.labelOption.verticalOrigin,"icon-allow-overlap":this.getOver("iconOverlap"),"text-allow-overlap":this.getOver("textOverlap"),"symbol-placement":this._options.symbolPlacement,"symbol-spacing":this._options.symbolSpacing});let n={};this._options.labelOption&&(n={"text-color":this._options.labelOption.fontColor,"text-opacity":this._options.labelOption.allShow?1:0,"text-halo-color":this._options.labelOption.outlineColor,"text-halo-width":this._options.labelOption.outlineWidth,"text-halo-blur":this._options.labelOption.outlineBlur}),cNt.value.addLayer({id:this.id+"Highlight",source:this.id+"Highlightsource",type:"symbol",layout:i,paint:n})}}}removeHighlight(){cNt.value.removeLayer(this.id+"Highlight"),cNt.value.removeSource(this.id+"Highlightsource")}destroy(){this._loadImagesList.forEach((t=>{cNt.value.hasImage(t)&&cNt.value.removeImage(t)})),super.destroy()}_isFeatureCollectionData(t){return t instanceof Array}update(t){let e=t;this._isFeatureCollectionData(t)&&(e=$p(t,"point")),this.bbox=Kp(e),this.updateSource("source",e),this.updateSource("Highlightsource",e)}updateSource(t,e){const i=cNt.value.getSource(this.id+t);if(i)i.setData(e);else if("source"==t)throw new Error("This source does not exist")}getTextSize(){if(this._options.labelOption)return"number"==typeof this._options.labelOption.fontSize?this._options.labelOption.fontSize:Number(Number(this._options.labelOption.fontSize?this._options.labelOption.fontSize.split("px")[0]:"0")*Number(this._options.scale))}getOver(t){let e=!1;return"massivePoints"==this._options.type?e=!0:this._options.labelOption&&(e=this._options.labelOption[t]),e}}class nd extends(m(C)){id;sourceId;_options;_data;bbox;constructor(t,e,i){super(),this.id=i||d(0,5),this.sourceId=this.id+"source",this._data=t,this.bbox=Kp(t),this._options=Object.assign({color:"rgb(255,0,0)",pixelSize:20,outlineColor:"rgb(255,0,0)",outlineWidth:0,isShow:!0},e),this._options.labelOption=Object.assign({pixelOffset:[0,0],allShow:!0,fontSize:"30px",fontColor:"#fff",fontFamily:["Microsoft YaHei"],horizontalOrigin:"center",verticalOrigin:"center",outlineColor:"#fff",outlineWidth:0,outlineBlur:0},e?e.labelOption:{}),this.reander()}reander(){const t={type:"geojson",data:this._data};cNt.value.addSource(this.sourceId,t),cNt.value.addLayer({id:this.id,type:"circle",source:`${this.id}source`,layout:{visibility:this._options.isShow?"visible":"none"},paint:{"circle-color":this._options.color,"circle-radius":this._options.pixelSize,"circle-stroke-color":this._options.outlineColor,"circle-stroke-width":this._options.outlineWidth}}),cNt.value.addLayer({id:`${this.id}-label`,type:"symbol",source:`${this.id}source`,layout:{visibility:this._options.isShow?"visible":"none","text-field":["get","text"],"text-offset":this._options.labelOption?this._options.labelOption.pixelOffset:null,"text-font":this._options.labelOption?this._options.labelOption.fontFamily:null,"text-justify":this._options.labelOption?this._options.labelOption.horizontalOrigin:null,"text-anchor":this._options.labelOption?this._options.labelOption.verticalOrigin:null,"text-size":Number(this._options.labelOption&&this._options.labelOption.fontSize?this._options.labelOption.fontSize.split("px")[0]:""),"text-allow-overlap":!0},paint:{"text-color":this._options.labelOption?this._options.labelOption.fontColor:null,"text-halo-color":this._options.labelOption?this._options.labelOption.outlineColor:null,"text-halo-width":this._options.labelOption?this._options.labelOption.outlineWidth:null,"text-opacity":this._options.labelOption&&this._options.labelOption.allShow?1:0}}),this._options.labelOption&&0==this._options.labelOption.allShow&&(cNt.value.on("mouseenter",this.id,(t=>this.mouseenter(t))),cNt.value.on("mouseleave",this.id,(()=>this.mouseleave())))}mouseenter(t){const e=t.features[0].properties.id;cNt.value.queryRenderedFeatures(t.point,{layers:[`${this.id}`]})[0].properties.text&&cNt.value.setPaintProperty(`${this.id}-label`,"text-opacity",["case",["boolean",["==",["get","id"],e],!1],1,0])}mouseleave(){cNt.value.setPaintProperty(`${this.id}-label`,"text-opacity",0)}destroy(){cNt.value.removeLayer(`${this.id}-label`),this._options.labelOption&&0==this._options.labelOption.allShow&&(cNt.value.off("mouseenter",this.id,(t=>this.mouseenter(t))),cNt.value.off("mouseleave",this.id,(()=>this.mouseleave()))),super.destroy()}}function rd(t,e,i){let n;return n=p(t)?$p(t,"point"):t,new id(n,e,i)}var od={exports:{}},sd={exports:{}},ad={exports:{}};!function(t,e){!function(t){const e="132",i=100,n=300,r=301,o=302,s=303,a=304,l=306,c=307,u=1e3,h=1001,p=1002,d=1003,f=1004,m=1005,g=1006,y=1007,v=1008,_=1009,x=1012,b=1014,w=1015,A=1016,E=1020,S=1022,M=1023,T=1026,I=1027,C=33776,P=33777,L=33778,D=33779,R=35840,O=35841,k=35842,N=35843,B=37492,z=37496,F=2300,V=2301,U=2302,G=2400,j=2401,H=2402,W=2500,q=2501,X=3e3,Z=3001,Y=3007,Q=3002,J=3004,K=3005,$=3006,tt=7680,et=35044,it=35048,nt="300 es";class rt{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e>8&255]+ot[t>>16&255]+ot[t>>24&255]+"-"+ot[255&e]+ot[e>>8&255]+"-"+ot[e>>16&15|64]+ot[e>>24&255]+"-"+ot[63&i|128]+ot[i>>8&255]+"-"+ot[i>>16&255]+ot[i>>24&255]+ot[255&n]+ot[n>>8&255]+ot[n>>16&255]+ot[n>>24&255]).toUpperCase()}function ut(t,e,i){return Math.max(e,Math.min(i,t))}function ht(t,e){return(t%e+e)%e}function pt(t,e,i){return(1-i)*t+i*e}function dt(t){return 0==(t&t-1)&&0!==t}function ft(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function mt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var gt=Object.freeze({__proto__:null,DEG2RAD:at,RAD2DEG:lt,generateUUID:ct,clamp:ut,euclideanModulo:ht,mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:pt,damp:function(t,e,i,n){return pt(t,e,1-Math.exp(-i*n))},pingpong:function(t,e=1){return e-Math.abs(ht(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(st=t%2147483647),st=16807*st%2147483647,(st-1)/2147483646},degToRad:function(t){return t*at},radToDeg:function(t){return t*lt},isPowerOfTwo:dt,ceilPowerOfTwo:ft,floorPowerOfTwo:mt,setQuaternionFromProperEuler:function(t,e,i,n,r){const o=Math.cos,s=Math.sin,a=o(i/2),l=s(i/2),c=o((e+n)/2),u=s((e+n)/2),h=o((e-n)/2),p=s((e-n)/2),d=o((n-e)/2),f=s((n-e)/2);switch(r){case"XYX":t.set(a*u,l*h,l*p,a*c);break;case"YZY":t.set(l*p,a*u,l*h,a*c);break;case"ZXZ":t.set(l*h,l*p,a*u,a*c);break;case"XZX":t.set(a*u,l*f,l*d,a*c);break;case"YXY":t.set(l*d,a*u,l*f,a*c);break;case"ZYZ":t.set(l*f,l*d,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}});class yt{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*i-o*n+t.x,this.y=r*n+o*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}yt.prototype.isVector2=!0;class vt{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,o,s,a,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=s,c[3]=e,c[4]=r,c[5]=a,c[6]=i,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,o=i[0],s=i[3],a=i[6],l=i[1],c=i[4],u=i[7],h=i[2],p=i[5],d=i[8],f=n[0],m=n[3],g=n[6],y=n[1],v=n[4],_=n[7],x=n[2],b=n[5],w=n[8];return r[0]=o*f+s*y+a*x,r[3]=o*m+s*v+a*b,r[6]=o*g+s*_+a*w,r[1]=l*f+c*y+u*x,r[4]=l*m+c*v+u*b,r[7]=l*g+c*_+u*w,r[2]=h*f+p*y+d*x,r[5]=h*m+p*v+d*b,r[8]=h*g+p*_+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],c=t[8];return e*o*c-e*s*l-i*r*c+i*s*a+n*r*l-n*o*a}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],c=t[8],u=c*o-s*l,h=s*a-c*r,p=l*r-o*a,d=e*u+i*h+n*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const f=1/d;return t[0]=u*f,t[1]=(n*l-c*i)*f,t[2]=(s*i-n*o)*f,t[3]=h*f,t[4]=(c*e-n*a)*f,t[5]=(n*r-s*e)*f,t[6]=p*f,t[7]=(i*a-l*e)*f,t[8]=(o*e-i*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,o,s){const a=Math.cos(r),l=Math.sin(r);return this.set(i*a,i*l,-i*(a*o+l*s)+o+t,-n*l,n*a,-n*(-l*o+a*s)+s+e,0,0,1),this}scale(t,e){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],o=n[3],s=n[6],a=n[1],l=n[4],c=n[7];return n[0]=e*r+i*a,n[3]=e*o+i*l,n[6]=e*s+i*c,n[1]=-i*r+e*a,n[4]=-i*o+e*l,n[7]=-i*s+e*c,this}translate(t,e){const i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let _t;vt.prototype.isMatrix3=!0;class xt{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===_t&&(_t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),_t.width=t.width,_t.height=t.height;const i=_t.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=_t}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let bt=0;class wt extends rt{constructor(t=wt.DEFAULT_IMAGE,e=wt.DEFAULT_MAPPING,i=1001,n=1001,r=1006,o=1008,s=1023,a=1009,l=1,c=3e3){super(),Object.defineProperty(this,"id",{value:bt++}),this.uuid=ct(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=a,this.offset=new yt(0,0),this.repeat=new yt(1,1),this.center=new yt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new vt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const n=this.image;if(void 0===n.uuid&&(n.uuid=ct()),!e&&void 0===t.images[n.uuid]){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t1)switch(this.wrapS){case u:t.x=t.x-Math.floor(t.x);break;case h:t.x=t.x<0?0:1;break;case p:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case u:t.y=t.y-Math.floor(t.y);break;case h:t.y=t.y<0?0:1;break;case p:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function At(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?xt.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}wt.DEFAULT_IMAGE=void 0,wt.DEFAULT_MAPPING=n,wt.prototype.isTexture=!0;class Et{constructor(t=0,e=0,i=0,n=1){this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*i+o[8]*n+o[12]*r,this.y=o[1]*e+o[5]*i+o[9]*n+o[13]*r,this.z=o[2]*e+o[6]*i+o[10]*n+o[14]*r,this.w=o[3]*e+o[7]*i+o[11]*n+o[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const o=.01,s=.1,a=t.elements,l=a[0],c=a[4],u=a[8],h=a[1],p=a[5],d=a[9],f=a[2],m=a[6],g=a[10];if(Math.abs(c-h)a&&t>y?ty?a=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),o=Math.atan2(r,e*i);t=Math.sin(t*o)/r,s=Math.sin(s*o)/r}const r=s*i;if(a=a*t+h*r,l=l*t+p*r,c=c*t+d*r,u=u*t+f*r,t===1-s){const t=1/Math.sqrt(a*a+l*l+c*c+u*u);a*=t,l*=t,c*=t,u*=t}}t[e]=a,t[e+1]=l,t[e+2]=c,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,n,r,o){const s=i[n],a=i[n+1],l=i[n+2],c=i[n+3],u=r[o],h=r[o+1],p=r[o+2],d=r[o+3];return t[e]=s*d+c*u+a*p-l*h,t[e+1]=a*d+c*h+l*u-s*p,t[e+2]=l*d+c*p+s*h-a*u,t[e+3]=c*d-s*u-a*h-l*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=t._x,n=t._y,r=t._z,o=t._order,s=Math.cos,a=Math.sin,l=s(i/2),c=s(n/2),u=s(r/2),h=a(i/2),p=a(n/2),d=a(r/2);switch(o){case"XYZ":this._x=h*c*u+l*p*d,this._y=l*p*u-h*c*d,this._z=l*c*d+h*p*u,this._w=l*c*u-h*p*d;break;case"YXZ":this._x=h*c*u+l*p*d,this._y=l*p*u-h*c*d,this._z=l*c*d-h*p*u,this._w=l*c*u+h*p*d;break;case"ZXY":this._x=h*c*u-l*p*d,this._y=l*p*u+h*c*d,this._z=l*c*d+h*p*u,this._w=l*c*u-h*p*d;break;case"ZYX":this._x=h*c*u-l*p*d,this._y=l*p*u+h*c*d,this._z=l*c*d-h*p*u,this._w=l*c*u+h*p*d;break;case"YZX":this._x=h*c*u+l*p*d,this._y=l*p*u+h*c*d,this._z=l*c*d-h*p*u,this._w=l*c*u-h*p*d;break;case"XZY":this._x=h*c*u-l*p*d,this._y=l*p*u-h*c*d,this._z=l*c*d+h*p*u,this._w=l*c*u+h*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],o=e[1],s=e[5],a=e[9],l=e[2],c=e[6],u=e[10],h=i+s+u;if(h>0){const t=.5/Math.sqrt(h+1);this._w=.25/t,this._x=(c-a)*t,this._y=(r-l)*t,this._z=(o-n)*t}else if(i>s&&i>u){const t=2*Math.sqrt(1+i-s-u);this._w=(c-a)/t,this._x=.25*t,this._y=(n+o)/t,this._z=(r+l)/t}else if(s>u){const t=2*Math.sqrt(1+s-i-u);this._w=(r-l)/t,this._x=(n+o)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+u-i-s);this._w=(o-n)/t,this._x=(r+l)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return iMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ut(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,o=t._w,s=e._x,a=e._y,l=e._z,c=e._w;return this._x=i*c+o*s+n*l-r*a,this._y=n*c+o*a+r*s-i*l,this._z=r*c+o*l+i*a-n*s,this._w=o*c-i*s-n*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,o=this._w;let s=o*t._w+i*t._x+n*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=i,this._y=n,this._z=r,this;const a=1-s*s;if(a<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,s),u=Math.sin((1-e)*c)/l,h=Math.sin(e*c)/l;return this._w=o*u+this._w*h,this._x=i*u+this._x*h,this._y=n*u+this._y*h,this._z=r*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(t,e,i){this.copy(t).slerp(e,i)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}It.prototype.isQuaternion=!0;class Ct{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Lt.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Lt.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,o=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*o,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,s=t.z,a=t.w,l=a*e+o*n-s*i,c=a*i+s*e-r*n,u=a*n+r*i-o*e,h=-r*e-o*i-s*n;return this.x=l*a+h*-r+c*-s-u*-o,this.y=c*a+h*-o+u*-r-l*-s,this.z=u*a+h*-s+l*-o-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=n*a-r*s,this.y=r*o-i*a,this.z=i*s-n*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Pt.copy(this).projectOnVector(t),this.sub(Pt)}reflect(t){return this.sub(Pt.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(ut(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}Ct.prototype.isVector3=!0;const Pt=new Ct,Lt=new It;class Dt{constructor(t=new Ct(1/0,1/0,1/0),e=new Ct(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.length;ar&&(r=l),c>o&&(o=c),u>s&&(s=u)}return this.min.set(e,i,n),this.max.set(r,o,s),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.count;ar&&(r=l),c>o&&(o=c),u>s&&(s=u)}return this.min.set(e,i,n),this.max.set(r,o,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Ot),Ot.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Gt),jt.subVectors(this.max,Gt),Nt.subVectors(t.a,Gt),Bt.subVectors(t.b,Gt),zt.subVectors(t.c,Gt),Ft.subVectors(Bt,Nt),Vt.subVectors(zt,Bt),Ut.subVectors(Nt,zt);let e=[0,-Ft.z,Ft.y,0,-Vt.z,Vt.y,0,-Ut.z,Ut.y,Ft.z,0,-Ft.x,Vt.z,0,-Vt.x,Ut.z,0,-Ut.x,-Ft.y,Ft.x,0,-Vt.y,Vt.x,0,-Ut.y,Ut.x,0];return!!qt(e,Nt,Bt,zt,jt)&&(e=[1,0,0,0,1,0,0,0,1],!!qt(e,Nt,Bt,zt,jt)&&(Ht.crossVectors(Ft,Vt),e=[Ht.x,Ht.y,Ht.z],qt(e,Nt,Bt,zt,jt)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Ot.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Ot).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Rt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Rt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Rt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Rt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Rt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Rt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Rt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Rt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Rt)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}Dt.prototype.isBox3=!0;const Rt=[new Ct,new Ct,new Ct,new Ct,new Ct,new Ct,new Ct,new Ct],Ot=new Ct,kt=new Dt,Nt=new Ct,Bt=new Ct,zt=new Ct,Ft=new Ct,Vt=new Ct,Ut=new Ct,Gt=new Ct,jt=new Ct,Ht=new Ct,Wt=new Ct;function qt(t,e,i,n,r){for(let o=0,s=t.length-3;o<=s;o+=3){Wt.fromArray(t,o);const s=r.x*Math.abs(Wt.x)+r.y*Math.abs(Wt.y)+r.z*Math.abs(Wt.z),a=e.dot(Wt),l=i.dot(Wt),c=n.dot(Wt);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>s)return!1}return!0}const Xt=new Dt,Zt=new Ct,Yt=new Ct,Qt=new Ct;class Jt{constructor(t=new Ct,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):Xt.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){Qt.subVectors(t,this.center);const e=Qt.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.add(Qt.multiplyScalar(i/t)),this.radius+=i}return this}union(t){return Yt.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(Zt.copy(t.center).add(Yt)),this.expandByPoint(Zt.copy(t.center).sub(Yt)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Kt=new Ct,$t=new Ct,te=new Ct,ee=new Ct,ie=new Ct,ne=new Ct,re=new Ct;class oe{constructor(t=new Ct,e=new Ct(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Kt)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Kt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Kt.copy(this.direction).multiplyScalar(e).add(this.origin),Kt.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){$t.copy(t).add(e).multiplyScalar(.5),te.copy(e).sub(t).normalize(),ee.copy(this.origin).sub($t);const r=.5*t.distanceTo(e),o=-this.direction.dot(te),s=ee.dot(this.direction),a=-ee.dot(te),l=ee.lengthSq(),c=Math.abs(1-o*o);let u,h,p,d;if(c>0)if(u=o*a-s,h=o*s-a,d=r*c,u>=0)if(h>=-d)if(h<=d){const t=1/c;u*=t,h*=t,p=u*(u+o*h+2*s)+h*(o*u+h+2*a)+l}else h=r,u=Math.max(0,-(o*h+s)),p=-u*u+h*(h+2*a)+l;else h=-r,u=Math.max(0,-(o*h+s)),p=-u*u+h*(h+2*a)+l;else h<=-d?(u=Math.max(0,-(-o*r+s)),h=u>0?-r:Math.min(Math.max(-r,-a),r),p=-u*u+h*(h+2*a)+l):h<=d?(u=0,h=Math.min(Math.max(-r,-a),r),p=h*(h+2*a)+l):(u=Math.max(0,-(o*r+s)),h=u>0?r:Math.min(Math.max(-r,-a),r),p=-u*u+h*(h+2*a)+l);else h=o>0?-r:r,u=Math.max(0,-(o*h+s)),p=-u*u+h*(h+2*a)+l;return i&&i.copy(this.direction).multiplyScalar(u).add(this.origin),n&&n.copy(te).multiplyScalar(h).add($t),p}intersectSphere(t,e){Kt.subVectors(t.center,this.origin);const i=Kt.dot(this.direction),n=Kt.dot(Kt)-i*i,r=t.radius*t.radius;if(n>r)return null;const o=Math.sqrt(r-n),s=i-o,a=i+o;return s<0&&a<0?null:s<0?this.at(a,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,o,s,a;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(i=(t.min.x-h.x)*l,n=(t.max.x-h.x)*l):(i=(t.max.x-h.x)*l,n=(t.min.x-h.x)*l),c>=0?(r=(t.min.y-h.y)*c,o=(t.max.y-h.y)*c):(r=(t.max.y-h.y)*c,o=(t.min.y-h.y)*c),i>o||r>n?null:((r>i||i!=i)&&(i=r),(o=0?(s=(t.min.z-h.z)*u,a=(t.max.z-h.z)*u):(s=(t.max.z-h.z)*u,a=(t.min.z-h.z)*u),i>a||s>n?null:((s>i||i!=i)&&(i=s),(a=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,Kt)}intersectTriangle(t,e,i,n,r){ie.subVectors(e,t),ne.subVectors(i,t),re.crossVectors(ie,ne);let o,s=this.direction.dot(re);if(s>0){if(n)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}ee.subVectors(this.origin,t);const a=o*this.direction.dot(ne.crossVectors(ee,ne));if(a<0)return null;const l=o*this.direction.dot(ie.cross(ee));if(l<0)return null;if(a+l>s)return null;const c=-o*ee.dot(re);return c<0?null:this.at(c/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class se{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,o,s,a,l,c,u,h,p,d,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=c,g[10]=u,g[14]=h,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new se).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/ae.setFromMatrixColumn(t,0).length(),r=1/ae.setFromMatrixColumn(t,1).length(),o=1/ae.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,i=t.x,n=t.y,r=t.z,o=Math.cos(i),s=Math.sin(i),a=Math.cos(n),l=Math.sin(n),c=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){const t=o*c,i=o*u,n=s*c,r=s*u;e[0]=a*c,e[4]=-a*u,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-s*a,e[2]=r-t*l,e[6]=n+i*l,e[10]=o*a}else if("YXZ"===t.order){const t=a*c,i=a*u,n=l*c,r=l*u;e[0]=t+r*s,e[4]=n*s-i,e[8]=o*l,e[1]=o*u,e[5]=o*c,e[9]=-s,e[2]=i*s-n,e[6]=r+t*s,e[10]=o*a}else if("ZXY"===t.order){const t=a*c,i=a*u,n=l*c,r=l*u;e[0]=t-r*s,e[4]=-o*u,e[8]=n+i*s,e[1]=i+n*s,e[5]=o*c,e[9]=r-t*s,e[2]=-o*l,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){const t=o*c,i=o*u,n=s*c,r=s*u;e[0]=a*c,e[4]=n*l-i,e[8]=t*l+r,e[1]=a*u,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){const t=o*a,i=o*l,n=s*a,r=s*l;e[0]=a*c,e[4]=r-t*u,e[8]=n*u+i,e[1]=u,e[5]=o*c,e[9]=-s*c,e[2]=-l*c,e[6]=i*u+n,e[10]=t-r*u}else if("XZY"===t.order){const t=o*a,i=o*l,n=s*a,r=s*l;e[0]=a*c,e[4]=-u,e[8]=l*c,e[1]=t*u+r,e[5]=o*c,e[9]=i*u-n,e[2]=n*u-i,e[6]=s*c,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(ce,t,ue)}lookAt(t,e,i){const n=this.elements;return de.subVectors(t,e),0===de.lengthSq()&&(de.z=1),de.normalize(),he.crossVectors(i,de),0===he.lengthSq()&&(1===Math.abs(i.z)?de.x+=1e-4:de.z+=1e-4,de.normalize(),he.crossVectors(i,de)),he.normalize(),pe.crossVectors(de,he),n[0]=he.x,n[4]=pe.x,n[8]=de.x,n[1]=he.y,n[5]=pe.y,n[9]=de.y,n[2]=he.z,n[6]=pe.z,n[10]=de.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,o=i[0],s=i[4],a=i[8],l=i[12],c=i[1],u=i[5],h=i[9],p=i[13],d=i[2],f=i[6],m=i[10],g=i[14],y=i[3],v=i[7],_=i[11],x=i[15],b=n[0],w=n[4],A=n[8],E=n[12],S=n[1],M=n[5],T=n[9],I=n[13],C=n[2],P=n[6],L=n[10],D=n[14],R=n[3],O=n[7],k=n[11],N=n[15];return r[0]=o*b+s*S+a*C+l*R,r[4]=o*w+s*M+a*P+l*O,r[8]=o*A+s*T+a*L+l*k,r[12]=o*E+s*I+a*D+l*N,r[1]=c*b+u*S+h*C+p*R,r[5]=c*w+u*M+h*P+p*O,r[9]=c*A+u*T+h*L+p*k,r[13]=c*E+u*I+h*D+p*N,r[2]=d*b+f*S+m*C+g*R,r[6]=d*w+f*M+m*P+g*O,r[10]=d*A+f*T+m*L+g*k,r[14]=d*E+f*I+m*D+g*N,r[3]=y*b+v*S+_*C+x*R,r[7]=y*w+v*M+_*P+x*O,r[11]=y*A+v*T+_*L+x*k,r[15]=y*E+v*I+_*D+x*N,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],o=t[1],s=t[5],a=t[9],l=t[13],c=t[2],u=t[6],h=t[10],p=t[14];return t[3]*(+r*a*u-n*l*u-r*s*h+i*l*h+n*s*p-i*a*p)+t[7]*(+e*a*p-e*l*h+r*o*h-n*o*p+n*l*c-r*a*c)+t[11]*(+e*l*u-e*s*p-r*o*u+i*o*p+r*s*c-i*l*c)+t[15]*(-n*s*c-e*a*u+e*s*h+n*o*u-i*o*h+i*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],c=t[8],u=t[9],h=t[10],p=t[11],d=t[12],f=t[13],m=t[14],g=t[15],y=u*m*l-f*h*l+f*a*p-s*m*p-u*a*g+s*h*g,v=d*h*l-c*m*l-d*a*p+o*m*p+c*a*g-o*h*g,_=c*f*l-d*u*l+d*s*p-o*f*p-c*s*g+o*u*g,x=d*u*a-c*f*a-d*s*h+o*f*h+c*s*m-o*u*m,b=e*y+i*v+n*_+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=y*w,t[1]=(f*h*r-u*m*r-f*n*p+i*m*p+u*n*g-i*h*g)*w,t[2]=(s*m*r-f*a*r+f*n*l-i*m*l-s*n*g+i*a*g)*w,t[3]=(u*a*r-s*h*r-u*n*l+i*h*l+s*n*p-i*a*p)*w,t[4]=v*w,t[5]=(c*m*r-d*h*r+d*n*p-e*m*p-c*n*g+e*h*g)*w,t[6]=(d*a*r-o*m*r-d*n*l+e*m*l+o*n*g-e*a*g)*w,t[7]=(o*h*r-c*a*r+c*n*l-e*h*l-o*n*p+e*a*p)*w,t[8]=_*w,t[9]=(d*u*r-c*f*r-d*i*p+e*f*p+c*i*g-e*u*g)*w,t[10]=(o*f*r-d*s*r+d*i*l-e*f*l-o*i*g+e*s*g)*w,t[11]=(c*s*r-o*u*r-c*i*l+e*u*l+o*i*p-e*s*p)*w,t[12]=x*w,t[13]=(c*f*n-d*u*n+d*i*h-e*f*h-c*i*m+e*u*m)*w,t[14]=(d*s*n-o*f*n-d*i*a+e*f*a+o*i*m-e*s*m)*w,t[15]=(o*u*n-c*s*n+c*i*a-e*u*a-o*i*h+e*s*h)*w,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,o=t.x,s=t.y,a=t.z,l=r*o,c=r*s;return this.set(l*o+i,l*s-n*a,l*a+n*s,0,l*s+n*a,c*s+i,c*a-n*o,0,l*a-n*s,c*a+n*o,r*a*a+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,o){return this.set(1,i,r,0,t,1,o,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,o=e._y,s=e._z,a=e._w,l=r+r,c=o+o,u=s+s,h=r*l,p=r*c,d=r*u,f=o*c,m=o*u,g=s*u,y=a*l,v=a*c,_=a*u,x=i.x,b=i.y,w=i.z;return n[0]=(1-(f+g))*x,n[1]=(p+_)*x,n[2]=(d-v)*x,n[3]=0,n[4]=(p-_)*b,n[5]=(1-(h+g))*b,n[6]=(m+y)*b,n[7]=0,n[8]=(d+v)*w,n[9]=(m-y)*w,n[10]=(1-(h+f))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=ae.set(n[0],n[1],n[2]).length();const o=ae.set(n[4],n[5],n[6]).length(),s=ae.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],le.copy(this);const a=1/r,l=1/o,c=1/s;return le.elements[0]*=a,le.elements[1]*=a,le.elements[2]*=a,le.elements[4]*=l,le.elements[5]*=l,le.elements[6]*=l,le.elements[8]*=c,le.elements[9]*=c,le.elements[10]*=c,e.setFromRotationMatrix(le),i.x=r,i.y=o,i.z=s,this}makePerspective(t,e,i,n,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,a=2*r/(e-t),l=2*r/(i-n),c=(e+t)/(e-t),u=(i+n)/(i-n),h=-(o+r)/(o-r),p=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=c,s[12]=0,s[1]=0,s[5]=l,s[9]=u,s[13]=0,s[2]=0,s[6]=0,s[10]=h,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,i,n,r,o){const s=this.elements,a=1/(e-t),l=1/(i-n),c=1/(o-r),u=(e+t)*a,h=(i+n)*l,p=(o+r)*c;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-u,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-h,s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}se.prototype.isMatrix4=!0;const ae=new Ct,le=new se,ce=new Ct(0,0,0),ue=new Ct(1,1,1),he=new Ct,pe=new Ct,de=new Ct,fe=new se,me=new It;class ge{constructor(t=0,e=0,i=0,n=ge.DefaultOrder){this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],o=n[4],s=n[8],a=n[1],l=n[5],c=n[9],u=n[2],h=n[6],p=n[10];switch(e){case"XYZ":this._y=Math.asin(ut(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ut(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(ut(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-ut(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(ut(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-ut(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return fe.makeRotationFromQuaternion(t),this.setFromRotationMatrix(fe,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return me.setFromEuler(this),this.setFromQuaternion(me,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Ct(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}ge.prototype.isEuler=!0,ge.DefaultOrder="XYZ",ge.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class ye{constructor(){this.mask=1}set(t){this.mask=1<1){for(let t=0;t1){for(let t=0;t0){n.children=[];for(let e=0;e0){n.animations=[];for(let e=0;e0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),s.length>0&&(i.images=s),a.length>0&&(i.shapes=a),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c)}return i.object=n,i;function o(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){De.subVectors(n,e),Re.subVectors(i,e),Oe.subVectors(t,e);const o=De.dot(De),s=De.dot(Re),a=De.dot(Oe),l=Re.dot(Re),c=Re.dot(Oe),u=o*l-s*s;if(0===u)return r.set(-2,-1,-1);const h=1/u,p=(l*a-s*c)*h,d=(o*c-s*a)*h;return r.set(1-p-d,d,p)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,ke),ke.x>=0&&ke.y>=0&&ke.x+ke.y<=1}static getUV(t,e,i,n,r,o,s,a){return this.getBarycoord(t,e,i,n,ke),a.set(0,0),a.addScaledVector(r,ke.x),a.addScaledVector(o,ke.y),a.addScaledVector(s,ke.z),a}static isFrontFacing(t,e,i,n){return De.subVectors(i,e),Re.subVectors(t,e),De.cross(Re).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return De.subVectors(this.c,this.b),Re.subVectors(this.a,this.b),.5*De.cross(Re).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Ge.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Ge.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return Ge.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return Ge.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Ge.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let o,s;Ne.subVectors(n,i),Be.subVectors(r,i),Fe.subVectors(t,i);const a=Ne.dot(Fe),l=Be.dot(Fe);if(a<=0&&l<=0)return e.copy(i);Ve.subVectors(t,n);const c=Ne.dot(Ve),u=Be.dot(Ve);if(c>=0&&u<=c)return e.copy(n);const h=a*u-c*l;if(h<=0&&a>=0&&c<=0)return o=a/(a-c),e.copy(i).addScaledVector(Ne,o);Ue.subVectors(t,r);const p=Ne.dot(Ue),d=Be.dot(Ue);if(d>=0&&p<=d)return e.copy(r);const f=p*l-a*d;if(f<=0&&l>=0&&d<=0)return s=l/(l-d),e.copy(i).addScaledVector(Be,s);const m=c*d-p*u;if(m<=0&&u-c>=0&&p-d>=0)return ze.subVectors(r,n),s=(u-c)/(u-c+(p-d)),e.copy(n).addScaledVector(ze,s);const g=1/(m+f+h);return o=f*g,s=h*g,e.copy(i).addScaledVector(Ne,o).addScaledVector(Be,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let je=0;class He extends rt{constructor(){super(),Object.defineProperty(this,"id",{value:je++}),this.uuid=ct(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.format=M,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=i,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=tt,this.stencilZFail=tt,this.stencilZPass=tt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.sheenTint&&this.sheenTint.isColor&&(i.sheenTint=this.sheenTint.getHex()),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularTint&&this.specularTint.isColor&&(i.specularTint=this.specularTint.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularTintMap&&this.specularTintMap.isTexture&&(i.specularTintMap=this.specularTintMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationTint&&(i.attenuationTint=this.attenuationTint.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.format!==M&&(i.format=this.format),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.format=t.format,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}He.prototype.isMaterial=!0;const We={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},qe={h:0,s:0,l:0},Xe={h:0,s:0,l:0};function Ze(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function Ye(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Je{constructor(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,i){return this.r=t,this.g=e,this.b=i,this}setHSL(t,e,i){if(t=ht(t,1),e=ut(e,0,1),i=ut(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Ze(r,n,t+1/3),this.g=Ze(r,n,t),this.b=Ze(r,n,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const n=i[1],r=i[2];switch(n){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const i=parseFloat(t[1])/360,n=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(i,n,r)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=We[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=Ye(t.r),this.g=Ye(t.g),this.b=Ye(t.b),this}copyLinearToSRGB(t){return this.r=Qe(t.r),this.g=Qe(t.g),this.b=Qe(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,i=this.g,n=this.b,r=Math.max(e,i,n),o=Math.min(e,i,n);let s,a;const l=(o+r)/2;if(o===r)s=0,a=0;else{const t=r-o;switch(a=l<=.5?t/(r+o):t/(2-r-o),r){case e:s=(i-n)/t+(i