map-core-func 0.1.89 → 0.1.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -153,7 +153,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
153
153
|
|
|
154
154
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
155
155
|
and limitations under the License.
|
|
156
|
-
***************************************************************************** */function Od(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var Ud=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function Gd(t,e){return t>e?1:t<e?-1:0}function zd(t,e,r){for(var n=new Ud(null,null),i=n,o=n;;){var s=r(t,e.key);if(s<0){if(null===e.left)break;if(r(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(r(t,e.right.key)>0){a=e.right;if(e.right=a.left,a.left=e,null===(e=a).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function jd(t,e,r,n){var i=new Ud(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=zd(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function Vd(t,e,r){var n=null,i=null;if(e){var o=r((e=zd(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function Hd(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&Hd(t.left,o,!1,n,i),t.right&&Hd(t.right,o,!0,n,i)}}var qd=function(){function t(t){void 0===t&&(t=Gd),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=jd(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new Ud(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=zd(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=zd(t,e,r)).key)?(null===e.left?n=e.right:(n=zd(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=zd(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=zd(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,r=[],n=!1,i=new Ud(null,null),o=i;for(;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&Wd(t,e,0,n-1,i),null===this._root)this._root=Yd(t,e,0,n),this._size=n;else{var o=function(t,e,r){var n=new Ud(null,null),i=n,o=t,s=e;for(;null!==o&&null!==s;)r(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;null!==o?i.next=o:null!==s&&(i.next=s);return n.next}(this.toList(),function(t,e){for(var r=new Ud(null,null),n=r,i=0;i<t.length;i++)n=n.next=new Ud(t[i],e[i]);return n.next=null,r.next}(t,e),i);n=this._size+n,this._root=Xd({head:o},0,n)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return Hd(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=Vd(t,this._root,n),o=i.left,s=i.right;n(t,e)<0?s=jd(e,r,s,n):o=jd(e,r,o,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=zd(t.key,e,r)).left=t),e)}(o,s,n)},t.prototype.split=function(t){return Vd(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t,e,r;return Od(this,(function(n){switch(n.label){case 0:t=this._root,e=[],r=!1,n.label=1;case 1:return r?[3,6]:null===t?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return 0===e.length?[3,4]:[4,t=e.pop()];case 3:return n.sent(),t=t.right,[3,5];case 4:r=!0,n.label=5;case 5:return[3,1];case 6:return[2]}}))},t}();function Yd(t,e,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),s=t[o],a=e[o],u=new Ud(s,a);return u.left=Yd(t,e,r,o),u.right=Yd(t,e,o+1,n),u}return null}function Xd(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=Xd(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=Xd(t,i+1,r),s}return null}function Wd(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,a=n+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}Wd(t,e,r,a,i),Wd(t,e,a+1,n,i)}}function Jd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Kd(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Zd(t,e,r){return e&&Kd(t.prototype,e),r&&Kd(t,r),t}var $d=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},tg=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},eg=Number.EPSILON;void 0===eg&&(eg=Math.pow(2,-52));var rg=eg*eg,ng=function(t,e){if(-eg<t&&t<eg&&-eg<e&&e<eg)return 0;var r=t-e;return r*r<rg*t*e?0:t<e?-1:1},ig=function(){function t(){Jd(this,t),this.reset()}return Zd(t,[{key:"reset",value:function(){this.xRounder=new og,this.yRounder=new og}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),og=function(){function t(){Jd(this,t),this.tree=new qd,this.round(0)}return Zd(t,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===ng(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===ng(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),t}(),sg=new ig,ag=function(t,e){return t.x*e.y-t.y*e.x},ug=function(t,e){return t.x*e.x+t.y*e.y},lg=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=ag(n,i);return ng(o,0)},hg=function(t){return Math.sqrt(ug(t,t))},cg=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return ug(i,n)/hg(i)/hg(n)},fg=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},pg=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},dg=function(){function t(e,r){Jd(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return Zd(t,null,[{key:"compare",value:function(e,r){var n=t.comparePoints(e.point,r.point);return 0!==n?n:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:Ag.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),Zd(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&(r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,a,u,l=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=l.point,a={x:o.x-i.x,y:o.y-i.y},u={x:s.x-i.x,y:s.y-i.y},ag(u,a)/hg(u)/hg(a)),cosine:cg(e.point,t.point,l.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,a=r.get(e),u=a.sine,l=a.cosine;return o>=0&&u>=0?s<l?1:s>l?-1:0:o<0&&u<0?s<l?-1:s>l?1:0:u<o?-1:u>o?1:0}}}]),t}(),gg=0,Ag=function(){function t(e,r,n,i){Jd(this,t),this.id=++gg,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return Zd(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(r<n){if(a<s&&a<u)return 1;if(a>s&&a>u)return-1;var h=t.comparePoint(e.leftSE.point);if(h<0)return 1;if(h>0)return-1;var c=e.comparePoint(t.rightSE.point);return 0!==c?c:-1}if(r>n){if(s<a&&s<l)return-1;if(s>a&&s>l)return 1;var f=e.comparePoint(t.leftSE.point);if(0!==f)return f;var p=t.comparePoint(e.rightSE.point);return p<0?1:p>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var d=e.comparePoint(t.rightSE.point);if(0!==d)return d}if(i>o){var g=t.comparePoint(e.rightSE.point);if(g<0)return 1;if(g>0)return-1}if(i!==o){var A=u-s,y=i-r,v=l-a,m=o-n;if(A>y&&v<m)return 1;if(A<y&&v>m)return-1}return i>o?1:i<o||u<l?-1:u>l?1:t.id<e.id?-1:t.id>e.id?1:0}}]),Zd(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,a=e.y+s*n.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=tg(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=$d(e,s)&&0===this.comparePoint(s),l=$d(r,i)&&0===t.comparePoint(i),h=$d(e,a)&&0===this.comparePoint(a),c=$d(r,o)&&0===t.comparePoint(o);if(l&&u)return c&&!h?o:!c&&h?a:null;if(l)return h&&i.x===a.x&&i.y===a.y?null:i;if(u)return c&&o.x===s.x&&o.y===s.y?null:s;if(c&&h)return null;if(c)return o;if(h)return a;var f=function(t,e,r,n){if(0===e.x)return pg(r,n,t.x);if(0===n.x)return pg(t,e,r.x);if(0===e.y)return fg(r,n,t.y);if(0===n.y)return fg(t,e,r.y);var i=ag(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=ag(o,e)/i,a=ag(o,n)/i;return{x:(t.x+a*e.x+(r.x+s*n.x))/2,y:(t.y+a*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===f?null:$d(n,f)?sg.round(f.x,f.y):null}},{key:"split",value:function(e){var r=[],n=void 0!==e.events,i=new dg(e,!0),o=new dg(e,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return dg.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),dg.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var r=this,n=e;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=t.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var a=0,u=n.rings.length;a<u;a++){var l=n.rings[a],h=n.windings[a],c=r.rings.indexOf(l);-1===c?(r.rings.push(l),r.windings.push(h)):r.windings[c]+=h}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),r.push(a)):r[u]+=a}for(var l=[],h=[],c=0,f=e.length;c<f;c++)if(0!==r[c]){var p=e[c],d=p.poly;if(-1===h.indexOf(d))if(p.isExterior)l.push(d);else{-1===h.indexOf(d)&&h.push(d);var g=l.indexOf(p.poly);-1!==g&&l.splice(g,1)}}for(var A=0,y=l.length;A<y;A++){var v=l[A].multiPoly;-1===n.indexOf(v)&&n.push(v)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Sg.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===Sg.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat(Sg.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,n){var i,o,s,a=dg.comparePoints(e,r);if(a<0)i=e,o=r,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,s=-1}return new t(new dg(i,!0),new dg(o,!1),[n],[s])}}]),t}(),yg=function(){function t(e,r,n){if(Jd(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=sg.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if("number"!=typeof e[s][0]||"number"!=typeof e[s][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=sg.round(e[s][0],e[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(Ag.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(Ag.fromRing(o,i,this))}return Zd(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),t}(),vg=function(){function t(e,r){if(Jd(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new yg(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var n=1,i=e.length;n<i;n++){var o=new yg(e[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return Zd(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),mg=function(){function t(e,r){if(Jd(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=e.length;n<i;n++){var o=new vg(e[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return Zd(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),_g=function(){function t(e){Jd(this,t),this.events=e;for(var r=0,n=e.length;r<n;r++)e[r].segment.ringOut=this;this.poly=null}return Zd(t,null,[{key:"factory",value:function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,l=[a],h=a.point,c=[];s=a,a=u,l.push(a),a.point!==h;)for(;;){var f=a.getAvailableLinkedEvents();if(0===f.length){var p=l[0].point,d=l[l.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(p.x,",")+" ".concat(p.y,"]. Last matching segment found ends at")+" [".concat(d.x,", ").concat(d.y,"]."))}if(1===f.length){u=f[0].otherSE;break}for(var g=null,A=0,y=c.length;A<y;A++)if(c[A].point===a.point){g=A;break}if(null===g){c.push({index:l.length,point:a.point});var v=a.getLeftmostComparator(s);u=f.sort(v)[0].otherSE;break}var m=c.splice(g)[0],_=l.splice(m.index);_.unshift(_[0].otherSE),r.push(new t(_.reverse()))}r.push(new t(l))}}return r}}]),Zd(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==lg(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===lg(s,t,a)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,l=this.isExteriorRing()?0:e.length-1,h=this.isExteriorRing()?e.length:-1,c=[],f=l;f!=h;f+=u)c.push([e[f].x,e[f].y]);return c}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];dg.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),Ig=function(){function t(e){Jd(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Zd(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),t}(),Eg=function(){function t(e){Jd(this,t),this.rings=e,this.polys=this._composePolys(e)}return Zd(t,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new Ig(i));else{var o=i.enclosingRing();o.poly||e.push(new Ig(o)),o.poly.addInterior(i)}}return e}}]),t}(),xg=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ag.compare;Jd(this,t),this.queue=e,this.tree=new qd(r),this.segments=[]}return Zd(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var l=s.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l)))for(var h=this._splitSafely(s,l),c=0,f=h.length;c<f;c++)r.push(h[c])}var p=null;if(a){var d=a.getIntersection(e);if(null!==d&&(e.isAnEndpoint(d)||(p=d),!a.isAnEndpoint(d)))for(var g=this._splitSafely(a,d),A=0,y=g.length;A<y;A++)r.push(g[A])}if(null!==u||null!==p){var v=null;if(null===u)v=p;else if(null===p)v=u;else{v=dg.comparePoints(u,p)<=0?u:p}this.queue.remove(e.rightSE),r.push(e.rightSE);for(var m=e.split(v),_=0,I=m.length;_<I;_++)r.push(m[_])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var E=s.getIntersection(a);if(null!==E){if(!s.isAnEndpoint(E))for(var x=this._splitSafely(s,E),w=0,C=x.length;w<C;w++)r.push(x[w]);if(!a.isAnEndpoint(E))for(var b=this._splitSafely(a,E),S=0,B=b.length;S<B;S++)r.push(b[S])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),t}(),wg="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Cg="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,bg=function(){function t(){Jd(this,t)}return Zd(t,[{key:"run",value:function(t,e,r){Sg.type=t,sg.reset();for(var n=[new mg(e,!0)],i=0,o=r.length;i<o;i++)n.push(new mg(r[i],!1));if(Sg.numMultiPolys=n.length,"difference"===Sg.type)for(var s=n[0],a=1;a<n.length;)null!==tg(n[a].bbox,s.bbox)?a++:n.splice(a,1);if("intersection"===Sg.type)for(var u=0,l=n.length;u<l;u++)for(var h=n[u],c=u+1,f=n.length;c<f;c++)if(null===tg(h.bbox,n[c].bbox))return[];for(var p=new qd(dg.compare),d=0,g=n.length;d<g;d++)for(var A=n[d].getSweepEvents(),y=0,v=A.length;y<v;y++)if(p.insert(A[y]),p.size>wg)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var m=new xg(p),_=p.size,I=p.pop();I;){var E=I.key;if(p.size===_){var x=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(p.size>wg)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(m.segments.length>Cg)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var w=m.process(E),C=0,b=w.length;C<b;C++){var S=w[C];void 0===S.consumedBy&&p.insert(S)}_=p.size,I=p.pop()}sg.reset();var B=_g.factory(m.segments);return new Eg(B).getGeom()}}]),t}(),Sg=new bg,Bg={union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Sg.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Sg.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Sg.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Sg.run("difference",t,r)}};"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),r=Math.max(Math.min(e.length,9007199254740991),0)||0,n=1 in arguments&&parseInt(Number(arguments[1]),10)||0;n=n<0?Math.max(r+n,0):Math.min(n,r);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:r;for(i=i<0?Math.max(r+arguments[2],0):Math.min(i,r);n<i;)e[n]=t,++n;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var Mg=function(){};Mg.prototype.interfaces_=function(){return[]},Mg.prototype.getClass=function(){return Mg},Mg.prototype.equalsWithTolerance=function(t,e,r){return Math.abs(t-e)<=r};var Tg=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Lg=function(){},Rg={MAX_VALUE:{configurable:!0}};Lg.isNaN=function(t){return Number.isNaN(t)},Lg.doubleToLongBits=function(t){return t},Lg.longBitsToDouble=function(t){return t},Lg.isInfinite=function(t){return!Number.isFinite(t)},Rg.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(Lg,Rg);var Ng=function(){},Pg=function(){},Dg=function(){};function kg(){}var Fg=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},Qg={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};Fg.prototype.setOrdinate=function(t,e){switch(t){case Fg.X:this.x=e;break;case Fg.Y:this.y=e;break;case Fg.Z:this.z=e;break;default:throw new Tg("Invalid ordinate index: "+t)}},Fg.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!Mg.equalsWithTolerance(this.x,e.x,r)&&!!Mg.equalsWithTolerance(this.y,e.y,r)}},Fg.prototype.getOrdinate=function(t){switch(t){case Fg.X:return this.x;case Fg.Y:return this.y;case Fg.Z:return this.z}throw new Tg("Invalid ordinate index: "+t)},Fg.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||Lg.isNaN(this.z))&&Lg.isNaN(t.z)},Fg.prototype.equals=function(t){return t instanceof Fg&&this.equals2D(t)},Fg.prototype.equalInZ=function(t,e){return Mg.equalsWithTolerance(this.z,t.z,e)},Fg.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},Fg.prototype.clone=function(){},Fg.prototype.copy=function(){return new Fg(this)},Fg.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},Fg.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},Fg.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},Fg.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+Fg.hashCode(this.x))+Fg.hashCode(this.y)},Fg.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},Fg.prototype.interfaces_=function(){return[Ng,Pg,kg]},Fg.prototype.getClass=function(){return Fg},Fg.hashCode=function(){if(1===arguments.length){var t=Lg.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},Qg.DimensionalComparator.get=function(){return Og},Qg.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},Qg.NULL_ORDINATE.get=function(){return Lg.NaN},Qg.X.get=function(){return 0},Qg.Y.get=function(){return 1},Qg.Z.get=function(){return 2},Object.defineProperties(Fg,Qg);var Og=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new Tg("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};Og.prototype.compare=function(t,e){var r=t,n=e,i=Og.compare(r.x,n.x);if(0!==i)return i;var o=Og.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:Og.compare(r.z,n.z)},Og.prototype.interfaces_=function(){return[Dg]},Og.prototype.getClass=function(){return Og},Og.compare=function(t,e){return t<e?-1:t>e?1:Lg.isNaN(t)?Lg.isNaN(e)?0:-1:Lg.isNaN(e)?1:0};var Ug=function(){};Ug.prototype.create=function(){},Ug.prototype.interfaces_=function(){return[]},Ug.prototype.getClass=function(){return Ug};var Gg=function(){},zg={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Gg.prototype.interfaces_=function(){return[]},Gg.prototype.getClass=function(){return Gg},Gg.toLocationSymbol=function(t){switch(t){case Gg.EXTERIOR:return"e";case Gg.BOUNDARY:return"b";case Gg.INTERIOR:return"i";case Gg.NONE:return"-"}throw new Tg("Unknown location value: "+t)},zg.INTERIOR.get=function(){return 0},zg.BOUNDARY.get=function(){return 1},zg.EXTERIOR.get=function(){return 2},zg.NONE.get=function(){return-1},Object.defineProperties(Gg,zg);var jg=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Vg=function(){},Hg={LOG_10:{configurable:!0}};Vg.prototype.interfaces_=function(){return[]},Vg.prototype.getClass=function(){return Vg},Vg.log10=function(t){var e=Math.log(t);return Lg.isInfinite(e)||Lg.isNaN(e)?e:e/Vg.LOG_10},Vg.min=function(t,e,r,n){var i=t;return e<i&&(i=e),r<i&&(i=r),n<i&&(i=n),i},Vg.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],r=arguments[2];return t<e?e:t>r?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return n<i?i:n>o?o:n}},Vg.wrap=function(t,e){return t<0?e- -t%e:t%e},Vg.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return n>s&&(s=n),i>s&&(s=i),o>s&&(s=o),s}},Vg.average=function(t,e){return(t+e)/2},Hg.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(Vg,Hg);var qg=function(t){this.str=t};qg.prototype.append=function(t){this.str+=t},qg.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},qg.prototype.toString=function(t){return this.str};var Yg=function(t){this.value=t};Yg.prototype.intValue=function(){return this.value},Yg.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},Yg.isNaN=function(t){return Number.isNaN(t)};var Xg=function(){};Xg.isWhitespace=function(t){return t<=32&&t>=0||127===t},Xg.toUpperCase=function(t){return t.toUpperCase()};var Wg=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else if("string"==typeof arguments[0]){t.call(this,t.parse(arguments[0]))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},Jg={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};Wg.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},Wg.prototype.extractSignificantDigits=function(t,e){var r=this.abs(),n=Wg.magnitude(r._hi),i=Wg.TEN.pow(n);(r=r.divide(i)).gt(Wg.TEN)?(r=r.divide(Wg.TEN),n+=1):r.lt(Wg.ONE)&&(r=r.multiply(Wg.TEN),n-=1);for(var o=n+1,s=new qg,a=Wg.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(r._hi);if(l<0)break;var h=!1,c=0;l>9?(h=!0,c="9"):c="0"+l,s.append(c),r=r.subtract(Wg.valueOf(l)).multiply(Wg.TEN),h&&r.selfAdd(Wg.TEN);var f=!0,p=Wg.magnitude(r._hi);if(p<0&&Math.abs(p)>=a-u&&(f=!1),!f)break}return e[0]=n,s.toString()},Wg.prototype.sqr=function(){return this.multiply(this)},Wg.prototype.doubleValue=function(){return this._hi+this._lo},Wg.prototype.subtract=function(){if(arguments[0]instanceof Wg){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},Wg.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},Wg.prototype.isZero=function(){return 0===this._hi&&0===this._lo},Wg.prototype.selfSubtract=function(){if(arguments[0]instanceof Wg){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},Wg.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},Wg.prototype.min=function(t){return this.le(t)?this:t},Wg.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof Wg){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var r,n,i,o,s=arguments[0],a=arguments[1],u=null,l=null,h=null,c=null;return i=this._hi/s,c=(u=(h=Wg.SPLIT*i)-(u=h-i))*(l=(c=Wg.SPLIT*s)-(l=c-s))-(o=i*s)+u*(n=s-l)+(r=i-u)*l+r*n,c=i+(h=(this._hi-o-c+this._lo-i*a)/s),this._hi=c,this._lo=i-c+h,this}},Wg.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},Wg.prototype.divide=function(){if(arguments[0]instanceof Wg){var t,e,r,n,i=arguments[0],o=null,s=null,a=null,u=null;return t=(r=this._hi/i._hi)-(o=(a=Wg.SPLIT*r)-(o=a-r)),u=o*(s=(u=Wg.SPLIT*i._hi)-(s=u-i._hi))-(n=r*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-n-u+this._lo-r*i._lo)/i._hi,new Wg(u=r+a,r-u+a)}if("number"==typeof arguments[0]){var l=arguments[0];return Lg.isNaN(l)?Wg.createNaN():Wg.copy(this).selfDivide(l,0)}},Wg.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},Wg.prototype.pow=function(t){if(0===t)return Wg.valueOf(1);var e=new Wg(this),r=Wg.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},Wg.prototype.ceil=function(){if(this.isNaN())return Wg.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new Wg(t,e)},Wg.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},Wg.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},Wg.prototype.setValue=function(){if(arguments[0]instanceof Wg){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},Wg.prototype.max=function(t){return this.ge(t)?this:t},Wg.prototype.sqrt=function(){if(this.isZero())return Wg.valueOf(0);if(this.isNegative())return Wg.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=Wg.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},Wg.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof Wg){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,s=arguments[0],a=null;return a=(n=this._hi+s)-(i=n-this._hi),r=(o=(a=s-i+(this._hi-a))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var u,l,h,c,f=arguments[0],p=arguments[1],d=null,g=null,A=null;h=this._hi+f,l=this._lo+p,g=h-(A=h-this._hi),d=l-(c=l-this._lo);var y=(u=h+(A=(g=f-A+(this._hi-g))+l))+(A=(d=p-c+(this._lo-d))+(A+(h-u))),v=A+(u-y);return this._hi=y,this._lo=v,this}},Wg.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof Wg){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var r,n,i=arguments[0],o=arguments[1],s=null,a=null,u=null,l=null;s=(u=Wg.SPLIT*this._hi)-this._hi,l=Wg.SPLIT*i,s=u-s,r=this._hi-s,a=l-i;var h=(u=this._hi*i)+(l=s*(a=l-a)-u+s*(n=i-a)+r*a+r*n+(this._hi*o+this._lo*i)),c=l+(s=u-h);return this._hi=h,this._lo=c,this}},Wg.prototype.selfSqr=function(){return this.selfMultiply(this)},Wg.prototype.floor=function(){if(this.isNaN())return Wg.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new Wg(t,e)},Wg.prototype.negate=function(){return this.isNaN()?this:new Wg(-this._hi,-this._lo)},Wg.prototype.clone=function(){},Wg.prototype.multiply=function(){if(arguments[0]instanceof Wg){var t=arguments[0];return t.isNaN()?Wg.createNaN():Wg.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Lg.isNaN(e)?Wg.createNaN():Wg.copy(this).selfMultiply(e,0)}},Wg.prototype.isNaN=function(){return Lg.isNaN(this._hi)},Wg.prototype.intValue=function(){return Math.trunc(this._hi)},Wg.prototype.toString=function(){var t=Wg.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},Wg.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+Wg.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+Wg.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},Wg.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,s=null,a=null;t=(r=1/this._hi)-(i=(s=Wg.SPLIT*r)-(i=s-r)),o=(a=Wg.SPLIT*this._hi)-this._hi;var u=r+(s=(1-(n=r*this._hi)-(a=i*(o=a-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new Wg(u,r-u+s)},Wg.prototype.toSciNotation=function(){if(this.isZero())return Wg.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=Wg.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},Wg.prototype.abs=function(){return this.isNaN()?Wg.NaN:this.isNegative()?this.negate():new Wg(this)},Wg.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},Wg.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},Wg.prototype.add=function(){if(arguments[0]instanceof Wg){var t=arguments[0];return Wg.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Wg.copy(this).selfAdd(e)}},Wg.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof Wg){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._hi=r,this._lo=n}},Wg.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},Wg.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},Wg.prototype.trunc=function(){return this.isNaN()?Wg.NaN:this.isPositive()?this.floor():this.ceil()},Wg.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},Wg.prototype.interfaces_=function(){return[kg,Ng,Pg]},Wg.prototype.getClass=function(){return Wg},Wg.sqr=function(t){return Wg.valueOf(t).selfMultiply(t)},Wg.valueOf=function(){return"string"==typeof arguments[0]?Wg.parse(arguments[0]):"number"==typeof arguments[0]?new Wg(arguments[0]):void 0},Wg.sqrt=function(t){return Wg.valueOf(t).sqrt()},Wg.parse=function(t){for(var e=0,r=t.length;Xg.isWhitespace(t.charAt(e));)e++;var n=!1;if(e<r){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(n=!0))}for(var o=new Wg,s=0,a=0,u=0;!(e>=r);){var l=t.charAt(e);if(e++,Xg.isDigit(l)){var h=l-"0";o.selfMultiply(Wg.TEN),o.selfAdd(h),s++}else{if("."!==l){if("e"===l||"E"===l){var c=t.substring(e);try{u=Yg.parseInt(c)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+c+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var f=o,p=s-a-u;if(0===p)f=o;else if(p>0){var d=Wg.TEN.pow(p);f=o.divide(d)}else if(p<0){var g=Wg.TEN.pow(-p);f=o.multiply(g)}return n?f.negate():f},Wg.createNaN=function(){return new Wg(Lg.NaN,Lg.NaN)},Wg.copy=function(t){return new Wg(t)},Wg.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},Wg.stringOfChar=function(t,e){for(var r=new qg,n=0;n<e;n++)r.append(t);return r.toString()},Jg.PI.get=function(){return new Wg(3.141592653589793,12246467991473532e-32)},Jg.TWO_PI.get=function(){return new Wg(6.283185307179586,24492935982947064e-32)},Jg.PI_2.get=function(){return new Wg(1.5707963267948966,6123233995736766e-32)},Jg.E.get=function(){return new Wg(2.718281828459045,14456468917292502e-32)},Jg.NaN.get=function(){return new Wg(Lg.NaN,Lg.NaN)},Jg.EPS.get=function(){return 123259516440783e-46},Jg.SPLIT.get=function(){return 134217729},Jg.MAX_PRINT_DIGITS.get=function(){return 32},Jg.TEN.get=function(){return Wg.valueOf(10)},Jg.ONE.get=function(){return Wg.valueOf(1)},Jg.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Jg.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(Wg,Jg);var Kg=function(){},Zg={DP_SAFE_EPSILON:{configurable:!0}};Kg.prototype.interfaces_=function(){return[]},Kg.prototype.getClass=function(){return Kg},Kg.orientationIndex=function(t,e,r){var n=Kg.orientationIndexFilter(t,e,r);if(n<=1)return n;var i=Wg.valueOf(e.x).selfAdd(-t.x),o=Wg.valueOf(e.y).selfAdd(-t.y),s=Wg.valueOf(r.x).selfAdd(-e.x),a=Wg.valueOf(r.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},Kg.signOfDet2x2=function(t,e,r,n){return t.multiply(n).selfSubtract(e.multiply(r)).signum()},Kg.intersection=function(t,e,r,n){var i=Wg.valueOf(n.y).selfSubtract(r.y).selfMultiply(Wg.valueOf(e.x).selfSubtract(t.x)),o=Wg.valueOf(n.x).selfSubtract(r.x).selfMultiply(Wg.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=Wg.valueOf(n.x).selfSubtract(r.x).selfMultiply(Wg.valueOf(t.y).selfSubtract(r.y)),u=Wg.valueOf(n.y).selfSubtract(r.y).selfMultiply(Wg.valueOf(t.x).selfSubtract(r.x)),l=a.subtract(u).selfDivide(s).doubleValue(),h=Wg.valueOf(t.x).selfAdd(Wg.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),c=Wg.valueOf(e.x).selfSubtract(t.x).selfMultiply(Wg.valueOf(t.y).selfSubtract(r.y)),f=Wg.valueOf(e.y).selfSubtract(t.y).selfMultiply(Wg.valueOf(t.x).selfSubtract(r.x)),p=c.subtract(f).selfDivide(s).doubleValue(),d=Wg.valueOf(r.y).selfAdd(Wg.valueOf(n.y).selfSubtract(r.y).selfMultiply(p)).doubleValue();return new Fg(h,d)},Kg.orientationIndexFilter=function(t,e,r){var n=null,i=(t.x-r.x)*(e.y-r.y),o=(t.y-r.y)*(e.x-r.x),s=i-o;if(i>0){if(o<=0)return Kg.signum(s);n=i+o}else{if(!(i<0))return Kg.signum(s);if(o>=0)return Kg.signum(s);n=-i-o}var a=Kg.DP_SAFE_EPSILON*n;return s>=a||-s>=a?Kg.signum(s):2},Kg.signum=function(t){return t>0?1:t<0?-1:0},Zg.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Kg,Zg);var $g=function(){},tA={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};tA.X.get=function(){return 0},tA.Y.get=function(){return 1},tA.Z.get=function(){return 2},tA.M.get=function(){return 3},$g.prototype.setOrdinate=function(t,e,r){},$g.prototype.size=function(){},$g.prototype.getOrdinate=function(t,e){},$g.prototype.getCoordinate=function(){},$g.prototype.getCoordinateCopy=function(t){},$g.prototype.getDimension=function(){},$g.prototype.getX=function(t){},$g.prototype.clone=function(){},$g.prototype.expandEnvelope=function(t){},$g.prototype.copy=function(){},$g.prototype.getY=function(t){},$g.prototype.toCoordinateArray=function(){},$g.prototype.interfaces_=function(){return[Pg]},$g.prototype.getClass=function(){return $g},Object.defineProperties($g,tA);var eA=function(){},rA=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(eA),nA=function(){};nA.arraycopy=function(t,e,r,n,i){for(var o=0,s=e;s<e+i;s++)r[n+o]=t[s],o++},nA.getProperty=function(t){return{"line.separator":"\n"}[t]};var iA=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this.x=r,this.y=n,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof Fg&&arguments[1]instanceof Fg){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var u=arguments[0],l=arguments[1],h=arguments[2];this.x=u,this.y=l,this.w=h}else if(4===arguments.length){var c=arguments[0],f=arguments[1],p=arguments[2],d=arguments[3],g=c.y-f.y,A=f.x-c.x,y=c.x*f.y-f.x*c.y,v=p.y-d.y,m=d.x-p.x,_=p.x*d.y-d.x*p.y;this.x=A*_-m*y,this.y=v*y-g*_,this.w=g*m-v*A}};iA.prototype.getY=function(){var t=this.y/this.w;if(Lg.isNaN(t)||Lg.isInfinite(t))throw new rA;return t},iA.prototype.getX=function(){var t=this.x/this.w;if(Lg.isNaN(t)||Lg.isInfinite(t))throw new rA;return t},iA.prototype.getCoordinate=function(){var t=new Fg;return t.x=this.getX(),t.y=this.getY(),t},iA.prototype.interfaces_=function(){return[]},iA.prototype.getClass=function(){return iA},iA.intersection=function(t,e,r,n){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=r.y-n.y,u=n.x-r.x,l=r.x*n.y-n.x*r.y,h=i*u-a*o,c=(o*l-u*s)/h,f=(a*s-i*l)/h;if(Lg.isNaN(c)||Lg.isInfinite(c)||Lg.isNaN(f)||Lg.isInfinite(f))throw new rA;return new Fg(c,f)};var oA=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof Fg){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},sA={serialVersionUID:{configurable:!0}};oA.prototype.getArea=function(){return this.getWidth()*this.getHeight()},oA.prototype.equals=function(t){if(!(t instanceof oA))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},oA.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new oA;var e=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new oA(e,n,r,i)},oA.prototype.isNull=function(){return this._maxx<this._minx},oA.prototype.getMaxX=function(){return this._maxx},oA.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof Fg){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof oA){var e=arguments[0];return!this.isNull()&&!e.isNull()&&(e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&(r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy)}},oA.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof oA){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof Fg){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||n>this._maxy||n<this._miny)}},oA.prototype.getMinY=function(){return this._miny},oA.prototype.getMinX=function(){return this._minx},oA.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof Fg){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof oA){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(r<this._minx&&(this._minx=r),r>this._maxx&&(this._maxx=r),n<this._miny&&(this._miny=n),n>this._maxy&&(this._maxy=n))}},oA.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},oA.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},oA.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},oA.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},oA.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},oA.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},oA.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},oA.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},oA.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},oA.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof oA){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof Fg){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},oA.prototype.centre=function(){return this.isNull()?null:new Fg((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},oA.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof Fg){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof oA){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},oA.prototype.getMaxY=function(){return this._maxy},oA.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var r=0;return this._maxy<t._miny?r=t._miny-this._maxy:this._miny>t._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},oA.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+Fg.hashCode(this._minx))+Fg.hashCode(this._maxx))+Fg.hashCode(this._miny))+Fg.hashCode(this._maxy)},oA.prototype.interfaces_=function(){return[Ng,kg]},oA.prototype.getClass=function(){return oA},oA.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.x<e.x?t.x:e.x)&&r.x<=(t.x>e.x?t.x:e.x)&&r.y>=(t.y<e.y?t.y:e.y)&&r.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(n.x,i.x),h=Math.max(n.x,i.x);return!(l>u)&&(!(h<a)&&(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(n.y,i.y),h=Math.max(n.y,i.y),!(l>u)&&!(h<a)))}},sA.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(oA,sA);var aA={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},uA=function(t){this.geometryFactory=t||new Yy};uA.prototype.read=function(t){var e,r,n;t=t.replace(/[\n\r]/g," ");var i=aA.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=aA.emptyTypeStr.exec(t))[2]=void 0),i&&(r=i[1].toLowerCase(),n=i[2],hA[r]&&(e=hA[r].apply(this,[n]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},uA.prototype.write=function(t){return this.extractGeometry(t)},uA.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!lA[e])return null;var r=e.toUpperCase();return t.isEmpty()?r+" EMPTY":r+"("+lA[e].apply(this,[t])+")"};var lA={coordinate:function(t){return t.x+" "+t.y},point:function(t){return lA.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+lA.point.apply(this,[t._geometries[r]])+")");return e.join(",")},linestring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(lA.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},linearring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(lA.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},multilinestring:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+lA.linestring.apply(this,[t._geometries[r]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+lA.linestring.apply(this,[t._shell])+")");for(var r=0,n=t._holes.length;r<n;++r)e.push("("+lA.linestring.apply(this,[t._holes[r]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+lA.polygon.apply(this,[t._geometries[r]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push(this.extractGeometry(t._geometries[r]));return e.join(",")}},hA={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(aA.spaces);return this.geometryFactory.createPoint(new Fg(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(aA.trimParens,"$1"),n.push(hA.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(n)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(aA.spaces),n.push(new Fg(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(aA.spaces),n.push(new Fg(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var r=t.trim().split(aA.parenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(aA.trimParens,"$1"),n.push(hA.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(n)},polygon:function(t){var e,r,n;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(aA.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(aA.trimParens,"$1"),r=hA.linestring.apply(this,[e]),n=this.geometryFactory.createLinearRing(r._points),0===a?i=n:s.push(n);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var r=t.trim().split(aA.doubleParenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(aA.trimParens,"$1"),n.push(hA.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(n)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),r=[],n=0,i=e.length;n<i;++n)r.push(this.read(e[n]));return this.geometryFactory.createGeometryCollection(r)}},cA=function(t){this.parser=new uA(t)};cA.prototype.write=function(t){return this.parser.write(t)},cA.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var fA=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),pA=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){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.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fA),dA=function(){};dA.prototype.interfaces_=function(){return[]},dA.prototype.getClass=function(){return dA},dA.shouldNeverReachHere=function(){if(0===arguments.length)dA.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new pA("Should never reach here"+(null!==t?": "+t:""))}},dA.isTrue=function(){var t;if(1===arguments.length)dA.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new pA:new pA(t)},dA.equals=function(){var t,e,r;if(2===arguments.length)dA.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],r=arguments[2],!(e=arguments[1]).equals(t)))throw new pA("Expected "+t+" but encountered "+e+(null!==r?": "+r:""))};var gA=function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new Fg,this._intPt[1]=new Fg,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},AA={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};gA.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},gA.prototype.getTopologySummary=function(){var t=new qg;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},gA.prototype.computeIntersection=function(t,e,r,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=r,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,r,n)},gA.prototype.getIntersectionNum=function(){return this._result},gA.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},gA.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},gA.prototype.setPrecisionModel=function(t){this._precisionModel=t},gA.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;r<this._result;r++)if(!t._intPt[r].equals2D(t._inputLines[e][0])&&!t._intPt[r].equals2D(t._inputLines[e][1]))return!0;return!1}},gA.prototype.getIntersection=function(t){return this._intPt[t]},gA.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},gA.prototype.hasIntersection=function(){return this._result!==gA.NO_INTERSECTION},gA.prototype.getEdgeDistance=function(t,e){return gA.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},gA.prototype.isCollinear=function(){return this._result===gA.COLLINEAR_INTERSECTION},gA.prototype.toString=function(){return cA.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+cA.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},gA.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},gA.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},gA.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},gA.prototype.interfaces_=function(){return[]},gA.prototype.getClass=function(){return gA},gA.computeEdgeDistance=function(t,e,r){var n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(r))o=n>i?n:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=n>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return dA.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},gA.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return dA.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},AA.DONT_INTERSECT.get=function(){return 0},AA.DO_INTERSECT.get=function(){return 1},AA.COLLINEAR.get=function(){return 2},AA.NO_INTERSECTION.get=function(){return 0},AA.POINT_INTERSECTION.get=function(){return 1},AA.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(gA,AA);var yA=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.isInSegmentEnvelopes=function(t){var e=new oA(this._inputLines[0][0],this._inputLines[0][1]),r=new oA(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,oA.intersects(r,n,e)&&0===_A.orientationIndex(r,n,e)&&0===_A.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=iA.intersection(t,r,n,i)}catch(s){if(!(s instanceof rA))throw s;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new Fg(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(r)<o&&(i=r,o=Math.abs(r)),Math.abs(n)<o&&(i=n),i},e.prototype.checkDD=function(t,e,r,n,i){var o=Kg.intersection(t,e,r,n),s=this.isInSegmentEnvelopes(o);nA.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&nA.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new Fg(t),o=new Fg(e),s=new Fg(r),a=new Fg(n),u=new Fg;this.normalizeToEnvCentre(i,o,s,a,u);var l=this.safeHCoordinateIntersection(i,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=oA.intersects(e,r,n),s=oA.intersects(e,r,i),a=oA.intersects(n,i,e),u=oA.intersects(n,i,r);return o&&s?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=r.x<n.x?r.x:n.x,h=r.y<n.y?r.y:n.y,c=r.x>n.x?r.x:n.x,f=r.y>n.y?r.y:n.y,p=((o>l?o:l)+(a<c?a:c))/2,d=((s>h?s:h)+(u<f?u:f))/2;i.x=p,i.y=d,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.computeIntersect=function(e,r,n,i){if(this._isProper=!1,!oA.intersects(e,r,n,i))return t.NO_INTERSECTION;var o=_A.orientationIndex(e,r,n),s=_A.orientationIndex(e,r,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=_A.orientationIndex(n,i,e),u=_A.orientationIndex(n,i,r);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,r,n,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new Fg(n):0===s?this._intPt[0]=new Fg(i):0===a?this._intPt[0]=new Fg(e):0===u&&(this._intPt[0]=new Fg(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=_A.distancePointLine(t,r,n),s=_A.distancePointLine(e,r,n);return s<o&&(o=s,i=e),(s=_A.distancePointLine(r,t,e))<o&&(o=s,i=r),(s=_A.distancePointLine(n,t,e))<o&&(o=s,i=n),i},e}(gA),vA=function(){};vA.prototype.interfaces_=function(){return[]},vA.prototype.getClass=function(){return vA},vA.orientationIndex=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,s=r.y-e.y;return vA.signOfDet2x2(n,i,o,s)},vA.signOfDet2x2=function(t,e,r,n){var i=null,o=null,s=null;if(i=1,0===t||0===n)return 0===e||0===r?0:e>0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(s=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=s*t)+r){if(e<n+n)return i}else{if(e>n+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(s=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=s*r)+t){if(n<e+e)return-i}else{if(n>e+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var mA=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};mA.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var r=t.x,n=e.x;return r>n&&(r=e.x,n=t.x),this._p.x>=r&&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 i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=vA.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},mA.prototype.isPointInPolygon=function(){return this.getLocation()!==Gg.EXTERIOR},mA.prototype.getLocation=function(){return this._isPointOnSegment?Gg.BOUNDARY:this._crossingCount%2==1?Gg.INTERIOR:Gg.EXTERIOR},mA.prototype.isOnSegment=function(){return this._isPointOnSegment},mA.prototype.interfaces_=function(){return[]},mA.prototype.getClass=function(){return mA},mA.locatePointInRing=function(){if(arguments[0]instanceof Fg&&jg(arguments[1],$g)){for(var t=arguments[1],e=new mA(arguments[0]),r=new Fg,n=new Fg,i=1;i<t.size();i++)if(t.getCoordinate(i,r),t.getCoordinate(i-1,n),e.countSegment(r,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof Fg&&arguments[1]instanceof Array){for(var o=arguments[1],s=new mA(arguments[0]),a=1;a<o.length;a++){var u=o[a],l=o[a-1];if(s.countSegment(u,l),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var _A=function(){},IA={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};_A.prototype.interfaces_=function(){return[]},_A.prototype.getClass=function(){return _A},_A.orientationIndex=function(t,e,r){return Kg.orientationIndex(t,e,r)},_A.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,r=t[0].x,n=1;n<t.length-1;n++){var i=t[n].x-r,o=t[n+1].y;e+=i*(t[n-1].y-o)}return e/2}if(jg(arguments[0],$g)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new Fg,l=new Fg,h=new Fg;s.getCoordinate(0,l),s.getCoordinate(1,h);var c=l.x;h.x-=c;for(var f=0,p=1;p<a-1;p++)u.y=l.y,l.x=h.x,l.y=h.y,s.getCoordinate(p+1,h),h.x-=c,f+=l.x*(u.y-h.y);return f/2}},_A.distanceLineLine=function(t,e,r,n){if(t.equals(e))return _A.distancePointLine(t,r,n);if(r.equals(n))return _A.distancePointLine(n,t,e);var i=!1;if(oA.intersects(t,e,r,n)){var o=(e.x-t.x)*(n.y-r.y)-(e.y-t.y)*(n.x-r.x);if(0===o)i=!0;else{var s=(t.y-r.y)*(n.x-r.x)-(t.x-r.x)*(n.y-r.y),a=((t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?Vg.min(_A.distancePointLine(t,r,n),_A.distancePointLine(e,r,n),_A.distancePointLine(r,t,e),_A.distancePointLine(n,t,e)):0},_A.isPointInRing=function(t,e){return _A.locatePointInRing(t,e)!==Gg.EXTERIOR},_A.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new Fg;t.getCoordinate(0,n);for(var i=n.x,o=n.y,s=1;s<e;s++){t.getCoordinate(s,n);var a=n.x,u=n.y,l=a-i,h=u-o;r+=Math.sqrt(l*l+h*h),i=a,o=u}return r},_A.isCCW=function(t){var e=t.length-1;if(e<3)throw new Tg("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],n=0,i=1;i<=e;i++){var o=t[i];o.y>r.y&&(r=o,n=i)}var s=n;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(r)&&s!==n);var a=n;do{a=(a+1)%e}while(t[a].equals2D(r)&&a!==n);var u=t[s],l=t[a];if(u.equals2D(r)||l.equals2D(r)||u.equals2D(l))return!1;var h=_A.computeOrientation(u,r,l),c=!1;return c=0===h?u.x>l.x:h>0,c},_A.locatePointInRing=function(t,e){return mA.locatePointInRing(t,e)},_A.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},_A.computeOrientation=function(t,e,r){return _A.orientationIndex(t,e,r)},_A.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new Tg("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n<e.length-1;n++){var i=_A.distancePointLine(t,e[n],e[n+1]);i<r&&(r=i)}return r}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(l>=1)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(h)*Math.sqrt(u)}},_A.isOnLine=function(t,e){for(var r=new yA,n=1;n<e.length;n++){var i=e[n-1],o=e[n];if(r.computeIntersection(t,i,o),r.hasIntersection())return!0}return!1},IA.CLOCKWISE.get=function(){return-1},IA.RIGHT.get=function(){return _A.CLOCKWISE},IA.COUNTERCLOCKWISE.get=function(){return 1},IA.LEFT.get=function(){return _A.COUNTERCLOCKWISE},IA.COLLINEAR.get=function(){return 0},IA.STRAIGHT.get=function(){return _A.COLLINEAR},Object.defineProperties(_A,IA);var EA=function(){};EA.prototype.filter=function(t){},EA.prototype.interfaces_=function(){return[]},EA.prototype.getClass=function(){return EA};var xA=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},wA={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};xA.prototype.isGeometryCollection=function(){return this.getSortIndex()===xA.SORTINDEX_GEOMETRYCOLLECTION},xA.prototype.getFactory=function(){return this._factory},xA.prototype.getGeometryN=function(t){return this},xA.prototype.getArea=function(){return 0},xA.prototype.isRectangle=function(){return!1},xA.prototype.equals=function(){if(arguments[0]instanceof xA){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof xA))return!1;var r=e;return this.equalsExact(r)}},xA.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},xA.prototype.geometryChanged=function(){this.apply(xA.geometryChangedFilter)},xA.prototype.geometryChangedAction=function(){this._envelope=null},xA.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},xA.prototype.getLength=function(){return 0},xA.prototype.getNumGeometries=function(){return 1},xA.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.getSortIndex()!==r.getSortIndex()?this.getSortIndex()-r.getSortIndex():this.isEmpty()&&r.isEmpty()?0:this.isEmpty()?-1:r.isEmpty()?1:this.compareToSameClass(r,n)}},xA.prototype.getUserData=function(){return this._userData},xA.prototype.getSRID=function(){return this._SRID},xA.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},xA.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===xA.SORTINDEX_GEOMETRYCOLLECTION)throw new Tg("This method does not support GeometryCollection arguments")},xA.prototype.equal=function(t,e,r){return 0===r?t.equals(e):t.distance(e)<=r},xA.prototype.norm=function(){var t=this.copy();return t.normalize(),t},xA.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},xA.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new oA(this._envelope)},xA.prototype.setSRID=function(t){this._SRID=t},xA.prototype.setUserData=function(t){this._userData=t},xA.prototype.compare=function(t,e){for(var r=t.iterator(),n=e.iterator();r.hasNext()&&n.hasNext();){var i=r.next(),o=n.next(),s=i.compareTo(o);if(0!==s)return s}return r.hasNext()?1:n.hasNext()?-1:0},xA.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},xA.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===xA.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===xA.SORTINDEX_MULTIPOINT||this.getSortIndex()===xA.SORTINDEX_MULTILINESTRING||this.getSortIndex()===xA.SORTINDEX_MULTIPOLYGON},xA.prototype.interfaces_=function(){return[Pg,Ng,kg]},xA.prototype.getClass=function(){return xA},xA.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},xA.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},wA.serialVersionUID.get=function(){return 0x799ea46522854c00},wA.SORTINDEX_POINT.get=function(){return 0},wA.SORTINDEX_MULTIPOINT.get=function(){return 1},wA.SORTINDEX_LINESTRING.get=function(){return 2},wA.SORTINDEX_LINEARRING.get=function(){return 3},wA.SORTINDEX_MULTILINESTRING.get=function(){return 4},wA.SORTINDEX_POLYGON.get=function(){return 5},wA.SORTINDEX_MULTIPOLYGON.get=function(){return 6},wA.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},wA.geometryChangedFilter.get=function(){return CA},Object.defineProperties(xA,wA);var CA=function(){};CA.interfaces_=function(){return[EA]},CA.filter=function(t){t.geometryChangedAction()};var bA=function(){};bA.prototype.filter=function(t){},bA.prototype.interfaces_=function(){return[]},bA.prototype.getClass=function(){return bA};var SA=function(){},BA={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};SA.prototype.isInBoundary=function(t){},SA.prototype.interfaces_=function(){return[]},SA.prototype.getClass=function(){return SA},BA.Mod2BoundaryNodeRule.get=function(){return MA},BA.EndPointBoundaryNodeRule.get=function(){return TA},BA.MultiValentEndPointBoundaryNodeRule.get=function(){return LA},BA.MonoValentEndPointBoundaryNodeRule.get=function(){return RA},BA.MOD2_BOUNDARY_RULE.get=function(){return new MA},BA.ENDPOINT_BOUNDARY_RULE.get=function(){return new TA},BA.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new LA},BA.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new RA},BA.OGC_SFS_BOUNDARY_RULE.get=function(){return SA.MOD2_BOUNDARY_RULE},Object.defineProperties(SA,BA);var MA=function(){};MA.prototype.isInBoundary=function(t){return t%2==1},MA.prototype.interfaces_=function(){return[SA]},MA.prototype.getClass=function(){return MA};var TA=function(){};TA.prototype.isInBoundary=function(t){return t>0},TA.prototype.interfaces_=function(){return[SA]},TA.prototype.getClass=function(){return TA};var LA=function(){};LA.prototype.isInBoundary=function(t){return t>1},LA.prototype.interfaces_=function(){return[SA]},LA.prototype.getClass=function(){return LA};var RA=function(){};RA.prototype.isInBoundary=function(t){return 1===t},RA.prototype.interfaces_=function(){return[SA]},RA.prototype.getClass=function(){return RA};var NA=function(){};function PA(t){this.message=t||""}NA.prototype.add=function(){},NA.prototype.addAll=function(){},NA.prototype.isEmpty=function(){},NA.prototype.iterator=function(){},NA.prototype.size=function(){},NA.prototype.toArray=function(){},NA.prototype.remove=function(){},PA.prototype=new Error,PA.prototype.name="IndexOutOfBoundsException";var DA=function(){};DA.prototype.hasNext=function(){},DA.prototype.next=function(){},DA.prototype.remove=function(){};var kA=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}(NA);function FA(t){this.message=t||""}FA.prototype=new Error,FA.prototype.name="NoSuchElementException";var QA=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof NA&&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,NA]},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 r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new OA(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new PA;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,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,r=0,n=this.array_.length;r<n;r++)if(this.array_[r]===t){this.array_.splice(r,1),e=!0;break}return e},e}(kA),OA=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new FA;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(DA),UA=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.ensureCapacity(r.length),this.add(r,n)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={coordArrayType:{configurable:!0}};return r.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],r=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),e),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=0;r<this.size();r++)e.add(r,this.get(r).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var r=arguments[0];t.prototype.add.call(this,r)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof Fg&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1])if(this.size()>=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 u=arguments[0],l=arguments[1];if(arguments[2])for(var h=0;h<u.length;h++)e.add(u[h],l);else for(var c=u.length-1;c>=0;c--)e.add(u[c],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof Fg){var f=arguments[0],p=arguments[1];if(!arguments[2]){var d=this.size();if(d>0){if(f>0)if(this.get(f-1).equals2D(p))return null;if(f<d)if(this.get(f).equals2D(p))return null}}t.prototype.add.call(this,f,p)}}else if(4===arguments.length){var g=arguments[0],A=arguments[1],y=arguments[2],v=arguments[3],m=1;y>v&&(m=-1);for(var _=y;_!==v;_+=m)e.add(g[_],A);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Fg(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(QA),GA=function(){},zA={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};zA.ForwardComparator.get=function(){return jA},zA.BidirectionalComparator.get=function(){return VA},zA.coordArrayType.get=function(){return new Array(0).fill(null)},GA.prototype.interfaces_=function(){return[]},GA.prototype.getClass=function(){return GA},GA.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},GA.ptNotInList=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(GA.indexOf(n,e)<0)return n}return null},GA.scroll=function(t,e){var r=GA.indexOf(e,t);if(r<0)return null;var n=new Array(t.length).fill(null);nA.arraycopy(t,r,n,0,t.length-r),nA.arraycopy(t,0,n,t.length-r,r),nA.arraycopy(n,0,t,0,t.length)},GA.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!t[r].equals(e[r]))return!1;return!0}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];if(n===i)return!0;if(null===n||null===i)return!1;if(n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(0!==o.compare(n[s],i[s]))return!1;return!0}},GA.intersection=function(t,e){for(var r=new UA,n=0;n<t.length;n++)e.intersects(t[n])&&r.add(t[n],!0);return r.toCoordinateArray()},GA.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},GA.removeRepeatedPoints=function(t){return GA.hasRepeatedPoints(t)?new UA(t,!1).toCoordinateArray():t},GA.reverse=function(t){for(var e=t.length-1,r=Math.trunc(e/2),n=0;n<=r;n++){var i=t[n];t[n]=t[e-n],t[e-n]=i}},GA.removeNull=function(t){for(var e=0,r=0;r<t.length;r++)null!==t[r]&&e++;var n=new Array(e).fill(null);if(0===e)return n;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(n[i++]=t[o]);return n},GA.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),r=0;r<t.length;r++)e[r]=new Fg(t[r]);return e}if(5===arguments.length)for(var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new Fg(n[i+u])},GA.isEqualReversed=function(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=e[t.length-r-1];if(0!==n.compareTo(i))return!1}return!0},GA.envelope=function(t){for(var e=new oA,r=0;r<t.length;r++)e.expandToInclude(t[r]);return e},GA.toCoordinateArray=function(t){return t.toArray(GA.coordArrayType)},GA.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},GA.indexOf=function(t,e){for(var r=0;r<e.length;r++)if(t.equals(e[r]))return r;return-1},GA.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var r=t.length-1-e,n=t[e].compareTo(t[r]);if(0!==n)return n}return 1},GA.compare=function(t,e){for(var r=0;r<t.length&&r<e.length;){var n=t[r].compareTo(e[r]);if(0!==n)return n;r++}return r<e.length?-1:r<t.length?1:0},GA.minCoordinate=function(t){for(var e=null,r=0;r<t.length;r++)(null===e||e.compareTo(t[r])>0)&&(e=t[r]);return e},GA.extract=function(t,e,r){e=Vg.clamp(e,0,t.length);var n=(r=Vg.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),r<e&&(n=0);var i=new Array(n).fill(null);if(0===n)return i;for(var o=0,s=e;s<=r;s++)i[o++]=t[s];return i},Object.defineProperties(GA,zA);var jA=function(){};jA.prototype.compare=function(t,e){return GA.compare(t,e)},jA.prototype.interfaces_=function(){return[Dg]},jA.prototype.getClass=function(){return jA};var VA=function(){};VA.prototype.compare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;var i=GA.compare(r,n);return GA.isEqualReversed(r,n)?0:i},VA.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;for(var i=GA.increasingDirection(r),o=GA.increasingDirection(n),s=i>0?0:r.length-1,a=o>0?0:r.length-1,u=0;u<r.length;u++){var l=r[s].compareTo(n[a]);if(0!==l)return l;s+=i,a+=o}return 0},VA.prototype.interfaces_=function(){return[Dg]},VA.prototype.getClass=function(){return VA};var HA=function(){};HA.prototype.get=function(){},HA.prototype.put=function(){},HA.prototype.size=function(){},HA.prototype.values=function(){},HA.prototype.entrySet=function(){};var qA=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}(HA);function YA(t){this.message=t||""}function XA(){}YA.prototype=new Error,YA.prototype.name="OperationNotSupported",XA.prototype=new NA,XA.prototype.contains=function(){};var WA=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof NA&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++){if(this.array_[e]===t)return!0}return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new JA(this)},e}(XA),JA=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new FA;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new YA},e}(DA);function KA(t){return null===t?0:t.color}function ZA(t){return null===t?null:t.parent}function $A(t,e){null!==t&&(t.color=e)}function ty(t){return null===t?null:t.left}function ey(t){return null===t?null:t.right}function ry(){this.root_=null,this.size_=0}ry.prototype=new qA,ry.prototype.get=function(t){for(var e=this.root_;null!==e;){var r=t.compareTo(e.key);if(r<0)e=e.left;else{if(!(r>0))return e.value;e=e.right}}return null},ry.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 r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:r,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},ry.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(ZA(t)===ty(ZA(ZA(t)))){var r=ey(ZA(ZA(t)));1===KA(r)?($A(ZA(t),0),$A(r,0),$A(ZA(ZA(t)),1),t=ZA(ZA(t))):(t===ey(ZA(t))&&(t=ZA(t),e.rotateLeft(t)),$A(ZA(t),0),$A(ZA(ZA(t)),1),e.rotateRight(ZA(ZA(t))))}else{var n=ty(ZA(ZA(t)));1===KA(n)?($A(ZA(t),0),$A(n,0),$A(ZA(ZA(t)),1),t=ZA(ZA(t))):(t===ty(ZA(t))&&(t=ZA(t),e.rotateRight(t)),$A(ZA(t),0),$A(ZA(ZA(t)),1),e.rotateLeft(ZA(ZA(t))))}this.root_.color=0},ry.prototype.values=function(){var t=new QA,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=ry.successor(e));)t.add(e.value);return t},ry.prototype.entrySet=function(){var t=new WA,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=ry.successor(e));)t.add(e);return t},ry.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}},ry.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}},ry.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},ry.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 r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},ry.prototype.size=function(){return this.size_};var ny=function(){};function iy(){}function oy(){this.array_=[],arguments[0]instanceof NA&&this.addAll(arguments[0])}ny.prototype.interfaces_=function(){return[]},ny.prototype.getClass=function(){return ny},iy.prototype=new XA,oy.prototype=new iy,oy.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++){if(0===this.array_[e].compareTo(t))return!0}return!1},oy.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,r=this.array_.length;e<r;e++){if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0}return this.array_.push(t),!0},oy.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},oy.prototype.remove=function(t){throw new YA},oy.prototype.size=function(){return this.array_.length},oy.prototype.isEmpty=function(){return 0===this.array_.length},oy.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},oy.prototype.iterator=function(){return new sy(this)};var sy=function(t){this.treeSet_=t,this.position_=0};sy.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new FA;return this.treeSet_.array_[this.position_++]},sy.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},sy.prototype.remove=function(){throw new YA};var ay=function(){};ay.sort=function(){var t,e,r,n,i=arguments[0];if(1===arguments.length)n=function(t,e){return t.compareTo(e)},i.sort(n);else if(2===arguments.length)r=arguments[1],n=function(t,e){return r.compare(t,e)},i.sort(n);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),r=arguments[3],n=function(t,e){return r.compare(t,e)},e.sort(n),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},ay.asList=function(t){for(var e=new QA,r=0,n=t.length;r<n;r++)e.add(t[r]);return e};var uy=function(){},ly={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};ly.P.get=function(){return 0},ly.L.get=function(){return 1},ly.A.get=function(){return 2},ly.FALSE.get=function(){return-1},ly.TRUE.get=function(){return-2},ly.DONTCARE.get=function(){return-3},ly.SYM_FALSE.get=function(){return"F"},ly.SYM_TRUE.get=function(){return"T"},ly.SYM_DONTCARE.get=function(){return"*"},ly.SYM_P.get=function(){return"0"},ly.SYM_L.get=function(){return"1"},ly.SYM_A.get=function(){return"2"},uy.prototype.interfaces_=function(){return[]},uy.prototype.getClass=function(){return uy},uy.toDimensionSymbol=function(t){switch(t){case uy.FALSE:return uy.SYM_FALSE;case uy.TRUE:return uy.SYM_TRUE;case uy.DONTCARE:return uy.SYM_DONTCARE;case uy.P:return uy.SYM_P;case uy.L:return uy.SYM_L;case uy.A:return uy.SYM_A}throw new Tg("Unknown dimension value: "+t)},uy.toDimensionValue=function(t){switch(Xg.toUpperCase(t)){case uy.SYM_FALSE:return uy.FALSE;case uy.SYM_TRUE:return uy.TRUE;case uy.SYM_DONTCARE:return uy.DONTCARE;case uy.SYM_P:return uy.P;case uy.SYM_L:return uy.L;case uy.SYM_A:return uy.A}throw new Tg("Unknown dimension symbol: "+t)},Object.defineProperties(uy,ly);var hy=function(){};hy.prototype.filter=function(t){},hy.prototype.interfaces_=function(){return[]},hy.prototype.getClass=function(){return hy};var cy=function(){};cy.prototype.filter=function(t,e){},cy.prototype.isDone=function(){},cy.prototype.isGeometryChanged=function(){},cy.prototype.interfaces_=function(){return[]},cy.prototype.getClass=function(){return cy};var fy=function(t){function e(e,r){if(t.call(this,r),this._geometries=e||[],t.hasNullElements(this._geometries))throw new Tg("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new oA,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=0;r<this._geometries.length;r++)for(var n=this._geometries[r].getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();ay.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=uy.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=uy.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new oy(ay.asList(this._geometries)),r=new oy(ay.asList(t._geometries));return this.compare(e,r)}if(2===arguments.length){for(var n=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var u=this.getGeometryN(a),l=i.getGeometryN(a),h=u.compareToSameClass(l,n);if(0!==h)return h;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(jg(arguments[0],bA))for(var e=arguments[0],r=0;r<this._geometries.length;r++)t._geometries[r].apply(e);else if(jg(arguments[0],cy)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(jg(arguments[0],hy)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(jg(arguments[0],EA)){var a=arguments[0];a.filter(this);for(var u=0;u<this._geometries.length;u++)t._geometries[u].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),dA.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var r=0;r<this._geometries.length;r++)e._geometries[r]=this._geometries[r].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,r),e}(xA),py=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return xA.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?uy.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[t-1-r]=this._geometries[r].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new dy(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[ny]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,r),e}(fy),dy=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=SA.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._geom=r,this._geomFact=r.getFactory(),this._bnRule=n}};dy.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},dy.prototype.getBoundary=function(){return this._geom instanceof Cy?this.boundaryLineString(this._geom):this._geom instanceof py?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},dy.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},dy.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},dy.prototype.computeBoundaryCoordinates=function(t){var e=this,r=new QA;this._endpointMap=new ry;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&r.add(s.getKey())}return GA.toCoordinateArray(r)},dy.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new gy,this._endpointMap.put(t,e)),e.count++},dy.prototype.interfaces_=function(){return[]},dy.prototype.getClass=function(){return dy},dy.getBoundary=function(){return 1===arguments.length?new dy(arguments[0]).getBoundary():2===arguments.length?new dy(arguments[0],arguments[1]).getBoundary():void 0};var gy=function(){this.count=null};function Ay(){}function yy(){}gy.prototype.interfaces_=function(){return[]},gy.prototype.getClass=function(){return gy};var vy=function(){};function my(){}function _y(){}function Iy(){}var Ey=function(){},xy={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Ey.prototype.interfaces_=function(){return[]},Ey.prototype.getClass=function(){return Ey},Ey.chars=function(t,e){for(var r=new Array(e).fill(null),n=0;n<e;n++)r[n]=t;return String(r)},Ey.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new my,r=new Ay;return t.printStackTrace(r),e.toString()}if(2===arguments.length){var n=arguments[1],i="";new yy(Ey.getStackTrace(arguments[0]));for(var o=new Iy,s=0;s<n;s++)try{i+=o.readLine()+Ey.NEWLINE}catch(t){if(!(t instanceof _y))throw t;dA.shouldNeverReachHere()}return i}},Ey.split=function(t,e){for(var r=e.length,n=new QA,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);n.add(s),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var a=new Array(n.size()).fill(null),u=0;u<a.length;u++)a[u]=n.get(u);return a},Ey.toString=function(){if(1===arguments.length){var t=arguments[0];return Ey.SIMPLE_ORDINATE_FORMAT.format(t)}},Ey.spaces=function(t){return Ey.chars(" ",t)},xy.NEWLINE.get=function(){return nA.getProperty("line.separator")},xy.SIMPLE_ORDINATE_FORMAT.get=function(){return new vy},Object.defineProperties(Ey,xy);var wy=function(){};wy.prototype.interfaces_=function(){return[]},wy.prototype.getClass=function(){return wy},wy.copyCoord=function(t,e,r,n){for(var i=Math.min(t.getDimension(),r.getDimension()),o=0;o<i;o++)r.setOrdinate(n,o,t.getOrdinate(e,o))},wy.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,$g.X)===t.getOrdinate(e-1,$g.X)&&t.getOrdinate(0,$g.Y)===t.getOrdinate(e-1,$g.Y))},wy.isEqual=function(t,e){var r=t.size();if(r!==e.size())return!1;for(var n=Math.min(t.getDimension(),e.getDimension()),i=0;i<r;i++)for(var o=0;o<n;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(t.getOrdinate(i,o)!==e.getOrdinate(i,o)&&(!Lg.isNaN(s)||!Lg.isNaN(a)))return!1}return!0},wy.extend=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();if(wy.copy(e,0,n,0,i),i>0)for(var o=i;o<r;o++)wy.copy(e,i-1,n,o,1);return n},wy.reverse=function(t){for(var e=t.size()-1,r=Math.trunc(e/2),n=0;n<=r;n++)wy.swap(t,n,e-n)},wy.swap=function(t,e,r){if(e===r)return null;for(var n=0;n<t.getDimension();n++){var i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(r,n)),t.setOrdinate(r,n,i)}},wy.copy=function(t,e,r,n,i){for(var o=0;o<i;o++)wy.copyCoord(t,e+o,r,n+o)},wy.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var r=t.getDimension(),n=new qg;n.append("(");for(var i=0;i<e;i++){i>0&&n.append(" ");for(var o=0;o<r;o++)o>0&&n.append(","),n.append(Ey.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},wy.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?wy.createClosedRing(t,e,4):e.getOrdinate(0,$g.X)===e.getOrdinate(r-1,$g.X)&&e.getOrdinate(0,$g.Y)===e.getOrdinate(r-1,$g.Y)?e:wy.createClosedRing(t,e,r+1)},wy.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();wy.copy(e,0,n,0,i);for(var o=i;o<r;o++)wy.copy(e,0,n,o,1);return n};var Cy=function(t){function e(e,r){t.call(this,r),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new oA:this._points.expandEnvelope(new oA)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var r=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(r)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(r))>0&&wy.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?uy.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 _A.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return wy.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e<this._points.size()&&r<t._points.size();){var n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(r));if(0!==n)return n;e++,r++}return e<this._points.size()?1:r<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(jg(arguments[0],bA))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(jg(arguments[0],cy)){var r=arguments[0];if(0===this._points.size())return null;for(var n=0;n<this._points.size()&&(r.filter(this._points,n),!r.isDone());n++);r.isGeometryChanged()&&this.geometryChanged()}else if(jg(arguments[0],hy)){arguments[0].filter(this)}else if(jg(arguments[0],EA)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return new dy(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new Tg("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[ny]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,r),e}(xA),by=function(){};by.prototype.interfaces_=function(){return[]},by.prototype.getClass=function(){return by};var Sy=function(t){function e(e,r){t.call(this,r),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new oA;var t=new oA;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),r))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return uy.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(jg(arguments[0],bA)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(jg(arguments[0],cy)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(jg(arguments[0],hy)){arguments[0].filter(this)}else if(jg(arguments[0],EA)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),dA.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[by]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,r),e}(xA),By=function(){};By.prototype.interfaces_=function(){return[]},By.prototype.getClass=function(){return By};var My=function(t){function e(e,r,n){if(t.call(this,n),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===r&&(r=[]),t.hasNullElements(r))throw new Tg("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(r))throw new Tg("shell is empty but holes are not");this._shell=e,this._holes=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=this._shell.getCoordinates(),n=0;n<r.length;n++)t[++e]=r[n];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(_A.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(_A.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),r=0;r<5;r++){var n=t.getX(r);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;var i=t.getY(r);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),l=t.getY(a);if(u!==o===(l!==s))return!1;o=u,s=l}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e,i=this._shell,o=n._shell;if(!i.equalsExact(o,r))return!1;if(this._holes.length!==n._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(n._holes[s],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);ay.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(e.isEmpty())return null;var n=new Array(e.getCoordinates().length-1).fill(null);nA.arraycopy(e.getCoordinates(),0,n,0,n.length);var i=GA.minCoordinate(e.getCoordinates());GA.scroll(n,i),nA.arraycopy(n,0,e.getCoordinates(),0,n.length),e.getCoordinates()[n.length]=n[0],_A.isCCW(e.getCoordinates())===r&&GA.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,r=t._shell;return e.compareToSameClass(r)}if(2===arguments.length){var n=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,n);if(0!==a)return a;for(var u=this.getNumInteriorRing(),l=i.getNumInteriorRing(),h=0;h<u&&h<l;){var c=this.getInteriorRingN(h),f=i.getInteriorRingN(h),p=c.compareToSameClass(f,n);if(0!==p)return p;h++}return h<u?1:h<l?-1:0}},e.prototype.apply=function(t){var e=this;if(jg(t,bA)){this._shell.apply(t);for(var r=0;r<this._holes.length;r++)e._holes[r].apply(t)}else if(jg(t,cy)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(e._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(jg(t,hy))t.filter(this);else if(jg(t,EA)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var r=0;r<this._holes.length;r++)e._holes[r]=this._holes[r].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),r=new Array(this._holes.length).fill(null),n=0;n<r.length;n++)r[n]=this._holes[n].copy();return new e(t,r,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[By]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,r),e}(xA),Ty=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return xA.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return uy.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[by]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,r),e}(fy),Ly=function(t){function e(e,r){e instanceof Fg&&r instanceof Yy&&(e=r.getCoordinateSequenceFactory().create(e)),t.call(this,e,r),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return xA.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return uy.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return wy.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new Tg("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new Tg("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 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},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(Cy),Ry=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return xA.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}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),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new QA,e=0;e<this._geometries.length;e++)for(var r=this._geometries[e].getBoundary(),n=0;n<r.getNumGeometries();n++)t.add(r.getGeometryN(n));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[By]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,r),e}(fy),Ny=function(t){this._factory=t||null,this._isUserDataCopied=!1},Py={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Ny.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Ny.prototype.edit=function(t,e){if(null===t)return null;var r=this.editInternal(t,e);return this._isUserDataCopied&&r.setUserData(t.getUserData()),r},Ny.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof fy?this.editGeometryCollection(t,e):t instanceof My?this.editPolygon(t,e):t instanceof Sy||t instanceof Cy?e.edit(t,this._factory):(dA.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Ny.prototype.editGeometryCollection=function(t,e){for(var r=e.edit(t,this._factory),n=new QA,i=0;i<r.getNumGeometries();i++){var o=this.edit(r.getGeometryN(i),e);null===o||o.isEmpty()||n.add(o)}return r.getClass()===Ty?this._factory.createMultiPoint(n.toArray([])):r.getClass()===py?this._factory.createMultiLineString(n.toArray([])):r.getClass()===Ry?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))},Ny.prototype.editPolygon=function(t,e){var r=e.edit(t,this._factory);if(null===r&&(r=this._factory.createPolygon(null)),r.isEmpty())return r;var n=this.edit(r.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();for(var i=new QA,o=0;o<r.getNumInteriorRing();o++){var s=this.edit(r.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(n,i.toArray([]))},Ny.prototype.interfaces_=function(){return[]},Ny.prototype.getClass=function(){return Ny},Ny.GeometryEditorOperation=function(){},Py.NoOpGeometryOperation.get=function(){return Dy},Py.CoordinateOperation.get=function(){return ky},Py.CoordinateSequenceOperation.get=function(){return Fy},Object.defineProperties(Ny,Py);var Dy=function(){};Dy.prototype.edit=function(t,e){return t},Dy.prototype.interfaces_=function(){return[Ny.GeometryEditorOperation]},Dy.prototype.getClass=function(){return Dy};var ky=function(){};ky.prototype.edit=function(t,e){var r=this.editCoordinates(t.getCoordinates(),t);return null===r?t:t instanceof Ly?e.createLinearRing(r):t instanceof Cy?e.createLineString(r):t instanceof Sy?r.length>0?e.createPoint(r[0]):e.createPoint():t},ky.prototype.interfaces_=function(){return[Ny.GeometryEditorOperation]},ky.prototype.getClass=function(){return ky};var Fy=function(){};Fy.prototype.edit=function(t,e){return t instanceof Ly?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Cy?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Sy?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},Fy.prototype.interfaces_=function(){return[Ny.GeometryEditorOperation]},Fy.prototype.getClass=function(){return Fy};var Qy=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 r=0;r<e;r++)t._coordinates[r]=new Fg}else if(jg(arguments[0],$g)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],u=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=u;for(var l=0;l<a;l++)t._coordinates[l]=new Fg}},Oy={serialVersionUID:{configurable:!0}};Qy.prototype.setOrdinate=function(t,e,r){switch(e){case $g.X:this._coordinates[t].x=r;break;case $g.Y:this._coordinates[t].y=r;break;case $g.Z:this._coordinates[t].z=r;break;default:throw new Tg("invalid ordinateIndex")}},Qy.prototype.size=function(){return this._coordinates.length},Qy.prototype.getOrdinate=function(t,e){switch(e){case $g.X:return this._coordinates[t].x;case $g.Y:return this._coordinates[t].y;case $g.Z:return this._coordinates[t].z}return Lg.NaN},Qy.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],r=arguments[1];r.x=this._coordinates[e].x,r.y=this._coordinates[e].y,r.z=this._coordinates[e].z}},Qy.prototype.getCoordinateCopy=function(t){return new Fg(this._coordinates[t])},Qy.prototype.getDimension=function(){return this._dimension},Qy.prototype.getX=function(t){return this._coordinates[t].x},Qy.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new Qy(t,this._dimension)},Qy.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},Qy.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new Qy(t,this._dimension)},Qy.prototype.toString=function(){if(this._coordinates.length>0){var t=new qg(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},Qy.prototype.getY=function(t){return this._coordinates[t].y},Qy.prototype.toCoordinateArray=function(){return this._coordinates},Qy.prototype.interfaces_=function(){return[$g,kg]},Qy.prototype.getClass=function(){return Qy},Oy.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(Qy,Oy);var Uy=function(){},Gy={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Uy.prototype.readResolve=function(){return Uy.instance()},Uy.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new Qy(arguments[0]);if(jg(arguments[0],$g))return new Qy(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new Qy(t):new Qy(t,e)}},Uy.prototype.interfaces_=function(){return[Ug,kg]},Uy.prototype.getClass=function(){return Uy},Uy.instance=function(){return Uy.instanceObject},Gy.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Gy.instanceObject.get=function(){return new Uy},Object.defineProperties(Uy,Gy);var zy=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 QA,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new WA;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(HA),jy=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 Hy){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},Vy={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};jy.prototype.equals=function(t){if(!(t instanceof jy))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},jy.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new Yg(r).compareTo(new Yg(n))},jy.prototype.getScale=function(){return this._scale},jy.prototype.isFloating=function(){return this._modelType===jy.FLOATING||this._modelType===jy.FLOATING_SINGLE},jy.prototype.getType=function(){return this._modelType},jy.prototype.toString=function(){var t="UNKNOWN";return this._modelType===jy.FLOATING?t="Floating":this._modelType===jy.FLOATING_SINGLE?t="Floating-Single":this._modelType===jy.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},jy.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return Lg.isNaN(t)||this._modelType===jy.FLOATING_SINGLE?t:this._modelType===jy.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof Fg){var e=arguments[0];if(this._modelType===jy.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},jy.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===jy.FLOATING?t=16:this._modelType===jy.FLOATING_SINGLE?t=6:this._modelType===jy.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},jy.prototype.setScale=function(t){this._scale=Math.abs(t)},jy.prototype.interfaces_=function(){return[kg,Ng]},jy.prototype.getClass=function(){return jy},jy.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Vy.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},Vy.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(jy,Vy);var Hy=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},qy={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Hy.prototype.readResolve=function(){return Hy.nameToTypeMap.get(this._name)},Hy.prototype.toString=function(){return this._name},Hy.prototype.interfaces_=function(){return[kg]},Hy.prototype.getClass=function(){return Hy},qy.serialVersionUID.get=function(){return-552860263173159e4},qy.nameToTypeMap.get=function(){return new zy},Object.defineProperties(Hy,qy),jy.Type=Hy,jy.FIXED=new Hy("FIXED"),jy.FLOATING=new Hy("FLOATING"),jy.FLOATING_SINGLE=new Hy("FLOATING SINGLE");var Yy=function t(){this._precisionModel=new jy,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?jg(arguments[0],Ug)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof jy&&(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]))},Xy={serialVersionUID:{configurable:!0}};Yy.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Fg(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Fg(t.getMinX(),t.getMinY()),new Fg(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Fg(t.getMinX(),t.getMinY()),new Fg(t.getMinX(),t.getMaxY()),new Fg(t.getMaxX(),t.getMaxY()),new Fg(t.getMaxX(),t.getMinY()),new Fg(t.getMinX(),t.getMinY())]),null)},Yy.prototype.createLineString=function(t){return t?t instanceof Array?new Cy(this.getCoordinateSequenceFactory().create(t),this):jg(t,$g)?new Cy(t,this):void 0:new Cy(this.getCoordinateSequenceFactory().create([]),this)},Yy.prototype.createMultiLineString=function(){return 0===arguments.length?new py(null,this):1===arguments.length?new py(arguments[0],this):void 0},Yy.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(Yy.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof My)return this.createMultiPolygon(Yy.toPolygonArray(t));if(a instanceof Cy)return this.createMultiLineString(Yy.toLineStringArray(t));if(a instanceof Sy)return this.createMultiPoint(Yy.toPointArray(t));dA.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},Yy.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},Yy.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Fg){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(jg(arguments[0],$g))return new Sy(arguments[0],this)}},Yy.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Yy.prototype.createPolygon=function(){if(0===arguments.length)return new My(null,null,this);if(1===arguments.length){if(jg(arguments[0],$g)){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 Ly){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length){return new My(arguments[0],arguments[1],this)}},Yy.prototype.getSRID=function(){return this._SRID},Yy.prototype.createGeometryCollection=function(){return 0===arguments.length?new fy(null,this):1===arguments.length?new fy(arguments[0],this):void 0},Yy.prototype.createGeometry=function(t){return new Ny(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},Yy.prototype.getPrecisionModel=function(){return this._precisionModel},Yy.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(jg(arguments[0],$g))return new Ly(arguments[0],this)}},Yy.prototype.createMultiPolygon=function(){return 0===arguments.length?new Ry(null,this):1===arguments.length?new Ry(arguments[0],this):void 0},Yy.prototype.createMultiPoint=function(){if(0===arguments.length)return new Ty(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new Ty(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(jg(arguments[0],$g)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n<e.size();n++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());wy.copy(e,n,i,0,1),r[n]=this.createPoint(i)}return this.createMultiPoint(r)}}},Yy.prototype.interfaces_=function(){return[kg]},Yy.prototype.getClass=function(){return Yy},Yy.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.getDefaultCoordinateSequenceFactory=function(){return Uy.instance()},Yy.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},Xy.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(Yy,Xy);var Wy=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Jy=function(t){this.geometryFactory=t||new Yy};Jy.prototype.read=function(t){var e,r=(e="string"==typeof t?JSON.parse(t):t).type;if(!Ky[r])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Wy.indexOf(r)?Ky[r].apply(this,[e.coordinates]):"GeometryCollection"===r?Ky[r].apply(this,[e.geometries]):Ky[r].apply(this,[e])},Jy.prototype.write=function(t){var e=t.getGeometryType();if(!Zy[e])throw new Error("Geometry is not supported");return Zy[e].apply(this,[t])};var Ky={Feature:function(t){var e={};for(var r in t)e[r]=t[r];if(t.geometry){var n=t.geometry.type;if(!Ky[n])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Ky.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var r=0;r<t.features.length;++r)e.features.push(this.read(t.features[r]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(new Fg(n[0],n[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new Fg(t[0],t[1]),new Fg(t[2],t[1]),new Fg(t[2],t[3]),new Fg(t[0],t[3]),new Fg(t[0],t[1])])},Point:function(t){var e=new Fg(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],r=0;r<t.length;++r)e.push(Ky.Point.apply(this,[t[r]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=Ky.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],r=0;r<t.length;++r)e.push(Ky.LineString.apply(this,[t[r]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=Ky.coordinates.apply(this,[t[0]]),r=this.geometryFactory.createLinearRing(e),n=[],i=1;i<t.length;++i){var o=t[i],s=Ky.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);n.push(a)}return this.geometryFactory.createPolygon(r,n)},MultiPolygon:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(Ky.Polygon.apply(this,[n]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},Zy={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:Zy.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=Zy.Point.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],r=t.getCoordinates(),n=0;n<r.length;++n){var i=r[n];e.push(Zy.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=Zy.LineString.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],r=Zy.LineString.apply(this,[t._shell]);e.push(r.coordinates);for(var n=0;n<t._holes.length;++n){var i=t._holes[n],o=Zy.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=Zy.Polygon.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=n.getGeometryType();e.push(Zy[i].apply(this,[n]))}return{type:"GeometryCollection",geometries:e}}},$y=function(t){this.geometryFactory=t||new Yy,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Jy(this.geometryFactory)};$y.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===jy.FIXED&&this.reducePrecision(e),e},$y.prototype.reducePrecision=function(t){var e,r;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,r=t.points.length;e<r;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,r=t.geometries.length;e<r;e++)this.reducePrecision(t.geometries[e])};var tv=function(){this.parser=new Jy(this.geometryFactory)};tv.prototype.write=function(t){return this.parser.write(t)};var ev=function(){},rv={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function nv(t){this.message=t||""}function iv(){this.array_=[]}ev.prototype.interfaces_=function(){return[]},ev.prototype.getClass=function(){return ev},ev.opposite=function(t){return t===ev.LEFT?ev.RIGHT:t===ev.RIGHT?ev.LEFT:t},rv.ON.get=function(){return 0},rv.LEFT.get=function(){return 1},rv.RIGHT.get=function(){return 2},Object.defineProperties(ev,rv),nv.prototype=new Error,nv.prototype.name="EmptyStackException",iv.prototype=new kA,iv.prototype.add=function(t){return this.array_.push(t),!0},iv.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},iv.prototype.push=function(t){return this.array_.push(t),t},iv.prototype.pop=function(t){if(0===this.array_.length)throw new nv;return this.array_.pop()},iv.prototype.peek=function(){if(0===this.array_.length)throw new nv;return this.array_[this.array_.length-1]},iv.prototype.empty=function(){return 0===this.array_.length},iv.prototype.isEmpty=function(){return this.empty()},iv.prototype.search=function(t){return this.array_.indexOf(t)},iv.prototype.size=function(){return this.array_.length},iv.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t};var ov=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};ov.prototype.getCoordinate=function(){return this._minCoord},ov.prototype.getRightmostSide=function(t,e){var r=this.getRightmostSideOfSegment(t,e);return r<0&&(r=this.getRightmostSideOfSegment(t,e-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),r},ov.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();dA.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],r=t[this._minIndex+1],n=_A.computeOrientation(this._minCoord,r,e),i=!1;(e.y<this._minCoord.y&&r.y<this._minCoord.y&&n===_A.COUNTERCLOCKWISE||e.y>this._minCoord.y&&r.y>this._minCoord.y&&n===_A.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},ov.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=ev.LEFT;return r[e].y<r[e+1].y&&(n=ev.RIGHT),n},ov.prototype.getEdge=function(){return this._orientedDe},ov.prototype.checkForRightmostCoordinate=function(t){for(var e=this,r=t.getEdge().getCoordinates(),n=0;n<r.length-1;n++)(null===e._minCoord||r[n].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},ov.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)},ov.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}dA.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)===ev.LEFT&&(this._orientedDe=this._minDe.getSym())},ov.prototype.interfaces_=function(){return[]},ov.prototype.getClass=function(){return ov};var sv=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new Fg(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}(fA),av=function(){this.array_=[]};av.prototype.addLast=function(t){this.array_.push(t)},av.prototype.removeFirst=function(){return this.array_.shift()},av.prototype.isEmpty=function(){return 0===this.array_.length};var uv=function(){this._finder=null,this._dirEdgeList=new QA,this._nodes=new QA,this._rightMostCoord=null,this._env=null,this._finder=new ov};uv.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},uv.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},uv.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new sv("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},uv.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(ev.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},uv.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},uv.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(ev.RIGHT)>=1&&e.getDepth(ev.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},uv.prototype.computeDepths=function(t){var e=new WA,r=new av,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(r.addLast(a),e.add(a))}}}},uv.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},uv.prototype.getEnvelope=function(){if(null===this._env){for(var t=new oA,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;n<r.length-1;n++)t.expandToInclude(r[n]);this._env=t}return this._env},uv.prototype.addReachable=function(t){var e=new iv;for(e.add(t);!e.empty();){var r=e.pop();this.add(r,e)}},uv.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(ev.LEFT,t.getDepth(ev.RIGHT)),e.setDepth(ev.RIGHT,t.getDepth(ev.LEFT))},uv.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var r=t.getEdges().iterator();r.hasNext();){var n=r.next();this._dirEdgeList.add(n);var i=n.getSym().getNode();i.isVisited()||e.push(i)}},uv.prototype.getNodes=function(){return this._nodes},uv.prototype.getDirectedEdges=function(){return this._dirEdgeList},uv.prototype.interfaces_=function(){return[Ng]},uv.prototype.getClass=function(){return uv};var lv=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[ev.ON]=r}else if(arguments[0]instanceof t){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[ev.ON]=o,this.location[ev.LEFT]=s,this.location[ev.RIGHT]=a}};lv.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},lv.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==Gg.NONE)return!1;return!0},lv.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===Gg.NONE&&(this.location[e]=t)},lv.prototype.isLine=function(){return 1===this.location.length},lv.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[ev.ON]=this.location[ev.ON],e[ev.LEFT]=Gg.NONE,e[ev.RIGHT]=Gg.NONE,this.location=e}for(var r=0;r<this.location.length;r++)this.location[r]===Gg.NONE&&r<t.location.length&&(this.location[r]=t.location[r])},lv.prototype.getLocations=function(){return this.location},lv.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[ev.LEFT];this.location[ev.LEFT]=this.location[ev.RIGHT],this.location[ev.RIGHT]=t},lv.prototype.toString=function(){var t=new qg;return this.location.length>1&&t.append(Gg.toLocationSymbol(this.location[ev.LEFT])),t.append(Gg.toLocationSymbol(this.location[ev.ON])),this.location.length>1&&t.append(Gg.toLocationSymbol(this.location[ev.RIGHT])),t.toString()},lv.prototype.setLocations=function(t,e,r){this.location[ev.ON]=t,this.location[ev.LEFT]=e,this.location[ev.RIGHT]=r},lv.prototype.get=function(t){return t<this.location.length?this.location[t]:Gg.NONE},lv.prototype.isArea=function(){return this.location.length>1},lv.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===Gg.NONE)return!0;return!1},lv.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(ev.ON,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.location[e]=r}},lv.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(Gg.NONE)},lv.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},lv.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},lv.prototype.interfaces_=function(){return[]},lv.prototype.getClass=function(){return lv};var hv=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new lv(e),this.elt[1]=new lv(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.elt[0]=new lv(r.elt[0]),this.elt[1]=new lv(r.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new lv(Gg.NONE),this.elt[1]=new lv(Gg.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new lv(o,s,a),this.elt[1]=new lv(o,s,a)}else if(4===arguments.length){var u=arguments[0],l=arguments[1],h=arguments[2],c=arguments[3];this.elt[0]=new lv(Gg.NONE,Gg.NONE,Gg.NONE),this.elt[1]=new lv(Gg.NONE,Gg.NONE,Gg.NONE),this.elt[u].setLocations(l,h,c)}};hv.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},hv.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},hv.prototype.isNull=function(t){return this.elt[t].isNull()},hv.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.elt[e].setAllLocationsIfNull(r)}},hv.prototype.isLine=function(t){return this.elt[t].isLine()},hv.prototype.merge=function(t){for(var e=this,r=0;r<2;r++)null===e.elt[r]&&null!==t.elt[r]?e.elt[r]=new lv(t.elt[r]):e.elt[r].merge(t.elt[r])},hv.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},hv.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(ev.ON)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return this.elt[e].get(r)}},hv.prototype.toString=function(){var t=new qg;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},hv.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},hv.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},hv.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(ev.ON,e)}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this.elt[r].setLocation(n,i)}},hv.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},hv.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},hv.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new lv(this.elt[t].location[0]))},hv.prototype.interfaces_=function(){return[]},hv.prototype.getClass=function(){return hv},hv.toLineLabel=function(t){for(var e=new hv(Gg.NONE),r=0;r<2;r++)e.setLocation(r,t.getLocation(r));return e};var cv=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new QA,this._pts=new QA,this._label=new hv(Gg.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new QA,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};cv.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=_A.isCCW(this._ring.getCoordinates())},cv.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},cv.prototype.computePoints=function(t){var e=this;this._startDe=t;var r=t,n=!0;do{if(null===r)throw new sv("Found null DirectedEdge");if(r.getEdgeRing()===e)throw new sv("Directed Edge visited twice during ring-building at "+r.getCoordinate());e._edges.add(r);var i=r.getLabel();dA.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(r.getEdge(),r.isForward(),n),n=!1,e.setEdgeRing(r,e),r=e.getNext(r)}while(r!==this._startDe)},cv.prototype.getLinearRing=function(){return this._ring},cv.prototype.getCoordinate=function(t){return this._pts.get(t)},cv.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var r=e.getNode().getEdges().getOutgoingDegree(t);r>t._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},cv.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o<n.length;o++)this._pts.add(n[o])}else{var s=n.length-2;r&&(s=n.length-1);for(var a=s;a>=0;a--)this._pts.add(n[a])}},cv.prototype.isHole=function(){return this._isHole},cv.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},cv.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!_A.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){if(r.next().containsPoint(t))return!1}return!0},cv.prototype.addHole=function(t){this._holes.add(t)},cv.prototype.isShell=function(){return null===this._shell},cv.prototype.getLabel=function(){return this._label},cv.prototype.getEdges=function(){return this._edges},cv.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},cv.prototype.getShell=function(){return this._shell},cv.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],r=arguments[0].getLocation(e,ev.RIGHT);if(r===Gg.NONE)return null;if(this._label.getLocation(e)===Gg.NONE)return this._label.setLocation(e,r),null}},cv.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},cv.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)e[r]=this._holes.get(r).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},cv.prototype.interfaces_=function(){return[]},cv.prototype.getClass=function(){return cv};var fv=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(cv),pv=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new QA,e=this._startDe;do{if(null===e.getMinEdgeRing()){var r=new fv(e,this._geometryFactory);t.add(r)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(cv),dv=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};dv.prototype.setVisited=function(t){this._isVisited=t},dv.prototype.setInResult=function(t){this._isInResult=t},dv.prototype.isCovered=function(){return this._isCovered},dv.prototype.isCoveredSet=function(){return this._isCoveredSet},dv.prototype.setLabel=function(t){this._label=t},dv.prototype.getLabel=function(){return this._label},dv.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},dv.prototype.updateIM=function(t){dA.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},dv.prototype.isInResult=function(){return this._isInResult},dv.prototype.isVisited=function(){return this._isVisited},dv.prototype.interfaces_=function(){return[]},dv.prototype.getClass=function(){return dv};var gv=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new hv(0,Gg.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 r=Gg.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==Gg.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new hv(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof hv)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===Gg.NONE&&t._label.setLocation(i,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=Gg.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;if(e===Gg.BOUNDARY)r=Gg.INTERIOR;else r=Gg.BOUNDARY;this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dv),Av=function(){this.nodeMap=new ry,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};Av.prototype.find=function(t){return this.nodeMap.get(t)},Av.prototype.addNode=function(){if(arguments[0]instanceof Fg){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 gv){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},Av.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Av.prototype.iterator=function(){return this.nodeMap.values().iterator()},Av.prototype.values=function(){return this.nodeMap.values()},Av.prototype.getBoundaryNodes=function(t){for(var e=new QA,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===Gg.BOUNDARY&&e.add(n)}return e},Av.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},Av.prototype.interfaces_=function(){return[]},Av.prototype.getClass=function(){return Av};var yv=function(){},vv={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};yv.prototype.interfaces_=function(){return[]},yv.prototype.getClass=function(){return yv},yv.isNorthern=function(t){return t===yv.NE||t===yv.NW},yv.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},yv.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var r=t<e?t:e;return 0===r&&3===(t>e?t:e)?3:r},yv.isInHalfPlane=function(t,e){return e===yv.SE?t===yv.SE||t===yv.SW:t===e||t===e+1},yv.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 Tg("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?yv.NE:yv.SE:e>=0?yv.NW:yv.SW}if(arguments[0]instanceof Fg&&arguments[1]instanceof Fg){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new Tg("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?yv.NE:yv.SE:n.y>=r.y?yv.NW:yv.SW}},vv.NE.get=function(){return 0},vv.NW.get=function(){return 1},vv.SW.get=function(){return 2},vv.SE.get=function(){return 3},Object.defineProperties(yv,vv);var mv=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],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};mv.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:_A.computeOrientation(t._p0,t._p1,this._p1)},mv.prototype.getDy=function(){return this._dy},mv.prototype.getCoordinate=function(){return this._p0},mv.prototype.setNode=function(t){this._node=t},mv.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),n=r.lastIndexOf("."),i=r.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},mv.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},mv.prototype.getDirectedCoordinate=function(){return this._p1},mv.prototype.getDx=function(){return this._dx},mv.prototype.getLabel=function(){return this._label},mv.prototype.getEdge=function(){return this._edge},mv.prototype.getQuadrant=function(){return this._quadrant},mv.prototype.getNode=function(){return this._node},mv.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),r=e.lastIndexOf(".");return" "+e.substring(r+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},mv.prototype.computeLabel=function(t){},mv.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=yv.quadrant(this._dx,this._dy),dA.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},mv.prototype.interfaces_=function(){return[Ng]},mv.prototype.getClass=function(){return mv};var _v=function(t){function e(){var e=arguments[0],r=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=r,r)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var n=e.getNumPoints()-1;this.init(e.getCoordinate(n),e.getCoordinate(n-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new hv(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new sv("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,r=0;r<2;r++)t._label.isArea(r)&&t._label.getLocation(r,ev.LEFT)===Gg.INTERIOR&&t._label.getLocation(r,ev.RIGHT)===Gg.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[ev.LEFT]+"/"+this._depth[ev.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,Gg.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,Gg.EXTERIOR);return t&&e&&r},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var n=1;t===ev.LEFT&&(n=-1);var i=ev.opposite(t),o=e+r*n;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===Gg.EXTERIOR&&e===Gg.INTERIOR?1:t===Gg.INTERIOR&&e===Gg.EXTERIOR?-1:0},e}(mv),Iv=function(){};Iv.prototype.createNode=function(t){return new gv(t,null)},Iv.prototype.interfaces_=function(){return[]},Iv.prototype.getClass=function(){return Iv};var Ev=function(){if(this._edges=new QA,this._nodes=null,this._edgeEndList=new QA,0===arguments.length)this._nodes=new Av(new Iv);else if(1===arguments.length){var t=arguments[0];this._nodes=new Av(t)}};Ev.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var r=this._edges.get(e);r.print(t),r.eiList.print(t)}},Ev.prototype.find=function(t){return this._nodes.find(t)},Ev.prototype.addNode=function(){if(arguments[0]instanceof gv){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof Fg){var e=arguments[0];return this._nodes.addNode(e)}},Ev.prototype.getNodeIterator=function(){return this._nodes.iterator()},Ev.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}},Ev.prototype.debugPrintln=function(t){nA.out.println(t)},Ev.prototype.isBoundaryNode=function(t,e){var r=this._nodes.find(e);if(null===r)return!1;var n=r.getLabel();return null!==n&&n.getLocation(t)===Gg.BOUNDARY},Ev.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}},Ev.prototype.matchInSameDirection=function(t,e,r,n){return!!t.equals(r)&&(_A.computeOrientation(t,e,n)===_A.COLLINEAR&&yv.quadrant(t,e)===yv.quadrant(r,n))},Ev.prototype.getEdgeEnds=function(){return this._edgeEndList},Ev.prototype.debugPrint=function(t){nA.out.print(t)},Ev.prototype.getEdgeIterator=function(){return this._edges.iterator()},Ev.prototype.findEdgeInSameDirection=function(t,e){for(var r=this,n=0;n<this._edges.size();n++){var i=r._edges.get(n),o=i.getCoordinates();if(r.matchInSameDirection(t,e,o[0],o[1]))return i;if(r.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},Ev.prototype.insertEdge=function(t){this._edges.add(t)},Ev.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var r=e.next();if(r.getEdge()===t)return r}return null},Ev.prototype.addEdges=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next();e._edges.add(n);var i=new _v(n,!0),o=new _v(n,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},Ev.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},Ev.prototype.getNodes=function(){return this._nodes.values()},Ev.prototype.findEdge=function(t,e){for(var r=0;r<this._edges.size();r++){var n=this._edges.get(r),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null},Ev.prototype.interfaces_=function(){return[]},Ev.prototype.getClass=function(){return Ev},Ev.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}};var xv=function(){this._geometryFactory=null,this._shellList=new QA;var t=arguments[0];this._geometryFactory=t};xv.prototype.sortShellsAndHoles=function(t,e,r){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()?r.add(i):e.add(i)}},xv.prototype.computePolygons=function(t){for(var e=new QA,r=t.iterator();r.hasNext();){var n=r.next().toPolygon(this._geometryFactory);e.add(n)}return e},xv.prototype.placeFreeHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(null===n.getShell()){var i=this.findEdgeRingContaining(n,t);if(null===i)throw new sv("unable to assign hole to a shell",n.getCoordinate(0));n.setShell(i)}}},xv.prototype.buildMinimalEdgeRings=function(t,e,r){for(var n=new QA,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):r.addAll(s)}else n.add(o)}return n},xv.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},xv.prototype.buildMaximalEdgeRings=function(t){for(var e=new QA,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new pv(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},xv.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},xv.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},xv.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),h=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(n)&&_A.isPointInRing(i,l.getCoordinates())&&(c=!0),c&&(null===o||s.contains(h))&&(o=u)}return o},xv.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return dA.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},xv.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];Ev.linkResultDirectedEdges(arguments[1]);var r=this.buildMaximalEdgeRings(e),n=new QA,i=this.buildMinimalEdgeRings(r,this._shellList,n);this.sortShellsAndHoles(i,this._shellList,n),this.placeFreeHoles(this._shellList,n)}},xv.prototype.interfaces_=function(){return[]},xv.prototype.getClass=function(){return xv};var wv=function(){};wv.prototype.getBounds=function(){},wv.prototype.interfaces_=function(){return[]},wv.prototype.getClass=function(){return wv};var Cv=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Cv.prototype.getItem=function(){return this._item},Cv.prototype.getBounds=function(){return this._bounds},Cv.prototype.interfaces_=function(){return[wv,kg]},Cv.prototype.getClass=function(){return Cv};var bv=function(){this._size=null,this._items=null,this._size=0,this._items=new QA,this._items.add(null)};bv.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},bv.prototype.size=function(){return this._size},bv.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},bv.prototype.clear=function(){this._size=0,this._items.clear()},bv.prototype.isEmpty=function(){return 0===this._size},bv.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)},bv.prototype.interfaces_=function(){return[]},bv.prototype.getClass=function(){return bv};var Sv=function(){};Sv.prototype.visitItem=function(t){},Sv.prototype.interfaces_=function(){return[]},Sv.prototype.getClass=function(){return Sv};var Bv=function(){};Bv.prototype.insert=function(t,e){},Bv.prototype.remove=function(t,e){},Bv.prototype.query=function(){},Bv.prototype.interfaces_=function(){return[]},Bv.prototype.getClass=function(){return Bv};var Mv=function(){if(this._childBoundables=new QA,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},Tv={serialVersionUID:{configurable:!0}};Mv.prototype.getLevel=function(){return this._level},Mv.prototype.size=function(){return this._childBoundables.size()},Mv.prototype.getChildBoundables=function(){return this._childBoundables},Mv.prototype.addChildBoundable=function(t){dA.isTrue(null===this._bounds),this._childBoundables.add(t)},Mv.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Mv.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Mv.prototype.interfaces_=function(){return[wv,kg]},Mv.prototype.getClass=function(){return Mv},Tv.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Mv,Tv);var Lv=function(){};Lv.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Lv.min=function(t){return Lv.sort(t),t.get(0)},Lv.sort=function(t,e){var r=t.toArray();e?ay.sort(r,e):ay.sort(r);for(var n=t.iterator(),i=0,o=r.length;i<o;i++)n.next(),n.set(r[i])},Lv.singletonList=function(t){var e=new QA;return e.add(t),e};var Rv=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],r=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=r,this._distance=this.distance()};Rv.prototype.expandToQueue=function(t,e){var r=Rv.isComposite(this._boundable1),n=Rv.isComposite(this._boundable2);if(r&&n)return Rv.area(this._boundable1)>Rv.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Tg("neither boundable is composite")},Rv.prototype.isLeaves=function(){return!(Rv.isComposite(this._boundable1)||Rv.isComposite(this._boundable2))},Rv.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},Rv.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new Rv(o,e,this._itemDistance);s.getDistance()<n&&r.add(s)}},Rv.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},Rv.prototype.getDistance=function(){return this._distance},Rv.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Rv.prototype.interfaces_=function(){return[Ng]},Rv.prototype.getClass=function(){return Rv},Rv.area=function(t){return t.getBounds().getArea()},Rv.isComposite=function(t){return t instanceof Mv};var Nv=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new QA,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var r=arguments[0];dA.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},Pv={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Nv.prototype.getNodeCapacity=function(){return this._nodeCapacity},Nv.prototype.lastNode=function(t){return t.get(t.size()-1)},Nv.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 r=e.next();r instanceof Mv?t+=this.size(r):r instanceof Cv&&(t+=1)}return t}},Nv.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof Cv&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},Nv.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new QA:t}if(1===arguments.length){for(var e=arguments[0],r=new QA,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof Mv){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof Cv?r.add(i.getItem()):dA.shouldNeverReachHere()}return r.size()<=0?null:r}},Nv.prototype.insert=function(t,e){dA.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Cv(t,e))},Nv.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new QA;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(dA.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof Mv?this.boundablesAtLevel(r,s,i):(dA.isTrue(s instanceof Cv),-1===r&&i.add(s))}return null}},Nv.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new QA;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(jg(arguments[2],Sv)&&arguments[0]instanceof Object&&arguments[1]instanceof Mv)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),u=0;u<a.size();u++){var l=a.get(u);t.getIntersectsOp().intersects(l.getBounds(),o)&&(l instanceof Mv?t.query(o,l,s):l instanceof Cv?s.visitItem(l.getItem()):dA.shouldNeverReachHere())}else if(jg(arguments[2],kA)&&arguments[0]instanceof Object&&arguments[1]instanceof Mv)for(var h=arguments[0],c=arguments[2],f=arguments[1].getChildBoundables(),p=0;p<f.size();p++){var d=f.get(p);t.getIntersectsOp().intersects(d.getBounds(),h)&&(d instanceof Mv?t.query(h,d,c):d instanceof Cv?c.add(d.getItem()):dA.shouldNeverReachHere())}},Nv.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},Nv.prototype.getRoot=function(){return this.build(),this._root},Nv.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=this.removeItem(n,i);if(o)return!0;for(var s=null,a=n.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),r)&&(u instanceof Mv&&(o=this.remove(r,u,i)))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(s),o}},Nv.prototype.createHigherLevels=function(t,e){dA.isTrue(!t.isEmpty());var r=this.createParentBoundables(t,e+1);return 1===r.size()?r.get(0):this.createHigherLevels(r,e+1)},Nv.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();if(r instanceof Mv){var n=this.depth(r);n>t&&(t=n)}}return t+1}},Nv.prototype.createParentBoundables=function(t,e){var r=this;dA.isTrue(!t.isEmpty());var n=new QA;n.add(this.createNode(e));var i=new QA(t);Lv.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(s)}return n},Nv.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Nv.prototype.interfaces_=function(){return[kg]},Nv.prototype.getClass=function(){return Nv},Nv.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},Pv.IntersectsOp.get=function(){return Dv},Pv.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},Pv.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Nv,Pv);var Dv=function(){},kv=function(){};kv.prototype.distance=function(t,e){},kv.prototype.interfaces_=function(){return[]},kv.prototype.getClass=function(){return kv};var Fv=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){dA.isTrue(t.length>0);for(var r=new QA,n=0;n<t.length;n++)r.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return r},e.prototype.createNode=function(t){return new Qv(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],r=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,r)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var r=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){n[o]=new QA;for(var s=0;i.hasNext()&&s<r;){var a=i.next();n[o].add(a),s++}}return n},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var r=arguments[0],n=arguments[1];t.prototype.query.call(this,r,n)}else if(3===arguments.length)if(jg(arguments[2],Sv)&&arguments[0]instanceof Object&&arguments[1]instanceof Mv){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(jg(arguments[2],kA)&&arguments[0]instanceof Object&&arguments[1]instanceof Mv){var a=arguments[0],u=arguments[1],l=arguments[2];t.prototype.query.call(this,a,u,l)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,r){return t.prototype.createParentBoundables.call(this,e,r)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return t.prototype.remove.call(this,e,r)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,r){dA.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new QA(t);Lv.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(o,r)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(jg(arguments[0],kv)){var t=arguments[0],r=new Rv(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(r)}if(arguments[0]instanceof Rv){var n=arguments[0];return this.nearestNeighbour(n,Lg.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&jg(arguments[1],kv)){var i=arguments[0],o=arguments[1],s=new Rv(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof Rv&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],l=null,h=new bv;for(h.add(a);!h.isEmpty()&&u>0;){var c=h.poll(),f=c.getDistance();if(f>=u)break;c.isLeaves()?(u=f,l=c):c.expandToQueue(h,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var p=arguments[2],d=new Cv(arguments[0],arguments[1]),g=new Rv(this.getRoot(),d,p);return this.nearestNeighbour(g)[0]}},e.prototype.interfaces_=function(){return[Bv,kg]},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())},r.STRtreeNode.get=function(){return Qv},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[Dg]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[Dg]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(Nv),Qv=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 r=e.next();null===t?t=new oA(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Mv),Ov=function(){};Ov.prototype.interfaces_=function(){return[]},Ov.prototype.getClass=function(){return Ov},Ov.relativeSign=function(t,e){return t<e?-1:t>e?1:0},Ov.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=Ov.relativeSign(e.x,r.x),i=Ov.relativeSign(e.y,r.y);switch(t){case 0:return Ov.compareValue(n,i);case 1:return Ov.compareValue(i,n);case 2:return Ov.compareValue(i,-n);case 3:return Ov.compareValue(-n,i);case 4:return Ov.compareValue(-n,-i);case 5:return Ov.compareValue(-i,-n);case 6:return Ov.compareValue(-i,n);case 7:return Ov.compareValue(n,-i)}return dA.shouldNeverReachHere("invalid octant value"),0},Ov.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Uv=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new Fg(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};Uv.prototype.getCoordinate=function(){return this.coord},Uv.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},Uv.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:Ov.compare(this._segmentOctant,this.coord,e.coord)},Uv.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},Uv.prototype.isInterior=function(){return this._isInterior},Uv.prototype.interfaces_=function(){return[Ng]},Uv.prototype.getClass=function(){return Uv};var Gv=function(){this._nodeMap=new ry,this._edge=null;var t=arguments[0];this._edge=t};Gv.prototype.getSplitCoordinates=function(){var t=new UA;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},Gv.prototype.addCollapsedNodes=function(){var t=new QA;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},Gv.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Gv.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var r=this._edge.getCoordinate(e),n=this._edge.getCoordinate(e+2);r.equals2D(n)&&t.add(new Yg(e+1))}},Gv.prototype.addEdgeCoordinates=function(t,e,r){var n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);r.add(new Fg(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)r.add(this._edge.getCoordinate(o));i&&r.add(new Fg(e.coord))},Gv.prototype.iterator=function(){return this._nodeMap.values().iterator()},Gv.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},Gv.prototype.findCollapseIndex=function(t,e,r){if(!t.coord.equals2D(e.coord))return!1;var n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(r[0]=t.segmentIndex+1,!0)},Gv.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),r=this.iterator(),n=r.next();r.hasNext();){var i=r.next();this.findCollapseIndex(n,i,e)&&t.add(new Yg(e[0])),n=i}},Gv.prototype.getEdge=function(){return this._edge},Gv.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},Gv.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new Fg(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new Fg(e.coord)),new Hv(o,this._edge.getData())},Gv.prototype.add=function(t,e){var r=new Uv(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(r);return null!==n?(dA.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(r,r),r)},Gv.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),r=t.get(0).getCoordinate(0);if(!r.equals2D(e[0]))throw new fA("bad split edge start point at "+r);var n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new fA("bad split edge end point at "+i)},Gv.prototype.interfaces_=function(){return[]},Gv.prototype.getClass=function(){return Gv};var zv=function(){};zv.prototype.interfaces_=function(){return[]},zv.prototype.getClass=function(){return zv},zv.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new Tg("Cannot compute the octant for point ( "+t+", "+e+" )");var r=Math.abs(t),n=Math.abs(e);return t>=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof Fg&&arguments[1]instanceof Fg){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new Tg("Cannot compute the octant for two identical points "+i);return zv.octant(s,a)}};var jv=function(){};jv.prototype.getCoordinates=function(){},jv.prototype.size=function(){},jv.prototype.getCoordinate=function(t){},jv.prototype.isClosed=function(){},jv.prototype.setData=function(t){},jv.prototype.getData=function(){},jv.prototype.interfaces_=function(){return[]},jv.prototype.getClass=function(){return jv};var Vv=function(){};Vv.prototype.addIntersection=function(t,e){},Vv.prototype.interfaces_=function(){return[jv]},Vv.prototype.getClass=function(){return Vv};var Hv=function(){this._nodeList=new Gv(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Hv.prototype.getCoordinates=function(){return this._pts},Hv.prototype.size=function(){return this._pts.length},Hv.prototype.getCoordinate=function(t){return this._pts[t]},Hv.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Hv.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Hv.prototype.setData=function(t){this._data=t},Hv.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:zv.octant(t,e)},Hv.prototype.getData=function(){return this._data},Hv.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new Fg(arguments[0].getIntersection(n));this.addIntersection(i,r)}},Hv.prototype.toString=function(){return cA.toLineString(new Qy(this._pts))},Hv.prototype.getNodeList=function(){return this._nodeList},Hv.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n<this._pts.length){var i=this._pts[n];t.equals2D(i)&&(r=n)}return this._nodeList.add(t,r)},Hv.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},Hv.prototype.interfaces_=function(){return[Vv]},Hv.prototype.getClass=function(){return Hv},Hv.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new QA;return Hv.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){n.next().getNodeList().addSplitEdges(r)}};var qv=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new Fg,this.p1=new Fg;else if(1===arguments.length){var t=arguments[0];this.p0=new Fg(t.p0),this.p1=new Fg(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=arguments[3];this.p0=new Fg(e,r),this.p1=new Fg(n,i)}},Yv={serialVersionUID:{configurable:!0}};qv.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},qv.prototype.orientationIndex=function(){if(arguments[0]instanceof qv){var t=arguments[0],e=_A.orientationIndex(this.p0,this.p1,t.p0),r=_A.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof Fg){var n=arguments[0];return _A.orientationIndex(this.p0,this.p1,n)}},qv.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},qv.prototype.isVertical=function(){return this.p0.x===this.p1.x},qv.prototype.equals=function(t){if(!(t instanceof qv))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},qv.prototype.intersection=function(t){var e=new yA;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},qv.prototype.project=function(){if(arguments[0]instanceof Fg){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Fg(t);var e=this.projectionFactor(t),r=new Fg;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof qv){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(n.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(n.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new qv(s,a)}},qv.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},qv.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},qv.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},qv.prototype.distancePerpendicular=function(t){return _A.distancePointLinePerpendicular(t,this.p0,this.p1)},qv.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},qv.prototype.midPoint=function(){return qv.midPoint(this.p0,this.p1)},qv.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,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?Lg.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},qv.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=Lg.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<n&&(n=i,r[0]=s,r[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<n&&(n=i,r[0]=this.p0,r[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<n&&(n=i,r[0]=this.p1,r[1]=u),r},qv.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},qv.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},qv.prototype.getLength=function(){return this.p0.distance(this.p1)},qv.prototype.compareTo=function(t){var e=t,r=this.p0.compareTo(e.p0);return 0!==r?r:this.p1.compareTo(e.p1)},qv.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},qv.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},qv.prototype.lineIntersection=function(t){try{return iA.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof rA))throw t}return null},qv.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},qv.prototype.pointAlongOffset=function(t,e){var r=this.p0.x+t*(this.p1.x-this.p0.x),n=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,u=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,u=e*o/s}return new Fg(r-u,n+a)},qv.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=r.x,this.p1.y=r.y}},qv.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||Lg.isNaN(e))&&(e=1),e},qv.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},qv.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},qv.prototype.distance=function(){if(arguments[0]instanceof qv){var t=arguments[0];return _A.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof Fg){var e=arguments[0];return _A.distancePointLine(e,this.p0,this.p1)}},qv.prototype.pointAlong=function(t){var e=new Fg;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},qv.prototype.hashCode=function(){var t=Lg.doubleToLongBits(this.p0.x);t^=31*Lg.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=Lg.doubleToLongBits(this.p1.x);return r^=31*Lg.doubleToLongBits(this.p1.y),e^(Math.trunc(r)^Math.trunc(r>>32))},qv.prototype.interfaces_=function(){return[Ng,kg]},qv.prototype.getClass=function(){return qv},qv.midPoint=function(t,e){return new Fg((t.x+e.x)/2,(t.y+e.y)/2)},Yv.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(qv,Yv);var Xv=function(){this.tempEnv1=new oA,this.tempEnv2=new oA,this._overlapSeg1=new qv,this._overlapSeg2=new qv};Xv.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},Xv.prototype.interfaces_=function(){return[]},Xv.prototype.getClass=function(){return Xv};var Wv=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],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};Wv.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},Wv.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var s=Math.trunc((e+r)/2);e<s&&this.computeSelect(t,e,s,n),s<r&&this.computeSelect(t,s,r,n)},Wv.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,r=this._start;r<=this._end;r++)t[e++]=this._pts[r];return t},Wv.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},Wv.prototype.setId=function(t){this._id=t},Wv.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},Wv.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new oA(t,e)}return this._env},Wv.prototype.getEndIndex=function(){return this._end},Wv.prototype.getStartIndex=function(){return this._start},Wv.prototype.getContext=function(){return this._context},Wv.prototype.getId=function(){return this._id},Wv.prototype.computeOverlapsInternal=function(t,e,r,n,i,o){var s=this._pts[t],a=this._pts[e],u=r._pts[n],l=r._pts[i];if(e-t==1&&i-n==1)return o.overlap(this,t,r,n),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),c=Math.trunc((n+i)/2);t<h&&(n<c&&this.computeOverlapsInternal(t,h,r,n,c,o),c<i&&this.computeOverlapsInternal(t,h,r,c,i,o)),h<e&&(n<c&&this.computeOverlapsInternal(h,e,r,n,c,o),c<i&&this.computeOverlapsInternal(h,e,r,c,i,o))},Wv.prototype.interfaces_=function(){return[]},Wv.prototype.getClass=function(){return Wv};var Jv=function(){};Jv.prototype.interfaces_=function(){return[]},Jv.prototype.getClass=function(){return Jv},Jv.getChainStartIndices=function(t){var e=0,r=new QA;r.add(new Yg(e));do{var n=Jv.findChainEnd(t,e);r.add(new Yg(n)),e=n}while(e<t.length-1);return Jv.toIntArray(r)},Jv.findChainEnd=function(t,e){for(var r=e;r<t.length-1&&t[r].equals2D(t[r+1]);)r++;if(r>=t.length-1)return t.length-1;for(var n=yv.quadrant(t[r],t[r+1]),i=e+1;i<t.length;){if(!t[i-1].equals2D(t[i]))if(yv.quadrant(t[i-1],t[i])!==n)break;i++}return i-1},Jv.getChains=function(){if(1===arguments.length)return Jv.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],r=new QA,n=Jv.getChainStartIndices(t),i=0;i<n.length-1;i++){var o=new Wv(t,n[i],n[i+1],e);r.add(o)}return r}},Jv.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var Kv=function(){};Kv.prototype.computeNodes=function(t){},Kv.prototype.getNodedSubstrings=function(){},Kv.prototype.interfaces_=function(){return[]},Kv.prototype.getClass=function(){return Kv};var Zv=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};Zv.prototype.setSegmentIntersector=function(t){this._segInt=t},Zv.prototype.interfaces_=function(){return[Kv]},Zv.prototype.getClass=function(){return Zv};var $v=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new QA,this._index=new Fv,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return Hv.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,r=Jv.getChains(t.getCoordinates(),t).iterator();r.hasNext();){var n=r.next();n.setId(e._idCounter++),e._index.insert(n.getEnvelope(),n),e._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=this,e=new tm(this._segInt),r=this._monoChains.iterator();r.hasNext();)for(var n=r.next(),i=t._index.query(n.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>n.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return tm},Object.defineProperties(e,r),e}(Zv),tm=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],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Xv),em=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 r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},rm={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}};em.prototype.getEndCapStyle=function(){return this._endCapStyle},em.prototype.isSingleSided=function(){return this._isSingleSided},em.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=em.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=em.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==em.JOIN_ROUND&&(this._quadrantSegments=em.DEFAULT_QUADRANT_SEGMENTS)},em.prototype.getJoinStyle=function(){return this._joinStyle},em.prototype.setJoinStyle=function(t){this._joinStyle=t},em.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},em.prototype.getSimplifyFactor=function(){return this._simplifyFactor},em.prototype.getQuadrantSegments=function(){return this._quadrantSegments},em.prototype.setEndCapStyle=function(t){this._endCapStyle=t},em.prototype.getMitreLimit=function(){return this._mitreLimit},em.prototype.setMitreLimit=function(t){this._mitreLimit=t},em.prototype.setSingleSided=function(t){this._isSingleSided=t},em.prototype.interfaces_=function(){return[]},em.prototype.getClass=function(){return em},em.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},rm.CAP_ROUND.get=function(){return 1},rm.CAP_FLAT.get=function(){return 2},rm.CAP_SQUARE.get=function(){return 3},rm.JOIN_ROUND.get=function(){return 1},rm.JOIN_MITRE.get=function(){return 2},rm.JOIN_BEVEL.get=function(){return 3},rm.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},rm.DEFAULT_MITRE_LIMIT.get=function(){return 5},rm.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(em,rm);var nm=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=_A.COUNTERCLOCKWISE,this._inputLine=t||null},im={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};nm.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[r];return!!this.isConcave(i,o,s)&&(!!this.isShallow(i,o,s,n)&&this.isShallowSampled(i,o,t,r,n))},nm.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n<this._inputLine.length;){var o=!1;t.isDeletable(e,r,n,t._distanceTol)&&(t._isDeleted[r]=nm.DELETE,o=!0,i=!0),e=o?n:r,r=t.findNextNonDeletedIndex(e),n=t.findNextNonDeletedIndex(r)}return i},nm.prototype.isShallowConcavity=function(t,e,r,n){return _A.computeOrientation(t,e,r)===this._angleOrientation&&_A.distancePointLine(e,t,r)<n},nm.prototype.isShallowSampled=function(t,e,r,n,i){var o=Math.trunc((n-r)/nm.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=r;s<n;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},nm.prototype.isConcave=function(t,e,r){var n=_A.computeOrientation(t,e,r)===this._angleOrientation;return n},nm.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=_A.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},nm.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===nm.DELETE;)e++;return e},nm.prototype.isShallow=function(t,e,r,n){return _A.distancePointLine(e,t,r)<n},nm.prototype.collapseLine=function(){for(var t=new UA,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==nm.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},nm.prototype.interfaces_=function(){return[]},nm.prototype.getClass=function(){return nm},nm.simplify=function(t,e){return new nm(t).simplify(e)},im.INIT.get=function(){return 0},im.DELETE.get=function(){return 1},im.KEEP.get=function(){return 1},im.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(nm,im);var om=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new QA},sm={COORDINATE_ARRAY_TYPE:{configurable:!0}};om.prototype.getCoordinates=function(){return this._ptList.toArray(om.COORDINATE_ARRAY_TYPE)},om.prototype.setPrecisionModel=function(t){this._precisionModel=t},om.prototype.addPt=function(t){var e=new Fg(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},om.prototype.revere=function(){},om.prototype.addPts=function(t,e){if(e)for(var r=0;r<t.length;r++)this.addPt(t[r]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},om.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},om.prototype.toString=function(){return(new Yy).createLineString(this.getCoordinates()).toString()},om.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new Fg(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},om.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},om.prototype.interfaces_=function(){return[]},om.prototype.getClass=function(){return om},sm.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(om,sm);var am=function(){},um={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};am.prototype.interfaces_=function(){return[]},am.prototype.getClass=function(){return am},am.toDegrees=function(t){return 180*t/Math.PI},am.normalize=function(t){for(;t>Math.PI;)t-=am.PI_TIMES_2;for(;t<=-Math.PI;)t+=am.PI_TIMES_2;return t},am.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],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},am.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},am.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},am.interiorAngle=function(t,e,r){var n=am.angle(e,t),i=am.angle(e,r);return Math.abs(i-n)},am.normalizePositive=function(t){if(t<0){for(;t<0;)t+=am.PI_TIMES_2;t>=am.PI_TIMES_2&&(t=0)}else{for(;t>=am.PI_TIMES_2;)t-=am.PI_TIMES_2;t<0&&(t=0)}return t},am.angleBetween=function(t,e,r){var n=am.angle(e,t),i=am.angle(e,r);return am.diff(n,i)},am.diff=function(t,e){var r=null;return(r=t<e?e-t:t-e)>Math.PI&&(r=2*Math.PI-r),r},am.toRadians=function(t){return t*Math.PI/180},am.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?am.COUNTERCLOCKWISE:r<0?am.CLOCKWISE:am.NONE},am.angleBetweenOriented=function(t,e,r){var n=am.angle(e,t),i=am.angle(e,r)-n;return i<=-Math.PI?i+am.PI_TIMES_2:i>Math.PI?i-am.PI_TIMES_2:i},um.PI_TIMES_2.get=function(){return 2*Math.PI},um.PI_OVER_2.get=function(){return Math.PI/2},um.PI_OVER_4.get=function(){return Math.PI/4},um.COUNTERCLOCKWISE.get=function(){return _A.COUNTERCLOCKWISE},um.CLOCKWISE.get=function(){return _A.CLOCKWISE},um.NONE.get=function(){return _A.COLLINEAR},Object.defineProperties(am,um);var lm=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 qv,this._seg1=new qv,this._offset0=new qv,this._offset1=new qv,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new yA,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===em.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},hm={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}};lm.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 r=_A.computeOrientation(this._s0,this._s1,this._s2),n=r===_A.CLOCKWISE&&this._side===ev.LEFT||r===_A.COUNTERCLOCKWISE&&this._side===ev.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},lm.prototype.addLineEndCap=function(t,e){var r=new qv(t,e),n=new qv;this.computeOffsetSegment(r,ev.LEFT,this._distance,n);var i=new qv;this.computeOffsetSegment(r,ev.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case em.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,_A.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case em.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case em.CAP_SQUARE:var u=new Fg;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new Fg(n.p1.x+u.x,n.p1.y+u.y),h=new Fg(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(h)}},lm.prototype.getCoordinates=function(){return this._segList.getCoordinates()},lm.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=iA.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof rA))throw t;o=new Fg(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},lm.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=r.x-t.x,l=r.y-t.y,h=Math.atan2(l,u);n===_A.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,n,i),this._segList.addPt(r)},lm.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*lm.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===em.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===em.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},lm.prototype.createSquare=function(t){this._segList.addPt(new Fg(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new Fg(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new Fg(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new Fg(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},lm.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},lm.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},lm.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},lm.prototype.initSideSegments=function(t,e,r){this._s1=t,this._s2=e,this._side=r,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,r,this._distance,this._offset1)},lm.prototype.addLimitedMitreJoin=function(t,e,r,n){var i=this._seg0.p1,o=am.angle(i,this._seg0.p0),s=am.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=am.normalize(o+s),u=am.normalize(a+Math.PI),l=n*r,h=r-l*Math.abs(Math.sin(s)),c=i.x+l*Math.cos(u),f=i.y+l*Math.sin(u),p=new Fg(c,f),d=new qv(i,p),g=d.pointAlongOffset(1,h),A=d.pointAlongOffset(1,-h);this._side===ev.LEFT?(this._segList.addPt(g),this._segList.addPt(A)):(this._segList.addPt(A),this._segList.addPt(g))},lm.prototype.computeOffsetSegment=function(t,e,r,n){var i=e===ev.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),u=i*r*o/a,l=i*r*s/a;n.p0.x=t.p0.x-l,n.p0.y=t.p0.y+u,n.p1.x=t.p1.x-l,n.p1.y=t.p1.y+u},lm.prototype.addFilletArc=function(t,e,r,n,i){var o=n===_A.CLOCKWISE?-1:1,s=Math.abs(e-r),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,h=new Fg;l<s;){var c=e+o*l;h.x=t.x+i*Math.cos(c),h.y=t.y+i*Math.sin(c),this._segList.addPt(h),l+=u}},lm.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*lm.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var r=new Fg((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(r);var n=new Fg((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)}},lm.prototype.createCircle=function(t){var e=new Fg(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},lm.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},lm.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new om,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*lm.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},lm.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===em.JOIN_BEVEL||this._bufParams.getJoinStyle()===em.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,_A.CLOCKWISE,this._distance))},lm.prototype.closeRing=function(){this._segList.closeRing()},lm.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},lm.prototype.interfaces_=function(){return[]},lm.prototype.getClass=function(){return lm},hm.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},hm.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},hm.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},hm.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(lm,hm);var cm=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};cm.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&GA.reverse(o),o},cm.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=nm.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],ev.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{r.addSegments(t,!1);var a=nm.simplify(t,n),u=a.length-1;r.initSideSegments(a[0],a[1],ev.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(a[l],!0)}r.addLastSegment(),r.closeRing()},cm.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===ev.RIGHT&&(n=-n);var i=nm.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;r.addNextSegment(i[s],a)}r.closeRing()},cm.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=nm.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],ev.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var s=nm.simplify(t,-r),a=s.length-1;e.initSideSegments(s[a],s[a-1],ev.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},cm.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case em.CAP_ROUND:e.createCircle(t);break;case em.CAP_SQUARE:e.createSquare(t)}},cm.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},cm.prototype.getBufferParameters=function(){return this._bufParams},cm.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},cm.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return cm.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},cm.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=nm.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],ev.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{var a=nm.simplify(t,n),u=a.length-1;r.initSideSegments(a[0],a[1],ev.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(a[l],!0)}r.addLastSegment()},cm.prototype.getSegGen=function(t){return new lm(this._precisionModel,this._bufParams,t)},cm.prototype.interfaces_=function(){return[]},cm.prototype.getClass=function(){return cm},cm.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;r<e.length;r++)e[r]=new Fg(t[r]);return e};var fm=function(){this._subgraphs=null,this._seg=new qv,this._cga=new _A;var t=arguments[0];this._subgraphs=t},pm={DepthSegment:{configurable:!0}};fm.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=new QA,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(jg(arguments[2],kA)&&arguments[0]instanceof Fg&&arguments[1]instanceof _v)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getEdge().getCoordinates(),h=0;h<l.length-1;h++){if(t._seg.p0=l[h],t._seg.p1=l[h+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse(),!(Math.max(t._seg.p0.x,t._seg.p1.x)<s.x||t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||_A.computeOrientation(t._seg.p0,t._seg.p1,s)===_A.RIGHT)){var c=a.getDepth(ev.LEFT);t._seg.p0.equals(l[h])||(c=a.getDepth(ev.RIGHT));var f=new dm(t._seg,c);u.add(f)}}else if(jg(arguments[2],kA)&&arguments[0]instanceof Fg&&jg(arguments[1],kA))for(var p=arguments[0],d=arguments[2],g=arguments[1].iterator();g.hasNext();){var A=g.next();A.isForward()&&t.findStabbedSegments(p,A,d)}},fm.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Lv.min(e)._leftDepth},fm.prototype.interfaces_=function(){return[]},fm.prototype.getClass=function(){return fm},pm.DepthSegment.get=function(){return dm},Object.defineProperties(fm,pm);var dm=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new qv(t),this._leftDepth=e};dm.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 r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!==(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},dm.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},dm.prototype.toString=function(){return this._upwardSeg.toString()},dm.prototype.interfaces_=function(){return[Ng]},dm.prototype.getClass=function(){return dm};var gm=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};gm.prototype.area=function(){return gm.area(this.p0,this.p1,this.p2)},gm.prototype.signedArea=function(){return gm.signedArea(this.p0,this.p1,this.p2)},gm.prototype.interpolateZ=function(t){if(null===t)throw new Tg("Supplied point is null.");return gm.interpolateZ(t,this.p0,this.p1,this.p2)},gm.prototype.longestSideLength=function(){return gm.longestSideLength(this.p0,this.p1,this.p2)},gm.prototype.isAcute=function(){return gm.isAcute(this.p0,this.p1,this.p2)},gm.prototype.circumcentre=function(){return gm.circumcentre(this.p0,this.p1,this.p2)},gm.prototype.area3D=function(){return gm.area3D(this.p0,this.p1,this.p2)},gm.prototype.centroid=function(){return gm.centroid(this.p0,this.p1,this.p2)},gm.prototype.inCentre=function(){return gm.inCentre(this.p0,this.p1,this.p2)},gm.prototype.interfaces_=function(){return[]},gm.prototype.getClass=function(){return gm},gm.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},gm.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},gm.det=function(t,e,r,n){return t*n-e*r},gm.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,s=r.x-i,a=n.x-i,u=r.y-o,l=n.y-o,h=s*l-a*u,c=t.x-i,f=t.y-o,p=(l*c-a*f)/h,d=(-u*c+s*f)/h;return e.z+p*(r.z-e.z)+d*(n.z-e.z)},gm.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),s=n;return i>s&&(s=i),o>s&&(s=o),s},gm.isAcute=function(t,e,r){return!!am.isAcute(t,e,r)&&(!!am.isAcute(e,r,t)&&!!am.isAcute(r,t,e))},gm.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,s=t.y-i,a=e.x-n,u=e.y-i,l=2*gm.det(o,s,a,u),h=gm.det(s,o*o+s*s,u,a*a+u*u),c=gm.det(o,o*o+s*s,a,a*a+u*u);return new Fg(n-h/l,i+c/l)},gm.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new iA(t.x+r/2,t.y+n/2,1),o=new iA(t.x-n+r/2,t.y+r+n/2,1);return new iA(i,o)},gm.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,s=r.y-t.y;return new Fg(t.x+i*o,t.y+i*s)},gm.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=r.x-t.x,a=r.y-t.y,u=r.z-t.z,l=i*u-o*a,h=o*s-n*u,c=n*a-i*s,f=l*l+h*h+c*c,p=Math.sqrt(f)/2;return p},gm.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new Fg(n,i)},gm.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),s=n+i+o,a=(n*t.x+i*e.x+o*r.x)/s,u=(n*t.y+i*e.y+o*r.y)/s;return new Fg(a,u)};var Am=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new QA;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};Am.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,Gg.EXTERIOR,Gg.INTERIOR)},Am.prototype.addPolygon=function(t){var e=this,r=this._distance,n=ev.LEFT;this._distance<0&&(r=-this._distance,n=ev.RIGHT);var i=t.getExteriorRing(),o=GA.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,Gg.EXTERIOR,Gg.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),u=GA.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,r,ev.opposite(n),Gg.INTERIOR,Gg.EXTERIOR)}},Am.prototype.isTriangleErodedCompletely=function(t,e){var r=new gm(t[0],t[1],t[2]),n=r.inCentre();return _A.distancePointLine(n,r.p0,r.p1)<Math.abs(e)},Am.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=GA.removeRepeatedPoints(t.getCoordinates()),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,Gg.EXTERIOR,Gg.INTERIOR)},Am.prototype.addCurve=function(t,e,r){if(null===t||t.length<2)return null;var n=new Hv(t,new hv(0,Gg.BOUNDARY,e,r));this._curveList.add(n)},Am.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Am.prototype.addPolygonRing=function(t,e,r,n,i){if(0===e&&t.length<Ly.MINIMUM_VALID_SIZE)return null;var o=n,s=i;t.length>=Ly.MINIMUM_VALID_SIZE&&_A.isCCW(t)&&(o=i,s=n,r=ev.opposite(r));var a=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(a,o,s)},Am.prototype.add=function(t){if(t.isEmpty())return null;t instanceof My?this.addPolygon(t):t instanceof Cy?this.addLineString(t):t instanceof Sy?this.addPoint(t):(t instanceof Ty||t instanceof py||t instanceof Ry||t instanceof fy)&&this.addCollection(t)},Am.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},Am.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},Am.prototype.interfaces_=function(){return[]},Am.prototype.getClass=function(){return Am};var ym=function(){};ym.prototype.locate=function(t){},ym.prototype.interfaces_=function(){return[]},ym.prototype.getClass=function(){return ym};var vm=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};vm.prototype.next=function(){if(this._atStart)return this._atStart=!1,vm.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new FA;var t=this._parent.getGeometryN(this._index++);return t instanceof fy?(this._subcollectionIterator=new vm(t),this._subcollectionIterator.next()):t},vm.prototype.remove=function(){throw new Error(this.getClass().getName())},vm.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)},vm.prototype.interfaces_=function(){return[DA]},vm.prototype.getClass=function(){return vm},vm.isAtomic=function(t){return!(t instanceof fy)};var mm=function(){this._geom=null;var t=arguments[0];this._geom=t};mm.prototype.locate=function(t){return mm.locate(t,this._geom)},mm.prototype.interfaces_=function(){return[ym]},mm.prototype.getClass=function(){return mm},mm.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&_A.isPointInRing(t,e.getCoordinates())},mm.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!mm.isPointInRing(t,r))return!1;for(var n=0;n<e.getNumInteriorRing();n++){var i=e.getInteriorRingN(n);if(mm.isPointInRing(t,i))return!1}return!0},mm.containsPoint=function(t,e){if(e instanceof My)return mm.containsPointInPolygon(t,e);if(e instanceof fy)for(var r=new vm(e);r.hasNext();){var n=r.next();if(n!==e&&mm.containsPoint(t,n))return!0}return!1},mm.locate=function(t,e){return e.isEmpty()?Gg.EXTERIOR:mm.containsPoint(t,e)?Gg.INTERIOR:Gg.EXTERIOR};var _m=function(){this._edgeMap=new ry,this._edgeList=null,this._ptInAreaLocation=[Gg.NONE,Gg.NONE]};_m.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),r=e-1;return 0===e&&(r=this._edgeList.size()-1),this._edgeList.get(r)},_m.prototype.propagateSideLabels=function(t){for(var e=Gg.NONE,r=this.iterator();r.hasNext();){var n=r.next().getLabel();n.isArea(t)&&n.getLocation(t,ev.LEFT)!==Gg.NONE&&(e=n.getLocation(t,ev.LEFT))}if(e===Gg.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,ev.ON)===Gg.NONE&&a.setLocation(t,ev.ON,i),a.isArea(t)){var u=a.getLocation(t,ev.LEFT),l=a.getLocation(t,ev.RIGHT);if(l!==Gg.NONE){if(l!==i)throw new sv("side location conflict",s.getCoordinate());u===Gg.NONE&&dA.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else dA.isTrue(a.getLocation(t,ev.LEFT)===Gg.NONE,"found single null side"),a.setLocation(t,ev.RIGHT,i),a.setLocation(t,ev.LEFT,i)}}},_m.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},_m.prototype.print=function(t){nA.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){e.next().print(t)}},_m.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},_m.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var r=e.size()-1,n=e.get(r).getLabel().getLocation(t,ev.LEFT);dA.isTrue(n!==Gg.NONE,"Found unlabelled area edge");for(var i=n,o=this.iterator();o.hasNext();){var s=o.next().getLabel();dA.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,ev.LEFT),u=s.getLocation(t,ev.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},_m.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++){if(this._edgeList.get(e)===t)return e}return-1},_m.prototype.iterator=function(){return this.getEdges().iterator()},_m.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new QA(this._edgeMap.values())),this._edgeList},_m.prototype.getLocation=function(t,e,r){return this._ptInAreaLocation[t]===Gg.NONE&&(this._ptInAreaLocation[t]=mm.locate(e,r[t].getGeometry())),this._ptInAreaLocation[t]},_m.prototype.toString=function(){var t=new qg;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var r=e.next();t.append(r),t.append("\n")}return t.toString()},_m.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){e.next().computeLabel(t)}},_m.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],r=this.iterator();r.hasNext();)for(var n=r.next().getLabel(),i=0;i<2;i++)n.isLine(i)&&n.getLocation(i)===Gg.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var l=Gg.NONE;if(e[u])l=Gg.EXTERIOR;else{var h=s.getCoordinate();l=this.getLocation(u,h,t)}a.setAllLocationsIfNull(u,l)}},_m.prototype.getDegree=function(){return this._edgeMap.size()},_m.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},_m.prototype.interfaces_=function(){return[]},_m.prototype.getClass=function(){return _m};var Im=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var t=this;this.getResultAreaEdges();for(var e=null,r=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),n){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;r=s,n=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;r.setNext(o),n=t._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===e)throw new sv("no outgoing dirEdge found",this.getCoordinate());dA.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),r.setNext(e)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var r=t.get(0);if(1===e)return r;var n=t.get(e-1),i=r.getQuadrant(),o=n.getQuadrant();return yv.isNorthern(i)&&yv.isNorthern(o)?r:yv.isNorthern(i)||yv.isNorthern(o)?0!==r.getDy()?r:0!==n.getDy()?n:(dA.shouldNeverReachHere("found two horizontal edges incident on node"),null):n},e.prototype.print=function(t){nA.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var r=e.next();t.print("out "),r.print(t),t.println(),t.print("in "),r.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new QA;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next().getLabel();r.setAllLocationsIfNull(0,t.getLocation(0)),r.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,r=this._edgeList.size()-1;r>=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(ev.LEFT),n=t.getDepth(ev.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new sv("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var u=this._edgeList.get(a);u.setEdgeDepths(ev.RIGHT,s),s=u.getDepth(ev.LEFT)}return s}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=this,r=null,n=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===r&&s.getEdgeRing()===t&&(r=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(dA.isTrue(null!==r,"found null for first outgoing dirEdge"),dA.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},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 r=arguments[0],n=0,i=this.iterator();i.hasNext();){i.next().getEdgeRing()===r&&n++}return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=Gg.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=Gg.INTERIOR;break}if(n.isInResult()){t=Gg.EXTERIOR;break}}}if(t===Gg.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===Gg.INTERIOR):(s.isInResult()&&(i=Gg.EXTERIOR),a.isInResult()&&(i=Gg.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new hv(Gg.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==Gg.INTERIOR&&o!==Gg.BOUNDARY||this._label.setLocation(i,Gg.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(_m),Em=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 gv(t,new Im)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Iv),xm=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};xm.prototype.compareTo=function(t){var e=t;return xm.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},xm.prototype.interfaces_=function(){return[Ng]},xm.prototype.getClass=function(){return xm},xm.orientation=function(t){return 1===GA.increasingDirection(t)},xm.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,s=e?t.length:-1,a=n?r.length:-1,u=e?0:t.length-1,l=n?0:r.length-1;;){var h=t[u].compareTo(r[l]);if(0!==h)return h;var c=(u+=i)===s,f=(l+=o)===a;if(c&&!f)return-1;if(!c&&f)return 1;if(c&&f)return 0}};var wm=function(){this._edges=new QA,this._ocaMap=new ry};wm.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var r=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i<n.length;i++)i>0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},wm.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},wm.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},wm.prototype.iterator=function(){return this._edges.iterator()},wm.prototype.getEdges=function(){return this._edges},wm.prototype.get=function(t){return this._edges.get(t)},wm.prototype.findEqualEdge=function(t){var e=new xm(t.getCoordinates());return this._ocaMap.get(e)},wm.prototype.add=function(t){this._edges.add(t);var e=new xm(t.getCoordinates());this._ocaMap.put(e,t)},wm.prototype.interfaces_=function(){return[]},wm.prototype.getClass=function(){return wm};var Cm=function(){};Cm.prototype.processIntersections=function(t,e,r,n){},Cm.prototype.isDone=function(){},Cm.prototype.interfaces_=function(){return[]},Cm.prototype.getClass=function(){return Cm};var bm=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};bm.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(bm.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},bm.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},bm.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},bm.prototype.getLineIntersector=function(){return this._li},bm.prototype.hasProperIntersection=function(){return this._hasProper},bm.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},bm.prototype.hasIntersection=function(){return this._hasIntersection},bm.prototype.isDone=function(){return!1},bm.prototype.hasInteriorIntersection=function(){return this._hasInterior},bm.prototype.interfaces_=function(){return[Cm]},bm.prototype.getClass=function(){return bm},bm.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Sm=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],r=arguments[2];this.coord=new Fg(t),this.segmentIndex=e,this.dist=r};Sm.prototype.getSegmentIndex=function(){return this.segmentIndex},Sm.prototype.getCoordinate=function(){return this.coord},Sm.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Sm.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Sm.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Sm.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Sm.prototype.getDistance=function(){return this.dist},Sm.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Sm.prototype.interfaces_=function(){return[Ng]},Sm.prototype.getClass=function(){return Sm};var Bm=function(){this._nodeMap=new ry,this.edge=null;var t=arguments[0];this.edge=t};Bm.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Bm.prototype.iterator=function(){return this._nodeMap.values().iterator()},Bm.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},Bm.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Bm.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new Fg(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new Nm(o,new hv(this.edge._label))},Bm.prototype.add=function(t,e,r){var n=new Sm(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},Bm.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},Bm.prototype.interfaces_=function(){return[]},Bm.prototype.getClass=function(){return Bm};var Mm=function(){};Mm.prototype.getChainStartIndices=function(t){var e=0,r=new QA;r.add(new Yg(e));do{var n=this.findChainEnd(t,e);r.add(new Yg(n)),e=n}while(e<t.length-1);return Mm.toIntArray(r)},Mm.prototype.findChainEnd=function(t,e){for(var r=yv.quadrant(t[e],t[e+1]),n=e+1;n<t.length;){if(yv.quadrant(t[n-1],t[n])!==r)break;n++}return n-1},Mm.prototype.interfaces_=function(){return[]},Mm.prototype.getClass=function(){return Mm},Mm.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var Tm=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new oA,this.env2=new oA;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Mm;this.startIndex=e.getChainStartIndices(this.pts)};Tm.prototype.getCoordinates=function(){return this.pts},Tm.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e>r?e:r},Tm.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e<r?e:r},Tm.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[r],e.startIndex[r+1],n)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],h=this.pts[i],c=this.pts[o],f=s.pts[a],p=s.pts[u];if(o-i==1&&u-a==1)return l.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(h,c),this.env2.init(f,p),!this.env1.intersects(this.env2))return null;var d=Math.trunc((i+o)/2),g=Math.trunc((a+u)/2);i<d&&(a<g&&this.computeIntersectsForChain(i,d,s,a,g,l),g<u&&this.computeIntersectsForChain(i,d,s,g,u,l)),d<o&&(a<g&&this.computeIntersectsForChain(d,o,s,a,g,l),g<u&&this.computeIntersectsForChain(d,o,s,g,u,l))}},Tm.prototype.getStartIndexes=function(){return this.startIndex},Tm.prototype.computeIntersects=function(t,e){for(var r=0;r<this.startIndex.length-1;r++)for(var n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(r,t,n,e)},Tm.prototype.interfaces_=function(){return[]},Tm.prototype.getClass=function(){return Tm};var Lm=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var r=0;r<3;r++)this._depth[e][r]=t.NULL_VALUE},Rm={NULL_VALUE:{configurable:!0}};Lm.prototype.getDepth=function(t,e){return this._depth[t][e]},Lm.prototype.setDepth=function(t,e,r){this._depth[t][e]=r},Lm.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==Lm.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===Lm.NULL_VALUE}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this._depth[n][i]===Lm.NULL_VALUE}},Lm.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var r=t._depth[e][1];t._depth[e][2]<r&&(r=t._depth[e][2]),r<0&&(r=0);for(var n=1;n<3;n++){var i=0;t._depth[e][n]>r&&(i=1),t._depth[e][n]=i}}},Lm.prototype.getDelta=function(t){return this._depth[t][ev.RIGHT]-this._depth[t][ev.LEFT]},Lm.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Gg.EXTERIOR:Gg.INTERIOR},Lm.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Lm.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==Gg.EXTERIOR&&i!==Gg.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=Lm.depthAtLocation(i):t._depth[r][n]+=Lm.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===Gg.INTERIOR&&this._depth[o][s]++}},Lm.prototype.interfaces_=function(){return[]},Lm.prototype.getClass=function(){return Lm},Lm.depthAtLocation=function(t){return t===Gg.EXTERIOR?0:t===Gg.INTERIOR?1:Lm.NULL_VALUE},Rm.NULL_VALUE.get=function(){return-1},Object.defineProperties(Lm,Rm);var Nm=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Bm(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Lm,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}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,hv.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 r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(r.pts[s])||(n=!1),this.pts[s].equals2D(r.pts[--o])||(i=!1),!n&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?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;e<this.pts.length;e++)e>0&&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 Tm(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new oA;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,r,n){var i=new Fg(t.getIntersection(n)),o=e,s=t.getEdgeDistance(r,n),a=o+1;if(a<this.pts.length){var u=this.pts[a];i.equals2D(u)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new qg;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&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;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],r=arguments[1];r.setAtLeastIfValid(e.getLocation(0,ev.ON),e.getLocation(1,ev.ON),1),e.isArea()&&(r.setAtLeastIfValid(e.getLocation(0,ev.LEFT),e.getLocation(1,ev.LEFT),2),r.setAtLeastIfValid(e.getLocation(0,ev.RIGHT),e.getLocation(1,ev.RIGHT),2))},e}(dv),Pm=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new wm,this._bufParams=t||null};Pm.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Pm.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new hv(t.getLabel())).flip(),r.merge(n);var i=Pm.depthDelta(n),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(Pm.depthDelta(t.getLabel()))},Pm.prototype.buildSubgraphs=function(t,e){for(var r=new QA,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getRightmostCoordinate(),s=new fm(r).getDepth(o);i.computeDepth(s),i.findResultEdges(),r.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},Pm.prototype.createSubgraphs=function(t){for(var e=new QA,r=t.getNodes().iterator();r.hasNext();){var n=r.next();if(!n.isVisited()){var i=new uv;i.create(n),e.add(i)}}return Lv.sort(e,Lv.reverseOrder()),e},Pm.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Pm.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new $v,r=new yA;return r.setPrecisionModel(t),e.setSegmentIntersector(new bm(r)),e},Pm.prototype.buffer=function(t,e){var r=this._workingPrecisionModel;null===r&&(r=t.getPrecisionModel()),this._geomFact=t.getFactory();var n=new cm(r,this._bufParams),i=new Am(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,r),this._graph=new Ev(new Em),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new xv(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},Pm.prototype.computeNodedEdges=function(t,e){var r=this.getNoder(e);r.computeNodes(t);for(var n=r.getNodedSubstrings().iterator();n.hasNext();){var i=n.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new Nm(i.getCoordinates(),new hv(s));this.insertUniqueEdge(a)}}},Pm.prototype.setNoder=function(t){this._workingNoder=t},Pm.prototype.interfaces_=function(){return[]},Pm.prototype.getClass=function(){return Pm},Pm.depthDelta=function(t){var e=t.getLocation(0,ev.LEFT),r=t.getLocation(0,ev.RIGHT);return e===Gg.INTERIOR&&r===Gg.EXTERIOR?1:e===Gg.EXTERIOR&&r===Gg.INTERIOR?-1:0},Pm.convertSegStrings=function(t){for(var e=new Yy,r=new QA;t.hasNext();){var n=t.next(),i=e.createLineString(n.getCoordinates());r.add(i)}return e.buildGeometry(r)};var Dm=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this._noder=r,this._scaleFactor=n,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};Dm.prototype.rescale=function(){var t=this;if(jg(arguments[0],NA))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/t._scaleFactor+t._offsetX,n[i].y=n[i].y/t._scaleFactor+t._offsetY;2===n.length&&n[0].equals2D(n[1])&&nA.out.println(n)}},Dm.prototype.scale=function(){var t=this;if(jg(arguments[0],NA)){for(var e=arguments[0],r=new QA,n=e.iterator();n.hasNext();){var i=n.next();r.add(new Hv(t.scale(i.getCoordinates()),i.getData()))}return r}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new Fg(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return GA.removeRepeatedPoints(s)}},Dm.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},Dm.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Dm.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},Dm.prototype.interfaces_=function(){return[Kv]},Dm.prototype.getClass=function(){return Dm};var km=function(){this._li=new yA,this._segStrings=null;var t=arguments[0];this._segStrings=t},Fm={fact:{configurable:!0}};km.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var r=e.next().getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(n))throw new fA("found endpt/interior pt intersection at index "+s+" :pt "+n)},km.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),r=this._segStrings.iterator();r.hasNext();){var n=r.next();this.checkInteriorIntersections(e,n)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var l=0;l<a.length-1;l++)this.checkInteriorIntersections(i,u,o,l);else if(4===arguments.length){var h=arguments[0],c=arguments[1],f=arguments[2],p=arguments[3];if(h===f&&c===p)return null;var d=h.getCoordinates()[c],g=h.getCoordinates()[c+1],A=f.getCoordinates()[p],y=f.getCoordinates()[p+1];if(this._li.computeIntersection(d,g,A,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,d,g)||this.hasInteriorIntersection(this._li,A,y)))throw new fA("found non-noded intersection at "+d+"-"+g+" and "+A+"-"+y)}},km.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},km.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var r=arguments[0].getCoordinates(),n=0;n<r.length-2;n++)this.checkCollapse(r[n],r[n+1],r[n+2])},km.prototype.hasInteriorIntersection=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++){var i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(r))return!0}return!1},km.prototype.checkCollapse=function(t,e,r){if(t.equals(r))throw new fA("found non-noded collapse at "+km.fact.createLineString([t,e,r]))},km.prototype.interfaces_=function(){return[]},km.prototype.getClass=function(){return km},Fm.fact.get=function(){return new Yy},Object.defineProperties(km,Fm);var Qm=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],r=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=r,e<=0)throw new Tg("Scale factor must be non-zero");1!==e&&(this._pt=new Fg(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new Fg,this._p1Scaled=new Fg),this.initCorners(this._pt)},Om={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Qm.prototype.intersectsScaled=function(t,e){var r=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<r||this._minx>n||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return dA.isTrue(!(s&&a),"Found bad envelope test"),a},Qm.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 Fg(this._maxx,this._maxy),this._corner[1]=new Fg(this._minx,this._maxy),this._corner[2]=new Fg(this._minx,this._miny),this._corner[3]=new Fg(this._maxx,this._miny)},Qm.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))},Qm.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Qm.prototype.getCoordinate=function(){return this._originalPt},Qm.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Qm.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=Qm.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new oA(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},Qm.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())))},Qm.prototype.intersectsToleranceSquare=function(t,e){var r=!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()&&(r=!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()||(!(!r||!n)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},Qm.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},Qm.prototype.interfaces_=function(){return[]},Qm.prototype.getClass=function(){return Qm},Om.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(Qm,Om);var Um=function(){this.tempEnv1=new oA,this.selectedSegment=new qv};Um.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)}},Um.prototype.interfaces_=function(){return[]},Um.prototype.getClass=function(){return Um};var Gm=function(){this._index=null;var t=arguments[0];this._index=t},zm={HotPixelSnapAction:{configurable:!0}};Gm.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],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new jm(e,r,n);return this._index.query(i,{interfaces_:function(){return[Sv]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},Gm.prototype.interfaces_=function(){return[]},Gm.prototype.getClass=function(){return Gm},zm.HotPixelSnapAction.get=function(){return jm},Object.defineProperties(Gm,zm);var jm=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,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],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Um),Vm=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new QA};Vm.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)}},Vm.prototype.isDone=function(){return!1},Vm.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Vm.prototype.interfaces_=function(){return[Cm]},Vm.prototype.getClass=function(){return Vm};var Hm=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new yA,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};Hm.prototype.checkCorrectness=function(t){var e=Hv.getNodedSubstrings(t),r=new km(e);try{r.checkValid()}catch(t){if(!(t instanceof eA))throw t;t.printStackTrace()}},Hm.prototype.getNodedSubstrings=function(){return Hv.getNodedSubstrings(this._nodedSegStrings)},Hm.prototype.snapRound=function(t,e){var r=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(r),this.computeVertexSnaps(t)},Hm.prototype.findInteriorIntersections=function(t,e){var r=new Vm(e);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(t),r.getInteriorIntersections()},Hm.prototype.computeVertexSnaps=function(){var t=this;if(jg(arguments[0],NA))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof Hv)for(var n=arguments[0],i=n.getCoordinates(),o=0;o<i.length;o++){var s=new Qm(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,n,o)&&n.addIntersection(i[o],o)}},Hm.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new $v,this._pointSnapper=new Gm(this._noder.getIndex()),this.snapRound(t,this._li)},Hm.prototype.computeIntersectionSnaps=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next(),i=new Qm(n,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},Hm.prototype.interfaces_=function(){return[Kv]},Hm.prototype.getClass=function(){return Hm};var qm=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new em,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._argGeom=e,this._bufParams=r}},Ym={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};qm.prototype.bufferFixedPrecision=function(t){var e=new Dm(new Hm(new jy(1)),t.getScale()),r=new Pm(this._bufParams);r.setWorkingPrecisionModel(t),r.setNoder(e),this._resultGeometry=r.buffer(this._argGeom,this._distance)},qm.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=qm.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof sv))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=qm.precisionScaleFactor(this._argGeom,this._distance,r),i=new jy(n);this.bufferFixedPrecision(i)}},qm.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===jy.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},qm.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},qm.prototype.bufferOriginalPrecision=function(){try{var t=new Pm(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof fA))throw t;this._saveException=t}},qm.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},qm.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},qm.prototype.interfaces_=function(){return[]},qm.prototype.getClass=function(){return qm},qm.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new qm(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof xA&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new qm(arguments[0]);return n.setQuadrantSegments(r),n.getResultGeometry(e)}if(arguments[2]instanceof em&&arguments[0]instanceof xA&&"number"==typeof arguments[1]){var i=arguments[1];return new qm(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],u=new qm(arguments[0]);return u.setQuadrantSegments(s),u.setEndCapStyle(a),u.getResultGeometry(o)}},qm.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=Vg.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},Ym.CAP_ROUND.get=function(){return em.CAP_ROUND},Ym.CAP_BUTT.get=function(){return em.CAP_FLAT},Ym.CAP_FLAT.get=function(){return em.CAP_FLAT},Ym.CAP_SQUARE.get=function(){return em.CAP_SQUARE},Ym.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(qm,Ym);var Xm=function(){this._pt=[new Fg,new Fg],this._distance=Lg.NaN,this._isNull=!0};Xm.prototype.getCoordinates=function(){return this._pt},Xm.prototype.getCoordinate=function(t){return this._pt[t]},Xm.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],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},Xm.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},Xm.prototype.getDistance=function(){return this._distance},Xm.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},Xm.prototype.interfaces_=function(){return[]},Xm.prototype.getClass=function(){return Xm};var Wm=function(){};Wm.prototype.interfaces_=function(){return[]},Wm.prototype.getClass=function(){return Wm},Wm.computeDistance=function(){if(arguments[2]instanceof Xm&&arguments[0]instanceof Cy&&arguments[1]instanceof Fg)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new qv,i=0;i<r.length-1;i++){n.setCoordinates(r[i],r[i+1]);var o=n.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof Xm&&arguments[0]instanceof My&&arguments[1]instanceof Fg){var s=arguments[0],a=arguments[1],u=arguments[2];Wm.computeDistance(s.getExteriorRing(),a,u);for(var l=0;l<s.getNumInteriorRing();l++)Wm.computeDistance(s.getInteriorRingN(l),a,u)}else if(arguments[2]instanceof Xm&&arguments[0]instanceof xA&&arguments[1]instanceof Fg){var h=arguments[0],c=arguments[1],f=arguments[2];if(h instanceof Cy)Wm.computeDistance(h,c,f);else if(h instanceof My)Wm.computeDistance(h,c,f);else if(h instanceof fy)for(var p=h,d=0;d<p.getNumGeometries();d++){var g=p.getGeometryN(d);Wm.computeDistance(g,c,f)}else f.setMinimum(h.getCoordinate(),c)}else if(arguments[2]instanceof Xm&&arguments[0]instanceof qv&&arguments[1]instanceof Fg){var A=arguments[1],y=arguments[2],v=arguments[0].closestPoint(A);y.setMinimum(v,A)}};var Jm=function(t){this._maxPtDist=new Xm,this._inputGeom=t||null},Km={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Jm.prototype.computeMaxMidpointDistance=function(t){var e=new $m(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Jm.prototype.computeMaxVertexDistance=function(t){var e=new Zm(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Jm.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Jm.prototype.getDistancePoints=function(){return this._maxPtDist},Jm.prototype.interfaces_=function(){return[]},Jm.prototype.getClass=function(){return Jm},Km.MaxPointDistanceFilter.get=function(){return Zm},Km.MaxMidpointDistanceFilter.get=function(){return $m},Object.defineProperties(Jm,Km);var Zm=function(t){this._maxPtDist=new Xm,this._minPtDist=new Xm,this._geom=t||null};Zm.prototype.filter=function(t){this._minPtDist.initialize(),Wm.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Zm.prototype.getMaxPointDistance=function(){return this._maxPtDist},Zm.prototype.interfaces_=function(){return[bA]},Zm.prototype.getClass=function(){return Zm};var $m=function(t){this._maxPtDist=new Xm,this._minPtDist=new Xm,this._geom=t||null};$m.prototype.filter=function(t,e){if(0===e)return null;var r=t.getCoordinate(e-1),n=t.getCoordinate(e),i=new Fg((r.x+n.x)/2,(r.y+n.y)/2);this._minPtDist.initialize(),Wm.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},$m.prototype.isDone=function(){return!1},$m.prototype.isGeometryChanged=function(){return!1},$m.prototype.getMaxPointDistance=function(){return this._maxPtDist},$m.prototype.interfaces_=function(){return[cy]},$m.prototype.getClass=function(){return $m};var t_=function(t){this._comps=t||null};t_.prototype.filter=function(t){t instanceof My&&this._comps.add(t)},t_.prototype.interfaces_=function(){return[hy]},t_.prototype.getClass=function(){return t_},t_.getPolygons=function(){if(1===arguments.length)return t_.getPolygons(arguments[0],new QA);if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof My?e.add(t):t instanceof fy&&t.apply(new t_(e)),e}};var e_=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._lines=e,this._isForcedToLineString=r}};e_.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Ly){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Cy&&this._lines.add(t)},e_.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},e_.prototype.interfaces_=function(){return[EA]},e_.prototype.getClass=function(){return e_},e_.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(e_.getLines(t))}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().buildGeometry(e_.getLines(e,r))}},e_.getLines=function(){if(1===arguments.length)return e_.getLines(arguments[0],!1);if(2===arguments.length){if(jg(arguments[0],NA)&&jg(arguments[1],NA)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var r=e.next();e_.getLines(r,t)}return t}if(arguments[0]instanceof xA&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1],o=new QA;return n.apply(new e_(o,i)),o}if(arguments[0]instanceof xA&&jg(arguments[1],NA)){var s=arguments[0],a=arguments[1];return s instanceof Cy?a.add(s):s.apply(new e_(a)),a}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&jg(arguments[0],NA)&&jg(arguments[1],NA)){for(var u=arguments[1],l=arguments[2],h=arguments[0].iterator();h.hasNext();){var c=h.next();e_.getLines(c,u,l)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof xA&&jg(arguments[1],NA)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new e_(f,p)),f}}};var r_=function(){if(this._boundaryRule=SA.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new Tg("Rule must be non-null");this._boundaryRule=t}};r_.prototype.locateInternal=function(){if(arguments[0]instanceof Fg&&arguments[1]instanceof My){var t=arguments[0],e=arguments[1];if(e.isEmpty())return Gg.EXTERIOR;var r=e.getExteriorRing(),n=this.locateInPolygonRing(t,r);if(n===Gg.EXTERIOR)return Gg.EXTERIOR;if(n===Gg.BOUNDARY)return Gg.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===Gg.INTERIOR)return Gg.EXTERIOR;if(s===Gg.BOUNDARY)return Gg.BOUNDARY}return Gg.INTERIOR}if(arguments[0]instanceof Fg&&arguments[1]instanceof Cy){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return Gg.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?_A.isOnLine(a,l)?Gg.INTERIOR:Gg.EXTERIOR:Gg.BOUNDARY}if(arguments[0]instanceof Fg&&arguments[1]instanceof Sy){var h=arguments[0];return arguments[1].getCoordinate().equals2D(h)?Gg.INTERIOR:Gg.EXTERIOR}},r_.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?_A.locatePointInRing(t,e.getCoordinates()):Gg.EXTERIOR},r_.prototype.intersects=function(t,e){return this.locate(t,e)!==Gg.EXTERIOR},r_.prototype.updateLocationInfo=function(t){t===Gg.INTERIOR&&(this._isIn=!0),t===Gg.BOUNDARY&&this._numBoundaries++},r_.prototype.computeLocation=function(t,e){var r=this;if(e instanceof Sy&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Cy)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof My)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof py)for(var n=e,i=0;i<n.getNumGeometries();i++){var o=n.getGeometryN(i);r.updateLocationInfo(r.locateInternal(t,o))}else if(e instanceof Ry)for(var s=e,a=0;a<s.getNumGeometries();a++){var u=s.getGeometryN(a);r.updateLocationInfo(r.locateInternal(t,u))}else if(e instanceof fy)for(var l=new vm(e);l.hasNext();){var h=l.next();h!==e&&r.computeLocation(t,h)}},r_.prototype.locate=function(t,e){return e.isEmpty()?Gg.EXTERIOR:e instanceof Cy||e instanceof My?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?Gg.BOUNDARY:this._numBoundaries>0||this._isIn?Gg.INTERIOR:Gg.EXTERIOR)},r_.prototype.interfaces_=function(){return[]},r_.prototype.getClass=function(){return r_};var n_=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],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},i_={INSIDE_AREA:{configurable:!0}};n_.prototype.isInsideArea=function(){return this._segIndex===n_.INSIDE_AREA},n_.prototype.getCoordinate=function(){return this._pt},n_.prototype.getGeometryComponent=function(){return this._component},n_.prototype.getSegmentIndex=function(){return this._segIndex},n_.prototype.interfaces_=function(){return[]},n_.prototype.getClass=function(){return n_},i_.INSIDE_AREA.get=function(){return-1},Object.defineProperties(n_,i_);var o_=function(t){this._pts=t||null};o_.prototype.filter=function(t){t instanceof Sy&&this._pts.add(t)},o_.prototype.interfaces_=function(){return[hy]},o_.prototype.getClass=function(){return o_},o_.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Sy?Lv.singletonList(t):o_.getPoints(t,new QA)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof Sy?r.add(e):e instanceof fy&&e.apply(new o_(r)),r}};var s_=function(){this._locations=null;var t=arguments[0];this._locations=t};s_.prototype.filter=function(t){(t instanceof Sy||t instanceof Cy||t instanceof My)&&this._locations.add(new n_(t,0,t.getCoordinate()))},s_.prototype.interfaces_=function(){return[hy]},s_.prototype.getClass=function(){return s_},s_.getLocations=function(t){var e=new QA;return t.apply(new s_(e)),e};var a_=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new r_,this._minDistanceLocation=null,this._minDistance=Lg.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 r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};a_.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 r=arguments[0],n=arguments[1],i=1-r,o=t_.getPolygons(this._geom[r]);if(o.size()>0){var s=s_.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&jg(arguments[0],kA)&&jg(arguments[1],kA)){for(var a=arguments[0],u=arguments[1],l=arguments[2],h=0;h<a.size();h++)for(var c=a.get(h),f=0;f<u.size();f++)if(t.computeContainmentDistance(c,u.get(f),l),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof n_&&arguments[1]instanceof My){var p=arguments[0],d=arguments[1],g=arguments[2],A=p.getCoordinate();if(Gg.EXTERIOR!==this._ptLocator.locate(A,d))return this._minDistance=0,g[0]=p,g[1]=new n_(d,A),null}},a_.prototype.computeMinDistanceLinesPoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},a_.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=e_.getLines(this._geom[0]),r=e_.getLines(this._geom[1]),n=o_.getPoints(this._geom[0]),i=o_.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(r,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))},a_.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},a_.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},a_.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},a_.prototype.computeMinDistance=function(){var t=this;if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof Cy&&arguments[1]instanceof Sy){var e=arguments[0],r=arguments[1],n=arguments[2];if(e.getEnvelopeInternal().distance(r.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),s=0;s<i.length-1;s++){var a=_A.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var u=new qv(i[s],i[s+1]).closestPoint(o);n[0]=new n_(e,s,u),n[1]=new n_(r,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Cy&&arguments[1]instanceof Cy){var l=arguments[0],h=arguments[1],c=arguments[2];if(l.getEnvelopeInternal().distance(h.getEnvelopeInternal())>this._minDistance)return null;for(var f=l.getCoordinates(),p=h.getCoordinates(),d=0;d<f.length-1;d++)for(var g=0;g<p.length-1;g++){var A=_A.distanceLineLine(f[d],f[d+1],p[g],p[g+1]);if(A<t._minDistance){t._minDistance=A;var y=new qv(f[d],f[d+1]),v=new qv(p[g],p[g+1]),m=y.closestPoints(v);c[0]=new n_(l,d,m[0]),c[1]=new n_(h,g,m[1])}if(t._minDistance<=t._terminateDistance)return null}}},a_.prototype.computeMinDistancePoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),u=o.getCoordinate().distance(a.getCoordinate());if(u<n._minDistance&&(n._minDistance=u,r[0]=new n_(o,0,o.getCoordinate()),r[1]=new n_(a,0,a.getCoordinate())),n._minDistance<=n._terminateDistance)return null}},a_.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new Tg("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},a_.prototype.computeMinDistanceLines=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},a_.prototype.interfaces_=function(){return[]},a_.prototype.getClass=function(){return a_},a_.distance=function(t,e){return new a_(t,e).distance()},a_.isWithinDistance=function(t,e,r){return new a_(t,e,r).distance()<=r},a_.nearestPoints=function(t,e){return new a_(t,e).nearestPoints()};var u_=function(){this._pt=[new Fg,new Fg],this._distance=Lg.NaN,this._isNull=!0};u_.prototype.getCoordinates=function(){return this._pt},u_.prototype.getCoordinate=function(t){return this._pt[t]},u_.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],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},u_.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},u_.prototype.toString=function(){return cA.toLineString(this._pt[0],this._pt[1])},u_.prototype.getDistance=function(){return this._distance},u_.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},u_.prototype.interfaces_=function(){return[]},u_.prototype.getClass=function(){return u_};var l_=function(){};l_.prototype.interfaces_=function(){return[]},l_.prototype.getClass=function(){return l_},l_.computeDistance=function(){if(arguments[2]instanceof u_&&arguments[0]instanceof Cy&&arguments[1]instanceof Fg)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new qv,i=t.getCoordinates(),o=0;o<i.length-1;o++){n.setCoordinates(i[o],i[o+1]);var s=n.closestPoint(e);r.setMinimum(s,e)}else if(arguments[2]instanceof u_&&arguments[0]instanceof My&&arguments[1]instanceof Fg){var a=arguments[0],u=arguments[1],l=arguments[2];l_.computeDistance(a.getExteriorRing(),u,l);for(var h=0;h<a.getNumInteriorRing();h++)l_.computeDistance(a.getInteriorRingN(h),u,l)}else if(arguments[2]instanceof u_&&arguments[0]instanceof xA&&arguments[1]instanceof Fg){var c=arguments[0],f=arguments[1],p=arguments[2];if(c instanceof Cy)l_.computeDistance(c,f,p);else if(c instanceof My)l_.computeDistance(c,f,p);else if(c instanceof fy)for(var d=c,g=0;g<d.getNumGeometries();g++){var A=d.getGeometryN(g);l_.computeDistance(A,f,p)}else p.setMinimum(c.getCoordinate(),f)}else if(arguments[2]instanceof u_&&arguments[0]instanceof qv&&arguments[1]instanceof Fg){var y=arguments[1],v=arguments[2],m=arguments[0].closestPoint(y);v.setMinimum(m,y)}};var h_=function(){this._g0=null,this._g1=null,this._ptDist=new u_,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},c_={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};h_.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},h_.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new Tg("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},h_.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},h_.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},h_.prototype.computeOrientedDistance=function(t,e,r){var n=new f_(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new p_(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},h_.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},h_.prototype.interfaces_=function(){return[]},h_.prototype.getClass=function(){return h_},h_.distance=function(){if(2===arguments.length)return new h_(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new h_(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},c_.MaxPointDistanceFilter.get=function(){return f_},c_.MaxDensifiedByFractionDistanceFilter.get=function(){return p_},Object.defineProperties(h_,c_);var f_=function(){this._maxPtDist=new u_,this._minPtDist=new u_,this._euclideanDist=new l_,this._geom=null;var t=arguments[0];this._geom=t};f_.prototype.filter=function(t){this._minPtDist.initialize(),l_.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},f_.prototype.getMaxPointDistance=function(){return this._maxPtDist},f_.prototype.interfaces_=function(){return[bA]},f_.prototype.getClass=function(){return f_};var p_=function(){this._maxPtDist=new u_,this._minPtDist=new u_,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};p_.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var u=n.x+a*o,l=n.y+a*s,h=new Fg(u,l);r._minPtDist.initialize(),l_.computeDistance(r._geom,h,r._minPtDist),r._maxPtDist.setMaximum(r._minPtDist)}},p_.prototype.isDone=function(){return!1},p_.prototype.isGeometryChanged=function(){return!1},p_.prototype.getMaxPointDistance=function(){return this._maxPtDist},p_.prototype.interfaces_=function(){return[cy]},p_.prototype.getClass=function(){return p_};var d_=function(t,e,r){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=r||null},g_={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};d_.prototype.checkMaximumDistance=function(t,e,r){var n=new h_(e,t);if(n.setDensifyFraction(.25),this._maxDistanceFound=n.orientedDistance(),this._maxDistanceFound>r){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+cA.toLineString(i[0],i[1])+")"}},d_.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=d_.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(),d_.VERBOSE&&nA.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},d_.prototype.checkNegativeValid=function(){if(!(this._input instanceof My||this._input instanceof Ry||this._input instanceof fy))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)},d_.prototype.getErrorIndicator=function(){return this._errorIndicator},d_.prototype.checkMinimumDistance=function(t,e,r){var n=new a_(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound<r){this._isValid=!1;var i=n.nearestPoints();this._errorLocation=n.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+cA.toLineString(i[0],i[1])+" )"}},d_.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},d_.prototype.getErrorLocation=function(){return this._errorLocation},d_.prototype.getPolygonLines=function(t){for(var e=new QA,r=new e_(e),n=t_.getPolygons(t).iterator();n.hasNext();){n.next().apply(r)}return t.getFactory().buildGeometry(e)},d_.prototype.getErrorMessage=function(){return this._errMsg},d_.prototype.interfaces_=function(){return[]},d_.prototype.getClass=function(){return d_},g_.VERBOSE.get=function(){return!1},g_.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(d_,g_);var A_=function(t,e,r){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=r||null},y_={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};A_.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},A_.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*A_.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new oA(this._input.getEnvelopeInternal());e.expandBy(this._distance);var r=new oA(this._result.getEnvelopeInternal());r.expandBy(t),r.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(r)),this.report("Envelope")},A_.prototype.checkDistance=function(){var t=new d_(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},A_.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},A_.prototype.checkPolygonal=function(){this._result instanceof My||this._result instanceof Ry||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},A_.prototype.getErrorIndicator=function(){return this._errorIndicator},A_.prototype.getErrorLocation=function(){return this._errorLocation},A_.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=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"))},A_.prototype.report=function(t){if(!A_.VERBOSE)return null;nA.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},A_.prototype.getErrorMessage=function(){return this._errorMsg},A_.prototype.interfaces_=function(){return[]},A_.prototype.getClass=function(){return A_},A_.isValidMsg=function(t,e,r){var n=new A_(t,e,r);return n.isValid()?null:n.getErrorMessage()},A_.isValid=function(t,e,r){return!!new A_(t,e,r).isValid()},y_.VERBOSE.get=function(){return!1},y_.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(A_,y_);var v_=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};v_.prototype.getCoordinates=function(){return this._pts},v_.prototype.size=function(){return this._pts.length},v_.prototype.getCoordinate=function(t){return this._pts[t]},v_.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},v_.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:zv.octant(this.getCoordinate(t),this.getCoordinate(t+1))},v_.prototype.setData=function(t){this._data=t},v_.prototype.getData=function(){return this._data},v_.prototype.toString=function(){return cA.toLineString(new Qy(this._pts))},v_.prototype.interfaces_=function(){return[jv]},v_.prototype.getClass=function(){return v_};var m_=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new QA,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};m_.prototype.getInteriorIntersection=function(){return this._interiorIntersection},m_.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},m_.prototype.getIntersectionSegments=function(){return this._intSegments},m_.prototype.count=function(){return this._intersectionCount},m_.prototype.getIntersections=function(){return this._intersections},m_.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},m_.prototype.setKeepIntersections=function(t){this._keepIntersections=t},m_.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(r,n)))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,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++)},m_.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},m_.prototype.hasIntersection=function(){return null!==this._interiorIntersection},m_.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},m_.prototype.interfaces_=function(){return[Cm]},m_.prototype.getClass=function(){return m_},m_.createAllIntersectionsFinder=function(t){var e=new m_(t);return e.setFindAllIntersections(!0),e},m_.createAnyIntersectionFinder=function(t){return new m_(t)},m_.createIntersectionCounter=function(t){var e=new m_(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var __=function(){this._li=new yA,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};__.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},__.prototype.getIntersections=function(){return this._segInt.getIntersections()},__.prototype.isValid=function(){return this.execute(),this._isValid},__.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},__.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new m_(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new $v;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},__.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new sv(this.getErrorMessage(),this._segInt.getInteriorIntersection())},__.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+cA.toLineString(t[0],t[1])+" and "+cA.toLineString(t[2],t[3])},__.prototype.interfaces_=function(){return[]},__.prototype.getClass=function(){return __},__.computeIntersections=function(t){var e=new __(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var I_=function t(){this._nv=null;var e=arguments[0];this._nv=new __(t.toSegmentStrings(e))};I_.prototype.checkValid=function(){this._nv.checkValid()},I_.prototype.interfaces_=function(){return[]},I_.prototype.getClass=function(){return I_},I_.toSegmentStrings=function(t){for(var e=new QA,r=t.iterator();r.hasNext();){var n=r.next();e.add(new v_(n.getCoordinates(),n))}return e},I_.checkValid=function(t){new I_(t).checkValid()};var E_=function(t){this._mapOp=t};E_.prototype.map=function(t){for(var e=new QA,r=0;r<t.getNumGeometries();r++){var n=this._mapOp.map(t.getGeometryN(r));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(Yy.toGeometryArray(e))},E_.prototype.interfaces_=function(){return[]},E_.prototype.getClass=function(){return E_},E_.map=function(t,e){return new E_(e).map(t)};var x_=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new QA,this._resultLineList=new QA;var t=arguments[0],e=arguments[1],r=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=r};x_.prototype.collectLines=function(t){for(var e=this,r=this._op.getGraph().getEdgeEnds().iterator();r.hasNext();){var n=r.next();e.collectLineEdge(n,t,e._lineEdgesList),e.collectBoundaryTouchEdge(n,t,e._lineEdgesList)}},x_.prototype.labelIsolatedLine=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,r)},x_.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},x_.prototype.collectLineEdge=function(t,e,r){var n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!nI.isResultOfOp(n,e)||i.isCovered()||(r.add(i),t.setVisitedEdge(!0)))},x_.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();){t.next().getEdges().findCoveredLineEdges()}for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var r=e.next(),n=r.getEdge();if(r.isLineEdge()&&!n.isCoveredSet()){var i=this._op.isCoveredByA(r.getCoordinate());n.setCovered(i)}}},x_.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next(),n=r.getLabel();r.isIsolated()&&(n.isNull(0)?this.labelIsolatedLine(r,0):this.labelIsolatedLine(r,1))}},x_.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var r=e.next(),n=this._geometryFactory.createLineString(r.getCoordinates());this._resultLineList.add(n),r.setInResult(!0)}},x_.prototype.collectBoundaryTouchEdge=function(t,e,r){var n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(dA.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(nI.isResultOfOp(n,e)&&e===nI.INTERSECTION&&(r.add(t.getEdge()),t.setVisitedEdge(!0))))},x_.prototype.interfaces_=function(){return[]},x_.prototype.getClass=function(){return x_};var w_=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new QA;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};w_.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var r=this._geometryFactory.createPoint(e);this._resultPointList.add(r)}},w_.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var r=e.next();if(!r.isInResult()&&(!r.isIncidentEdgeInResult()&&(0===r.getEdges().getDegree()||t===nI.INTERSECTION))){var n=r.getLabel();nI.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r)}}},w_.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},w_.prototype.interfaces_=function(){return[]},w_.prototype.getClass=function(){return w_};var C_=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};C_.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},C_.prototype.transformPolygon=function(t,e){var r=!0,n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof Ly&&!n.isEmpty()||(r=!1);for(var i=new QA,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof Ly||(r=!1),i.add(s))}if(r)return this._factory.createPolygon(n,i.toArray([]));var a=new QA;return null!==n&&a.add(n),a.addAll(i),this._factory.buildGeometry(a)},C_.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},C_.prototype.getInputGeometry=function(){return this._inputGeom},C_.prototype.transformMultiLineString=function(t,e){for(var r=new QA,n=0;n<t.getNumGeometries();n++){var i=this.transformLineString(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},C_.prototype.transformCoordinates=function(t,e){return this.copy(t)},C_.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},C_.prototype.transformMultiPoint=function(t,e){for(var r=new QA,n=0;n<t.getNumGeometries();n++){var i=this.transformPoint(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},C_.prototype.transformMultiPolygon=function(t,e){for(var r=new QA,n=0;n<t.getNumGeometries();n++){var i=this.transformPolygon(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},C_.prototype.copy=function(t){return t.copy()},C_.prototype.transformGeometryCollection=function(t,e){for(var r=new QA,n=0;n<t.getNumGeometries();n++){var i=this.transform(t.getGeometryN(n));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||r.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Yy.toGeometryArray(r)):this._factory.buildGeometry(r)},C_.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Sy)return this.transformPoint(t,null);if(t instanceof Ty)return this.transformMultiPoint(t,null);if(t instanceof Ly)return this.transformLinearRing(t,null);if(t instanceof Cy)return this.transformLineString(t,null);if(t instanceof py)return this.transformMultiLineString(t,null);if(t instanceof My)return this.transformPolygon(t,null);if(t instanceof Ry)return this.transformMultiPolygon(t,null);if(t instanceof fy)return this.transformGeometryCollection(t,null);throw new Tg("Unknown Geometry subtype: "+t.getClass().getName())},C_.prototype.transformLinearRing=function(t,e){var r=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===r)return this._factory.createLinearRing(null);var n=r.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},C_.prototype.interfaces_=function(){return[]},C_.prototype.getClass=function(){return C_};var b_=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new qv,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Cy&&"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 r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};b_.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n<r;n++){var i=t.get(n),o=this.findSnapForVertex(i,e);null!==o&&(t.set(n,new Fg(o)),0===n&&this._isClosed&&t.set(t.size()-1,new Fg(o)))}},b_.prototype.findSnapForVertex=function(t,e){for(var r=0;r<e.length;r++){if(t.equals2D(e[r]))return null;if(t.distance(e[r])<this._snapTolerance)return e[r]}return null},b_.prototype.snapTo=function(t){var e=new UA(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},b_.prototype.snapSegments=function(t,e){if(0===e.length)return null;var r=e.length;e[0].equals2D(e[e.length-1])&&(r=e.length-1);for(var n=0;n<r;n++){var i=e[n],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new Fg(i),!1)}},b_.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=Lg.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(r._seg.p0=e.get(o),r._seg.p1=e.get(o+1),r._seg.p0.equals2D(t)||r._seg.p1.equals2D(t)){if(r._allowSnappingToSourceVertices)continue;return-1}var s=r._seg.distance(t);s<r._snapTolerance&&s<n&&(n=s,i=o)}return i},b_.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},b_.prototype.interfaces_=function(){return[]},b_.prototype.getClass=function(){return b_},b_.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var S_=function(t){this._srcGeom=t||null},B_={SNAP_PRECISION_FACTOR:{configurable:!0}};S_.prototype.snapTo=function(t,e){var r=this.extractTargetCoordinates(t);return new M_(e,r).transform(this._srcGeom)},S_.prototype.snapToSelf=function(t,e){var r=this.extractTargetCoordinates(this._srcGeom),n=new M_(t,r,!0).transform(this._srcGeom),i=n;return e&&jg(i,By)&&(i=n.buffer(0)),i},S_.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},S_.prototype.extractTargetCoordinates=function(t){for(var e=new oy,r=t.getCoordinates(),n=0;n<r.length;n++)e.add(r[n]);return e.toArray(new Array(0).fill(null))},S_.prototype.computeMinimumSegmentLength=function(t){for(var e=Lg.MAX_VALUE,r=0;r<t.length-1;r++){var n=t[r].distance(t[r+1]);n<e&&(e=n)}return e},S_.prototype.interfaces_=function(){return[]},S_.prototype.getClass=function(){return S_},S_.snap=function(t,e,r){var n=new Array(2).fill(null),i=new S_(t);n[0]=i.snapTo(e,r);var o=new S_(e);return n[1]=o.snapTo(n[0],r),n},S_.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=S_.computeSizeBasedSnapTolerance(t),r=t.getPrecisionModel();if(r.getType()===jy.FIXED){var n=1/r.getScale()*2/1.415;n>e&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(S_.computeOverlaySnapTolerance(i),S_.computeOverlaySnapTolerance(o))}},S_.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*S_.SNAP_PRECISION_FACTOR},S_.snapToSelf=function(t,e,r){return new S_(t).snapToSelf(e,r)},B_.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(S_,B_);var M_=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||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 r=new b_(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(C_),T_=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};T_.prototype.getCommon=function(){return Lg.longBitsToDouble(this._commonBits)},T_.prototype.add=function(t){var e=Lg.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=T_.signExpBits(this._commonBits),this._isFirst=!1,null):T_.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=T_.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=T_.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},T_.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=Lg.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+Lg.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},T_.prototype.interfaces_=function(){return[]},T_.prototype.getClass=function(){return T_},T_.getBit=function(t,e){return 0!=(t&1<<e)?1:0},T_.signExpBits=function(t){return t>>52},T_.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},T_.numCommonMostSigMantissaBits=function(t,e){for(var r=0,n=52;n>=0;n--){if(T_.getBit(t,n)!==T_.getBit(e,n))return r;r++}return 52};var L_=function(){this._commonCoord=null,this._ccFilter=new N_},R_={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};L_.prototype.addCommonBits=function(t){var e=new P_(this._commonCoord);t.apply(e),t.geometryChanged()},L_.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new Fg(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new P_(e);return t.apply(r),t.geometryChanged(),t},L_.prototype.getCommonCoordinate=function(){return this._commonCoord},L_.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},L_.prototype.interfaces_=function(){return[]},L_.prototype.getClass=function(){return L_},R_.CommonCoordinateFilter.get=function(){return N_},R_.Translater.get=function(){return P_},Object.defineProperties(L_,R_);var N_=function(){this._commonBitsX=new T_,this._commonBitsY=new T_};N_.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},N_.prototype.getCommonCoordinate=function(){return new Fg(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},N_.prototype.interfaces_=function(){return[bA]},N_.prototype.getClass=function(){return N_};var P_=function(){this.trans=null;var t=arguments[0];this.trans=t};P_.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},P_.prototype.isDone=function(){return!1},P_.prototype.isGeometryChanged=function(){return!0},P_.prototype.interfaces_=function(){return[cy]},P_.prototype.getClass=function(){return P_};var D_=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()};D_.prototype.selfSnap=function(t){return new S_(t).snapTo(t,this._snapTolerance)},D_.prototype.removeCommonBits=function(t){this._cbr=new L_,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},D_.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},D_.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=nI.overlayOp(e[0],e[1],t);return this.prepareResult(r)},D_.prototype.checkValid=function(t){t.isValid()||nA.out.println("Snapped geometry is invalid")},D_.prototype.computeSnapTolerance=function(){this._snapTolerance=S_.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},D_.prototype.snap=function(t){var e=this.removeCommonBits(t);return S_.snap(e[0],e[1],this._snapTolerance)},D_.prototype.interfaces_=function(){return[]},D_.prototype.getClass=function(){return D_},D_.overlayOp=function(t,e,r){return new D_(t,e).getResultGeometry(r)},D_.union=function(t,e){return D_.overlayOp(t,e,nI.UNION)},D_.intersection=function(t,e){return D_.overlayOp(t,e,nI.INTERSECTION)},D_.symDifference=function(t,e){return D_.overlayOp(t,e,nI.SYMDIFFERENCE)},D_.difference=function(t,e){return D_.overlayOp(t,e,nI.DIFFERENCE)};var k_=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};k_.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=nI.overlayOp(this._geom[0],this._geom[1],t);r=!0}catch(t){if(!(t instanceof fA))throw t;n=t}if(!r)try{e=D_.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof fA?n:t}return e},k_.prototype.interfaces_=function(){return[]},k_.prototype.getClass=function(){return k_},k_.overlayOp=function(t,e,r){return new k_(t,e).getResultGeometry(r)},k_.union=function(t,e){return k_.overlayOp(t,e,nI.UNION)},k_.intersection=function(t,e){return k_.overlayOp(t,e,nI.INTERSECTION)},k_.symDifference=function(t,e){return k_.overlayOp(t,e,nI.SYMDIFFERENCE)},k_.difference=function(t,e){return k_.overlayOp(t,e,nI.DIFFERENCE)};var F_=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};F_.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},F_.prototype.interfaces_=function(){return[]},F_.prototype.getClass=function(){return F_};var Q_=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],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},O_={INSERT:{configurable:!0},DELETE:{configurable:!0}};Q_.prototype.isDelete=function(){return this._eventType===Q_.DELETE},Q_.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},Q_.prototype.getObject=function(){return this._obj},Q_.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},Q_.prototype.getInsertEvent=function(){return this._insertEvent},Q_.prototype.isInsert=function(){return this._eventType===Q_.INSERT},Q_.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},Q_.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Q_.prototype.interfaces_=function(){return[Ng]},Q_.prototype.getClass=function(){return Q_},O_.INSERT.get=function(){return 1},O_.DELETE.get=function(){return 2},Object.defineProperties(Q_,O_);var U_=function(){};U_.prototype.interfaces_=function(){return[]},U_.prototype.getClass=function(){return U_};var G_=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],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};G_.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(G_.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},G_.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},G_.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},G_.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},G_.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},G_.prototype.hasProperIntersection=function(){return this._hasProper},G_.prototype.hasIntersection=function(){return this._hasIntersection},G_.prototype.isDone=function(){return this._isDone},G_.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},G_.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},G_.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.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))))},G_.prototype.interfaces_=function(){return[]},G_.prototype.getClass=function(){return G_},G_.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var z_=function(t){function e(){t.call(this),this.events=new QA,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Lv.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var r=this.events.get(e);if(r.isInsert()&&this.processOverlaps(e,r.getDeleteEventIndex(),r,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof G_&&jg(arguments[0],kA)&&jg(arguments[1],kA)){var n=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(n,n),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&jg(arguments[0],kA)&&arguments[1]instanceof G_){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var r=t.getMonotoneChainEdge(),n=r.getStartIndexes(),i=0;i<n.length-1;i++){var o=new F_(r,i),s=new Q_(e,r.getMinX(i),o);this.events.add(s),this.events.add(new Q_(r.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,r,n){for(var i=r.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();r.isSameLabel(s)||(i.computeIntersections(a,n),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){var i=n.next();this.addEdge(i,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(U_),j_=function(){this._min=Lg.POSITIVE_INFINITY,this._max=Lg.NEGATIVE_INFINITY},V_={NodeComparator:{configurable:!0}};j_.prototype.getMin=function(){return this._min},j_.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},j_.prototype.getMax=function(){return this._max},j_.prototype.toString=function(){return cA.toLineString(new Fg(this._min,0),new Fg(this._max,0))},j_.prototype.interfaces_=function(){return[]},j_.prototype.getClass=function(){return j_},V_.NodeComparator.get=function(){return H_},Object.defineProperties(j_,V_);var H_=function(){};H_.prototype.compare=function(t,e){var r=t,n=e,i=(r._min+r._max)/2,o=(n._min+n._max)/2;return i<o?-1:i>o?1:0},H_.prototype.interfaces_=function(){return[Dg]},H_.prototype.getClass=function(){return H_};var q_=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,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,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(j_),Y_=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,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,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(j_),X_=function(){this._leaves=new QA,this._root=null,this._level=0};X_.prototype.buildTree=function(){Lv.sort(this._leaves,new j_.NodeComparator);for(var t=this._leaves,e=null,r=new QA;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},X_.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new q_(t,e,r))},X_.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},X_.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},X_.prototype.printNode=function(t){nA.out.println(cA.toLineString(new Fg(t._min,this._level),new Fg(t._max,this._level)))},X_.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},X_.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r<t.size();r+=2){var n=t.get(r);if(null===(r+1<t.size()?t.get(r):null))e.add(n);else{var i=new Y_(t.get(r),t.get(r+1));e.add(i)}}},X_.prototype.interfaces_=function(){return[]},X_.prototype.getClass=function(){return X_};var W_=function(){this._items=new QA};W_.prototype.visitItem=function(t){this._items.add(t)},W_.prototype.getItems=function(){return this._items},W_.prototype.interfaces_=function(){return[Sv]},W_.prototype.getClass=function(){return W_};var J_=function(){this._index=null;var t=arguments[0];if(!jg(t,By))throw new Tg("Argument must be Polygonal");this._index=new $_(t)},K_={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};J_.prototype.locate=function(t){var e=new mA(t),r=new Z_(e);return this._index.query(t.y,t.y,r),e.getLocation()},J_.prototype.interfaces_=function(){return[ym]},J_.prototype.getClass=function(){return J_},K_.SegmentVisitor.get=function(){return Z_},K_.IntervalIndexedGeometry.get=function(){return $_},Object.defineProperties(J_,K_);var Z_=function(){this._counter=null;var t=arguments[0];this._counter=t};Z_.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},Z_.prototype.interfaces_=function(){return[Sv]},Z_.prototype.getClass=function(){return Z_};var $_=function(){this._index=new X_;var t=arguments[0];this.init(t)};$_.prototype.init=function(t){for(var e=e_.getLines(t).iterator();e.hasNext();){var r=e.next().getCoordinates();this.addLine(r)}},$_.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var r=new qv(t[e-1],t[e]),n=Math.min(r.p0.y,r.p1.y),i=Math.max(r.p0.y,r.p1.y);this._index.insert(n,i,r)}},$_.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new W_;return this._index.query(t,e,r),r.getItems()}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._index.query(n,i,o)}},$_.prototype.interfaces_=function(){return[]},$_.prototype.getClass=function(){return $_};var tI=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new zy,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new r_,2===arguments.length){var e=arguments[0],r=arguments[1],n=SA.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=r,this._boundaryNodeRule=n,null!==r&&this.add(r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,r){var n=this._nodes.addNode(r).getLabel(),i=1;n.getLocation(t,ev.ON)===Gg.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var r=arguments[1],n=arguments[2],i=new G_(arguments[0],!0,!1);i.setIsDoneIfProperInt(n);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof Ly||this._parentGeom instanceof My||this._parentGeom instanceof Ry,a=r||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();){e.next().eiList.addSplitEdges(t)}},e.prototype.computeEdgeIntersections=function(t,e,r){var n=new G_(e,r,!0);return n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof Sy){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,Gg.INTERIOR)}else if(arguments[0]instanceof Fg){var e=arguments[0];this.insertPoint(this._argIndex,e,Gg.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),Gg.EXTERIOR,Gg.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var r=t.getInteriorRingN(e);this.addPolygonRing(r,Gg.INTERIOR,Gg.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],Gg.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],Gg.BOUNDARY)},e.prototype.addLineString=function(t){var e=GA.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var r=new Nm(e,new hv(this._argIndex,Gg.INTERIOR));this._lineEdgeMap.put(t,r),this.insertEdge(r),dA.isTrue(e.length>=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),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=i.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,r){if(this.isBoundaryNode(t,e))return null;r===Gg.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=GA.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;_A.isCCW(n)&&(i=r,o=e);var s=new Nm(n,new hv(this._argIndex,Gg.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,n[0],Gg.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new hv(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new z_},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.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 Ry&&(this._useBoundaryDeterminationRule=!1),e instanceof My)this.addPolygon(e);else if(e instanceof Cy)this.addLineString(e);else if(e instanceof Sy)this.addPoint(e);else if(e instanceof Ty)this.addCollection(e);else if(e instanceof py)this.addCollection(e);else if(e instanceof Ry)this.addCollection(e);else{if(!(e instanceof fy))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},e.prototype.locate=function(t){return jg(this._parentGeom,By)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new J_(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)?Gg.BOUNDARY:Gg.INTERIOR},e}(Ev),eI=function(){if(this._li=new yA,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 tI(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=SA.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new tI(0,e,n),this._arg[1]=new tI(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new tI(0,i,s),this._arg[1]=new tI(1,o,s)}};eI.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},eI.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},eI.prototype.interfaces_=function(){return[]},eI.prototype.getClass=function(){return eI};var rI=function(){};rI.prototype.interfaces_=function(){return[]},rI.prototype.getClass=function(){return rI},rI.map=function(){if(arguments[0]instanceof xA&&jg(arguments[1],rI.MapOp)){for(var t=arguments[0],e=arguments[1],r=new QA,n=0;n<t.getNumGeometries();n++){var i=e.map(t.getGeometryN(n));null!==i&&r.add(i)}return t.getFactory().buildGeometry(r)}if(jg(arguments[0],NA)&&jg(arguments[1],rI.MapOp)){for(var o=arguments[0],s=arguments[1],a=new QA,u=o.iterator();u.hasNext();){var l=u.next(),h=s.map(l);null!==h&&a.add(h)}return a}},rI.MapOp=function(){};var nI=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r),this._ptLocator=new r_,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new wm,this._resultPolyList=new QA,this._resultLineList=new QA,this._resultPointList=new QA,this._graph=new Ev(new Em),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new hv(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(r),i.add(n),r.merge(n)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),r=e.getSym();e.isInResult()&&r.isInResult()&&(e.setInResult(!1),r.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,r,n,i){var o=new QA;return o.addAll(t),o.addAll(r),o.addAll(n),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().mergeSymLabels()}},e.prototype.isCovered=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(this._ptLocator.locate(t,n)!==Gg.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new QA,e=this._edgeList.iterator();e.hasNext();){var r=e.next();r.isCollapsed()&&(e.remove(),t.add(r.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getEdges().getLabel();e.getLabel().merge(r)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();this.insertUniqueEdge(r)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new QA;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),I_.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var r=new xv(this._geomFact);r.add(this._graph),this._resultPolyList=r.getPolygons();var n=new x_(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);var i=new w_(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,r)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var r=e.next();this._graph.addNode(r.getCoordinate()).setLabel(t,r.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var n=r.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,ev.RIGHT),i.getLocation(1,ev.RIGHT),t)&&n.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),r=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(var i=0;i<2;i++)r.isNull(i)||!r.isArea()||n.isNull(i)||(0===n.getDelta(i)?r.toLine(i):(dA.isTrue(!n.isNull(i,ev.LEFT),"depth of LEFT side has not been initialized"),r.setLocation(i,ev.LEFT,n.getLocation(i,ev.LEFT)),dA.isTrue(!n.isNull(i,ev.RIGHT),"depth of RIGHT side has not been initialized"),r.setLocation(i,ev.RIGHT,n.getLocation(i,ev.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().computeLabelling(this._arg)}this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getLabel();e.isIsolated()&&(r.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(r)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(eI);nI.overlayOp=function(t,e,r){return new nI(t,e).getResultGeometry(r)},nI.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return nI.createEmptyResult(nI.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var r=e;return E_.map(t,{interfaces_:function(){return[rI.MapOp]},map:function(t){return t.intersection(r)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),k_.overlayOp(t,e,nI.INTERSECTION)},nI.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return nI.createEmptyResult(nI.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),k_.overlayOp(t,e,nI.SYMDIFFERENCE)},nI.resultDimension=function(t,e,r){var n=e.getDimension(),i=r.getDimension(),o=-1;switch(t){case nI.INTERSECTION:o=Math.min(n,i);break;case nI.UNION:o=Math.max(n,i);break;case nI.DIFFERENCE:o=n;break;case nI.SYMDIFFERENCE:o=Math.max(n,i)}return o},nI.createEmptyResult=function(t,e,r,n){var i=null;switch(nI.resultDimension(t,e,r)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon()}return i},nI.difference=function(t,e){return t.isEmpty()?nI.createEmptyResult(nI.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),k_.overlayOp(t,e,nI.DIFFERENCE))},nI.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=t.getLocation(0),n=t.getLocation(1);return nI.isResultOfOp(r,n,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===Gg.BOUNDARY&&(i=Gg.INTERIOR),o===Gg.BOUNDARY&&(o=Gg.INTERIOR),arguments[2]){case nI.INTERSECTION:return i===Gg.INTERIOR&&o===Gg.INTERIOR;case nI.UNION:return i===Gg.INTERIOR||o===Gg.INTERIOR;case nI.DIFFERENCE:return i===Gg.INTERIOR&&o!==Gg.INTERIOR;case nI.SYMDIFFERENCE:return i===Gg.INTERIOR&&o!==Gg.INTERIOR||i!==Gg.INTERIOR&&o===Gg.INTERIOR}return!1}},nI.INTERSECTION=1,nI.UNION=2,nI.DIFFERENCE=3,nI.SYMDIFFERENCE=4;var iI=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new r_,this._seg=new qv;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};iI.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,r=0;r<this._linework.getNumGeometries();r++)for(var n=e._linework.getGeometryN(r).getCoordinateSequence(),i=0;i<n.size()-1;i++){if(n.getCoordinate(i,e._seg.p0),n.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0}return!1},iI.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?Gg.BOUNDARY:this._ptLocator.locate(t,this._g)},iI.prototype.extractLinework=function(t){var e=new oI;t.apply(e);var r=e.getLinework(),n=Yy.toLineStringArray(r);return t.getFactory().createMultiLineString(n)},iI.prototype.interfaces_=function(){return[]},iI.prototype.getClass=function(){return iI};var oI=function(){this._linework=null,this._linework=new QA};oI.prototype.getLinework=function(){return this._linework},oI.prototype.filter=function(t){if(t instanceof My){var e=t;this._linework.add(e.getExteriorRing());for(var r=0;r<e.getNumInteriorRing();r++)this._linework.add(e.getInteriorRingN(r))}},oI.prototype.interfaces_=function(){return[hy]},oI.prototype.getClass=function(){return oI};var sI=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};sI.prototype.extractPoints=function(t,e,r){for(var n=t.getCoordinates(),i=0;i<n.length-1;i++)this.computeOffsetPoints(n[i],n[i+1],e,r)},sI.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},sI.prototype.getPoints=function(t){for(var e=new QA,r=e_.getLines(this._g).iterator();r.hasNext();){var n=r.next();this.extractPoints(n,t,e)}return e},sI.prototype.computeOffsetPoints=function(t,e,r,n){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=r*i/s,u=r*o/s,l=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var c=new Fg(l-u,h+a);n.add(c)}if(this._doRight){var f=new Fg(l+u,h-a);n.add(f)}},sI.prototype.interfaces_=function(){return[]},sI.prototype.getClass=function(){return sI};var aI=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new QA;var e=arguments[0],r=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,r),this._geom=[e,r,n],this._locFinder=[new iI(this._geom[0],this._boundaryDistanceTolerance),new iI(this._geom[1],this._boundaryDistanceTolerance),new iI(this._geom[2],this._boundaryDistanceTolerance)]},uI={TOLERANCE:{configurable:!0}};aI.prototype.reportResult=function(t,e,r){nA.out.println("Overlay result invalid - A:"+Gg.toLocationSymbol(e[0])+" B:"+Gg.toLocationSymbol(e[1])+" expected:"+(r?"i":"e")+" actual:"+Gg.toLocationSymbol(e[2]))},aI.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},aI.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=0;r<this._testCoords.size();r++){var n=t._testCoords.get(r);if(!t.checkValid(e,n))return t._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!aI.hasLocation(this._location,Gg.BOUNDARY)||this.isValidResult(i,this._location)}},aI.prototype.addTestPts=function(t){var e=new sI(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},aI.prototype.isValidResult=function(t,e){var r=nI.isResultOfOp(e[0],e[1],t),n=!(r^e[2]===Gg.INTERIOR);return n||this.reportResult(t,e,r),n},aI.prototype.getInvalidLocation=function(){return this._invalidLocation},aI.prototype.interfaces_=function(){return[]},aI.prototype.getClass=function(){return aI},aI.hasLocation=function(t,e){for(var r=0;r<3;r++)if(t[r]===e)return!0;return!1},aI.computeBoundaryDistanceTolerance=function(t,e){return Math.min(S_.computeSizeBasedSnapTolerance(t),S_.computeSizeBasedSnapTolerance(e))},aI.isValid=function(t,e,r,n){return new aI(t,e,n).isValid(r)},uI.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(aI,uI);var lI=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};lI.prototype.extractElements=function(t,e){if(null===t)return null;for(var r=0;r<t.getNumGeometries();r++){var n=t.getGeometryN(r);this._skipEmpty&&n.isEmpty()||e.add(n)}},lI.prototype.combine=function(){for(var t=new QA,e=this._inputGeoms.iterator();e.hasNext();){var r=e.next();this.extractElements(r,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},lI.prototype.interfaces_=function(){return[]},lI.prototype.getClass=function(){return lI},lI.combine=function(){return 1===arguments.length?new lI(arguments[0]).combine():2===arguments.length?new lI(lI.createList(arguments[0],arguments[1])).combine():3===arguments.length?new lI(lI.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},lI.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},lI.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new QA;return r.add(t),r.add(e),r}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=new QA;return s.add(n),s.add(i),s.add(o),s}};var hI=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new QA)},cI={STRTREE_NODE_CAPACITY:{configurable:!0}};hI.prototype.reduceToGeometries=function(t){for(var e=new QA,r=t.iterator();r.hasNext();){var n=r.next(),i=null;jg(n,kA)?i=this.unionTree(n):n instanceof xA&&(i=n),e.add(i)}return e},hI.prototype.extractByEnvelope=function(t,e,r){for(var n=new QA,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?n.add(o):r.add(o)}return this._geomFactory.buildGeometry(n)},hI.prototype.unionOptimized=function(t,e){var r=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();if(!r.intersects(n))return lI.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=r.intersection(n);return this.unionUsingEnvelopeIntersection(t,e,i)},hI.prototype.union=function(){if(null===this._inputPolys)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new Fv(hI.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var r=e.next();t.insert(r.getEnvelopeInternal(),r)}this._inputPolys=null;var n=t.itemsTree();return this.unionTree(n)},hI.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];if(n-r<=1){var i=hI.getGeometry(e,r);return this.unionSafe(i,null)}if(n-r==2)return this.unionSafe(hI.getGeometry(e,r),hI.getGeometry(e,r+1));var o=Math.trunc((n+r)/2),s=this.binaryUnion(e,r,o),a=this.binaryUnion(e,o,n);return this.unionSafe(s,a)}},hI.prototype.repeatedUnion=function(t){for(var e=null,r=t.iterator();r.hasNext();){var n=r.next();e=null===e?n.copy():e.union(n)}return e},hI.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},hI.prototype.unionActual=function(t,e){return hI.restrictToPolygons(t.union(e))},hI.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},hI.prototype.unionUsingEnvelopeIntersection=function(t,e,r){var n=new QA,i=this.extractByEnvelope(r,t,n),o=this.extractByEnvelope(r,e,n),s=this.unionActual(i,o);return n.add(s),lI.combine(n)},hI.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().createGeometryCollection([e,r]).buffer(0)}},hI.prototype.interfaces_=function(){return[]},hI.prototype.getClass=function(){return hI},hI.restrictToPolygons=function(t){if(jg(t,By))return t;var e=t_.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(Yy.toPolygonArray(e))},hI.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},hI.union=function(t){return new hI(t).union()},cI.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(hI,cI);var fI=function(){};function pI(){return new dI}function dI(){this.reset()}fI.prototype.interfaces_=function(){return[]},fI.prototype.getClass=function(){return fI},fI.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return nI.createEmptyResult(nI.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),k_.overlayOp(t,e,nI.UNION)},dI.prototype={constructor:dI,reset:function(){this.s=this.t=0},add:function(t){AI(gI,t,this.t),AI(this,gI.s,this.s),this.s?this.t+=gI.t:this.s=gI.t},valueOf:function(){return this.s}};var gI=new dI;function AI(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var yI=1e-6,vI=Math.PI,mI=vI/2,_I=vI/4,II=2*vI,EI=180/vI,xI=vI/180,wI=Math.abs,CI=Math.atan,bI=Math.atan2,SI=Math.cos,BI=Math.sin,MI=Math.sqrt;function TI(t){return t>1?0:t<-1?vI:Math.acos(t)}function LI(t){return t>1?mI:t<-1?-mI:Math.asin(t)}function RI(){}function NI(t,e){t&&FI.hasOwnProperty(t.type)&&FI[t.type](t,e)}var PI,DI,kI={Feature:function(t,e){NI(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)NI(r[n].geometry,e)}},FI={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){QI(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)QI(r[n],e,0)},Polygon:function(t,e){OI(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)OI(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)NI(r[n],e)}};function QI(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function OI(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)QI(t[r],e,1);e.polygonEnd()}function UI(t){return[bI(t[1],t[0]),LI(t[2])]}function GI(t){var e=t[0],r=t[1],n=SI(r);return[n*SI(e),n*BI(e),BI(r)]}function zI(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function jI(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function VI(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function HI(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function qI(t){var e=MI(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function YI(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function XI(t,e){return[t>vI?t-II:t<-vI?t+II:t,e]}function WI(t){return function(e,r){return[(e+=t)>vI?e-II:e<-vI?e+II:e,r]}}function JI(t){var e=WI(t);return e.invert=WI(-t),e}function KI(t,e){var r=SI(t),n=BI(t),i=SI(e),o=BI(e);function s(t,e){var s=SI(e),a=SI(t)*s,u=BI(t)*s,l=BI(e),h=l*r+a*n;return[bI(u*i-h*o,a*r-l*n),LI(h*i+u*o)]}return s.invert=function(t,e){var s=SI(e),a=SI(t)*s,u=BI(t)*s,l=BI(e),h=l*i-u*o;return[bI(u*i+l*o,a*r+h*n),LI(h*r-a*n)]},s}function ZI(t,e){(e=GI(e))[0]-=t,qI(e);var r=TI(-e[1]);return((-e[2]<0?-r:r)+II-yI)%II}function $I(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:RI,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function tE(t,e){return wI(t[0]-e[0])<yI&&wI(t[1]-e[1])<yI}function eE(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function rE(t,e,r,n,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],s=t[e];if(tE(n,s)){for(i.lineStart(),o=0;o<e;++o)i.point((n=t[o])[0],n[1]);i.lineEnd()}else a.push(r=new eE(n,t,null,!0)),u.push(r.o=new eE(n,null,r,!1)),a.push(r=new eE(s,t,null,!1)),u.push(r.o=new eE(s,null,r,!0))}})),a.length){for(u.sort(e),nE(a),nE(u),o=0,s=u.length;o<s;++o)u[o].e=r=!r;for(var l,h,c=a[0];;){for(var f=c,p=!0;f.v;)if((f=f.n)===c)return;l=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(o=0,s=l.length;o<s;++o)i.point((h=l[o])[0],h[1]);else n(f.x,f.n.x,1,i);f=f.n}else{if(p)for(l=f.p.z,o=l.length-1;o>=0;--o)i.point((h=l[o])[0],h[1]);else n(f.x,f.p.x,-1,i);f=f.p}l=(f=f.o).z,p=!p}while(!f.v);i.lineEnd()}}}function nE(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function iE(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function oE(t){for(var e,r,n,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(r=new Array(s);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--s]=n[e];return r}pI(),pI(),pI(),XI.invert=XI,1===(PI=iE).length&&(DI=PI,PI=function(t,e){return iE(DI(t),e)});var sE=1e9,aE=-sE;function uE(t,e,r,n){function i(i,o){return t<=i&&i<=r&&e<=o&&o<=n}function o(i,o,a,l){var h=0,c=0;if(null==i||(h=s(i,a))!==(c=s(o,a))||u(i,o)<0^a>0)do{l.point(0===h||3===h?t:r,h>1?n:e)}while((h=(h+a+4)%4)!==c);else l.point(o[0],o[1])}function s(n,i){return wI(n[0]-t)<yI?i>0?0:3:wI(n[0]-r)<yI?i>0?2:1:wI(n[1]-e)<yI?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){var u,l,h,c,f,p,d,g,A,y,v,m=s,_=$I(),I={point:E,lineStart:function(){I.point=x,l&&l.push(h=[]);y=!0,A=!1,d=g=NaN},lineEnd:function(){u&&(x(c,f),p&&A&&_.rejoin(),u.push(_.result()));I.point=E,A&&m.lineEnd()},polygonStart:function(){m=_,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=l.length;r<i;++r)for(var o,s,a=l[r],u=1,h=a.length,c=a[0],f=c[0],p=c[1];u<h;++u)o=f,s=p,f=(c=a[u])[0],p=c[1],s<=n?p>n&&(f-o)*(n-s)>(p-s)*(t-o)&&++e:p<=n&&(f-o)*(n-s)<(p-s)*(t-o)&&--e;return e}(),r=v&&e,i=(u=oE(u)).length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&rE(u,a,e,o,s),s.polygonEnd());m=s,u=l=h=null}};function E(t,e){i(t,e)&&m.point(t,e)}function x(o,s){var a=i(o,s);if(l&&h.push([o,s]),y)c=o,f=s,p=a,y=!1,a&&(m.lineStart(),m.point(o,s));else if(a&&A)m.point(o,s);else{var u=[d=Math.max(aE,Math.min(sE,d)),g=Math.max(aE,Math.min(sE,g))],_=[o=Math.max(aE,Math.min(sE,o)),s=Math.max(aE,Math.min(sE,s))];!function(t,e,r,n,i,o){var s,a=t[0],u=t[1],l=0,h=1,c=e[0]-a,f=e[1]-u;if(s=r-a,c||!(s>0)){if(s/=c,c<0){if(s<l)return;s<h&&(h=s)}else if(c>0){if(s>h)return;s>l&&(l=s)}if(s=i-a,c||!(s<0)){if(s/=c,c<0){if(s>h)return;s>l&&(l=s)}else if(c>0){if(s<l)return;s<h&&(h=s)}if(s=n-u,f||!(s>0)){if(s/=f,f<0){if(s<l)return;s<h&&(h=s)}else if(f>0){if(s>h)return;s>l&&(l=s)}if(s=o-u,f||!(s<0)){if(s/=f,f<0){if(s>h)return;s>l&&(l=s)}else if(f>0){if(s<l)return;s<h&&(h=s)}return l>0&&(t[0]=a+l*c,t[1]=u+l*f),h<1&&(e[0]=a+h*c,e[1]=u+h*f),!0}}}}}(u,_,t,e,r,n)?a&&(m.lineStart(),m.point(o,s),v=!1):(A||(m.lineStart(),m.point(u[0],u[1])),m.point(_[0],_[1]),a||m.lineEnd(),v=!1)}d=o,g=s,A=a}return I}}var lE=pI();function hE(t){return t}pI(),pI(),pI();var cE=1/0,fE=cE,pE=-cE,dE=pE,gE={point:function(t,e){t<cE&&(cE=t);t>pE&&(pE=t);e<fE&&(fE=e);e>dE&&(dE=e)},lineStart:RI,lineEnd:RI,polygonStart:RI,polygonEnd:RI,result:function(){var t=[[cE,fE],[pE,dE]];return pE=dE=-(fE=cE=1/0),t}};function AE(t,e,r,n){return function(i,o){var s,a,u,l=e(o),h=i.invert(n[0],n[1]),c=$I(),f=e(c),p=!1,d={point:g,lineStart:y,lineEnd:v,polygonStart:function(){d.point=m,d.lineStart=_,d.lineEnd=I,a=[],s=[]},polygonEnd:function(){d.point=g,d.lineStart=y,d.lineEnd=v,a=oE(a);var t=function(t,e){var r=e[0],n=e[1],i=[BI(r),-SI(r),0],o=0,s=0;lE.reset();for(var a=0,u=t.length;a<u;++a)if(h=(l=t[a]).length)for(var l,h,c=l[h-1],f=c[0],p=c[1]/2+_I,d=BI(p),g=SI(p),A=0;A<h;++A,f=v,d=_,g=I,c=y){var y=l[A],v=y[0],m=y[1]/2+_I,_=BI(m),I=SI(m),E=v-f,x=E>=0?1:-1,w=x*E,C=w>vI,b=d*_;if(lE.add(bI(b*x*BI(w),g*I+b*SI(w))),o+=C?E+x*II:E,C^f>=r^v>=r){var S=jI(GI(c),GI(y));qI(S);var B=jI(i,S);qI(B);var M=(C^E>=0?-1:1)*LI(B[2]);(n>M||n===M&&(S[0]||S[1]))&&(s+=C^E>=0?1:-1)}}return(o<-yI||o<yI&&lE<-yI)^1&s}(s,h);a.length?(p||(o.polygonStart(),p=!0),rE(a,vE,t,r,o)):t&&(p||(o.polygonStart(),p=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),p&&(o.polygonEnd(),p=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function g(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function A(t,e){var r=i(t,e);l.point(r[0],r[1])}function y(){d.point=A,l.lineStart()}function v(){d.point=g,l.lineEnd()}function m(t,e){u.push([t,e]);var r=i(t,e);f.point(r[0],r[1])}function _(){f.lineStart(),u=[]}function I(){m(u[0][0],u[0][1]),f.lineEnd();var t,e,r,n,i=f.clean(),l=c.result(),h=l.length;if(u.pop(),s.push(u),u=null,h)if(1&i){if((e=(r=l[0]).length-1)>0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t<e;++t)o.point((n=r[t])[0],n[1]);o.lineEnd()}}else h>1&&2&i&&l.push(l.pop().concat(l.shift())),a.push(l.filter(yE))}return d}}function yE(t){return t.length>1}function vE(t,e){return((t=t.x)[0]<0?t[1]-mI-yI:mI-t[1])-((e=e.x)[0]<0?e[1]-mI-yI:mI-e[1])}pI();var mE=AE((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?vI:-vI,u=wI(o-r);wI(u-vI)<yI?(t.point(r,n=(n+s)/2>0?mI:-mI),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):i!==a&&u>=vI&&(wI(r-i)<yI&&(r-=i*yI),wI(o-a)<yI&&(o-=a*yI),n=function(t,e,r,n){var i,o,s=BI(t-r);return wI(s)>yI?CI((BI(e)*(o=SI(n))*BI(r)-BI(n)*(i=SI(e))*BI(t))/(i*o*s)):(e+n)/2}(r,n,o,s),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(r=o,n=s),i=a},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*mI,n.point(-vI,i),n.point(0,i),n.point(vI,i),n.point(vI,0),n.point(vI,-i),n.point(0,-i),n.point(-vI,-i),n.point(-vI,0),n.point(-vI,i);else if(wI(t[0]-e[0])>yI){var o=t[0]<e[0]?vI:-vI;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}),[-vI,-mI]);function _E(t,e){var r=SI(t),n=r>0,i=wI(r)>yI;function o(t,e){return SI(t)*SI(e)>r}function s(t,e,n){var i=[1,0,0],o=jI(GI(t),GI(e)),s=zI(o,o),a=o[0],u=s-a*a;if(!u)return!n&&t;var l=r*s/u,h=-r*a/u,c=jI(i,o),f=HI(i,l);VI(f,HI(o,h));var p=c,d=zI(f,p),g=zI(p,p),A=d*d-g*(zI(f,f)-1);if(!(A<0)){var y=MI(A),v=HI(p,(-d-y)/g);if(VI(v,f),v=UI(v),!n)return v;var m,_=t[0],I=e[0],E=t[1],x=e[1];I<_&&(m=_,_=I,I=m);var w=I-_,C=wI(w-vI)<yI;if(!C&&x<E&&(m=E,E=x,x=m),C||w<yI?C?E+x>0^v[1]<(wI(v[0]-_)<yI?E:x):E<=v[1]&&v[1]<=x:w>vI^(_<=v[0]&&v[0]<=I)){var b=HI(p,(-d+y)/g);return VI(b,f),[v,UI(b)]}}}function a(e,r){var i=n?t:vI-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return AE(o,(function(t){var e,r,u,l,h;return{lineStart:function(){l=u=!1,h=1},point:function(c,f){var p,d=[c,f],g=o(c,f),A=n?g?0:a(c,f):g?a(c+(c<0?vI:-vI),f):0;if(!e&&(l=u=g)&&t.lineStart(),g!==u&&(!(p=s(e,d))||tE(e,p)||tE(d,p))&&(d[0]+=yI,d[1]+=yI,g=o(d[0],d[1])),g!==u)h=0,g?(t.lineStart(),p=s(d,e),t.point(p[0],p[1])):(p=s(e,d),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(i&&e&&n^g){var y;A&r||!(y=s(d,e,!0))||(h=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])))}!g||e&&tE(e,d)||t.point(d[0],d[1]),e=d,u=g,r=A},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return h|(l&&u)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var s=SI(e),a=BI(e),u=n*r;null==i?(i=e+n*II,o=e-u/2):(i=ZI(s,i),o=ZI(s,o),(n>0?i<o:i>o)&&(i+=n*II));for(var l,h=i;n>0?h>o:h<o;h-=u)l=UI([s,-a*SI(h),-a*BI(h)]),t.point(l[0],l[1])}}(o,t,e,i,r,n)}),n?[0,-t]:[-vI,t-vI])}function IE(t){return function(e){var r=new EE;for(var n in t)r[n]=t[n];return r.stream=e,r}}function EE(){}function xE(t,e,r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&kI.hasOwnProperty(t.type)?kI[t.type](t,e):NI(t,e)}(r,t.stream(gE));var s=gE.result(),a=Math.min(n/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(n-a*(s[1][0]+s[0][0]))/2,l=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,l])}EE.prototype={constructor:EE,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var wE=16,CE=SI(30*xI);function bE(t,e){return+e?function(t,e){function r(n,i,o,s,a,u,l,h,c,f,p,d,g,A){var y=l-n,v=h-i,m=y*y+v*v;if(m>4*e&&g--){var _=s+f,I=a+p,E=u+d,x=MI(_*_+I*I+E*E),w=LI(E/=x),C=wI(wI(E)-1)<yI||wI(o-c)<yI?(o+c)/2:bI(I,_),b=t(C,w),S=b[0],B=b[1],M=S-n,T=B-i,L=v*M-y*T;(L*L/m>e||wI((y*M+v*T)/m-.5)>.3||s*f+a*p+u*d<CE)&&(r(n,i,o,s,a,u,S,B,C,_/=x,I/=x,E,g,A),A.point(S,B),r(S,B,C,_,I,E,l,h,c,f,p,d,g,A))}}return function(e){var n,i,o,s,a,u,l,h,c,f,p,d,g={point:A,lineStart:y,lineEnd:m,polygonStart:function(){e.polygonStart(),g.lineStart=_},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function A(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){h=NaN,g.point=v,e.lineStart()}function v(n,i){var o=GI([n,i]),s=t(n,i);r(h,c,l,f,p,d,h=s[0],c=s[1],l=n,f=o[0],p=o[1],d=o[2],wE,e),e.point(h,c)}function m(){g.point=A,e.lineEnd()}function _(){y(),g.point=I,g.lineEnd=E}function I(t,e){v(n=t,e),i=h,o=c,s=f,a=p,u=d,g.point=v}function E(){r(h,c,l,f,p,d,i,o,n,s,a,u,wE,e),g.lineEnd=m,m()}return g}}(t,e):function(t){return IE({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}(t)}var SE=IE({point:function(t,e){this.stream.point(t*xI,e*xI)}});function BE(t){return function(t){var e,r,n,i,o,s,a,u,l,h,c=150,f=480,p=250,d=0,g=0,A=0,y=0,v=0,m=null,_=mE,I=null,E=hE,x=.5,w=bE(S,x);function C(t){return[(t=o(t[0]*xI,t[1]*xI))[0]*c+r,n-t[1]*c]}function b(t){return(t=o.invert((t[0]-r)/c,(n-t[1])/c))&&[t[0]*EI,t[1]*EI]}function S(t,i){return[(t=e(t,i))[0]*c+r,n-t[1]*c]}function B(){o=YI(i=function(t,e,r){return(t%=II)?e||r?YI(JI(t),KI(e,r)):JI(t):e||r?KI(e,r):XI}(A,y,v),e);var t=e(d,g);return r=f-t[0]*c,n=p+t[1]*c,M()}function M(){return l=h=null,C}return C.stream=function(t){return l&&h===t?l:l=SE(_(i,w(E(h=t))))},C.clipAngle=function(t){return arguments.length?(_=+t?_E(m=t*xI,6*xI):(m=null,mE),M()):m*EI},C.clipExtent=function(t){return arguments.length?(E=null==t?(I=s=a=u=null,hE):uE(I=+t[0][0],s=+t[0][1],a=+t[1][0],u=+t[1][1]),M()):null==I?null:[[I,s],[a,u]]},C.scale=function(t){return arguments.length?(c=+t,B()):c},C.translate=function(t){return arguments.length?(f=+t[0],p=+t[1],B()):[f,p]},C.center=function(t){return arguments.length?(d=t[0]%360*xI,g=t[1]%360*xI,B()):[d*EI,g*EI]},C.rotate=function(t){return arguments.length?(A=t[0]%360*xI,y=t[1]%360*xI,v=t.length>2?t[2]%360*xI:0,B()):[A*EI,y*EI,v*EI]},C.precision=function(t){return arguments.length?(w=bE(S,x=t*t),M()):MI(x)},C.fitExtent=function(t,e){return xE(C,t,e)},C.fitSize=function(t,e){return function(t,e,r){return xE(t,[[0,0],e],r)}(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&b,B()}}((function(){return t}))()}function ME(t){return function(e,r){var n=SI(e),i=SI(r),o=t(n*i);return[o*i*BI(e),o*BI(r)]}}function TE(t){return function(e,r){var n=MI(e*e+r*r),i=t(n),o=BI(i),s=SI(i);return[bI(e*o,n*s),LI(n&&r*o/n)]}}ME((function(t){return MI(2/(1+t))})).invert=TE((function(t){return 2*LI(t/2)}));var LE=ME((function(t){return(t=TI(t))&&t/BI(t)}));function RE(){return BE(LE).scale(79.4188).clipAngle(179.999)}function NE(t,e){return[t,e]}function PE(t,e,r,n){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return nn(t,(function(t){var i=PE(t,e,r,n);i&&s.push(i)})),Lr(s)}var a=function(t){var e=$o(t).geometry.coordinates,r=[-e[0],-e[1]];return RE().rotate(r).scale(mr)}(o),u={type:o.type,coordinates:kE(o.coordinates,a)},l=(new $y).read(u),h=Fr(Qr(e,r),"meters"),c=qm.bufferOp(l,h,n);if(!DE((c=(new tv).write(c)).coordinates))return xr({type:c.type,coordinates:FE(c.coordinates,a)},i)}function DE(t){return Array.isArray(t[0])?DE(t[0]):isNaN(t[0])}function kE(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return kE(t,e)}))}function FE(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return FE(t,e)}))}function QE(t,e,r){void 0===r&&(r={});var n=En(t),i=En(e),o=Bg.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?Sr(o[0],r.properties):Pr(o,r.properties)}function OE(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,h=2*e/Pi([i,u],[s,u],r)*(s-i),c=2*e/Pi([l,o],[l,a],r)*(a-o),f=h/2,p=2*f,d=Math.sqrt(3)/2*c,g=s-i,A=a-o,y=3/4*p,v=d,m=(g-p)/(p-f/2),_=Math.floor(m),I=(_*y-f/2-g)/2-f/2+y/2,E=Math.floor((A-d)/d),x=(A-E*d)/2,w=E*d-A>d/2;w&&(x-=d/4);for(var C=[],b=[],S=0;S<6;S++){var B=2*Math.PI/6*S;C.push(Math.cos(B)),b.push(Math.sin(B))}for(var M=[],T=0;T<=_;T++)for(var L=0;L<=E;L++){var R=T%2==1;if((0!==L||!R)&&(0!==L||!w)){var N=T*y+i-I,P=L*v+o+x;if(R&&(P-=d/2),!0===r.triangles)GE([N,P],h/2,c/2,JSON.parse(n),C,b).forEach((function(t){r.mask?QE(r.mask,t)&&M.push(t):M.push(t)}));else{var D=UE([N,P],h/2,c/2,JSON.parse(n),C,b);r.mask?QE(r.mask,D)&&M.push(D):M.push(D)}}}return Lr(M)}function UE(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+r*o[a];s.push([u,l])}return s.push(s[0].slice()),Sr([s],n)}function GE(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+r*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+r*o[(a+1)%6]]),u.push(t),s.push(Sr([u],n))}return s}function zE(t){return Pr(t)}function jE(t){return Sr(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}function VE(t,e,r){return void 0===r&&(r={}),function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],l=e/Pi([o,s],[a,s],n)*(a-o),h=r/Pi([o,s],[o,u],n)*(u-s),c=a-o,f=u-s,p=Math.floor(c/l),d=Math.floor(f/h),g=(f-d*h)/2,A=o+(c-p*l)/2,y=0;y<p;y++){for(var v=s+g,m=0;m<d;m++){var _=Sr([[[A,v],[A,v+h],[A+l,v+h],[A+l,v],[A,v]]],n.properties);n.mask?$f(n.mask,_)&&i.push(_):i.push(_),v+=h}A+=l}return Lr(i)}(t,e,e,r)}function HE(t,e,r){void 0===r&&(r={});for(var n=[],i=e/Pi([t[0],t[1]],[t[2],t[1]],r)*(t[2]-t[0]),o=e/Pi([t[0],t[1]],[t[0],t[3]],r)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var u=0,l=t[1];l<=t[3];){var h=null,c=null;s%2==0&&u%2==0?(h=Sr([[[a,l],[a,l+o],[a+i,l],[a,l]]],r.properties),c=Sr([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],r.properties)):s%2==0&&u%2==1?(h=Sr([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],r.properties),c=Sr([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],r.properties)):u%2==0&&s%2==1?(h=Sr([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],r.properties),c=Sr([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],r.properties)):u%2==1&&s%2==1&&(h=Sr([[[a,l],[a,l+o],[a+i,l],[a,l]]],r.properties),c=Sr([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],r.properties)),r.mask?(QE(r.mask,h)&&n.push(h),QE(r.mask,c)&&n.push(c)):(n.push(h),n.push(c)),l+=o,u++}s++,a+=i}return Lr(n)}LE.invert=TE((function(t){return t})),NE.invert=NE;var qE=Object.freeze({__proto__:null,projection:Ed,random:Td,clusters:Qd,helpers:Wr,invariant:wn,meta:dn,isolines:function(t,e,r){if(!qr(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(In(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks must be an Array");if(!qr(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s=Qn(t,{zProperty:n,flip:!0}),a=function(t,e,r,n,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=Tn({},n,i[s]);u[r]=a;var l=Rr(Nn(t,a),u);o.push(l)}return o}(s,e,n,i,o),u=function(t,e,r){var n=gn(r),i=n[2]-n[0],o=n[3]-n[1],s=n[0],a=n[1],u=e[0].length-1,l=e.length-1,h=i/u,c=o/l,f=function(t){t[0]=t[0]*h+s,t[1]=t[1]*c+a};return t.forEach((function(t){Jr(t,f)})),t}(a,s,t);return Lr(u)},convex:Ti,pointsWithinPolygon:Ni,within:Ni,concave:function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=function(t){var e=[],r={};return tn(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),Lr(e)}(t),i=Di(n);if(i.features=i.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=Pi(n,i,e),a=Pi(i,o,e),u=Pi(n,o,e);return s<=r&&a<=r&&u<=r})),i.features.length<1)return null;var o=go(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),xr(o)},collect:function(t,e,r,n){var i=Ro(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[r]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=gn(t),r=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];r.forEach((function(e){Li([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[n]=o})),t},flip:function(t,e){if(!qr(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if(!t)throw new Error("geojson is required");return!1!==r&&void 0!==r||(t=Oi(t)),Jr(t,(function(t){var e=t[0],r=t[1];t[0]=r,t[1]=e})),t},simplify:Go,bezier:qo,bezierSpline:qo,tag:function(t,e,r,n){return t=Oi(t),e=Oi(e),tn(t,(function(t){t.properties||(t.properties={}),tn(e,(function(e){void 0===t.properties[n]&&Li(t,e)&&(t.properties[n]=e.properties[r])}))})),t},sample:function(t,e){if(!t)throw new Error("featurecollection is required");if(null==e)throw new Error("num is required");if("number"!=typeof e)throw new Error("num must be a number");var r=Lr(function(t,e){var r,n,i=t.slice(0),o=t.length,s=o-e;for(;o-- >s;)r=i[n=Math.floor((o+1)*Math.random())],i[n]=i[o],i[o]=r;return i.slice(s)}(t.features,e));return r},envelope:Xo,square:Wo,circle:Ko,midpoint:function(t,e){return Jo(t,Pi(t,e)/2,Zo(t,e))},center:$o,centerOfMass:function t(e,r){switch(void 0===r&&(r={}),xn(e)){case"Point":return Cr(An(e),r.properties);case"Polygon":var n=[];Jr(e,(function(t){n.push(t)}));var i,o,s,a,u,l,h,c,f=ts(e,{properties:r.properties}),p=f.geometry.coordinates,d=0,g=0,A=0,y=n.map((function(t){return[t[0]-p[0],t[1]-p[1]]}));for(i=0;i<n.length-1;i++)a=(o=y[i])[0],l=o[1],u=(s=y[i+1])[0],A+=c=a*(h=s[1])-u*l,d+=(a+u)*c,g+=(l+h)*c;if(0===A)return f;var v=1/(6*(.5*A));return Cr([p[0]+v*d,p[1]+v*g],r.properties);default:var m=Ti(e);return m?t(m,{properties:r.properties}):ts(e,{properties:r.properties})}},centroid:ts,combine:function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return tn(t,(function(t){var r,n,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(r=e.MultiPoint.coordinates).push.apply(r,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(n=e.MultiLineString.coordinates).push.apply(n,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),Lr(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return xr({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},distance:Pi,explode:es,bbox:gn,tesselate:function(t){if(!t.geometry||"Polygon"!==t.geometry.type&&"MultiPolygon"!==t.geometry.type)throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return"Polygon"===t.geometry.type?e.features=Ts(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(Ts(t))})),e},bboxPolygon:Yo,booleanPointInPolygon:Li,inside:Li,nearest:Ls,nearestPoint:Ls,nearestPointOnLine:Ea,pointOnLine:Ea,nearestPointToLine:function(t,e,r){void 0===r&&(r={});var n=r.units,i=r.properties||{},o=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return nn(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}(t);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==xn(e))throw new Error("line must be a LineString");var s=1/0,a=null;return tn(o,(function(t){var r=wa(t,e,{units:n});r<s&&(s=r,a=t)})),a&&(a.properties=Tn({dist:s},a.properties,i)),a},planepoint:function(t,e){var r=An(t),n=En(e).coordinates[0];if(n.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var i=e.properties||{},o=i.a,s=i.b,a=i.c,u=r[0],l=r[1],h=n[0][0],c=n[0][1],f=void 0!==o?o:n[0][2],p=n[1][0],d=n[1][1],g=void 0!==s?s:n[1][2],A=n[2][0],y=n[2][1],v=void 0!==a?a:n[2][2];return(v*(u-h)*(l-d)+f*(u-p)*(l-y)+g*(u-A)*(l-c)-g*(u-h)*(l-y)-v*(u-p)*(l-c)-f*(u-A)*(l-d))/((u-h)*(l-d)+(u-p)*(l-y)+(u-A)*(l-c)-(u-h)*(l-y)-(u-p)*(l-c)-(u-A)*(l-d))},tin:Di,bearing:Zo,destination:Jo,kinks:function(t){var e,r,n={type:"FeatureCollection",features:[]};if("LineString"===(r="Feature"===t.type?t.geometry:t).type)e=[r.coordinates];else if("MultiLineString"===r.type)e=r.coordinates;else if("MultiPolygon"===r.type)e=[].concat.apply([],r.coordinates);else{if("Polygon"!==r.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=r.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var r=0;r<t.length-1;r++)for(var i=r;i<e.length-1;i++){if(t===e){if(1===Math.abs(r-i))continue;if(0===r&&i===t.length-2&&t[r][0]===t[t.length-1][0]&&t[r][1]===t[t.length-1][1])continue}var o=Sa(t[r][0],t[r][1],t[r+1][0],t[r+1][1],e[i][0],e[i][1],e[i+1][0],e[i+1][1]);o&&n.features.push(Cr([o[0],o[1]]))}}))})),n},pointOnFeature:Ba,pointOnSurface:Ba,area:La,along:function(t,e,r){void 0===r&&(r={});for(var n=En(t).coordinates,i=0,o=0;o<n.length&&!(e>=i&&o===n.length-1);o++){if(i>=e){var s=e-i;if(s){var a=Zo(n[o],n[o-1])-180;return Jo(n[o],s,a,r)}return Cr(n[o])}i+=Pi(n[o],n[o+1],r)}return Cr(n[n.length-1])},length:Da,lineDistance:Da,lineSlice:function(t,e,r){var n=yn(r);if("LineString"!==xn(r))throw new Error("line must be a LineString");for(var i,o=Ea(r,t),s=Ea(r,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)a.push(n[u]);return a.push(i[1].geometry.coordinates),Mr(a,r.properties)},lineSliceAlong:ka,pointGrid:ja,truncate:Va,flatten:Ha,lineIntersect:_a,lineChunk:function(t,e,r){if(!qr(r=r||{}))throw new Error("options is invalid");var n=r.units,i=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return sn(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,n){var i=Da(t,{units:r});if(i<=e)return n(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++){n(ka(t,e*s,e*(s+1),{units:r}),s)}}(t,e,n,(function(t){o.push(t)}))})),Lr(o)},unkinkPolygon:function(t){var e=[];return sn(t,(function(t){"Polygon"===t.geometry.type&&tn(Xa(t),(function(r){e.push(Sr(r.geometry.coordinates,t.properties))}))})),Lr(e)},greatCircle:function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.properties,i=r.npoints,o=r.offset;return t=An(t),e=An(e),n=n||{},i=i||100,o=o||10,new su({x:t[0],y:t[1]},{x:e[0],y:e[1]},n).Arc(i,{offset:o}).json()},lineSegment:Rs,lineSplit:function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var r=xn(t),n=xn(e);if("LineString"!==r)throw new Error("line must be LineString");if("FeatureCollection"===n)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===n)throw new Error("splitter cannot be a GeometryCollection");var i=Va(e,{precision:7});switch(n){case"Point":return uu(t,i);case"MultiPoint":return au(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return au(t,_a(t,i))}},lineArc:cu,polygonToLine:pu,polygonToLineString:pu,lineStringToPolygon:Au,lineToPolygon:Au,bboxClip:function(t,e){var r=En(t),n=r.type,i="Feature"===t.type?t.properties:{},o=r.coordinates;switch(n){case"LineString":case"MultiLineString":var s=[];return"LineString"===n&&(o=[o]),o.forEach((function(t){!function(t,e,r){var n,i,o,s,a,u=t.length,l=Iu(t[0],e),h=[];for(r||(r=[]),n=1;n<u;n++){for(s=t[n-1],i=o=Iu(a=t[n],e);;){if(!(l|i)){h.push(s),i!==o?(h.push(a),n<u-1&&(r.push(h),h=[])):n===u-1&&h.push(a);break}if(l&i)break;l?l=Iu(s=_u(s,a,l,e),e):i=Iu(a=_u(s,a,i,e),e)}l=o}h.length&&r.push(h)}(t,e,s)})),1===s.length?Mr(s[0],i):Rr(s,i);case"Polygon":return Sr(Eu(o,e),i);case"MultiPolygon":return Pr(o.map((function(t){return Eu(t,e)})),i);default:throw new Error("geometry "+n+" not supported")}},lineOverlap:nc,sector:function(t,e,r,n,i){if(!qr(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(oc(r)===oc(n))return Ko(t,e,i);var s=yn(t),a=cu(t,e,r,n,i),u=[[s]];return Jr(a,(function(t){u[0].push(t)})),u[0].push(s),Sr(u,o)},rhumbBearing:sc,rhumbDistance:xa,rhumbDestination:uc,polygonTangents:function(t,e){var r,n,i,o,s=yn(t),a=yn(e),u=gn(e),l=0,h=null;switch(s[0]>u[0]&&s[0]<u[2]&&s[1]>u[1]&&s[1]<u[3]&&(l=(h=Ls(t,es(e))).properties.featureIndex),xn(e)){case"Polygon":r=a[0][l],n=a[0][0],null!==h&&h.geometry.coordinates[1]<s[1]&&(n=a[0][l]),o=cc(a[0][0],a[0][a[0].length-1],s);var c=lc(a[0],s,o,i,r,n);r=c[0],n=c[1];break;case"MultiPolygon":for(var f=0,p=0,d=0,g=0;g<a[0].length;g++){f=g;for(var A=!1,y=0;y<a[0][g].length;y++){if(p=y,d===l){A=!0;break}d++}if(A)break}r=a[0][f][p],n=a[0][f][p],o=cc(a[0][0][0],a[0][0][a[0][0].length-1],s),a.forEach((function(t){var e=lc(t[0],s,o,i,r,n);r=e[0],n=e[1]}))}return Lr([Cr(r),Cr(n)])},rewind:function(t,e){if(!qr(e=e||{}))throw new Error("options is invalid");var r=e.reverse||!1,n=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof r)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof n)throw new Error("<mutate> must be a boolean");!1===n&&(t=Oi(t));var i=[];switch(t.type){case"GeometryCollection":return nn(t,(function(t){pc(t,r)})),t;case"FeatureCollection":return tn(t,(function(t){tn(pc(t,r),(function(t){i.push(t)}))})),Lr(i)}return pc(t,r)},isobands:function(t,e,r){if(!qr(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(In(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!qr(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=Ac(t,{zProperty:n,flip:!0}),a=function(t,e,r){for(var n=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=vf(yf(mc(t,o,s-o))),u={};u.groupedRings=a,u[r]=o+"-"+s,n.push(u)}return n}(s,e,n);a=function(t,e,r){var n=gn(r),i=n[2]-n[0],o=n[3]-n[1],s=n[0],a=n[1],u=e[0].length-1,l=e.length-1,h=i/u,c=o/l,f=function(t){t[0]=t[0]*h+s,t[1]=t[1]*c+a};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(f)}))}))})),t}(a,s,t);var u=a.map((function(t,e){if(o[e]&&!qr(o[e]))throw new Error("Each mappedProperty is required to be an Object");var r=Tn({},i,o[e]);return r[n]=t[n],Pr(t.groupedRings,r)}));return Lr(u)},transformRotate:If,transformScale:Ef,transformTranslate:function(t,e,r,n){if(!qr(n=n||{}))throw new Error("options is invalid");var i=n.units,o=n.zTranslation,s=n.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");if(o&&"number"!=typeof o&&isNaN(o))throw new Error("zTranslation is not a number");if(o=void 0!==o?o:0,0===e&&0===o)return t;if(null==r||isNaN(r))throw new Error("direction is required");return e<0&&(e=-e,r+=180),!1!==s&&void 0!==s||(t=Oi(t)),Jr(t,(function(t){var n=yn(uc(t,e,r,{units:i}));t[0]=n[0],t[1]=n[1],o&&3===t.length&&(t[2]+=o)})),t},lineOffset:function(t,e,r){if(!qr(r=r||{}))throw new Error("options is invalid");var n=r.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=xn(t),o=t.properties;switch(i){case"LineString":return Sf(t,e,n);case"MultiLineString":var s=[];return sn(t,(function(t){s.push(Sf(t,e,n).geometry.coordinates)})),Rr(s,o);default:throw new Error("geometry "+i+" is not supported")}},polygonize:function(t){var e=Df.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var r=[],n=[];return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?r.push(t):n.push(t)})),r.forEach((function(t){Nf.findEdgeRingContaining(t,n)&&n.push(t)})),Lr(n.map((function(t){return t.toPolygon()})))},booleanDisjoint:kf,booleanContains:function(t,e){var r=En(t),n=En(e),i=r.type,o=n.type,s=r.coordinates,a=n.coordinates;switch(i){case"Point":if("Point"===o)return Gf(s,a);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return function(t,e){var r,n=!1;for(r=0;r<t.coordinates.length;r++)if(Gf(t.coordinates[r],e.coordinates)){n=!0;break}return n}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){for(var i=n[r],o=!1,s=0,a=t.coordinates;s<a.length;s++){if(Gf(i,a[s])){o=!0;break}}if(!o)return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return Fa(n,r,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(Fa({type:"Point",coordinates:o},t,{ignoreEndVertices:!0})&&(r=!0),!Fa({type:"Point",coordinates:o},t,{ignoreEndVertices:!1}))return!1}return r}(r,n);case"MultiPoint":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(Fa(o,t,{ignoreEndVertices:!0})&&(r=!0),!Fa(o,t))return!1}if(r)return!0;return!1}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return Li(n,r,{ignoreBoundary:!0});case"LineString":return function(t,e){var r=!1,n=0,i=gn(t),o=gn(e);if(!Uf(i,o))return!1;for(;n<e.coordinates.length-1;n++){if(Li({type:"Point",coordinates:zf(e.coordinates[n],e.coordinates[n+1])},t,{ignoreBoundary:!0})){r=!0;break}}return r}(r,n);case"Polygon":return function(t,e){if("Feature"===t.type&&null===t.geometry)return!1;if("Feature"===e.type&&null===e.geometry)return!1;var r=gn(t),n=gn(e);if(!Uf(r,n))return!1;for(var i=En(e).coordinates,o=0,s=i;o<s.length;o++)for(var a=0,u=s[o];a<u.length;a++){if(!Li(u[a],t))return!1}return!0}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){if(!Li(n[r],t,{ignoreBoundary:!0}))return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanCrosses:function(t,e){var r=En(t),n=En(e),i=r.type,o=n.type;switch(i){case"MultiPoint":switch(o){case"LineString":return jf(r,n);case"Polygon":return Hf(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return jf(n,r);case"LineString":return function(t,e){if(_a(t,e).features.length>0)for(var r=0;r<t.coordinates.length-1;r++)for(var n=0;n<e.coordinates.length-1;n++){var i=!0;if(0!==n&&n!==e.coordinates.length-2||(i=!1),qf(t.coordinates[r],t.coordinates[r+1],e.coordinates[n],i))return!0}return!1}(r,n);case"Polygon":return Vf(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return Hf(n,r);case"LineString":return Vf(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanClockwise:fc,booleanOverlap:function(t,e){var r=En(t),n=En(e),i=r.type,o=n.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new Zf({precision:6}).compare(t,e))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<r.coordinates.length;a++)for(var u=0;u<n.coordinates.length;u++){var l=r.coordinates[a],h=n.coordinates[u];if(l[0]===h[0]&&l[1]===h[1])return!0}return!1;case"LineString":case"MultiLineString":un(t,(function(t){un(e,(function(e){nc(t,e).features.length&&s++}))}));break;case"Polygon":case"MultiPolygon":un(t,(function(t){un(e,(function(e){_a(t,e).features.length&&s++}))}))}return s>0},booleanPointOnLine:Fa,booleanEqual:function(t,e){return En(t).type===En(e).type&&new Zf({precision:6}).compare(No(t),No(e))},booleanWithin:Oa,booleanIntersects:$f,clone:Oi,cleanCoords:No,clustersDbscan:function(t,e,r){void 0===r&&(r={}),!0!==r.mutate&&(t=Oi(t)),r.minPoints=r.minPoints||3;var n=new op.DBSCAN,i=n.run(rn(t),jr(e,r.units),r.minPoints,Pi),o=-1;return i.forEach((function(e){o++,e.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster=o,r.properties.dbscan="core"}))})),n.noise.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster?r.properties.dbscan="edge":r.properties.dbscan="noise"})),t},clustersKmeans:function(t,e){void 0===e&&(e={});var r=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(r/2)),e.numberOfClusters>r&&(e.numberOfClusters=r),!0!==e.mutate&&(t=Oi(t));var n=rn(t),i=n.slice(0,e.numberOfClusters),o=dp(n,e.numberOfClusters,i),s={};return o.centroids.forEach((function(t,e){s[e]=t})),tn(t,(function(t,e){var r=o.idxs[e];t.properties.cluster=r,t.properties.centroid=s[r]})),t},pointToLineDistance:wa,booleanParallel:function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Ap(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Ap(e,"line2"))throw new Error("line2 must be a LineString");for(var r=Rs(No(t)).features,n=Rs(No(e)).features,i=0;i<r.length;i++){var o=r[i].geometry.coordinates;if(!n[i])break;if(!gp(o,n[i].geometry.coordinates))return!1}return!0},shortestPath:function(t,e,r){if(!qr(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,o=r.obstacles||Lr([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!Hr(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=An(t),a=An(e);switch(t=Cr(s),e=Cr(a),xn(o)){case"FeatureCollection":if(0===o.features.length)return Mr([s,a]);break;case"Polygon":o=Lr([xr(En(o))]);break;default:throw new Error("invalid obstacles")}var u=o;u.features.push(t),u.features.push(e);var l=gn(Ef(Yo(gn(u)),1.15));n||(n=Pi([l[0],l[1]],[l[2],l[1]],r)/100),u.features.pop(),u.features.pop();for(var h=l[0],c=l[1],f=l[2],p=l[3],d=n/Pi([h,c],[f,c],r)*(f-h),g=n/Pi([h,c],[h,p],r)*(p-c),A=f-h,y=p-c,v=Math.floor(A/d),m=Math.floor(y/g),_=(A-v*d)/2,I=[],E=[],x=[],w=[],C=1/0,b=1/0,S=p-(y-m*g)/2,B=0;S>=c;){for(var M=[],T=[],L=h+_,R=0;L<=f;){var N=Cr([L,S]),P=Ep(N,o);M.push(P?0:1),T.push(L+"|"+S);var D=Pi(N,t);!P&&D<C&&(C=D,x={x:R,y:B});var k=Pi(N,e);!P&&k<b&&(b=k,w={x:R,y:B}),L+=d,R++}E.push(M),I.push(T),S-=g,B++}var F=new mp(E,{diagonal:!0}),Q=F.grid[x.y][x.x],O=F.grid[w.y][w.x],U=vp.search(F,Q,O),G=[s];return U.forEach((function(t){var e=I[t.x][t.y].split("|");G.push([+e[0],+e[1]])})),G.push(a),No(Mr(G))},voronoi:function(t,e){if(!qr(e=e||{}))throw new Error("options is invalid");var r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return In(t,"Point","points"),Lr(function(){var t=wp,e=Cp,r=null;function n(n){return new od(n.map((function(r,i){var o=[Math.round(t(r,i,n)/rd)*rd,Math.round(e(r,i,n)/rd)*rd];return o.index=i,o.data=r,o})),r)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(e){return arguments.length?(t="function"==typeof e?e:xp(+e),n):t},n.y=function(t){return arguments.length?(e="function"==typeof t?t:xp(+t),n):e},n.extent=function(t){return arguments.length?(r=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},n.size=function(t){return arguments.length?(r=null==t?null:[[0,0],[+t[0],+t[1]]],n):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},n}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(sd))},ellipse:ad,centerMean:ld,centerMedian:function(t,e){if(void 0===e&&(e={}),!qr(e=e||{}))throw new Error("options is invalid");var r=e.counter||10;if(!Hr(r))throw new Error("counter must be a number");var n=e.weight,i=ld(t,{weight:e.weight}),o=Lr([]);tn(t,(function(t){var e;o.features.push(ts(t,{properties:{weight:null===(e=t.properties)||void 0===e?void 0:e[n]}}))}));var s={tolerance:e.tolerance,medianCandidates:[]};return hd(i.geometry.coordinates,[0,0],o,s,r)},standardDeviationalEllipse:function(t,e){if(!qr(e=e||{}))throw new Error("options is invalid");var r=e.steps||64,n=e.weight,i=e.properties||{};if(!Hr(r))throw new Error("steps must be a number");if(!qr(i))throw new Error("properties must be a number");var o=rn(t).length,s=ld(t,{weight:n}),a=0,u=0,l=0;tn(t,(function(t){var e=t.properties[n]||1,r=cd(yn(t),yn(s));a+=Math.pow(r.x,2)*e,u+=Math.pow(r.y,2)*e,l+=r.x*r.y*e}));var h=a-u,c=Math.sqrt(Math.pow(h,2)+4*Math.pow(l,2)),f=2*l,p=Math.atan((h+c)/f),d=180*p/Math.PI,g=0,A=0,y=0;tn(t,(function(t){var e=t.properties[n]||1,r=cd(yn(t),yn(s));g+=Math.pow(r.x*Math.cos(p)-r.y*Math.sin(p),2)*e,A+=Math.pow(r.x*Math.sin(p)+r.y*Math.cos(p),2)*e,y+=e}));var v=Math.sqrt(2*g/y),m=Math.sqrt(2*A/y),_=ad(s,v,m,{units:"degrees",angle:d,steps:r,properties:i}),I=Ni(t,Lr([_])),E={meanCenterCoordinates:yn(s),semiMajorAxis:v,semiMinorAxis:m,numberOfFeatures:o,angle:d,percentageWithinEllipse:100*rn(I).length/o};return _.properties.standardDeviationalEllipse=E,_},angle:function(t,e,r,n){if(void 0===n&&(n={}),!qr(n))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!r)throw new Error("endPoint is required");var i=t,o=e,s=r,a=Ur(!0!==n.mercator?Zo(i,o):sc(i,o)),u=Ur(!0!==n.mercator?Zo(s,o):sc(s,o)),l=Math.abs(a-u);return!0===n.explementary?360-l:l},polygonSmooth:function(t,e){var r=[],n=e.iterations||1;if(!t)throw new Error("inputPolys is required");return nn(t,(function(t,e,i){var o,s,a;switch(t.type){case"Polygon":o=[[]];for(var u=0;u<n;u++)a=[[]],s=t,u>0&&(s=Sr(o).geometry),fd(s,a),o=a.slice(0);r.push(Sr(o,i));break;case"MultiPolygon":o=[[[]]];for(var l=0;l<n;l++)a=[[[]]],s=t,l>0&&(s=Pr(o).geometry),pd(s,a),o=a.slice(0);r.push(Pr(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),Lr(r)},moranIndex:function(t,e){var r=e.inputField,n=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=gd(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:n}),a=[];tn(t,(function(t){var e=t.properties||{};a.push(e[r])}));for(var u=Ad(a),l=function(t){for(var e=Ad(t),r=0,n=0,i=t;n<i.length;n++){var o=i[n];r+=Math.pow(o-e,2)}return r/t.length}(a),h=0,c=0,f=0,p=0,d=s.length,g=0;g<d;g++){for(var A=0,y=0;y<d;y++)h+=s[g][y]*(a[g]-u)*(a[y]-u),c+=s[g][y],f+=Math.pow(s[g][y]+s[y][g],2),A+=s[g][y]+s[y][g];p+=Math.pow(A,2)}var v=h/c/l,m=-1/(d-1),_=(d*d*(f*=.5)-d*p+c*c*3)/((d-1)*(d+1)*(c*c))-m*m,I=Math.sqrt(_);return{expectedMoranIndex:m,moranIndex:v,stdNorm:I,zNorm:(v-m)/I}},distanceWeight:gd,bearingToAngle:Ur,convertDistance:jr,degrees2radians:zr,distanceToDegrees:Or,distanceToRadians:Qr,radians2degrees:Gr,radiansToDistance:Fr,difference:function(t,e){var r=En(t),n=En(e),i=t.properties||{},o=Bg.difference(r.coordinates,n.coordinates);return 0===o.length?null:1===o.length?Sr(o[0],i):Pr(o,i)},buffer:function(t,e,r){var n=(r=r||{}).units||"kilometers",i=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof r)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return nn(t,(function(t){var r=PE(t,e,n,i);r&&o.push(r)})),Lr(o);case"FeatureCollection":return tn(t,(function(t){var r=PE(t,e,n,i);r&&tn(r,(function(t){t&&o.push(t)}))})),Lr(o)}return PE(t,e,n,i)},union:function(t,e,r){void 0===r&&(r={});var n=En(t),i=En(e),o=Bg.union(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?Sr(o[0],r.properties):Pr(o,r.properties)},intersect:QE,dissolve:function(t,e){if(!qr(e=e||{}))throw new Error("options is invalid");var r=e.propertyName;In(t,"Polygon","dissolve");var n=[];if(!e.propertyName)return Ha(Pr(Bg.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};tn(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[r])||(i[t.properties[r]]=[]),i[t.properties[r]].push(t)}));for(var o=Object.keys(i),s=0;s<o.length;s++){var a=Pr(Bg.union.apply(null,i[o[s]].map((function(t){return t.geometry.coordinates}))));a.properties[r]=o[s],n.push(a)}return Ha(Lr(n))},hexGrid:OE,mask:function(t,e){var r,n,i=jE(e),o=null;return"FeatureCollection"===t.type?(n=2===(r=t).features.length?Bg.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):Bg.union.apply(Bg,r.features.map((function(t){return t.geometry.coordinates}))),o=zE(n)):o=zE(Bg.union(t.geometry.coordinates)),o.geometry.coordinates.forEach((function(t){i.geometry.coordinates.push(t[0])})),i},squareGrid:VE,triangleGrid:HE,interpolate:function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.gridType,i=r.property,o=r.weight;if(!t)throw new Error("points is required");if(In(t,"Point","input must contain Points"),!e)throw new Error("cellSize is required");if(void 0!==o&&"number"!=typeof o)throw new Error("weight must be a number");i=i||"elevation",n=n||"square",o=o||1;var s,a=gn(t);switch(n){case"point":case"points":s=ja(a,e,r);break;case"square":case"squares":s=VE(a,e,r);break;case"hex":case"hexes":s=OE(a,e,r);break;case"triangle":case"triangles":s=HE(a,e,r);break;default:throw new Error("invalid gridType")}var u=[];return tn(s,(function(e){var s=0,a=0;tn(t,(function(t){var u,l=Pi("point"===n?e:ts(e),t,r);if(void 0!==i&&(u=t.properties[i]),void 0===u&&(u=t.geometry.coordinates[2]),void 0===u)throw new Error("zValue is missing");0===l&&(s=u);var h=1/Math.pow(l,o);a+=h,s+=h*u}));var l=Oi(e);l.properties[i]=s/a,u.push(l)})),Lr(u)},toMercator:yd,toWgs84:vd,randomPosition:wd,randomPoint:Cd,randomPolygon:bd,randomLineString:Sd,getCluster:Ld,clusterEach:Rd,clusterReduce:Nd,createBins:Pd,applyFilter:Dd,propertiesContainsFilter:kd,filterProperties:Fd,earthRadius:mr,factors:_r,unitsFactors:Ir,areaFactors:Er,feature:xr,geometry:wr,point:Cr,points:br,polygon:Sr,polygons:Br,lineString:Mr,lineStrings:Tr,featureCollection:Lr,multiLineString:Rr,multiPoint:Nr,multiPolygon:Pr,geometryCollection:Dr,round:kr,radiansToLength:Fr,lengthToRadians:Qr,lengthToDegrees:Or,bearingToAzimuth:Ur,radiansToDegrees:Gr,degreesToRadians:zr,convertLength:jr,convertArea:Vr,isNumber:Hr,isObject:qr,validateBBox:Yr,validateId:Xr,getCoord:An,getCoords:yn,containsNumber:vn,geojsonType:mn,featureOf:_n,collectionOf:In,getGeom:En,getType:xn,coordAll:rn,coordEach:Jr,coordReduce:Kr,featureEach:tn,featureReduce:en,findPoint:pn,findSegment:fn,flattenEach:sn,flattenReduce:an,geomEach:nn,geomReduce:on,lineEach:hn,lineReduce:cn,propEach:Zr,propReduce:$r,segmentEach:un,segmentReduce:ln});function YE(t){for(var e,r,n,i=-1,o=0,s=0;s<t.length;++s){var a=t[s];if(a.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===e&&(e=a.array.constructor),e!==a.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===r&&(r=a.itemSize),r!==a.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===n&&(n=a.normalized),n!==a.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===i&&(i=a.gpuType),i!==a.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;o+=a.array.length}for(var u=new e(o),l=0,c=0;c<t.length;++c)u.set(t[c].array,l),l+=t[c].array.length;var f=new h(u,r,n);return void 0!==i&&(f.gpuType=i),f}function XE(t,e){if(e===c)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===f||e===p){var r=t.getIndex();if(null===r){var n=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var o=0;o<i.count;o++)n.push(o);t.setIndex(n),r=t.getIndex()}var s=r.count-2,a=[];if(e===f)for(var u=1;u<=s;u++)a.push(r.getX(0)),a.push(r.getX(u)),a.push(r.getX(u+1));else for(var l=0;l<s;l++)l%2==0?(a.push(r.getX(l)),a.push(r.getX(l+1)),a.push(r.getX(l+2))):(a.push(r.getX(l+2)),a.push(r.getX(l+1)),a.push(r.getX(l)));a.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var h=t.clone();return h.setIndex(a),h.clearGroups(),h}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}function WE(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return console.warn("THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries()."),function(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=null!==t[0].index,n=new Set(Object.keys(t[0].attributes)),i=new Set(Object.keys(t[0].morphAttributes)),o={},s={},a=t[0].morphTargetsRelative,u=new l,h=0,c=0;c<t.length;++c){var f=t[c],p=0;if(r!==(null!==f.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(var d in f.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;void 0===o[d]&&(o[d]=[]),o[d].push(f.attributes[d]),p++}if(p!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(var g in f.morphAttributes){if(!i.has(g))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+". .morphAttributes must be consistent throughout all geometries."),null;void 0===s[g]&&(s[g]=[]),s[g].push(f.morphAttributes[g])}if(e){var A=void 0;if(r)A=f.index.count;else{if(void 0===f.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+". The geometry must have either an index or a position attribute"),null;A=f.attributes.position.count}u.addGroup(h,A,c),h+=A}}if(r){for(var y=0,v=[],m=0;m<t.length;++m){for(var _=t[m].index,I=0;I<_.count;++I)v.push(_.getX(I)+y);y+=t[m].attributes.position.count}u.setIndex(v)}for(var E in o){var x=YE(o[E]);if(!x)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+E+" attribute."),null;u.setAttribute(E,x)}for(var w in s){var C=s[w][0].length;if(0===C)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[w]=[];for(var b=0;b<C;++b){for(var S=[],B=0;B<s[w].length;++B)S.push(s[w][B][b]);var M=YE(S);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+w+" morphAttribute."),null;u.morphAttributes[w].push(M)}}return u}(t,e)}var JE=Math.PI/180,KE=6378137;function ZE(){var t="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}));return"iep".concat(t,"layer")}function $E(t){return new Promise((function(e){return setTimeout(e,t)}))}function tx(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function ex(t,e){return 256*(t=u.MathUtils.clamp(Math.floor(t),0,255))+(e=u.MathUtils.clamp(Math.floor(e),0,255))}function rx(e){for(var r=1/0,n=1/0,i=-1/0,o=-1/0,s=0,a=e.length;s<a;s++){var u=e[s],l=u.coordinate,h=u.lnglat,c=u.lnglats,f=u.xy,p=u.xys,d=l||h||c||f||p||e[s],g=void 0,A=void 0;Array.isArray(d)?(g=d[0],A=d[1]):d instanceof t.Coordinate&&(g=d.x,A=d.y),r=Math.min(r,g),n=Math.min(n,A),i=Math.max(i,g),o=Math.max(o,A)}return new t.Coordinate((r+i)/2,(n+o)/2)}function nx(t,e,r,n){var i=t,o=e.getShell(),s=[];o.forEach((function(t){var e=r.coordinateToVector3(t).sub(i);s.push(e)}));for(var a=[],l=0,h=s.length;l<h;l++)if(l!==s.length-1){var c=new Float32Array(12),f=s[l],p=s[l+1];c[0]=f.x,c[1]=f.y,c[2]=n,c[6]=f.x,c[7]=f.y,c[8]=0,c[3]=p.x,c[4]=p.y,c[5]=n,c[9]=p.x,c[10]=p.y,c[11]=0;var d=new u.BufferGeometry;d.setAttribute("position",new u.BufferAttribute(c,3)),d.setIndex([0,2,1,2,3,1]),a.push(d)}var g=new Float32Array(12),A=s[s.length-1],y=s[0];g[0]=A.x,g[1]=A.y,g[2]=n,g[6]=A.x,g[7]=A.y,g[8]=0,g[3]=y.x,g[4]=y.y,g[5]=n,g[9]=y.x,g[10]=y.y,g[11]=0;var v=new u.BufferGeometry;v.setAttribute("position",new u.BufferAttribute(g,3)),v.setIndex([0,2,1,2,3,1]),a.push(v);var m=WE(a);return m.computeVertexNormals(),m}function ix(t){for(var e=t.length,r=0,n=0;n<e;n++){r+=t[n].position.count}return new Float32Array(3*r)}function ox(t){return t*JE}function sx(t,e){if(!t||!e)return 0;Array.isArray(t)||(t=t.toArray()),Array.isArray(e)||(e=e.toArray());var r=ox(t[1]),n=ox(e[1]),i=r-n,o=ox(t[0])-ox(e[0]);return r=2*Math.asin(Math.sqrt(Math.pow(Math.sin(i/2),2)+Math.cos(r)*Math.cos(n)*Math.pow(Math.sin(o/2),2))),r*=KE,Math.round(1e5*r)/1e5}function ax(t){for(var e=function(t){return t.getCoordinates().map((function(t){return t.toArray()}))}(t),r=0,n=0,i=e.length;n<i-1;n++)r+=sx(e[n],e[n+1]);return r}function ux(t,e,r){var n=t*(Math.PI/180),i=new u.Vector3(Math.sin(n)*e,Math.cos(n)*e,0);return i=i.applyMatrix4(r)}function lx(t,e,r,n,i){for(var o,s,a=[],l=i.map,h=i.coordinateToVector3([t,e],0),c=(new u.Matrix4).makeTranslation(h.x,h.y,0),f=i.distanceToVector3(r,r).x,p=0;p<=360;){var d=(s=void 0,s=0,(o=p)<=90?s=-o:o>90&&o<=180||o>180&&o<=270?s=180-o:o>270&&o<360&&(s=360-o),{rotation:s}),g=ux(p,f,c),A=l.pointAtResToCoord(g,l.getGLRes());a.push({coord:[A.x,A.y],rotation:d.rotation}),p+=n}return a}function hx(t,e,r,n,i){for(var o=i.map,s=i.coordinateToVector3([t,e],0),a=(new u.Matrix4).makeTranslation(s.x,s.y,0),l=i.distanceToVector3(r,r).x,h=[],c=0;c<=360;c++){var f=new u.Vector3(Math.sin(c*(Math.PI/180))*l,Math.cos(c*(Math.PI/180))*l,0);f=f.applyMatrix4(a);var p=o.pointAtResToCoord(f,o.getGLRes());h.push([p.x,p.y])}return{type:"FeatureCollection",name:"net",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:[{type:"Feature",properties:{Id:0,color:n.color||"#fff"},geometry:{type:"MultiPolygon",coordinates:[[h]]}}]}}function cx(t,e,r,n,i){var o=t.x*Math.cos(r)*n-t.y*Math.sin(r)*n,s=t.x*Math.sin(r)*n+t.y*Math.cos(r)*n,a=new u.Vector3(o,s,0);return a=a.applyMatrix4(e),i.pointAtResToCoord(a,i.getGLRes())}function fx(t,e,r,n,i,o,s){var a=Math.PI/180*90,l=Math.PI/180*-90,h=s.distanceToVector3(i,i).x,c=s.coordinateToVector3([t,e],0),f=(new u.Matrix4).makeTranslation(c.x,c.y,0),p=s.coordinateToVector3([r,n],0).sub(c).normalize(),d=cx(p,f,a,h,s.map),g=cx(p,f,l,h,s.map);return{type:"FeatureCollection",name:"net",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:[{type:"Feature",properties:{Id:0},geometry:{type:"MultiPolygon",coordinates:[[[[d.x,d.y],[g.x,g.y]]]]}}]}}function px(e,r){var n,i,o=[],s=[];return e instanceof t.Geometry?(e.getCoordinates().forEach((function(t){t[0].forEach((function(t){o.push([t.x,t.y])}))})),n=Sr([o])):n=e,r instanceof t.Geometry?(r.getCoordinates().forEach((function(t){t[0].forEach((function(t){s.push([t.x,t.y])}))})),i=Sr([s])):i=r,QE(n,i)}function dx(t,e){for(var r=0;r<t.geometry.coordinates[0].length;r++){var n=t.geometry.coordinates[0][r];if(n[0]===e[0]&&n[1]===e[1])return!0}return!1}function gx(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(n[0].toFixed(6)===e[0].toFixed(6)&&n[1].toFixed(6)===e[1].toFixed(6))return!0}return!1}function Ax(t,e,r,n){for(var i=0;i<t.geometry.coordinates[0].length;i++){var o=t.geometry.coordinates[0][i],s=gx(e,o),a=gx(r,o),u=gx(n,o);if(!1===s&&!1===a&&!1===u)return o}}function yx(e,r){for(var n=[],i=[],o=0;o<e.length-1;o++){var s=[],a=o+1,u=fx(e[o][0],e[o][1],e[a][0],e[a][1],50,0,r);s.push(u.features[0].geometry.coordinates[0][0][0]),s.push(u.features[0].geometry.coordinates[0][0][1]);var l=fx(e[a][0],e[a][1],e[o][0],e[o][1],50,0,r);s.push(l.features[0].geometry.coordinates[0][0][0]),s.push(l.features[0].geometry.coordinates[0][0][1]),s.push(u.features[0].geometry.coordinates[0][0][0]);var h={type:"FeatureCollection",features:[{type:"Feature",properties:{_draw_type:"line"},geometry:{type:"MultiPolygon",coordinates:[[s]]}}]};n.push(s);var c=new t.MultiPolygon(h.features[0].geometry.coordinates);i.push(c)}var f=[];f.push(n[0][0]),f.push(n[0][1]);for(var p=0;p<n.length-1;p++){var d=i[p],g=i[p+1],A=n[p],y=n[p+1],v=px(d,g);if(dx(v,0===p?A[2]:y[1])){var m=Ax(v,A,y,e);f.push(m)}else f.push(A[2]),f.push(y[1])}f.push(n[n.length-1][2]),f.push(n[n.length-1][3]);for(var _=n.length-1;_>0;_--){var I=i[_],E=i[_-1],x=n[_],w=n[_-1],C=px(I,E);if(dx(C,x[4])){var b=Ax(C,x,w,e);f.push(b)}else f.push(x[4]),f.push(w[3])}return f.push(n[0][0]),f}function vx(t,e,r,n){for(var i=Mr(t),o=[],s=[],a=0;a<e.length;a++)if(0!==a&&a!==e.length-1){var l=Ea(i,Cr(e[a]),{units:"miles"});o.push(l),s.push(n[l.properties.index].z)}for(var h=1,c=[],f=0;f<o.length;f++){var p=o[f].properties.index;c.push([h,p]),h=p+1}c.push([h,t.length-2]);var d=[],g=new u.Color(r[0].color);d.push(g.r,g.g,g.b);for(var A=0;A<c.length;A++)for(var y=r[A],v=r[A+1],m=c[A],_=parseInt((m[1]-m[0]+1)/2),I=0,E=m[0];E<=m[1];E++){var x=void 0;x=I<_?new u.Color(y.color):new u.Color(v.color),d.push(x.r,x.g,x.b),I+=1}var w=new u.Color(r[r.length-1].color);return d.push(w.r,w.g,w.b),{allColors:d,snapPoints:o,snapPointsH:s}}var mx={altitude:0,imageWidth:512,imageHeight:512,texture:null},_x=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n);var l=i=t.Util.extend({},mx,i),h=l.altitude;l.imageHeight,l.imageWidth,e instanceof t.Extent||(e=new t.Extent(e));var c=e,f=c.xmin,p=c.ymin,d=c.xmax,g=c.ymax,A=1/0,y=1/0,v=-1/0,m=-1/0;[[f,p],[f,g],[d,g],[d,p]].forEach((function(t){var e=s.coordinateToVector3(t),r=e.x,n=e.y;A=Math.min(r,A),y=Math.min(n,y),v=Math.max(r,v),m=Math.max(n,m)}));var _=Math.abs(v-A),I=Math.abs(m-y),E=new u.PlaneGeometry(_,I);(a=r.call(this))._initOptions(i),a._createMesh(E,o);var x=s.distanceToVector3(h,h).x,w=s.coordinateToVector3(e.getCenter(),x);return a.getObject3d().position.copy(w),a.parent=null,a.type="Image",a}return tr(n)}(),Ix=function(){function e(r,n,i,o,s,a){var l=this;Ze(this,e),this.threelayer=s,this.map=s.map,this.groupId=a,this.textureLoader=new u.TextureLoader;var h=r.split(","),c=n.split(","),f=parseFloat(h[0]),p=parseFloat(h[1]),d=parseFloat(c[0]),g=parseFloat(c[1]),A=o.maxZoom||11,y=o.renderOrder||0,v=o.opacity||1,m=o.minZoom||3,_=new t.Extent(f,p,d,g);this.xmin_g=f,this.ymin_g=p,this.xmax_g=d,this.ymax_g=g,this.cacheTextureFlag=o.cacheTextureFlag,this.cacheTexture={},this.textureLoader.load(i,(function(t){var e=new u.MeshBasicMaterial({map:t,transparent:!0,opacity:v}),r=new _x(_,{imageWidth:512,imageHeight:512,maxZoom:A,minZoom:m,interactive:void 0!==o.interactive&&o.interactive},e,l.threelayer);r.object3d.renderOrder=y,l.imgMesh=r,l.imgMesh.parent=l,l.m=e,l.texture=t,l.groupId?l.threelayer.addMesh1(l.imgMesh,l.groupId):l.threelayer.addMesh(l.imgMesh),o.opacityItems&&o.opacityItems.length>0&&!isNaN(o.opacityItems[0])&&!isNaN(o.opacityItems[1])&&o.opacityItems[0]>3&&o.opacityItems[0]<=18&&o.opacityItems[1]>=0&&o.opacityItems[1]<=1&&(l.opacityItems=o.opacityItems,l._bindMapEvents(),l._viewChange()),l.cacheTextureFlag&&void 0===l.cacheTexture[i]&&(l.cacheTexture[i]=t)}))}return tr(e,[{key:"_bindMapEvents",value:function(){this.map.on("viewchange",this._viewChange,this)}},{key:"_viewChange",value:function(){this.opacityItems[0]<=this.map.getZoom()?this.imgMesh.object3d.material.opacity=this.opacityItems[1]:this.imgMesh.object3d.material.opacity=1}},{key:"_closeEvent",value:function(){this.map.off("viewchange",this._viewChange,this)}},{key:"updateImage",value:function(e,r){var n=this;if(r&&r.leftbottom&&r.righttop){var i=parseFloat(r.leftbottom[0]),o=parseFloat(r.leftbottom[1]),s=parseFloat(r.righttop[0]),a=parseFloat(r.righttop[1]);if(i!==this.xmin_g||o!==this.ymin_g||s!==this.xmax_g||a!==this.ymax_g){var l=new t.Extent(i,o,s,a),h=1/0,c=1/0,f=-1/0,p=-1/0;[[i,o],[i,a],[s,a],[s,o]].forEach((function(t){var e=n.threelayer.coordinateToVector3(t),r=e.x,i=e.y;h=Math.min(r,h),c=Math.min(i,c),f=Math.max(r,f),p=Math.max(i,p)}));for(var d=Math.abs(f-h),g=Math.abs(p-c),A=new u.PlaneBufferGeometry(d,g),y=A.attributes.position.array,v=this.imgMesh.object3d.geometry.attributes.position.array,m=0;m<v.length;m++)v[m]=y[m];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var _=this.threelayer.coordinateToVector3(l.getCenter(),0);this.imgMesh.getObject3d().position.copy(_),A.dispose(),this.xmin_g=i,this.ymin_g=o,this.xmax_g=s,this.ymax_g=a}}this.cacheTextureFlag?void 0===this.cacheTexture[e]?this.textureLoader.load(e,(function(t){t.magFilter=u.NearestFilter,t.minFilter=u.NearestFilter,n.imgMesh.object3d.material.map=t,n.imgMesh.object3d.material.map.needsUpdate=!0,n.cacheTexture[e]=t})):(this.imgMesh.object3d.material.map=this.cacheTexture[e],this.imgMesh.object3d.material.map.needsUpdate=!0):this.textureLoader.load(e,(function(t){n.texture&&n.texture.dispose(),delete n.texture,t.magFilter=u.NearestFilter,t.minFilter=u.NearestFilter,n.imgMesh.object3d.material.map=t,n.imgMesh.object3d.material.map.needsUpdate=!0,n.texture=t})),!1===this.imgMesh.isAdd&&(this.threelayer?(this.groupId?this.threelayer.addMesh1(this.imgMesh,this.groupId):this.threelayer.addMesh(this.imgMesh),this.opacityItems&&this._bindMapEvents()):this.dispose())}},{key:"clearImage",value:function(){this.imgMesh&&(this.groupId?this.threelayer.removeMesh1(this.imgMesh,this.groupId):this.threelayer.removeMesh(this.imgMesh),this.opacityItems&&this._closeEvent())}},{key:"show",value:function(){this.imgMesh&&(this.threelayer.addMesh(this.imgMesh),this.opacityItems&&this._bindMapEvents())}},{key:"dispose",value:function(){var t;for(var e in this.imgMesh&&(!0===this.imgMesh.isAdd&&(this.groupId?this.threelayer.removeMesh1(this.imgMesh,this.groupId):this.threelayer.removeMesh(this.imgMesh)),this.imgMesh.object3d.geometry&&this.imgMesh.object3d.geometry.dispose(),this.imgMesh.object3d.material&&(this.imgMesh.object3d.material.dispose(),delete this.m)),this.cacheTexture)this.cacheTexture[e].dispose(),delete this.cacheTexture[e];null===(t=this.texture)||void 0===t||t.dispose(),this.texture=null,this.opacityItems&&(this._closeEvent(),delete this.opacityItems),this.threelayer=null,this.textureLoader&&delete this.textureLoader}}]),e}(),Ex={interactive:!1,altitude:0,imageWidth:512,imageHeight:512,texture:null},xx=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s,a){var l;Ze(this,n);var h=(o=t.Util.extend({},Ex,o)).altitude,c=a.distanceToVector3(i,i).x,f=new u.CircleGeometry(c,32);(l=r.call(this))._initOptions(o),l._createMesh(f,s);var p=a.distanceToVector3(h,h).x,d=a.coordinateToVector3(e,p);return l.getObject3d().position.copy(d),l.parent=null,l.type="radarObject",l}return tr(n)}(),wx=function(){function t(e,r,n,i,o,s){Ze(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s,this.imgUrl=n.imgUrl,this.loader=new u.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var a=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n const float PI = 3.14159265359;\n const float TWO_PI = 6.28318530718;\n const int N = 3;\n const float r0 = 0.01;\n const float r_blue = 0.025;\n const float r_red = 0.015;\n const float edge = 0.95;\n const float offset = 0.05;\n\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n float plot(const vec2 st, const float pct, const float width)\n {\n return smoothstep(pct - width, pct, st.y) -\n smoothstep(pct, pct + width, st.y);\n }\n float drawPolygon(const vec2 polygonCenter, const int N, const float radius, vec2 pos)\n {\n pos = pos - polygonCenter;\n float d = 0.0;\n float a = atan(pos.x, pos.y);\n float r = TWO_PI / float(N);\n d = cos(floor(0.5 + a / r)*r - a)*length(pos);\n return (1.0 - smoothstep(radius, radius + radius/10.0, d));\n }\n float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n {\n float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n }\n void main() {\n // Normalized pixel coordinates (from 0 to 1)\n vec2 uv = vUv;\n vec2 pos = uv.xy - vec2(0.5, 0.5) ; // center what being drawn\n vec4 grndSpd = vec4(0.0, time/5.0, 0.0, 0.0);\n vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.85, 0.0, 1.0);\n //vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.58, 1.0, 1.0);\n //vec3 color = vec3(0.0, 0.0, 0.0);\n vec3 color = vec3(0.0, 147. / 255., 1.0);\n float r = length(pos) * 2.0;\n float a = atan(pos.y, pos.x); // angle of pixel\n float an = PI - mod(time/ 1.0, TWO_PI); // angle of radar sweep\n float blipSpd = 3.0; // Blip / Trace speed\n vec2 translate1 = vec2(cos(time/ blipSpd), sin(time/ blipSpd));\n vec2 translate2 = vec2(sin(time/ blipSpd), cos(time/ blipSpd));\n vec2 left1 = translate1 * 0.35;\n vec2 right1 = -translate1 * 0.30;\n vec2 left2 = translate2 * 0.15;\n vec2 right2 = -translate2 * 0.25;\n // Radar Sweep\n float sn = step(PI/2.0, an) * step(-PI/2.0, (a + an)) * step(r, edge) * (1.0 - 0.55 * (a + (TWO_PI) - an));\n float sw = step(an, a) * step(r, edge);\n float s_blade = sw * (1.0 - (a - an) * 20.0);\n float s = sw * (1.0 - 0.55 * (a - an));\n s = max(sn,s);\n float se = step(r, edge - 0.05);\n // Center point\n float s1 = smoothstep(edge - 0.00, edge + 0.01, r)* smoothstep(edge + 0.02, edge + 0.01, r);\n // Circular concentric rings\n float s0 = 1.0 - smoothstep(r0 / 2.0, r0, length(pos));\n float smb = (1.0 - smoothstep(0.2, 0.2 + 0.01, length(pos))) * (1.0 - smoothstep(0.2 +0.01, 0.2, length(pos)));\n float smr = (1.0 - smoothstep(0.3, 0.3 + 0.01, length(pos))) * (1.0 - smoothstep(0.3 +0.01, 0.3, length(pos)));\n // Circular concentric gradations\n float gradNum = 120.0;\n float tickWidth = 0.9;\n const float tickLen = 0.04;\n float outRad = edge;\n float move = 0.0;\n float sm = 0.75*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n gradNum = 36.0;\n tickWidth = 0.95;\n outRad = 0.6;\n move = sin(time/10.0);\n smr += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n outRad = 0.4;\n move = cos(time/10.0);\n smb += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n // Radial spoke gradations\n float sr = plot(pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.x, 0.002) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.y, 0.003) * step(r, edge - 0.06);\n sr += plot(-pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr *= 0.75;\n // Blue circular radar blip traces\n vec2 st_trace1 = left2;\n float s_trace1 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1)));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+offset, +offset))));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+2.0 *offset, +2.0 *offset))));\n\n vec2 st_trace2 = right1;\n float s_trace2 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace2)));\n // Red Trianglular radar flight blip trace\n vec2 st_trace3 = left1;\n float st1 = s * (drawPolygon(st_trace3, N, r_red , pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(-offset, -offset), N, r_red, pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(+offset, -offset), N, r_red, pos));\n\n vec2 st_trace4 = right2;\n float st2 = s * (drawPolygon(st_trace4, N, r_red, pos)); \n // Lets add all the bits together and send them to screen\n float s_grn = max(s * mapcol.y, s_blade);\n s_grn = max(s_grn, (s0 + sr + sm));\n s_grn += s1 / 1.5 + smb + smr;\n\n float s_red = st1*2.0 + st2*2.0 + smr;\n \n float s_blue = max(s_trace1 + s_trace2, s_blade) + smb;\n\n if (s_trace1 > 0.0 || s_trace2 > 0.0) { s_blue = max(s, s_blue); s_grn = max(s_grn, s_blue); }\n\n color += vec3(s_red , s_grn, s_blue); \n vec4 texColor = mapcol * s;\n // Output to screen \n gl_FragColor = vec4(color, 0.5);//Set the screen pixel to that color\n }",side:u.DoubleSide,transparent:!0});this.radar=new xx(e,r,{},a,i),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return tr(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.radar,this.groupId):this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),Cx=function(){function t(e,r,n,i,o,s){Ze(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s,this.imgUrl=n.imgUrl,this.loader=new u.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var a=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n const float PI = 3.14159265359;\n const float TWO_PI = 6.28318530718;\n const int N = 3;\n const float r0 = 0.01;\n const float r_blue = 0.025;\n const float r_red = 0.015;\n const float edge = 0.95;\n const float offset = 0.05;\n\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n float plot(const vec2 st, const float pct, const float width)\n {\n return smoothstep(pct - width, pct, st.y) -\n smoothstep(pct, pct + width, st.y);\n }\n float drawPolygon(const vec2 polygonCenter, const int N, const float radius, vec2 pos)\n {\n pos = pos - polygonCenter;\n float d = 0.0;\n float a = atan(pos.x, pos.y);\n float r = TWO_PI / float(N);\n d = cos(floor(0.5 + a / r)*r - a)*length(pos);\n return (1.0 - smoothstep(radius, radius + radius/10.0, d));\n }\n float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n {\n float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n }\n void main() {\n // Normalized pixel coordinates (from 0 to 1)\n vec2 uv = vUv;\n vec2 pos = uv.xy - vec2(0.5, 0.5) ; // center what being drawn\n vec4 grndSpd = vec4(0.0, time/5.0, 0.0, 0.0);\n vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.85, 0.0, 1.0);\n //vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.58, 1.0, 1.0);\n vec3 color = vec3(0.0, 0.0, 0.0); //背景色 黑色\n float r = length(pos) * 2.0;\n float a = atan(pos.y, pos.x); // angle of pixel\n float an = PI - mod(time/ 1.0, TWO_PI); // angle of radar sweep\n float blipSpd = 3.0; // Blip / Trace speed\n vec2 translate1 = vec2(cos(time/ blipSpd), sin(time/ blipSpd));\n vec2 translate2 = vec2(sin(time/ blipSpd), cos(time/ blipSpd));\n vec2 left1 = translate1 * 0.35;\n vec2 right1 = -translate1 * 0.30;\n vec2 left2 = translate2 * 0.15;\n vec2 right2 = -translate2 * 0.25;\n // Radar Sweep 雷达扫描\n float sn = step(PI/2.0, an) * step(-PI/2.0, (a + an)) * step(r, edge) * (1.0 - 0.55 * (a + (TWO_PI) - an));\n float sw = step(an, a) * step(r, edge);\n float s_blade = sw * (1.0 - (a - an) * 20.0);\n float s = sw * (1.0 - 0.55 * (a - an));\n s = max(sn,s);\n float se = step(r, edge - 0.05);\n // Center point\n float s1 = smoothstep(edge - 0.00, edge + 0.01, r) * smoothstep(edge + 0.02, edge + 0.01, r);\n // Circular concentric rings 圆形同心环\n float s0 = 1.0 - smoothstep(r0 / 2.0, r0, length(pos));\n //float smb = (1.0 - smoothstep(0.2, 0.2 + 0.01, length(pos))) * (1.0 - smoothstep(0.2 +0.01, 0.2, length(pos)));\n //float smb = s1;\n //float smr = (1.0 - smoothstep(0.3, 0.3 + 0.01, length(pos))) * (1.0 - smoothstep(0.3 +0.01, 0.3, length(pos)));\n // Circular concentric gradations 圆形同心渐变\n float gradNum = 120.0;\n float tickWidth = 0.9;\n const float tickLen = 0.04;\n float outRad = edge;\n float move = 0.0;\n float sm = 0.75*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n gradNum = 36.0;\n tickWidth = 0.95;\n //move = sin(time/10.0);\n //smr += gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n move = cos(time/10.0);\n //smb += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n //smb += gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n float smb = gradations(a, 1., 0.75, 0.08, 0.75, r, time); //圆环\n float smr = gradations(a, gradNum, outRad, tickLen, tickWidth, r, time * 0.3);\n\n\n // Lets add all the bits together and send them to screen\n //float s_grn = max(s * mapcol.y, s_blade);\n //s_grn = max(s_grn, (s0 + sr + sm));\n //s_grn = max(s_grn, (s0 + sr + sm));\n //s_grn += s1 / 1.5 + smb + smr;\n //s_grn += s1 / 1.5 + smb;\n //s_grn += s1 + smb;\n float s_grn = s1 + smb + smr;\n \n\n \n //float s_blue = max(s_trace1 + s_trace2, s_blade) + smb;\n float s_blue = s1 + smb + smr;\n\n //color += vec3(s_red , s_grn, s_blue); \n //color += vec3(0., s_grn, s_blue); //去掉红色三角\n color += vec3(0., s_grn, s_blue); //去掉红色三角\n //vec4 texColor = mapcol * s;\n // Output to screen \n gl_FragColor = vec4(color, 0.5);//Set the screen pixel to that color\n }",side:u.DoubleSide,transparent:!0});this.radar=new xx(e,r,{},a,i),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return tr(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.radar,this.groupId):this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),bx=function(){function t(e,r,n,i,o,s){Ze(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s,this.imgUrl=n.imgUrl,this.loader=new u.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var a=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n #define\tPI 3.141592\n #define\tTAU 6.283185\n\n uniform float time;\n varying vec2 vUv;\n float remap(float s, float a1, float a2, float b1, float b2)\n {\n return b1 + (s-a1)*(b2-b1)/(a2-a1);\n }\n // out: 0->val->0\n float SmoothTri2(float t, float val)\n {\n return val * (1.0-(0.5+cos(t*TAU)*0.5));\n }\n // Ring\n float ring(vec2 uv, float rad, float thickness)\n {\n return abs(rad - length(uv)) - thickness;\n }\n // Ring Segment (start 0-1, len 0-1)\n float ringseg(vec2 uv, float rad, float thickness,float segstart, float seglen)\n {\n float d = ring(uv,rad,thickness);\n float rr = fract((atan(uv.x, uv.y)/TAU)+segstart);\n return seglen > rr ? d : 1.0;\n }\n // Ring Segment pattern\n float ringsegpat(vec2 uv, float rad, float thickness,float segstart, float seglen,float pat)\n {\n float rr = fract((atan(uv.x, uv.y)/TAU)+segstart);\n float v1 = remap(rr, 0.0, seglen, 0.0, pat);\n thickness *= sin(v1*PI);\t\t\t// example pattern 1\n //thickness *= SmoothTri2(v1,1.0);\t// example pattern 2\n thickness *= fract(v1);\t\t\t\t// example pattern 3\n float d = abs(rad - length(uv)) - thickness;\n return seglen > rr ? d : 1.0;\n }\n float ringsegpat1(vec2 uv, float rad, float thickness,float segstart, float seglen,float pat)\n {\n float rr = fract((atan(uv.x, uv.y)/TAU)+segstart);\n float v1 = remap(rr, 0.0, seglen, 0.0, pat);\n thickness *= sin(v1*PI);\t\t\t// example pattern 1\n //thickness *= SmoothTri2(v1,1.0);\t// example pattern 2\n thickness *= fract(v1);\t\t\t\t// example pattern 3\n float d = abs(rad - length(uv)) - thickness;\n return seglen > rr ? d : 1.0;\n }\n float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n {\n float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n }\n void main() {\n vec2 uv = 2.0 * vUv - vec2(1., 1.);\n // ring segments\n float s = fract(time*0.3);\n //float r1 = ringseg(uv,0.5,0.025,s,0.2);\n float r1 = ringseg(uv,0.75,0.025,-s,0.2);\n float r2 = ringseg(uv,0.4,0.025,-s,0.2);\n\n // whole ring\n //float r3 = ring(uv,0.6,0.025);\n float r3 = ring(uv, 0.95, 0.005);\n // pattern ring 花纹环\n float r4 = ringsegpat(uv,0.8,0.1,fract(time*0.1),1.0,16.0);\n // 刻度\n float a = atan(uv.y, uv.x); // angle of pixel\n float r = length(uv) * 2.0;\n float move = cos(time/10.0);\n //float r5 = gradations(a, 120., 0.98, 0.04, 0.95, r, move);\n float r5 = ringsegpat1(uv,0.8,0.1,fract(time*0.1), 1.0, 32.0);\n \n // combine\n //float d = min(r4,min(r3,min(r1,r2)));//这里是全部图形\n //float d = min(r1,r2); //这里是两条弧段\n //float d = min(r1, r3);\n float d = r5;\n float c = smoothstep(0.0,0.01,d);\n \n vec4 backgroundcol = vec4(0, 0, 0, 1.0); //把1.0调成0.0背景就透明了\n vec4 imagecol = vec4(1.0, 1.0, 1.0, 1.0); //这里是所有图形的颜色\n\n gl_FragColor = mix(imagecol,backgroundcol,c);\n }",side:u.DoubleSide,transparent:!0});this.radar=new xx(e,r,{},a,i),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return tr(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.radar,this.groupId):this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),Sx=function(){function t(e,r,n,i,o,s){Ze(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s,this.imgUrl=n.imgUrl,this.loader=new u.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var a=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform float time;\n varying vec2 vUv;\n \n //#define PI 3.14159265358979323846\n #define roundnes 0.035\n\n #define PI 3.14159265\n #define DEG2RAD ((PI * 2.0) / 360.0)\n\n /*vec2 rotate2D(vec2 _st, float _angle){\n _st -= 0.5;\n _st = mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n _st += 0.5;\n return _st;\n }\n\n vec2 tile(vec2 _st, float _zoom){\n _st *= _zoom;\n return fract(_st);\n }\n\n float _box(vec2 _st, vec2 _size, float _smoothEdges){\n _size = vec2(0.5)-_size*0.5;\n vec2 aa = vec2(_smoothEdges*0.5);\n vec2 uv = smoothstep(_size,_size+aa,_st);\n uv *= smoothstep(_size,_size+aa,vec2(1.0)-_st);\n return uv.x*uv.y;\n }*/\n float subtract(float a, float b)\n {\n return min(max(a, -b), -roundnes) + length(max(vec2(roundnes) + vec2(a, -b), vec2(0.0)));\n }\n float merge(float a, float b)\n {\n return max(min(a, b), roundnes) - length(max(vec2(roundnes) - vec2(a, b), vec2(0.0)));\n }\n mat2 rotate(float a)\n {\n float sa = sin(a), ca = cos(a);\n return mat2(ca, -sa, sa, ca);\n }\n float box(vec2 p, vec2 size)\n {\n vec2 d = abs(p) - size + roundnes;\n return min(max(d.x, d.y), 0.0) + length(max(d, 0.0)) - roundnes;\n }\n float pModPolar(inout vec2 p, float repetitions)\n {\n float angle = 2.*PI/repetitions;\n float a = atan(p.y, p.x) + angle/2.;\n float r = length(p);\n float c = floor(a/angle);\n a = mod(a,angle) - angle/2.;\n p = vec2(cos(a), sin(a))*r;\n // For an odd number of repetitions, fix cell index of the cell in -x direction\n // (cell index would be e.g. -5 and 5 in the two halves of the cell):\n if (abs(c) >= (repetitions/2.)) c = abs(c);\n return c;\n }\n float shapeDist(vec2 p)\n {\n float d1 = box(p+vec2(0.0,0.0), vec2(1.0, 1.0));\t\t// main box to subtract\n //vec2 p2 = p * rotate(time*0.25*PI);\n vec2 p2 = p * rotate(0.25*PI);\n float offset = pModPolar(p2,16.0);\n //vec2 p3 = (p2-vec2(0.45,0.0)) * rotate(time*0.8);\n vec2 p3 = (p2-vec2(0.45,0.0)) * rotate(0.8);\n pModPolar(p3,9.0); \n float d2 = box(p3-vec2(0.05,0.0), vec2(0.04, 0.02));\n \n //float d4 = box(p,vec2(0.1,0.1));\n //d2 = merge(d2,d4);\n\n float dist = subtract(d1,d2);\n return dist;\n }\n\n float maskSharp(vec2 p)\n {\n return clamp(shapeDist(p) * 100.0, 0.0, 1.0);\n }\n\n float maskBlurry(vec2 p)\n {\n return clamp((shapeDist(p ) + 0.003) * 75.0, 0.0, 1.0);\n }\n\n vec3 normalAt(vec2 p)\n {\n float ps = 1.0 / p.x;\n float x = maskBlurry(p - vec2( ps, 0.0)) - maskBlurry(p + vec2( ps, 0.0));\n float y = maskBlurry(p - vec2(0.0, ps)) - maskBlurry(p + vec2(0.0, ps));\n return normalize(vec3(x, y, 1.0));\n }\n \n void main() {\n \n vec2 uv = vUv;\n /*uv *= 1.1;\n float px = 0.9;\n \n float width = 0.015;\n float dist = 1.0;\n float centerdist = length(uv);\n \n float isRed = 1.0;\n // static background to emulate the effect of the shaders alpha output channel\n vec4 color = vec4(uv,mix(1.0-uv.x,0.0,uv.y),1.0);\n for (float i = 0.0; i <= 15.0; i += 1.0) {\n if (mod(i, 5.0) == 0.0) {\n dist = min(dist, rln(abs(uv), 1.0 - 10.0 * width, 1.0 - 2.0 * width, i / 60.0));\n // draw first bar red\n if (i == 0.0 && uv.y > 0.0) {\n isRed = dist;\n dist = smoothstep(width, max(width - 3.0 * px, 0.0), dist);\n color = mixer(color, vec4(1.0, 0.0, 0.0, dist));\n dist = 1.0;\n } else {\n dist = min(dist, rln(abs(uv), 1.0 - 10.0 * width, 1.0 - 7.0 * width, i / 60.0));\n }\n }\n dist = min(dist, abs(1.0-width-length(uv)));\n // draw clock shadow\n if (centerdist > 1.0)\n color = mixer(color, vec4(0.0,0.0,0.0, 0.3*smoothstep(1.0 + width*2.0, 1.0, centerdist)));\n\n // draw outline + minute bars in white\n color = mixer(color, vec4(0.0, 0.0, 0.0,\n (1.0 - pow(smoothstep(width, width + 0.02, min(isRed, dist)), 0.4))*0.2));\n color = mixer(color, vec4(vec3(1.0), smoothstep(width, max(width - 3.0 * px, 0.0), dist)));\n }\n\n\n gl_FragColor = color;*/\n\n /*\n vec3 color = vec3(0.0, 0.0, 0.0);\n uv *= 3.0; // Scale up the space by 3\n uv = fract(uv); // Wrap around 1.0\n color = vec3(uv, 0.0);\n gl_FragColor = vec4(color, 1.0);\n */\n \n /*\n vec3 color = vec3(0.0, 0.0, 0.0);\n // Divide the space in 4\n uv = tile(uv, 4.);\n // Use a matrix to rotate the space 45 degrees\n uv = rotate2D(uv, PI*0.25);\n // Draw a square\n color = vec3(box(uv, vec2(0.7),0.01));\n */\n \n /*vec3 color = vec3(0.0, 0.0, 0.0);\n // bottom-left\n vec2 bl = step(vec2(0.2),uv);//0.1变成0.2矩形会变小\n float pct = bl.x * bl.y;\n // top-right\n vec2 tr = step(vec2(0.2),1.0-uv);\n pct *= tr.x * tr.y;\n\n color = vec3(pct);\n\n gl_FragColor = vec4(color, 1.0);\n */\n vec2 p = uv - vec2(0.5, 0.5);\n //vec3 color = vec3(0.1,0.3,0.1);\n vec3 color = vec3(0.0, 0.0, 0.0);\n //float val = maskSharp(p);\n float shade = 0.0;\n //if (val>0.0)\n //{\n //float z = (0.5+sin(time*3.5))*0.1;\n //vec3 lightPos = vec3(0.0, 0.0, 0.2+z);\n //vec3 toLight = lightPos - vec3(p, 0.0);\n //vec3 normal = normalAt(p);\n //shade = 0.3 + maskSharp(p) * 0.7;\n shade = maskSharp(p);\n //float col = clamp(dot(normalize(toLight), normal), 0.0, 1.0) / length(toLight) * shade;\n float col = shade;\n //color = vec3(0.6,0.2,0.9)*col;\n color = vec3(1.0, 1.0, 1.0)*col;\n //}\n gl_FragColor = vec4(color, 1.0);\n }",side:u.DoubleSide,transparent:!0});this.radar=new xx(e,r,{},a,i),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return tr(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.radar,this.groupId):this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),Bx={radius:100,altitude:0,interactive:!1},Mx=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({},Bx,i,{layer:s,coordinate:e}),(a=r.call(this))._initOptions(i);var l=i,h=l.altitude,c=l.radius,f=s.distanceToVector3(c,c).x,p=i.thetaStart||0,d=i.thetaLength||90,g=new u.CircleGeometry(f,128,p*Math.PI/180,d*Math.PI/180);a._createMesh(g,o);var A=s.distanceToVector3(h,h).x,y=s.coordinateToVector3(e,A);return a.getObject3d().position.copy(y),a}return tr(n)}(),Tx=function(){function t(e,r,n,i,o){Ze(this,t),this.threeLayer=i,this.map=i.map,this.groupId=o;var s=n.thetaLength||90,a=n.rotation||0,l=s/2,h=void 0!==n.gradientFlag&&n.gradientFlag,c=n.color||"#FF0000",f=n.opacity||1,p=a-l;p=p<0?p+360:p,this._uniforms={color:{value:new u.Color(c)}},this.material=null,this.material=h?new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec2 vUv;\n uniform vec3 color;\n void main() {\n vec2 uv = vUv;\n //vec2 pos = uv.xy - vec2(0.5, 0.5);\n float distance1 = clamp(length(uv - vec2(0.5, 0.5)) * 2., 0., 0.9);\n //vec2 pos = uv.xy - vec2(0.5, 0.5) * 2.;\n //float distance = clamp(length(pos), 0., 0.9);\n float opacity = 1. - distance1 / 1.;\n //gl_FragColor = vec4(1.0, 0.0, 0.0, opacity);\n gl_FragColor = vec4(color, opacity);\n\n }",side:u.DoubleSide,transparent:!0}):new u.MeshBasicMaterial({color:c,side:u.DoubleSide,transparent:!0,opacity:f}),console.log(this.material),this.sector=new Mx(e,{thetaStart:p,thetaLength:n.thetaLength,radius:r},this.material,i),this.groupId?this.threeLayer.addMesh1(this.sector,this.groupId):this.threeLayer.addMesh(this.sector)}return tr(t,[{key:"hide",value:function(){this.sector.hide()}},{key:"show",value:function(){this.sector.show()}},{key:"dispose",value:function(){this.groupId?this.threeLayer.removeMesh1(this.sector,this.groupId):this.threeLayer.removeMesh(this.sector),this.sector.object3d.geometry&&this.sector.object3d.geometry.dispose(),this.sector.object3d.material&&this.sector.object3d.material.dispose()}}]),t}(),Lx={altitude:0,height:0},Rx=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),o=t.Util.extend({},Lx,o,{layer:s}),a=r.call(this);var l=o,h=l.width,c=l.height,f=l.altitude;a._initOptions(o);var p=new u.PlaneGeometry(h,c);p.computeBoundingBox();var d=new u.Mesh(p,i);a._createGroup(),a.getObject3d().add(d);var g=s.distanceToVector3(f,f).x,A=s.coordinateToVector3(e,g);return d.position.set(0,p.boundingBox.max.y,0),a.getObject3d().position.copy(A),a}return tr(n)}();function Nx(t,e,r,n,i,o){this.tilesHorizontal=e,this.tilesVertical=r,this.numberOfTiles=n,t.wrapS=t.wrapT=u.RepeatWrapping,t.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=i,this.currentDisplayTime=0,this.currentTile=0,this.flag=o,this.update=function(e){for(this.currentDisplayTime+=e;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var r=this.currentTile%this.tilesHorizontal;t.offset.x=r/this.tilesHorizontal;var n=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?t.offset.y=this.tilesVertical-n/this.tilesVertical:t.offset.y=1-n/this.tilesVertical-1/this.tilesVertical}}}var Px=function(){function t(e,r,n,i,o){var s=this;Ze(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o;var a=n.thetaLength||45;this.millsec=n.millsec||1e3,this.duration=n.duration||75,this.tilesHoriz=n.tilesHoriz||12,this.tilesVert=n.tilesVert||5,this.numTiles=n.numTiles||49;var l=n.rotation||0,h=a/2,c=i.distanceToVector3(r,r).x,f=Math.sin(h*Math.PI/180)*c*2,p=void 0===n.flag;this.imgUrl=n.imgUrl,this.textureLoader=new u.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){s.texture=t,s.annie=new Nx(t,s.tilesHoriz,s.tilesVert,s.numTiles,s.duration,p);var r=new u.MeshBasicMaterial({transparent:!0,map:t,side:u.DoubleSide,depthTest:!1});s.imgObj=new Rx(e,r,{width:f,height:c},i),s.imgObj.object3d.renderOrder=1,s.imgObj.object3d.rotation.z=l*Math.PI/180,s.threelayer.addMesh(s.imgObj),s.layerClass.updatables.push(s)}))}return tr(t,[{key:"tick",value:function(t){var e;null===(e=this.annie)||void 0===e||e.update(this.millsec*t)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.threelayer.removeMesh(this.imgObj),this.imgObj.object3d.geometry&&this.imgObj.object3d.geometry.dispose(),this.imgObj.object3d.material&&this.imgObj.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),Dx={radius:100,altitude:0},kx=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({},Dx,i,{layer:s}),a=r.call(this);var l=i,h=l.width;l.height;var c=l.altitude;a._initOptions(i);var f=new u.CircleGeometry(h,32);a._createMesh(f,o);var p=s.distanceToVector3(c,c).x,d=s.coordinateToVector3(e,p);return a.getObject3d().position.copy(d),a}return tr(n)}(),Fx=function(){function t(e,r,n,i){var o=this;Ze(this,t),this.threelayer=n,this.map=n.map,this.layerClass=i,this.time=0,n.coordinateToVector3(e,0),this.imgUrl=r.imgUrl,this.textureLoader=new u.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){o.texture=t,o._uniforms={impactPosition:{value:new u.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:o.texture}};var r=new u.ShaderMaterial({uniforms:o._uniforms,vertexShader:"\n varying vec3 vPosition;\n varying vec2 vUv;\n void main(){\n vUv = uv;\n vPosition = position;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n uniform vec3 impactPosition;\n uniform float impactMaxRadius;\n uniform float impactRatio;\n varying vec3 vPosition;\n varying vec2 vUv;\n void main() {\n float dist = distance(vPosition, impactPosition);\n float curRadius = impactMaxRadius * impactRatio;\n float sstep = smoothstep(0., curRadius, dist) - smoothstep(curRadius - ( 0.25 * impactRatio ), curRadius, dist);\n sstep = 1. - sstep * (1. - impactRatio);\n vec3 col = mix(vec3(1., 0.5, 0.0625), vec3(1., 0.25, 0.125), impactRatio);\n gl_FragColor = texture2D(map, vUv);\n gl_FragColor = vec4( mix( col, gl_FragColor.rgb, sstep), 1.0 );\n }",side:u.DoubleSide,transparent:!0,depthTest:!1}),i=new kx(e,{width:2,height:2},r,n);o.threelayer.addMesh(i),o.layerClass.updatables.push(o)}))}return tr(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),Qx=document.createElement("canvas"),Ox=function(){function e(){Ze(this,e),this.type="gisCommon"}var r;return tr(e,null,[{key:"getTexture",value:function(t,e,r,n){var i=t.getContext("2d");i.drawImage(e,r,n);var o=new u.Texture(i.getImageData(0,0,t.width,t.height));return o.minFilter=u.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"getTexture1",value:function(t,e,r,n,i){Qx.width=Qx.height=128;var o=Qx.getContext("2d");o.drawImage(t,e,r,n,i);var s=new u.Texture(o.getImageData(0,0,Qx.width,Qx.height));return s.minFilter=u.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s}},{key:"addImageProcessImage",value:function(t){return new Promise((function(e,r){var n=document.createElement("img");n&&!n.crossOrigin&&(n.crossOrigin="Anonymous"),n.onload=function(){return e(n)},n.onerror=r,n.setAttribute("src",t)}))}},{key:"addImageProcess",value:function(t){return new Promise((function(e,r){var n=document.createElement("img");n.onload=function(){return e(n)},n.onerror=r,n.setAttribute("src","data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(t))))}))}},{key:"containsCoordinate3",value:function(t,e,r){if(1e3*Pi({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.x,e.y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.radius){var n=r.coordinateToVector3([e.x,e.y],0),i=r.coordinateToVector3(t,0).sub(n).normalize(),o=r.distanceToVector3(e.radius,e.radius).x,s=new u.Vector3(n.x,n.y+o,0).sub(n).normalize(),a=((i.clone().cross(s).z<0?-1:1)*Math.acos(i.dot(s))*180/Math.PI).toFixed(2);(a=parseFloat(a))<0&&(a=a+180+180);var l=parseFloat(e.begin),h=parseFloat(e.end);if(l>h){if(a>=l||a<=h)return!0}else if(a>=l&&a<=h)return!0;return!1}return!1}},{key:"containsCoordinate1",value:function(t,e){return 1e3*Pi({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.getCenter().x,e.getCenter().y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.getRadius()}},{key:"containsCoordinate2",value:function(t,e){return Li({type:"Feature",geometry:{type:"Point",coordinates:t}},{type:"Feature",geometry:{type:"Polygon",coordinates:e.geometry.coordinates[0]}})}},{key:"containsCoordinate",value:function(e,r){var n,i;Array.isArray(e)?(n=e[0],i=e[1]):e instanceof t.Coordinate&&(n=e.x,i=e.y);var o=r.xmin,s=r.ymin,a=r.xmax,u=r.ymax;return o<=n&&n<=a&&s<=i&&i<=u}},{key:"isInLevels",value:function(t,e){for(var r=!1,n=0;n<t.rangeArr.length;n+=2){var i=1*t.rangeArr[n],o=1*t.rangeArr[n+1];if(e>i&&e<=o){r=!0;break}}return r}},{key:"getExtent",value:function(t){if(0!==t.length){var e=1/0,r=1/0,n=-1/0,i=-1/0;return 1===t.length?(e=1*t[0].longitude-.5,r=1*t[0].latitude-.5,n=1*t[0].longitude+.5,i=1*t[0].latitude+.5):t.length>1&&t.slice(0,1/0).map((function(t){var o=1*t.longitude,s=1*t.latitude;e=Math.min(e,o),r=Math.min(r,s),n=Math.max(n,o),i=Math.max(i,s)})),{minX:e,minY:r,maxX:n,maxY:i}}}},{key:"vector2Pixel",value:function(t,e,r){var n=t.project(r),i=e.width/2,o=e.height/2;return{x:Math.round(n.x*i+i),y:Math.round(-n.y*o+o)}}},{key:"generateTextureOne",value:function(t,e,r){Qx.width=e,Qx.height=r;var n=Qx.getContext("2d");n.drawImage(t,0,0,e,r);var i=new u.Texture(n.getImageData(0,0,Qx.width,Qx.height));return i.magFilter=u.LinearFilter,i.minFilter=u.LinearFilter,i.generateMipmaps=!1,i.needsUpdate=!0,i}},{key:"generateTexture",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Qx.width=Qx.height=s;for(var l=Qx.getContext("2d"),h=0,c=0,f=[],p=0;p<n;p++){for(var d=5*(p+1)+p*h,g=0;g<n;g++){var A=5*(g+1)+g*t[c].w;if("img"===t[c].type){var y=(t[c].w-t[c].iw)/2,v=(t[c].h-t[c].ih)/2;l.drawImage(t[c].src,A+y,d+v,t[c].iw,t[c].ih)}else if("txt"===t[c].type)l.fillStyle=t[c].color,"#fff"===t[c].color?(l.font="lighter "+t[c].size+"px Microsoft YaHei",l.fillText(t[c].src,A+t[c].offx,d+t[c].offy),l.strokeStyle=t[c].color,l.strokeText(t[c].src,A+t[c].offx,d+t[c].offy)):(l.font="normal "+t[c].size+"px Microsoft YaHei",l.fillText(t[c].src,A+t[c].offx,d+t[c].offy));else{var m=(t[c].w-t[c].iw)/2,_=(t[c].h-t[c].ih)/2,I=t[c].offx||0,E=t[c].offy||0;l.drawImage(t[c].src,A+m+I,d+_+E,t[c].iw,t[c].ih)}if(f.push({w:t[c].w,h:t[c].h,u:A/s,v:d/s}),h=Math.max(h,t[c].h),(c+=1)>=t.length)break}if(c>=t.length)break}var x=new u.Texture(l.getImageData(0,0,Qx.width,Qx.height));return x.minFilter=u.LinearFilter,x.generateMipmaps=!1,x.needsUpdate=!0,{xys:f,texture:x,textureSize:s}}},{key:"generateTextureNew",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Qx.width=Qx.height=s;for(var l=Qx.getContext("2d"),h=0,c=0,f=0,p=[],d=0;d<n;d++){for(var g=5*(d+1)+d*h,A=0;A<n;A++){var y=5*(A+1)+f;if("img"===t[c].type){var v=(t[c].w-t[c].iw)/2,m=(t[c].h-t[c].ih)/2;l.drawImage(t[c].src,y+v,g+m,t[c].iw,t[c].ih)}else if("txt"===t[c].type)l.fillStyle=t[c].color,"#fff"===t[c].color?(l.font="lighter "+t[c].size+"px Microsoft YaHei",l.fillText(t[c].src,y+t[c].offx,g+t[c].offy),l.strokeStyle=t[c].color,l.strokeText(t[c].src,y+t[c].offx,g+t[c].offy)):(l.font="normal "+t[c].size+"px Microsoft YaHei",l.fillText(t[c].src,y+t[c].offx,g+t[c].offy));else{var _=(t[c].w-t[c].iw)/2,I=(t[c].h-t[c].ih)/2,E=t[c].offx||0,x=t[c].offy||0;l.drawImage(t[c].src,y+_+E,g+I+x,t[c].iw,t[c].ih)}if(p.push({w:t[c].w,h:t[c].h,u:y/s,v:g/s}),h=Math.max(h,t[c].h),f+=t[c].w,(c+=1)>=t.length)break}if(c>=t.length)break}var w=new u.Texture(l.getImageData(0,0,Qx.width,Qx.height));return w.minFilter=u.LinearFilter,w.generateMipmaps=!1,w.needsUpdate=!0,{xys:p,texture:w,textureSize:s}}},{key:"generateGifTexture",value:(r=Ke(Xe().mark((function t(r,n,i){var o,s,a,l,h,c,f,p,d,g,A,y,v;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=Math.sqrt(r.length),s=parseInt(o),a=s,o>s&&(a+=1),(l=document.createElement("canvas")).width=s*n,l.height=a*i,h=l.getContext("2d"),c=0,f=0;case 10:if(!(f<o)){t.next=32;break}p=f*i,d=0,g=0;case 14:if(!(g<o)){t.next=27;break}return A=d,t.next=18,e.addImageProcessImage(r[c]);case 18:if(y=t.sent,h.drawImage(y,A,p,n,i),d+=n,!((c+=1)>=r.length)){t.next=24;break}return t.abrupt("break",27);case 24:g++,t.next=14;break;case 27:if(!(c>=r.length)){t.next=29;break}return t.abrupt("break",32);case 29:f++,t.next=10;break;case 32:return(v=new u.Texture(h.getImageData(0,0,l.width,l.height))).generateMipmaps=!1,v.needsUpdate=!0,t.abrupt("return",{texture:v,colNum:s,rowNum:a});case 36:case"end":return t.stop()}}),t)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"generateTextureOptimize",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Qx.width=Qx.height=s;for(var l=Qx.getContext("2d"),h=0,c=0,f={},p=0;p<n;p++){for(var d=5*(p+1)+p*h,g=0,A=0;A<n;A++){var y=5*(A+1)+g,v=(t[c].w-t[c].iw)/2,m=(t[c].h-t[c].ih)/2;if(l.drawImage(t[c].src,y+v,d+m,t[c].iw,t[c].ih),f[t[c].key]={w:t[c].w,h:t[c].h,u:y/s,v:d/s},h=Math.max(h,t[c].h),g+=t[c].w,(c+=1)>=t.length)break}if(c>=t.length)break}var _=new u.Texture(l.getImageData(0,0,Qx.width,Qx.height));return _.magFilter=u.LinearFilter,_.minFilter=u.LinearFilter,_.generateMipmaps=!1,_.premultiplyAlpha=!0,_.needsUpdate=!0,{xys:f,texture:_,textureSize:s}}},{key:"setPointEventStatus",value:function(t,e){t&&t.getMeshes().forEach((function(t){"Points"===t.type&&(t.options.interactive=e)}))}},{key:"createTextTexture",value:function(t,e){Qx.width=Qx.height=t;var r=Qx.width/2,n=Qx.height/2;if(e){var i=0;e.forEach((function(t){var e=Qx.getContext("2d");e.fillStyle=t.fontcolor,e.font="".concat(t.fontsize,"px Arial"),e.textAlign="center",e.textBaseline="middle",e.fillText(t.txt,r,n+i),i+=t.fontsize}))}var o=new u.Texture(Qx);return o.minFilter=u.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"createTextAndBgTexture",value:function(t,e,r,n){var i=document.createElement("canvas");i.width=t,i.height=e;var o=i.getContext("2d");o.drawImage(r,0,0,t,e);var s=i.width/2,a=i.height/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle="#FFF",o.font="".concat(n.fontsize,"px Arial"),o.fillText(n.txt,s,a);var l=new u.Texture(i);return l.magFilter=u.NearestFilter,l.minFilter=u.NearestFilter,l.needsUpdate=!0,l}},{key:"getIntColor",value:function(t){var e=parseInt(255*t.r);return e=((e=(e<<8)+parseInt(255*t.g))<<8)+parseInt(255*t.b)}},{key:"colorIntToRGB",value:function(t){var e=t>>16&255,r=t>>8&255,n=255&t;return new u.Color("rgb(".concat(e,",").concat(r,",").concat(n,")"))}},{key:"createSimpleShader",value:function(t,e,r){return t.uniforms.texture1={value:e},t.uniforms.size1={value:r},t.uniforms.flag={value:1},t.vertexShader="uniform float size1;\n attribute float imgflag;\n varying float vimgflag;\n attribute float visibility;\n varying float vVisible;\n "+t.vertexShader,t.vertexShader=t.vertexShader.replace("#include <project_vertex>","\n #include <project_vertex>\n vimgflag = imgflag;\n vVisible = visibility;\n ").replace("gl_PointSize = size;","\n gl_PointSize = size1;\n "),t.fragmentShader="\n uniform sampler2D texture1;\n varying float vimgflag;\n varying float vVisible;\n "+t.fragmentShader,t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( outgoingLight, diffuseColor.a );","\n\n vec2 pUv = gl_PointCoord;\n pUv.y = 1. - pUv.y;\n\n if(vimgflag < 1.0){\n vec4 texColor = texture2D( texture1, pUv );\n outgoingLight *= texColor.xyz;\n gl_FragColor = vec4( outgoingLight, texColor.a * diffuseColor.a );\n }\n\n if (vVisible < 0.5) discard;\n "),t}},{key:"calTextWidth",value:function(t,e){var r=(t.match(/[\u4e00-\u9fa5]/g)||"").length;return r*e+.5*(t.length-r)*e}}]),e}();function Ux(t,e,r,n,i,o,s,a,u,l){var h=t.split("\n"),c=[],f={positionedGlyphs:c,text:t,top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:l,lineCount:h.length};return function(t,e,r,n,i,o,s,a,u){var l=0,h=-17,c=0,f=t.positionedGlyphs,p="right"===o?1:"left"===o?0:.5,d=f.length;r.forEach((function(t){if(t.split("").forEach((function(t){var r=e[u],n=t.charCodeAt(0),i=r&&r[n];i&&(f.push({glyph:n,x:l,y:h+0,vertical:!1,scale:1,fontStack:u}),l+=i.metrics.advance+a)})),f.length!==d){var r=l-a;c=Math.max(r,c),function(t,e,r,n,i){if(i){var o=t[n],s=e[o.fontStack],a=s&&s[o.glyph];if(a)for(var u=a.metrics.advance*o.scale,l=(t[n].x+u)*i,h=r;h<=n;h++)t[h].x-=l}}(f,e,d,f.length-1,p)}l=0,h+=n}));var g=function(t){var e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}(i),A=g.horizontalAlign,y=g.verticalAlign;!function(t,e,r,n,i,o,s){for(var a=(e-r)*i,u=(-n*s+.5)*o,l=0;l<t.length;l++)t[l].x+=a,t[l].y+=u}(f,p,A,y,c,n,r.length);var v=h- -17;t.top+=-y*v,t.bottom=t.top+v,t.left+=-A*c,t.right=t.left+c}(f,e,h,i,o,s,0,a,r),!!c.length&&f}var Gx=zx;function zx(t,e){this.x=t,this.y=e}zx.prototype={clone:function(){return new zx(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},zx.convert=function(t){return t instanceof zx?t:Array.isArray(t)?new zx(t[0],t[1]):t};var jx={radius:40,altitude:0},Vx=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s,a,l,h,c){var f;Ze(this,n);var p=rx(e);f=r.call(this),i=t.Util.extend({center:p,layer:c},jx,i),f._initOptions(i);var d=f.getLayer().getPick();f._colorMap={},f._datas=e,f._childCount=h,f.hidePosition=i.hidePosition;var g=c.coordinateToVector3(p);f.glyphMap=a,f.glyphAtlas=l;for(var A=new u.InstancedBufferGeometry,y=new Uint16Array([0,1,2,2,3,0]),v=new Float32Array([0,1,-.5,-.5,1,1,.5,-.5,1,0,.5,.5,0,0,-.5,.5]),m=new u.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),_=new u.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),I=new u.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),E=new u.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),x=new u.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),w=new u.InstancedBufferAttribute(new Float32Array(3*f._childCount),3,!0),C=0,b=function(t){var r=e[t],n=r.texts,i=r.markers,o=d.getColor(),s=o.getHex();f._colorMap[s]=t,f._datas[t].colorIndex=s,i&&i.forEach((function(r){if(m.setXYZW(C,r.markerWidth,r.markerHeight,r.markerDx,r.markerDy),_.setXYZW(C,r.u,r.v,-16,16),r.markerColor){var n=ex(0,255);x.setXYZW(C,n,0,0,0);var i=new u.Color(r.markerColor);I.setXYZW(C,i.r,i.g,i.b,r.markerOpacity),E.setXYZW(C,r.w,r.h,0,0)}else{var s=ex(0,0);x.setXYZW(C,s,0,0,0);var a=new u.Color("#fff");I.setXYZW(C,a.r,a.g,a.b,r.markerOpacity),E.setXYZW(C,r.w,r.h,0,0)}w.setXYZ(C,o.r,o.g,o.b),r.markerIndex=C,C+=1,e[t].childNum+=1})),n&&n.forEach((function(r){var n=new u.Color(r.textColor),i=ex(255,0);f.buildTextBuffers("".concat(r.text),r.textAnchor,"center",r.textSpacing).forEach((function(s){if(m.setXYZW(C,r.textSize,0,r.textDx,r.textDy),_.setXYZW(C,s[0],s[1],s[2],s[3]),r.textHaloColor){I.setXYZW(C,n.r,n.g,n.b,r.textOpacity);var a=new u.Color(r.textHaloColor);E.setXYZW(C,a.r,a.g,a.b,r.textHaloOpacity);var l=r.textHaloRadius;x.setXYZW(C,i,l,0,0)}else I.setXYZW(C,n.r,n.g,n.b,r.textOpacity),E.setXYZW(C,0,0,0,0),x.setXYZW(C,i,-1.9,0,0);w.setXYZ(C,o.r,o.g,o.b),r.textIndex.push(C),C+=1,e[t].childNum+=1}))}))},S=0;S<e.length;S++)b(S);A.setIndex(new u.Uint16BufferAttribute(y,1)),A.setAttribute("uv_offset",new u.Float32BufferAttribute(v,4,!0)),A.setAttribute("size",m),A.setAttribute("uv_image",_),A.setAttribute("color",I),A.setAttribute("util",x),A.setAttribute("haloAndWH",E),A.setAttribute("pickingColor",w),f._createInstancedMesh(A,o,f._childCount),f.getObject3d().instanceMatrix.setUsage(u.DynamicDrawUsage),f.getObject3d().frustumCulled=!1;var B=new u.InstancedMesh(A,s,f._childCount);B.frustumCulled=!1,B.instanceMatrix.setUsage(u.DynamicDrawUsage);var M=d.getColor().getHex();B._colorIndex=M,f.setPickObject3d(B);var T=new u.Object3D;C=0,e.forEach((function(t,r){var n,i,o=c.coordinateToVector3(t.coordinate);o.sub(g),t.height?o.z=c.altitudeToVector3(t.height).x:o.z=0,null===(n=e[r].markers)||void 0===n||n.forEach((function(e){!1===t.visible||!1===e.markerVisible?T.position.set(f.hidePosition[0],f.hidePosition[1],f.hidePosition[2]):T.position.set(o.x,o.y,o.z),T.rotation.z=-t.rotation,T.updateMatrix(),f.getObject3d().setMatrixAt(C,T.matrix),B.setMatrixAt(C,T.matrix),C+=1})),null===(i=e[r].texts)||void 0===i||i.forEach((function(e){e.textIndex.forEach((function(){!1===t.visible||!1===e.textVisible?T.position.set(f.hidePosition[0],f.hidePosition[1],f.hidePosition[2]):T.position.set(o.x,o.y,o.z),T.rotation.z=-t.rotation,T.updateMatrix(),f.getObject3d().setMatrixAt(C,T.matrix),B.setMatrixAt(C,T.matrix),C+=1}))}))}));var L=c.altitudeToVector3(i.altitude,i.altitude).x;return g.z=L,f.getObject3d().position.copy(g),B.position.copy(f.getObject3d().position),f.parent=null,f.pickMesh=B,f.threeLayer=c,f.center=g,f._init(),f}return tr(n,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}},{key:"getColorVector2",value:function(t,e){var r,n=new u.Color(t).getHexString(),i=(r="#".concat(n),{r:parseInt(r.slice(1,3),16),g:parseInt(r.slice(3,5),16),b:parseInt(r.slice(5,7),16)}),o=i.b;return[ex(i.r,i.g),ex(o,void 0!==e?e:255)]}},{key:"buildTextBuffers",value:function(t,e,r,n){var i=[],o=[0,0],s=Ux(t,this.glyphMap,"sans-serif",0,24,e,r,n,o,1);if(s){var a=function(t,e,r,n){for(var i=t.positionedGlyphs,o=[],s=0;s<i.length;s++){var a=i[s],u=n[a.fontStack],l=u&&u[a.glyph];if(l){var h=l.rect;if(h){var c=l.metrics.advance*a.scale/2,f=r?[a.x+c,a.y]:[0,0],p=r?[0,0]:[a.x+c+e[0],a.y+e[1]],d=(l.metrics.left-4)*a.scale-c+p[0],g=(-l.metrics.top-4)*a.scale+p[1],A=d+h.w*a.scale,y=g+h.h*a.scale,v=new Gx(d,g),m=new Gx(A,g),_=new Gx(d,y),I=new Gx(A,y);o.push({tl:v,tr:m,bl:_,br:I,tex:h,writingMode:t.writingMode,glyphOffset:f})}}}return o}(s,o,!1,this.glyphAtlas.positions);a.forEach((function(t){i.push([t.tex.x,t.tex.y+t.tex.h,t.bl.x,t.bl.y])}))}return i}},{key:"changeVisible",value:function(){var t=this,e=new u.Object3D;this._datas.forEach((function(r,n){var i=t.threeLayer.coordinateToVector3(r.coordinate);i.sub(t.center),r.height?i.z=t.threeLayer.altitudeToVector3(r.height).x:i.z=0,r.markers&&r.markers.forEach((function(n){!1===r.visible||!1===n.markerVisible?e.position.set(t.hidePosition[0],t.hidePosition[1],t.hidePosition[2]):e.position.set(i.x,i.y,i.z),e.rotation.z=-r.rotation,e.updateMatrix(),t.getObject3d().setMatrixAt(n.markerIndex,e.matrix),t.pickMesh.setMatrixAt(n.markerIndex,e.matrix)})),r.texts&&r.texts.forEach((function(n){n.textIndex.forEach((function(o){!1===r.visible||!1===n.textVisible?e.position.set(t.hidePosition[0],t.hidePosition[1],t.hidePosition[2]):e.position.set(i.x,i.y,i.z),e.rotation.z=-r.rotation,e.updateMatrix(),t.getObject3d().setMatrixAt(o,e.matrix),t.pickMesh.setMatrixAt(o,e.matrix)}))}))})),this.getObject3d().instanceMatrix.needsUpdate=!0,this.pickMesh.instanceMatrix.needsUpdate=!0}},{key:"changePickVisible",value:function(t){var e=this,r=new u.Object3D;this._datas.forEach((function(n,i){var o=e.threeLayer.coordinateToVector3(n.coordinate);o.sub(e.center),n.height?o.z=e.threeLayer.altitudeToVector3(n.height).x:o.z=0,n.markers&&n.markers.forEach((function(i){!1===t?r.position.set(e.hidePosition[0],e.hidePosition[1],e.hidePosition[2]):r.position.set(o.x,o.y,o.z),r.rotation.z=-n.rotation,r.updateMatrix(),e.pickMesh.setMatrixAt(i.markerIndex,r.matrix)})),n.texts&&n.texts.forEach((function(i){i.textIndex.forEach((function(i){!1===t?r.position.set(e.hidePosition[0],e.hidePosition[1],e.hidePosition[2]):r.position.set(o.x,o.y,o.z),r.rotation.z=-n.rotation,r.updateMatrix(),e.pickMesh.setMatrixAt(i,r.matrix)}))}))})),this.pickMesh.instanceMatrix.needsUpdate=!0}}]),n}(),Hx=function(){function t(e,r){Ze(this,t),this.createImage(e,1,r)}return tr(t,[{key:"createImage",value:function(t,e,r){var n=t.width,i=t.height;if(r){if(r.length!==n*i*e)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*i*e);this.width=n,this.height=i,this.data=r}},{key:"resize",value:function(){}}],[{key:"copy",value:function(t,e,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var s=t.data,a=e.data,u=0;u<i.height;u++)for(var l=((r.y+u)*t.width+r.x)*o,h=((n.y+u)*e.width+n.x)*o,c=0;c<i.width*o;c++)a[h+c]=s[l+c];return e}}]),t}();var qx=tr((function t(e){Ze(this,t);var r={},n=[];for(var i in e){var o=e[i],s=r[i]={};for(var a in o){var u=o[+a];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var l={x:0,y:0,w:u.bitmap.width+2,h:u.bitmap.height+2};n.push(l),s[a]={rect:l,metrics:u.metrics}}}}var h=function(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,o=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,o=Math.max(o,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:o,fill:e/(i*o)||0}}(n),c=h.w,f=h.h,p=new Hx({width:c||1,height:f||1});for(var d in e){var g=e[d];for(var A in g){var y=g[+A];if(y&&0!==y.bitmap.width&&0!==y.bitmap.height){var v=r[d][A].rect;Hx.copy(y.bitmap,p,{x:0,y:0},{x:v.x+1,y:v.y+1},y.bitmap)}}}this.image=p,this.positions=r})),Yx={exports:{}};Yx.exports=Wx,Yx.exports.default=Wx;var Xx=1e20;function Wx(t,e,r,n,i,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var s=this.size=this.fontSize+2*this.buffer,a=s+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=s,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a),this.useMetrics=void 0!==this.ctx.measureText("A").actualBoundingBoxLeft,this.middle=Math.round(s/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function Jx(t,e,r,n,i,o){for(var s=0;s<e;s++)Kx(t,s,e,r,n,i,o);for(var a=0;a<r;a++)Kx(t,a*e,1,e,n,i,o)}function Kx(t,e,r,n,i,o,s){var a,u,l,h;for(o[0]=0,s[0]=-Xx,s[1]=Xx,a=0;a<n;a++)i[a]=t[e+a*r];for(a=1,u=0,l=0;a<n;a++){do{h=o[u],l=(i[a]-i[h]+a*a-h*h)/(a-h)/2}while(l<=s[u]&&--u>-1);o[++u]=a,s[u]=l,s[u+1]=Xx}for(a=0,u=0;a<n;a++){for(;s[u+1]<a;)u++;h=o[u],t[e+a*r]=i[h]+(a-h)*(a-h)}}Wx.prototype._draw=function(t,e){var r,n,i,o,s,a,u,l,h,c=this.ctx.measureText(t),f=c.width,p=2*this.buffer;e&&this.useMetrics?(s=Math.floor(c.actualBoundingBoxAscent),l=this.buffer+Math.ceil(c.actualBoundingBoxAscent),a=this.buffer,u=this.buffer,r=(n=Math.min(this.size,Math.ceil(c.actualBoundingBoxRight-c.actualBoundingBoxLeft)))+p,i=(o=Math.min(this.size-a,Math.ceil(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent)))+p,this.ctx.textBaseline="alphabetic"):(r=n=this.size,i=o=this.size,s=19*this.fontSize/24,a=u=0,l=this.middle,this.ctx.textBaseline="middle"),n&&o&&(this.ctx.clearRect(u,a,n,o),this.ctx.fillText(t,this.buffer,l),h=this.ctx.getImageData(u,a,n,o));var d=new Uint8ClampedArray(r*i);return function(t,e,r,n,i,o,s){o.fill(Xx,0,e*r),s.fill(0,0,e*r);for(var a=(e-n)/2,u=0;u<i;u++)for(var l=0;l<n;l++){var h=(u+a)*e+l+a,c=t.data[4*(u*n+l)+3]/255;if(1===c)o[h]=0,s[h]=Xx;else if(0===c)o[h]=Xx,s[h]=0;else{var f=Math.max(0,.5-c),p=Math.max(0,c-.5);o[h]=f*f,s[h]=p*p}}}(h,r,i,n,o,this.gridOuter,this.gridInner),Jx(this.gridOuter,r,i,this.f,this.v,this.z),Jx(this.gridInner,r,i,this.f,this.v,this.z),function(t,e,r,n,i,o,s){for(var a=0;a<e*r;a++){var u=Math.sqrt(n[a])-Math.sqrt(i[a]);t[a]=Math.round(255-255*(u/o+s))}}(d,r,i,this.gridOuter,this.gridInner,this.radius,this.cutoff),{data:d,metrics:{width:n,height:o,sdfWidth:r,sdfHeight:i,top:s,left:0,advance:f}}},Wx.prototype.draw=function(t){return this._draw(t,!1).data},Wx.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var Zx=Yx.exports,$x={},tw={};var ew=function(){function e(t,r,n,i){var o=this;Ze(this,e);var s=r.pointMinZoom,a=r.pointOrder;if(0!=t.length){var u=[];this.charArray="",this.imgDict={},this.threeLayer=n,this.map=n.map,this.interactive=void 0===r.interactive||r.interactive,this.beginSizeZoom=r.beginSizeZoom||3,this.endSizeZoom=r.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.altitude=r.altitude||0,this.groupId=i,"EPSG:4326"===this.map.getSpatialReference().getProjection().code?this.tileResolution=.0006866455078125:this.tileResolution=76.43702828517625,this.textMinZoom=r.textMinZoom||0,this.textMaxZoom=r.textMaxZoom||30,this.textMinMaxZooms=r.textMinMaxZooms,this.hasAlign=r.hasAlign||!1,this.childCount=0,t.slice(0,1/0).map((function(t){1*t.longitude>70&&1*t.longitude<138&&1*t.latitude>0&&1*t.latitude<56&&o._bindDataItem(u,t)})),this.textures=null,this.glyphMap=null,this.glyphAtlas=null,this.dataItems=u,this.point=null,this.shader=null,this.minZoom=s||8,this.maxZoom=r.pointMaxZoom||20,this.order=a||0,this.isToolTip=r.isToolTip||!1,this.clickFunc=r.clickFunc||null,this.cFunc=r.cFunc||null,this.mouseMoveFunc=r.mouseMoveFunc||null,this.mouseOutFunc=r.mouseOutFunc||null,this.mMoveFunc=r.mMoveFunc||null,this.hasAlign=r.hasAlign||!1,this.zoomChangeCallback=r.zoomChangeCallback,this.hidePosition=r.hidePosition||[-999,-999,0]}else console.error("需要绘制的点位数量为0")}var r,n,i,o,s,a,l;return tr(e,[{key:"_putImgToDict",value:function(t,e,r){void 0===this.imgDict[t]?this.imgDict[t]={imgSrc:t,width:e,height:r}:(this.imgDict[t].width=(this.imgDict[t].width+e)/2,this.imgDict[t].height=(this.imgDict[t].height+r)/2)}},{key:"_bindDataItem",value:function(t,e){var r=(parseFloat(e.rotation)||0)+.01,n=parseFloat(r*(Math.PI/180)),i={coordinate:[parseFloat(e.longitude),parseFloat(e.latitude)],height:void 0!==e.height?parseFloat(e.height):0,visible:void 0===e.visible||e.visible,code:e.code,status:void 0!==e.status?e.status:1,name:e.name,rotation:n,childNum:0,data:e.data},o=e.texts;if(o){i.texts=[];for(var s=0,a=0;a<o.length;a++){var u=o[a];if(u.text&&u.text.length>0){s+=u.text.length,this.charArray=tx(this.charArray,u.text);var l={text:u.text,textSize:u.textSize||14,textDx:u.textDx||0,textDy:u.textDy||0,textColor:u.textColor||"#fff",textAnchor:u.textAnchor||"center",textSpacing:u.textSpacing||2,textOpacity:u.textOpacity||1,textVisible:void 0===u.textVisible||u.textVisible,textIndex:[]};u.textHaloColor&&(l=Object.assign(l,{textHaloColor:u.textHaloColor,textHaloRadius:u.textHaloRadius||1,textHaloOpacity:void 0!==u.textHaloOpacity?u.textHaloOpacity:1})),i.texts.push(l)}}this.childCount+=s}var h=e.markers;if(h){i.markers=[];for(var c=0,f=0;f<h.length;f++){var p=h[f];p.imgSrc&&(c+=1,this._putImgToDict(p.imgSrc,p.markerWidth||40,p.markerHeight||40),i.markers.push({markerWidth:1*p.markerWidth||40,markerHeight:1*p.markerHeight||40,markerDx:1*p.markerDx||0,markerDy:1*p.markerDy||0,markerColor:p.markerColor,markerOpacity:1*p.markerOpacity||1,key:p.imgSrc,markerIndex:-1,markerVisible:void 0===p.markerVisible||p.markerVisible}))}this.childCount+=c}t.push(i)}},{key:"_loadTexture",value:(l=Ke(Xe().mark((function t(){var e,r,n,i,o;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],t.t0=Xe().keys(this.imgDict);case 2:if((t.t1=t.t0()).done){t.next=18;break}if(r=t.t1.value,n=r,!r.includes(".svg")){t.next=12;break}return t.next=8,fetch(r);case 8:return i=t.sent,t.next=11,i.text();case 11:n=t.sent;case 12:return t.next=14,Ox.addImageProcess(n);case 14:o=t.sent,e.push({key:r,src:o,w:this.imgDict[r].width,h:this.imgDict[r].height,iw:this.imgDict[r].width,ih:this.imgDict[r].height}),t.next=2;break;case 18:return t.abrupt("return",Ox.generateTextureOptimize(e));case 19:case"end":return t.stop()}}),t,this)}))),function(){return l.apply(this,arguments)})},{key:"initGlyphAtlas",value:function(){var t=this.charArray.split("").map((function(t){return function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,n=function(t){var e=t.trim().substring(0,t.lastIndexOf(" ")),r="400";return/bold/i.test(t)?r="900":/medium/i.test(t)?r="500":/light/i.test(t)&&(r="200"),{fontFamily:e,fontWeight:r}}(e),i=n.fontFamily,o=n.fontWeight,s=r.charCodeAt(0),a=$x[e];return a||(a=$x[e]=new Zx(24,3,8,.25,i,o)),tw[e]||(tw[e]={}),tw[e][r]||(tw[e][r]=a.ctx.measureText(r).width),{id:s,bitmap:new Hx({width:30,height:30},a.draw(r)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=s,t>=19968&&t<=40959?24:tw[e][r])}}}("",t)})).reduce((function(t,e){return t[e.id]=e,t}),{});this.glyphMap||(this.glyphMap={}),this.glyphMap["sans-serif"]=t,this.glyphAtlas=new qx(this.glyphMap)}},{key:"addPoint",value:(a=Ke(Xe().mark((function t(){var e,r,n,i,o,s,a,l=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.dataItems){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this._loadTexture();case 4:return e=t.sent,this.textures||(this.textures=[]),this.textures.push(e.texture),this.initGlyphAtlas(),r=this.glyphAtlas.image,n=r.width,i=r.height,o=r.data,(s=new u.DataTexture(o,n,i)).needsUpdate=!0,s.magFilter=u.LinearFilter,s.minFilter=u.LinearFilter,s.format=u.RedFormat,this.textures.push(s),this.m=this._getRawShaderMaterial(e,s,n,i),this.m.depthTest=!1,this.hasAlign&&(this.m.vertexShader="#define HAS_ALIGN\n"+this.m.vertexShader),this.m_pick=this._getRawShaderMaterial(e,s,n,i),this.hasAlign&&(this.m_pick.vertexShader="#define HAS_ALIGN\n"+this.m_pick.vertexShader),this.m_pick.vertexShader="#define PICKING\n"+this.m_pick.vertexShader,this.m_pick.fragmentShader="#define PICKING\n"+this.m_pick.fragmentShader,this.dataItems.forEach((function(t){t.markers&&t.markers.forEach((function(t){t=Object.assign(t,e.xys[t.key])}))})),(a=new Vx(this.dataItems,{minZoom:this.minZoom,maxZoom:this.maxZoom,interactive:this.interactive,altitude:this.altitude,hidePosition:this.hidePosition},this.m,this.m_pick,this.glyphMap,this.glyphAtlas,this.childCount,this.threeLayer)).zoomChange=function(){l.m.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m.uniforms.zoomScale.value=l.tileResolution/l.map.getResolution(),l.m_pick.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m_pick.uniforms.zoomScale.value=l.tileResolution/l.map.getResolution();for(var t=l._getRate(),e=l.point.object3d.geometry.attributes.size.array,r=0,n=0;n<l.dataItems.length;n++){var i=l.dataItems[n];if(i.markers)for(var o=0;o<i.markers.length;o++)e[4*r+0]=i.markers[o].markerWidth*t,e[4*r+1]=i.markers[o].markerHeight*t,e[4*r+2]=i.markers[o].markerDx*t,e[4*r+3]=i.markers[o].markerDy*t,r+=1;if(i.texts)for(var s=function(){var n=i.texts[a].textSize,o=i.texts[a].textDx,s=i.texts[a].textDy;i.texts[a].textIndex.forEach((function(){e[4*r+0]=n*t,e[4*r+1]=0,e[4*r+2]=o*t,e[4*r+3]=s*t,r+=1}))},a=0;a<i.texts.length;a++)s()}l.point.object3d.geometry.attributes.size.needsUpdate=!0,l.zoomChangeCallback&&l.zoomChangeCallback()},a.object3d.renderOrder=this.order,a.pickMesh.renderOrder=this.order,this.point=a,this.point.parent=this,this.groupId?this.threeLayer.addMesh1(this.point,this.groupId):this.threeLayer.addMesh(this.point),this._bindMapEvents(),t.abrupt("return",this);case 32:case"end":return t.stop()}}),t,this)}))),function(){return a.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(t,e,r,n){return new u.RawShaderMaterial({uniforms:{imgTexture:{type:"t",value:t.texture},imgTextureSize:{type:"f",value:t.textureSize},sdfTexture:{type:"t",value:e},sdfTextureSize:{value:[r,n]},canvasSize:{value:[this.map.width,this.map.height]},cameraToCenterDistance:{type:"f",value:this.map.cameraToCenterDistance},zoomScale:{type:"f",value:this.tileResolution/this.map.getResolution()},mapPitch:{value:this.map.getPitch()*Math.PI/180},gammaScale:{value:1}},vertexShader:"\n precision mediump float;\n\n uniform mat4 modelViewMatrix;\n uniform mat4 projectionMatrix;\n\n uniform vec2 canvasSize;\n uniform float cameraToCenterDistance;\n uniform float zoomScale;\n uniform float mapPitch;\n uniform vec2 sdfTextureSize;\n uniform float imgTextureSize;\n\n attribute mat4 instanceMatrix;\n attribute vec4 size;\n attribute vec4 uv_offset;\n attribute vec4 uv_image;\n attribute vec4 util;\n varying vec4 vColor;\n\n #ifdef PICKING\n attribute vec3 pickingColor;\n #else\n varying vec2 vUv;\n varying float vGammaScale;\n varying float vSize;\n varying vec4 vUtil;\n varying vec4 vHaloAndWH;\n attribute vec4 color;\n attribute vec4 haloAndWH;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n void main()\n {\n #ifdef PICKING\n vColor = vec4(pickingColor, 1.);\n #else\n vColor = color;\n vHaloAndWH = haloAndWH;\n vUtil = util;\n #endif\n vec2 utils1 = unpack_float(util.x) / 255.0;\n vec2 wh1 = uv_offset.zw * 32.;\n vec2 offset = vec2(uv_image.z + wh1.x, uv_image.w - wh1.y);\n \n vec2 j = vec2(offset.x + 16., offset.y - 16.);\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(0, 0, 0, 1.);\n float camera_to_anchor_distance = gl_Position.w;\n float distance_ratio = camera_to_anchor_distance / cameraToCenterDistance;\n float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, \n 1.5);\n float m = (1. - cameraToCenterDistance / camera_to_anchor_distance) * perspective_ratio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n vec3 c = vec3(0.0, 0.0, 0.0);\n\n if (utils1.x > 0.) {\n float glyphSize = 24.;\n #ifndef PICKING\n vec2 wh = uv_offset.xy / sdfTextureSize * 32.;\n vec2 xy = uv_image.xy / sdfTextureSize;\n vUv = vec2(xy.x + wh.x, xy.y - wh.y);\n #endif\n \n j = j / glyphSize * size.x;\n float B = camera_to_anchor_distance / cameraToCenterDistance;\n\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n vec2 C = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(C, .0) / zoomScale * B * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n\n #ifndef PICKING\n #ifndef HAS_ALIGN\n vGammaScale = mix(1., B, perspective_ratio);\n #else\n vGammaScale = B + mapPitch / 4.;\n #endif\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = size.x;\n #endif\n } else {\n #ifndef PICKING\n //float width = uv_offset.x / imgTextureSize * color.z;\n //float height = uv_offset.y / imgTextureSize * color.w;\n float width = uv_offset.x / imgTextureSize * haloAndWH.x;\n float height = uv_offset.y / imgTextureSize * haloAndWH.y;\n float x = uv_image.x;\n float y = 1.0 - uv_image.y;\n vUv = vec2(x + width, y - height);\n #endif\n\n j = j * vec2(1., -1.);\n j = j / 32. * size.xy;\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n float C = camera_to_anchor_distance / cameraToCenterDistance;\n vec2 B = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(B, .0) / zoomScale * C * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n }\n }\n ",fragmentShader:"\n precision mediump float;\n #define SDF_PX 8.0\n #define DEVICE_PIXEL_RATIO 1.0\n #define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\n uniform sampler2D sdfTexture;\n uniform sampler2D imgTexture;\n uniform highp float gammaScale;\n varying vec4 vColor;\n #ifndef PICKING\n varying vec2 vUv;\n varying float vSize;\n varying float vGammaScale;\n varying vec4 vUtil;\n varying vec4 vHaloAndWH;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n \n vec4 decode_color(const vec2 encodedColor) {\n return vec4(\n unpack_float(encodedColor[0]) / 255.0,\n unpack_float(encodedColor[1]) / 255.0\n );\n }\n void main()\n {\n #ifdef PICKING\n gl_FragColor = vColor;\n #else\n //vec4 color = decode_color(vColor.xy);\n vec4 color = vColor;\n vec2 utils1 = unpack_float(vUtil.x) / 255.0;\n if (utils1.x > 0.) {\n /*float vOpacity = 1.0;\n float d = vSize / 24.;\n lowp vec4 e = color;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n float l = texture2D(texture1, vUv).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * 1.0 * vOpacity);*/\n\n //float dist = texture2D(sdfTexture, vUv).a;\n float dist = texture2D(sdfTexture, vUv).r;\n float fontScale = vSize / 24.0;\n\n highp float gamma = EDGE_GAMMA / (fontScale * gammaScale);\n //lowp float buff = (192. + floor(fontScale)) / 256.0;\n lowp float buff = 185. / 256.;\n highp float gamma_scaled = gamma * vGammaScale * 0.7;\n highp float alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n\n if (vUtil.y < 0.) {\n // 使用自定义混合有效\n gl_FragColor = color * alpha;\n // 使用默认混合可以消除黑边\n // gl_FragColor = vec4(color.rgb, alpha * color.a);\n } else {\n float u_halo_width = vUtil.y;\n float u_halo_blur = 0.;\n //vec4 u_halo_color = decode_color(vColor.zw);\n vec4 u_halo_color = vHaloAndWH;\n float radius = u_halo_width / fontScale / 10.;\n //float halo_width = ceil(u_halo_width - u_halo_width / 10.);\n float halo_width = u_halo_width;\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * gammaScale);\n gamma_scaled = gamma * vGammaScale * 0.7;\n alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n // 使用自定义混合有效\n gl_FragColor = mix(u_halo_color, color, \n smoothstep(buff + radius - gamma_scaled, buff + radius + gamma_scaled, dist)) * alpha;\n // 使用默认混合可以消除黑边\n // vec4 mix_color = mix(u_halo_color, color, smoothstep(buff + radius - gamma_scaled, buff + radius + gamma_scaled, dist));\n // gl_FragColor = vec4(mix_color.rgb, alpha * mix_color.a);\n }\n } else {\n if (utils1.y > 0.) {\n gl_FragColor = color * texture2D(imgTexture, vUv);\n /*vec4 dist = color * texture2D(imgTexture, vUv);\n highp float alpha = smoothstep(0.5, 1.0, dist.a);\n gl_FragColor = vec4(dist.rgb, alpha * dist.a);*/\n } else {\n gl_FragColor = texture2D(imgTexture, vUv);\n /*vec4 dist = texture2D(imgTexture, vUv);\n highp float alpha = smoothstep(0.5, 1.0, dist.a);\n gl_FragColor = vec4(dist.rgb, alpha * dist.a);*/\n }\n }\n #endif\n }\n ",transparent:!0,side:u.DoubleSide,blending:u.CustomBlending,blendEquation:u.AddEquation,blendSrc:u.OneFactor,blendDst:u.OneMinusSrcAlphaFactor,blendSrcAlpha:u.OneFactor,blendDstAlpha:u.OneMinusSrcAlphaFactor})}},{key:"_bindMapEvents",value:function(){this.map.on("pitch",this._setSizeOn,this),this.point&&this.point.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.map.off("pitch",this._setSizeOn,this),this.point&&this.point.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setSizeOn",value:function(){this.m.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m_pick.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m.uniforms.mapPitch.value=this.map.getPitch()*Math.PI/180}},{key:"addContent",value:(s=Ke(Xe().mark((function t(e){return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(e);case 2:this.iconFile&&this._addIcon(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_setPointEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var r=e.name;if(this.isToolTip){var n=this.point.getToolTip();n?n._content="".concat(r):this.point.setToolTip("".concat(r),{showTimeout:0,eventsPropagation:!0,dx:10})}}"click"===t.type&&e&&this.clickFunc&&!this.cFunc&&this.addContent(e)}},{key:"findItemByCode",value:function(t){for(var e=0;e<this.dataItems.length;e++)if(this.dataItems[e].code===t)return e}},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom,e=(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize;return e=e>=.1?e:.1}},{key:"show",value:function(){var t,e;null===(t=this.point)||void 0===t||t.show();for(var r=0;r<this.dataItems.length;r++){this.dataItems[r].visible=!0}null===(e=this.point)||void 0===e||e.changeVisible()}},{key:"hide",value:function(){this.pointShowHideByCode([])}},{key:"disableEvent",value:function(){var t;null===(t=this.point)||void 0===t||t.changePickVisible(!1)}},{key:"enableEvent",value:function(){var t;null===(t=this.point)||void 0===t||t.changePickVisible(!0)}},{key:"setInteractiveState",value:function(t){this.point&&(this.point.options.interactive=t)}},{key:"changePartVisible",value:(o=Ke(Xe().mark((function t(e){var r,n=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.point){t.next=2;break}return t.abrupt("return");case 2:e.slice(0,1/0).map((function(t){var e,r,i=n.findItemByCode(t.code);void 0!==i&&(t.imgVisible&&(null===(e=n.dataItems[i].markers)||void 0===e||e.forEach((function(e,r){e.markerVisible=t.imgVisible[r]}))),t.textVisible&&(null===(r=n.dataItems[i].texts)||void 0===r||r.forEach((function(e,r){e.textVisible=t.textVisible[r]}))))})),null===(r=this.point)||void 0===r||r.changeVisible();case 4:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"changeText",value:(i=Ke(Xe().mark((function t(e){var r,n,i,o,s,a,l,h,c,f,p,d,g,A=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.point){t.next=2;break}return t.abrupt("return");case 2:for(e.slice(0,1/0).map((function(t){var e,r=A.findItemByCode(t.code);void 0!==r&&t.text&&(null===(e=A.dataItems[r].texts)||void 0===e||e.forEach((function(e,r){e.text=t.text[r]})))})),this.charArray="",n=0;n<this.dataItems.length;n++)null===(i=this.dataItems[n].texts)||void 0===i||i.forEach((function(t){A.charArray=tx(A.charArray,t.text)}));for(this.glyphMap={},delete this.glyphAtlas,this.initGlyphAtlas(),o=this.glyphAtlas.image,s=o.width,a=o.height,l=o.data,(h=new u.DataTexture(l,s,a)).needsUpdate=!0,h.magFilter=u.LinearFilter,h.minFilter=u.LinearFilter,h.format=u.RedFormat,null===(r=this.textures[this.textures.length-1])||void 0===r||r.dispose(),this.textures[this.textures.length-1]=null,this.textures[this.textures.length-1]=h,this.point.glyphMap=this.glyphMap,this.point.glyphAtlas=this.glyphAtlas,c=this.point.object3d.geometry.attributes.uv_image.array,f=0,p=0;p<this.dataItems.length;p++)null===(d=this.dataItems[p].markers)||void 0===d||d.forEach((function(t){f+=1})),null===(g=this.dataItems[p].texts)||void 0===g||g.forEach((function(t){A.point.buildTextBuffers("".concat(t.text),t.textAnchor,"center",t.textSpacing).forEach((function(t){c[4*f+0]=t[0],c[4*f+1]=t[1],c[4*f+2]=t[2],c[4*f+3]=t[3],f+=1}))}));this.point.object3d.material.uniforms.sdfTexture.value=h,this.point.object3d.material.uniforms.sdfTextureSize.value=[s,a],this.point.object3d.geometry.attributes.uv_image.needsUpdate=!0;case 25:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"changeColor",value:(n=Ke(Xe().mark((function t(e){var r,n,i,o,s,a=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.point){t.next=2;break}return t.abrupt("return");case 2:for(e.slice(0,1/0).map((function(t){var e,r,n=a.findItemByCode(t.code);void 0!==n&&(t.imgColor&&(null===(e=a.dataItems[n].markers)||void 0===e||e.forEach((function(e,r){e.markerColor=t.imgColor[r]}))),t.textColor&&(null===(r=a.dataItems[n].texts)||void 0===r||r.forEach((function(e,r){e.textColor=t.textColor[r]}))))})),r=this.point.object3d.geometry.attributes.color.array,n=0,i=0;i<this.dataItems.length;i++)null===(o=this.dataItems[i].markers)||void 0===o||o.forEach((function(t){var e=new u.Color(t.markerColor);r[4*n+0]=e.r,r[4*n+1]=e.g,r[4*n+2]=e.b,r[4*n+3]=t.markerOpacity,n+=1})),null===(s=this.dataItems[i].texts)||void 0===s||s.forEach((function(t){var e=new u.Color(t.textColor);t.textIndex.forEach((function(){r[4*n+0]=e.r,r[4*n+1]=e.g,r[4*n+2]=e.b,r[4*n+3]=t.textOpacity,n+=1}))}));this.point.object3d.geometry.attributes.color.needsUpdate=!0;case 7:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"changeHaloPara",value:(r=Ke(Xe().mark((function t(e){var r,n,i,o,s,a,l=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.point){t.next=2;break}return t.abrupt("return");case 2:for(e.slice(0,1/0).map((function(t){var e,r,n=l.findItemByCode(t.code);void 0!==n&&(t.textHaloColor&&(null===(e=l.dataItems[n].texts)||void 0===e||e.forEach((function(e,r){e.textHaloColor=t.textHaloColor[r]}))),t.textHaloRadius&&(null===(r=l.dataItems[n].texts)||void 0===r||r.forEach((function(e,r){e.textHaloRadius=t.textHaloRadius[r]}))))})),r=this.point.object3d.geometry.attributes.haloAndWH.array,n=this.point.object3d.geometry.attributes.util.array,i=0,o=0;o<this.dataItems.length;o++)null===(s=this.dataItems[o].markers)||void 0===s||s.forEach((function(t){i+=1})),null===(a=this.dataItems[o].texts)||void 0===a||a.forEach((function(t){var e=new u.Color(t.textHaloColor);t.textIndex.forEach((function(){r[4*i+0]=e.r,r[4*i+1]=e.g,r[4*i+2]=e.b,r[4*i+3]=t.textHaloOpacity,n[4*i+1]=t.textHaloRadius,i+=1}))}));this.point.object3d.geometry.attributes.haloAndWH.needsUpdate=!0,this.point.object3d.geometry.attributes.util.needsUpdate=!0,console.log(this.point.object3d.geometry.attributes,"5555555555");case 10:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"pointShowHideByCode",value:function(e,r,n){for(var i,o=1/0,s=1/0,a=-1/0,u=-1/0,l=0;l<this.dataItems.length;l++){var h=this.dataItems[l];e.includes(h.code)?(o=Math.min(o,this.dataItems[l].coordinate[0]),s=Math.min(s,this.dataItems[l].coordinate[1]),a=Math.max(a,this.dataItems[l].coordinate[0]),u=Math.max(u,this.dataItems[l].coordinate[1]),h.visible=!0):h.visible=!1}null===(i=this.point)||void 0===i||i.changeVisible(),r&&this.map.fitExtent(new t.Extent(o,s,a,u),n||0)}},{key:"updateByZoom",value:function(){var t=this,e=this.map.getZoom(),r=new u.Object3D,n=0;this.dataItems.forEach((function(i){var o=t.threeLayer.coordinateToVector3(i.coordinate);if(o.sub(t.point.center),i.height&&(o.z=t.threeLayer.altitudeToVector3(i.height).x),i.markers&&(n+=i.markers.length),i.value&&t.showValueFlag)for(var s=0;s<i.value.length;s++)e<t.valueMinZoom||e>t.valueMaxZoom?r.position.set(-999,-999,0):r.position.set(o.x,o.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(n,r.matrix),t.point.pickMesh.setMatrixAt(n,r.matrix),n+=1;if(i.name&&t.showNameFlag)for(var a=0;a<i.name.length;a++)e<t.nameMinZoom||e>t.nameMaxZoom?r.position.set(-999,-999,0):r.position.set(o.x,o.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(n,r.matrix),t.point.pickMesh.setMatrixAt(n,r.matrix),n+=1})),this.point.getObject3d().instanceMatrix.needsUpdate=!0,this.point.pickMesh.instanceMatrix.needsUpdate=!0}},{key:"dispose",value:function(){this.isToolTip&&this.point&&this.point.removeToolTip(),this._closeEvent(),this.point&&(this.groupId?this.threeLayer.removeMesh1(this.point,this.groupId):this.threeLayer.removeMesh(this.point),this.point.object3d.geometry&&this.point.object3d.geometry.dispose(),this.point.object3d.material&&this.point.object3d.material.dispose(),this.point.pickObject3d.geometry&&this.point.pickObject3d.geometry.dispose(),this.point.pickObject3d.material&&this.point.pickObject3d.material.dispose(),this.point._datas=[],this.point._colorMap={},delete this.point.object3d,delete this.point.pickObject3d,this.point.toolTip&&delete this.point.toolTip,delete this.point),this.textures&&this.textures.length>0&&(this.textures.forEach((function(t){t.dispose()})),delete this.textures),this.m&&(this.m.dispose(),delete this.m),this.m_pick&&(this.m_pick.dispose(),delete this.m_pick),this.glyphMap={},this.glyphAtlas&&delete this.glyphAtlas}}]),e}(),rw={};function nw(t){if(!rw[t]){var e=Math.random(),r=.5+.5*Math.random(),n=.375+.25*Math.random();rw[t]=(new d).setHSL(e,r,n)}return rw[t]}function iw(t){var e;try{e=new URL(t,"http://fakehost.com/")}catch(t){return null}var r=e.pathname.split("/").pop(),n=r.lastIndexOf(".");return-1===n||n===r.length-1?null:r.substring(n+1)}var ow=function(){function t(){Ze(this,t),this.maxSize=800,this.minSize=600,this.unloadPercent=.05,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.unloadPriorityCallback=null;var e=this.itemSet;this.defaultPriorityCallback=function(t){return e.get(t)}}return tr(t,[{key:"isFull",value:function(){return this.itemSet.size>=this.maxSize}},{key:"add",value:function(t,e){var r=this.itemSet;if(r.has(t))return!1;if(this.isFull())return!1;var n=this.usedSet,i=this.itemList,o=this.callbacks;return i.push(t),n.add(t),r.set(t,Date.now()),o.set(t,e),!0}},{key:"remove",value:function(t){var e=this.usedSet,r=this.itemSet,n=this.itemList,i=this.callbacks;if(r.has(t)){i.get(t)(t);var o=n.indexOf(t);return n.splice(o,1),e.delete(t),r.delete(t),i.delete(t),!0}return!1}},{key:"markUsed",value:function(t){var e=this.itemSet,r=this.usedSet;e.has(t)&&!r.has(t)&&(e.set(t,Date.now()),r.add(t))}},{key:"markAllUnused",value:function(){this.usedSet.clear()}},{key:"unloadUnusedContent",value:function(){var t=this.unloadPercent,e=this.minSize,r=this.itemList,n=this.itemSet,i=this.usedSet,o=this.callbacks,s=r.length-i.size,a=r.length-e,u=this.unloadPriorityCallback||this.defaultPriorityCallback;if(a>0&&s>0){r.sort((function(t,e){var r=i.has(t),n=i.has(e);return r&&n?0:r||n?r?1:-1:u(e)-u(t)}));var l=Math.min(a,s),h=Math.max(e*t,l*t),c=Math.min(h,s);c=Math.ceil(c);for(var f=r.splice(0,c),p=0,d=f.length;p<d;p++){var g=f[p];o.get(g)(g),n.delete(g),o.delete(g)}}}},{key:"scheduleUnload",value:function(){var t,e=this,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scheduled||(this.scheduled=!0,t=function(){e.scheduled=!1,e.unloadUnusedContent(),r&&e.markAllUnused()},Promise.resolve().then(t))}}]),t}(),sw=function(){function t(){var e=this;Ze(this,t),this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=function(){throw new Error("PriorityQueue: PriorityCallback function not defined.")},this.schedulingCallback=function(t){requestAnimationFrame(t)},this._runjobs=function(){e.tryRunJobs(),e.scheduled=!1}}return tr(t,[{key:"sort",value:function(){var t=this.priorityCallback;this.items.sort(t)}},{key:"add",value:function(t,e){var r=this;return new Promise((function(n,i){var o=r.items,s=r.callbacks;o.push(t),s.set(t,(function(){return e.apply(void 0,arguments).then(n).catch(i)})),r.autoUpdate&&r.scheduleJobRun()}))}},{key:"remove",value:function(t){var e=this.items,r=this.callbacks,n=e.indexOf(t);-1!==n&&(e.splice(n,1),r.delete(t))}},{key:"tryRunJobs",value:function(){var t=this;this.sort();for(var e=this.items,r=this.callbacks,n=this.maxJobs,i=this.currJobs;n>i&&e.length>0;){i++;var o=e.pop(),s=r.get(o);r.delete(o),s(o).then((function(){t.currJobs--,t.autoUpdate&&t.scheduleJobRun()})).catch((function(){t.currJobs--,t.autoUpdate&&t.scheduleJobRun()}))}this.currJobs=i}},{key:"scheduleJobRun",value:function(){this.scheduled||(this.schedulingCallback(this._runjobs),this.scheduled=!0)}}]),t}(),aw=0,uw=1,lw=2,hw=3,cw=4,fw=6378137,pw=1/298.257223563,dw=6356752.314245179;function gw(t){return t===hw||t===cw}function Aw(t,e){return t.__lastFrameVisited===e&&t.__used}function yw(t,e){t.__lastFrameVisited!==e&&(t.__lastFrameVisited=e,t.__used=!1,t.__inFrustum=!1,t.__isLeaf=!1,t.__visible=!1,t.__active=!1,t.__error=1/0,t.__distanceFromCamera=1/0,t.__childrenWereVisible=!1,t.__allChildrenLoaded=!1)}function vw(t,e,r,n){if(n.ensureChildrenArePreprocessed(t),yw(t,e),t.__used=!0,r.markUsed(t),t.__contentEmpty)for(var i=t.children,o=0,s=i.length;o<s;o++)vw(i[o],e,r,n)}function mw(t,e,r){if(r.ensureChildrenArePreprocessed(t),t.__contentEmpty&&(!t.__externalTileSet||gw(t.__loadingState)))for(var n=t.children,i=0,o=n.length;i<o;i++){var s=n[i];s.__depthFromRenderedParent=e,mw(s,e,r)}else r.requestTileContents(t)}function _w(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(e&&e(t,n,i))r&&r(t,n,i);else{for(var o=t.children,s=0,a=o.length;s<a;s++)_w(o[s],e,r,t,i+1);r&&r(t,n,i)}}function Iw(t,e){e.ensureChildrenArePreprocessed(t);var r=e.stats,n=e.frameCount,i=e.errorTarget,o=e.maxDepth,s=e.loadSiblings,a=e.lruCache,u=e.stopAtEmptyTiles;if(yw(t,n),!1===e.tileInView(t))return!1;if(t.__used=!0,a.markUsed(t),t.__inFrustum=!0,r.inFrustum++,(u||!t.__contentEmpty)&&!t.__externalTileSet){if(e.calculateError(t),t.__error<=i)return!0;if(e.maxDepth>0&&t.__depth+1>=o)return!0}for(var l=!1,h=t.children,c=0,f=h.length;c<f;c++){var p=Iw(h[c],e);l=l||p}if(l&&s)for(var d=0,g=h.length;d<g;d++){vw(h[d],n,a,e)}return!0}function Ew(t,e){var r=e.stats,n=e.frameCount;if(Aw(t,n)){r.used++;for(var i=t.children,o=!1,s=0,a=i.length;s<a;s++){var u=i[s];o=o||Aw(u,n)}if(o){for(var l=!1,h=!0,c=0,f=i.length;c<f;c++){var p=i[c];if(Ew(p,e),l=l||p.__wasSetVisible||p.__childrenWereVisible,Aw(p,n)){var d=p.__allChildrenLoaded||!p.__contentEmpty&&gw(p.__loadingState)||p.__externalTileSet&&p.__loadingState===cw;h=h&&d}}t.__childrenWereVisible=l,t.__allChildrenLoaded=h}else t.__isLeaf=!0}}function xw(t,e){var r=e.stats,n=e.frameCount;if(Aw(t,n)){var i=t.parent,o=i?i.__depthFromRenderedParent:-1;t.__depthFromRenderedParent=o;var s=e.lruCache;if(t.__isLeaf)return t.__depthFromRenderedParent++,void(t.__loadingState===hw?(t.__inFrustum&&(t.__visible=!0,r.visible++),t.__active=!0,r.active++):s.isFull()||t.__contentEmpty&&!t.__externalTileSet||e.requestTileContents(t));var a=(e.errorTarget+1)*e.errorThreshold,u=t.__error<=a,l=u||"ADD"===t.refine,h=!t.__contentEmpty,c=h||t.__externalTileSet,f=gw(t.__loadingState)&&c,p=t.__childrenWereVisible,d=t.children,g=t.__allChildrenLoaded;if(l&&h&&t.__depthFromRenderedParent++,l&&!f&&!s.isFull()&&c&&e.requestTileContents(t),(u&&!g&&!p&&f||"ADD"===t.refine&&f)&&(t.__inFrustum&&(t.__visible=!0,r.visible++),t.__active=!0,r.active++),"ADD"!==t.refine&&u&&!g&&f)for(var A=0,y=d.length;A<y;A++){var v=d[A];Aw(v,n)&&!s.isFull()&&(v.__depthFromRenderedParent=t.__depthFromRenderedParent+1,mw(v,v.__depthFromRenderedParent,e))}else for(var m=0,_=d.length;m<_;m++){var I=d[m];Aw(I,n)&&xw(I,e)}}}function ww(t,e){var r=Aw(t,e.frameCount);if(r||t.__usedLastFrame){var n=!1,i=!1;r&&(n=t.__active,i=e.displayActiveTiles&&t.__active||t.__visible),t.__contentEmpty||t.__loadingState!==hw||(t.__wasSetActive!==n&&e.setTileActive(t,n),t.__wasSetVisible!==i&&e.setTileVisible(t,i)),t.__wasSetActive=n,t.__wasSetVisible=i,t.__usedLastFrame=r;for(var o=t.children,s=0,a=o.length;s<a;s++){ww(o[s],e)}}}var Cw=function(t,e){return t.__depth!==e.__depth?t.__depth>e.__depth?-1:1:t.__inFrustum!==e.__inFrustum?t.__inFrustum?1:-1:t.__used!==e.__used?t.__used?1:-1:t.__error!==e.__error?t.__error>e.__error?1:-1:t.__distanceFromCamera!==e.__distanceFromCamera?t.__distanceFromCamera>e.__distanceFromCamera?-1:1:0},bw=function(t){return 1/(t.__depthFromRenderedParent+1)},Sw=function(){function t(e,r){Ze(this,t),this.tileSets={},this.rootURL=e,this.fetchOptions={},this.preprocessURL=null;var n=new ow;n.unloadPriorityCallback=bw;var i=new sw;i.maxJobs=4,i.priorityCallback=Cw;var o=new sw;o.maxJobs=1,o.priorityCallback=Cw,this.lruCache=n,this.downloadQueue=i,this.parseQueue=o,this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0,this.errorTarget=6,this.errorThreshold=1/0,this.loadSiblings=!0,this.displayActiveTiles=!1,this.maxDepth=1/0,this.stopAtEmptyTiles=!0,this.threeLayer=r,this.heightOffset=0,this.xOffset=0,this.yOffset=0,this.yScale=1}return tr(t,[{key:"rootTileSet",get:function(){var t=this.tileSets[this.rootURL];return!t||t instanceof Promise?null:t}},{key:"root",get:function(){var t=this.rootTileSet;return t?t.root:null}},{key:"traverse",value:function(t,e){var r=this,n=this.tileSets[this.rootURL];n&&n.root&&_w(n.root,(function(e){r.ensureChildrenArePreprocessed(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return!!t&&t.apply(void 0,[e].concat(i))}),e)}},{key:"update",value:function(){var t=this.stats,e=this.lruCache,r=this.tileSets,n=r[this.rootURL];if(this.rootURL in r){if(n&&n.root){var i=n.root;t.inFrustum=0,t.used=0,t.active=0,t.visible=0,this.frameCount++,Iw(i,this),Ew(i,this),xw(i,this),ww(i,this),e.scheduleUnload()}}else this.loadRootTileSet(this.rootURL)}},{key:"parseTile",value:function(t,e,r){return null}},{key:"disposeTile",value:function(t){}},{key:"preprocessNode",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.content&&(!("uri"in t.content)&&"url"in t.content&&(t.content.uri=t.content.url,delete t.content.url),t.content.uri&&(t.content.uri=new URL(t.content.uri,e+"/").toString()),t.content.boundingVolume&&!("box"in t.content.boundingVolume||"sphere"in t.content.boundingVolume||"region"in t.content.boundingVolume)&&delete t.content.boundingVolume),t.parent=r,t.children=t.children||[],t.content&&t.content.uri){var n=iw(t.content.uri),i=Boolean(n&&"json"===n.toLowerCase());t.__externalTileSet=i,t.__contentEmpty=i}else t.__externalTileSet=!1,t.__contentEmpty=!0;t.__distanceFromCamera=1/0,t.__error=1/0,t.__inFrustum=!1,t.__isLeaf=!1,t.__usedLastFrame=!1,t.__used=!1,t.__wasSetVisible=!1,t.__visible=!1,t.__childrenWereVisible=!1,t.__allChildrenLoaded=!1,t.__wasSetActive=!1,t.__active=!1,t.__loadingState=0,t.__loadIndex=0,t.__loadAbort=null,t.__depthFromRenderedParent=-1,null===r?(t.__depth=0,t.refine=t.refine||"REPLACE"):(t.__depth=r.__depth+1,t.refine=t.refine||r.refine),t.__basePath=e}},{key:"setTileActive",value:function(t,e){}},{key:"setTileVisible",value:function(t,e){}},{key:"calculateError",value:function(t){return 0}},{key:"tileInView",value:function(t){return!0}},{key:"ensureChildrenArePreprocessed",value:function(t){for(var e=t.children,r=0,n=e.length;r<n;r++){var i=e[r];if("__depth"in i)break;this.preprocessNode(i,t.__basePath,t)}}},{key:"resetFailedTiles",value:function(){var t=this.stats;0!==t.failed&&(this.traverse((function(t){t.__loadingState===cw&&(t.__loadingState=0)})),t.failed=0)}},{key:"fetchTileSet",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return fetch(t,e).then((function(e){if(e.ok)return e.json();throw new Error('TilesRenderer: Failed to load tileset "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText))})).then((function(e){var i=pr(e.asset.version.split(".").map((function(t){return parseInt(t)})),2),o=i[0],s=i[1];console.assert(o<=1,"TilesRenderer: asset.version is expected to be a 1.x or a compatible version."),1===o&&s>0&&console.warn("TilesRenderer: tiles versions at 1.1 or higher have limited support. Some new extensions and features may not be supported.");var a=t.replace(/\/[^\/]*\/?$/,"");return a=new URL(a,window.location.href).toString(),r.preprocessNode(e.root,a,n),e}))}},{key:"loadRootTileSet",value:function(t){var e=this.tileSets;if(t in e)return e[t]instanceof Error?Promise.reject(e[t]):Promise.resolve(e[t]);var r=this.fetchTileSet(this.preprocessURL?this.preprocessURL(t):t,this.fetchOptions).then((function(r){e[t]=r}));return r.catch((function(r){console.error(r),e[t]=r})),e[t]=r,r}},{key:"requestTileContents",value:function(t){var e=this;if(0===t.__loadingState){var r=this.stats,n=this.lruCache,i=this.downloadQueue,o=this.parseQueue,s=t.__externalTileSet;n.add(t,(function(t){1===t.__loadingState?(t.__loadAbort.abort(),t.__loadAbort=null):s?t.children.length=0:e.disposeTile(t),1===t.__loadingState?r.downloading--:2===t.__loadingState&&r.parsing--,t.__loadingState=0,t.__loadIndex++,o.remove(t),i.remove(t)})),t.__loadIndex++;var a=t.__loadIndex,u=new AbortController,l=u.signal;r.downloading++,t.__loadAbort=u,t.__loadingState=1;var h=function(e){t.__loadIndex===a&&("AbortError"!==e.name?(o.remove(t),i.remove(t),2===t.__loadingState?r.parsing--:1===t.__loadingState&&r.downloading--,r.failed++,console.error('TilesRenderer : Failed to load tile at url "'.concat(t.content.uri,'".')),console.error(e),t.__loadingState=cw):n.remove(t))};s?i.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=e.preprocessURL?e.preprocessURL(t.content.uri):t.content.uri;return e.fetchTileSet(r,Object.assign({signal:l},e.fetchOptions),t)})).then((function(e){t.__loadIndex===a&&(r.downloading--,t.__loadAbort=null,t.__loadingState=hw,t.children.push(e.root))})).catch(h):i.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=e.preprocessURL?e.preprocessURL(t.content.uri):t.content.uri;return fetch(r,Object.assign({signal:l},e.fetchOptions))})).then((function(e){if(t.__loadIndex===a){if(e.ok)return e.arrayBuffer();throw new Error("Failed to load model with error code ".concat(e.status))}})).then((function(n){if(t.__loadIndex===a)return r.downloading--,r.parsing++,t.__loadAbort=null,t.__loadingState=2,o.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=iw(t.content.uri);return e.parseTile(n,t,r)}))})).then((function(){t.__loadIndex===a&&(r.parsing--,t.__loadingState=hw,t.__wasSetVisible&&e.setTileVisible(t,!0),t.__wasSetActive&&e.setTileActive(t,!0))})).catch(h)}}},{key:"dispose",value:function(){var t=this.lruCache,e=[];this.traverse((function(t){return e.push(t),!1}));for(var r=0,n=e.length;r<n;r++)t.remove(e[r]);this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0}}]),t}();function Bw(t){return(new TextDecoder).decode(t)}var Mw=function(){function t(e,r,n,i){Ze(this,t),this.buffer=e,this.binOffset=r+n,this.binLength=i;var o=null;if(0!==n){var s=new Uint8Array(e,r,n);o=JSON.parse(Bw(s))}else o={};this.header=o}return tr(t,[{key:"getKeys",value:function(){return Object.keys(this.header)}},{key:"getData",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=this.header;if(!(t in i))return null;var o=i[t];if(o instanceof Object){if(Array.isArray(o))return o;var s,a,u=this.buffer,l=this.binOffset,h=this.binLength,c=o.byteOffset||0,f=o.type||n,p=o.componentType||r;if("type"in o&&n&&o.type!==n)throw new Error("FeatureTable: Specified type does not match expected type.");switch(f){case"SCALAR":s=1;break;case"VEC2":s=2;break;case"VEC3":s=3;break;case"VEC4":s=4;break;default:throw new Error('FeatureTable : Feature type not provided for "'.concat(t,'".'))}var d=l+c,g=e*s;switch(p){case"BYTE":a=new Int8Array(u,d,g);break;case"UNSIGNED_BYTE":a=new Uint8Array(u,d,g);break;case"SHORT":a=new Int16Array(u,d,g);break;case"UNSIGNED_SHORT":a=new Uint16Array(u,d,g);break;case"INT":a=new Int32Array(u,d,g);break;case"UNSIGNED_INT":a=new Uint32Array(u,d,g);break;case"FLOAT":a=new Float32Array(u,d,g);break;case"DOUBLE":a=new Float64Array(u,d,g);break;default:throw new Error('FeatureTable : Feature component type not provided for "'.concat(t,'".'))}if(d+g*a.BYTES_PER_ELEMENT>l+h)throw new Error("FeatureTable: Feature data read outside binary body length.");return a}return o}},{key:"getBuffer",value:function(t,e){var r=this.buffer,n=this.binOffset;return r.slice(n+t,n+t+e)}}]),t}(),Tw=function(t){rr(r,Mw);var e=ur(r);function r(t,n,i,o,s){var a;return Ze(this,r),(a=e.call(this,t,i,o,s)).batchSize=n,a}return tr(r,[{key:"getData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return hr(nr(r.prototype),"getData",this).call(this,t,this.batchSize,e,n)}}]),r}(),Lw=function(){function t(){Ze(this,t),this.fetchOptions={},this.workingPath=""}return tr(t,[{key:"load",value:function(t){var e=this;return fetch(t,this.fetchOptions).then((function(e){if(!e.ok)throw new Error('Failed to load file "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText));return e.arrayBuffer()})).then((function(r){return""===e.workingPath&&(e.workingPath=e.workingPathForURL(t)),e.parse(r)}))}},{key:"resolveExternalURL",value:function(t){return/^[^\\/]/.test(t)?this.workingPath+"/"+t:t}},{key:"workingPathForURL",value:function(t){var e=t.split(/[\\/]/g);return e.pop(),e.join("/")+"/"}},{key:"parse",value:function(t){throw new Error("LoaderBase: Parse not implemented.")}}]),t}();function Rw(t){var e;if(e=t instanceof DataView?t:new DataView(t),"{"===String.fromCharCode(e.getUint8(0)))return null;for(var r="",n=0;n<4;n++)r+=String.fromCharCode(e.getUint8(n));return r}var Nw=function(t){rr(r,Lw);var e=ur(r);function r(){return Ze(this,r),e.apply(this,arguments)}return tr(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Rw(e);console.assert("b3dm"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=t.slice(28,28+o+s),h=new Mw(l,0,o,s),c=28+o+s,f=t.slice(c,c+a+u),p=new Tw(f,h.getData("BATCH_LENGTH"),0,a,u),d=c+a+u;return{version:n,featureTable:h,batchTable:p,glbBytes:new Uint8Array(t,d,i-d)}}}]),r}(),Pw=function(t){rr(r,m);var e=ur(r);function r(t){var n;return Ze(this,r),(n=e.call(this,t)).dracoLoader=null,n.ktx2Loader=null,n.meshoptDecoder=null,n.pluginCallbacks=[],n.register((function(t){return new Uw(t)})),n.register((function(t){return new Ww(t)})),n.register((function(t){return new Jw(t)})),n.register((function(t){return new Kw(t)})),n.register((function(t){return new zw(t)})),n.register((function(t){return new jw(t)})),n.register((function(t){return new Vw(t)})),n.register((function(t){return new Hw(t)})),n.register((function(t){return new Ow(t)})),n.register((function(t){return new qw(t)})),n.register((function(t){return new Gw(t)})),n.register((function(t){return new Xw(t)})),n.register((function(t){return new Yw(t)})),n.register((function(t){return new Fw(t)})),n.register((function(t){return new Zw(t)})),n.register((function(t){return new $w(t)})),n}return tr(r,[{key:"load",value:function(t,e,r,n){var i,o=this;if(""!==this.resourcePath)i=this.resourcePath;else if(""!==this.path){var s=y.extractUrlBase(t);i=y.resolveURL(s,this.path)}else i=y.extractUrlBase(t);this.manager.itemStart(t);var a=function(e){n?n(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},u=new v(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(t,(function(r){try{o.parse(r,i,(function(r){e(r),o.manager.itemEnd(t)}),a)}catch(t){a(t)}}),r,a)}},{key:"setDRACOLoader",value:function(t){return this.dracoLoader=t,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(t){return this.ktx2Loader=t,this}},{key:"setMeshoptDecoder",value:function(t){return this.meshoptDecoder=t,this}},{key:"register",value:function(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}},{key:"unregister",value:function(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}},{key:"parse",value:function(t,e,r,n){var i,o={},s={},a=new TextDecoder;if("string"==typeof t)i=JSON.parse(t);else if(t instanceof ArrayBuffer){if(a.decode(new Uint8Array(t,0,4))===tC){try{o[kw.KHR_BINARY_GLTF]=new nC(t)}catch(t){return void(n&&n(t))}i=JSON.parse(o[kw.KHR_BINARY_GLTF].content)}else i=JSON.parse(a.decode(t))}else i=t;if(void 0===i.asset||i.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new BC(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var l=0;l<this.pluginCallbacks.length;l++){var h=this.pluginCallbacks[l](u);h.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),s[h.name]=h,o[h.name]=!0}if(i.extensionsUsed)for(var c=0;c<i.extensionsUsed.length;++c){var f=i.extensionsUsed[c],p=i.extensionsRequired||[];switch(f){case kw.KHR_MATERIALS_UNLIT:o[f]=new Qw;break;case kw.KHR_DRACO_MESH_COMPRESSION:o[f]=new iC(i,this.dracoLoader);break;case kw.KHR_TEXTURE_TRANSFORM:o[f]=new oC;break;case kw.KHR_MESH_QUANTIZATION:o[f]=new sC;break;default:p.indexOf(f)>=0&&void 0===s[f]&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(o),u.setPlugins(s),u.parse(r,n)}}},{key:"parseAsync",value:function(t,e){var r=this;return new Promise((function(n,i){r.parse(t,e,n,i)}))}}]),r}();function Dw(){var t={};return{get:function(e){return t[e]},add:function(e,r){t[e]=r},remove:function(e){delete t[e]},removeAll:function(){t={}}}}var kw={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},Fw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return tr(t,[{key:"_markDefs",value:function(){for(var t=this.parser,e=this.parser.json.nodes||[],r=0,n=e.length;r<n;r++){var i=e[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(t){var e=this.parser,r="light:"+t,n=e.cache.get(r);if(n)return n;var i,o=e.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[t],a=new d(16777215);void 0!==s.color&&a.setRGB(s.color[0],s.color[1],s.color[2],_);var u=void 0!==s.range?s.range:0;switch(s.type){case"directional":(i=new x(a)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new E(a)).distance=u;break;case"spot":(i=new I(a)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,i.angle=s.spot.outerConeAngle,i.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return i.position.set(0,0,0),i.decay=2,EC(i,s),void 0!==s.intensity&&(i.intensity=s.intensity),i.name=e.createUniqueName(s.name||"light_"+t),n=Promise.resolve(i),e.cache.add(r,n),n}},{key:"getDependency",value:function(t,e){if("light"===t)return this._loadLight(e)}},{key:"createNodeAttachment",value:function(t){var e=this,r=this.parser,n=r.json.nodes[t],i=(n.extensions&&n.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(t){return r._getNodeRef(e.cache,i,t)}))}}]),t}(),Qw=function(){function t(){Ze(this,t),this.name=kw.KHR_MATERIALS_UNLIT}return tr(t,[{key:"getMaterialType",value:function(){return w}},{key:"extendParams",value:function(t,e,r){var n=[];t.color=new d(1,1,1),t.opacity=1;var i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var o=i.baseColorFactor;t.color.setRGB(o[0],o[1],o[2],_),t.opacity=o[3]}void 0!==i.baseColorTexture&&n.push(r.assignTexture(t,"map",i.baseColorTexture,C))}return Promise.all(n)}}]),t}(),Ow=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_EMISSIVE_STRENGTH}return tr(t,[{key:"extendMaterialParams",value:function(t,e){var r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var n=r.extensions[this.name].emissiveStrength;return void 0!==n&&(e.emissiveIntensity=n),Promise.resolve()}}]),t}(),Uw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_CLEARCOAT}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];if(void 0!==o.clearcoatFactor&&(e.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(r.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(r.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(r.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new S(s,s)}return Promise.all(i)}}]),t}(),Gw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_IRIDESCENCE}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return void 0!==o.iridescenceFactor&&(e.iridescence=o.iridescenceFactor),void 0!==o.iridescenceTexture&&i.push(r.assignTexture(e,"iridescenceMap",o.iridescenceTexture)),void 0!==o.iridescenceIor&&(e.iridescenceIOR=o.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==o.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),void 0!==o.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),void 0!==o.iridescenceThicknessTexture&&i.push(r.assignTexture(e,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}]),t}(),zw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_SHEEN}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[];e.sheenColor=new d(0,0,0),e.sheenRoughness=0,e.sheen=1;var o=n.extensions[this.name];if(void 0!==o.sheenColorFactor){var s=o.sheenColorFactor;e.sheenColor.setRGB(s[0],s[1],s[2],_)}return void 0!==o.sheenRoughnessFactor&&(e.sheenRoughness=o.sheenRoughnessFactor),void 0!==o.sheenColorTexture&&i.push(r.assignTexture(e,"sheenColorMap",o.sheenColorTexture,C)),void 0!==o.sheenRoughnessTexture&&i.push(r.assignTexture(e,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}]),t}(),jw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_TRANSMISSION}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return void 0!==o.transmissionFactor&&(e.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(r.assignTexture(e,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}]),t}(),Vw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_VOLUME}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];e.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&i.push(r.assignTexture(e,"thicknessMap",o.thicknessTexture)),e.attenuationDistance=o.attenuationDistance||1/0;var s=o.attenuationColor||[1,1,1];return e.attenuationColor=(new d).setRGB(s[0],s[1],s[2],_),Promise.all(i)}}]),t}(),Hw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_IOR}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var n=r.extensions[this.name];return e.ior=void 0!==n.ior?n.ior:1.5,Promise.resolve()}}]),t}(),qw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_SPECULAR}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];e.specularIntensity=void 0!==o.specularFactor?o.specularFactor:1,void 0!==o.specularTexture&&i.push(r.assignTexture(e,"specularIntensityMap",o.specularTexture));var s=o.specularColorFactor||[1,1,1];return e.specularColor=(new d).setRGB(s[0],s[1],s[2],_),void 0!==o.specularColorTexture&&i.push(r.assignTexture(e,"specularColorMap",o.specularColorTexture,C)),Promise.all(i)}}]),t}(),Yw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.EXT_MATERIALS_BUMP}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return e.bumpScale=void 0!==o.bumpFactor?o.bumpFactor:1,void 0!==o.bumpTexture&&i.push(r.assignTexture(e,"bumpMap",o.bumpTexture)),Promise.all(i)}}]),t}(),Xw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_ANISOTROPY}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return void 0!==o.anisotropyStrength&&(e.anisotropy=o.anisotropyStrength),void 0!==o.anisotropyRotation&&(e.anisotropyRotation=o.anisotropyRotation),void 0!==o.anisotropyTexture&&i.push(r.assignTexture(e,"anisotropyMap",o.anisotropyTexture)),Promise.all(i)}}]),t}(),Ww=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_TEXTURE_BASISU}return tr(t,[{key:"loadTexture",value:function(t){var e=this.parser,r=e.json,n=r.textures[t];if(!n.extensions||!n.extensions[this.name])return null;var i=n.extensions[this.name],o=e.options.ktx2Loader;if(!o){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,i.source,o)}}]),t}(),Jw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.EXT_TEXTURE_WEBP,this.isSupported=null}return tr(t,[{key:"loadTexture",value:function(t){var e=this.name,r=this.parser,n=r.json,i=n.textures[t];if(!i.extensions||!i.extensions[e])return null;var o=i.extensions[e],s=n.images[o.source],a=r.textureLoader;if(s.uri){var u=r.options.manager.getHandler(s.uri);null!==u&&(a=u)}return this.detectSupport().then((function(i){if(i)return r.loadTextureImage(t,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(t)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(t){var e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}]),t}(),Kw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.EXT_TEXTURE_AVIF,this.isSupported=null}return tr(t,[{key:"loadTexture",value:function(t){var e=this.name,r=this.parser,n=r.json,i=n.textures[t];if(!i.extensions||!i.extensions[e])return null;var o=i.extensions[e],s=n.images[o.source],a=r.textureLoader;if(s.uri){var u=r.options.manager.getHandler(s.uri);null!==u&&(a=u)}return this.detectSupport().then((function(i){if(i)return r.loadTextureImage(t,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(t)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(t){var e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}]),t}(),Zw=function(){function t(e){Ze(this,t),this.name=kw.EXT_MESHOPT_COMPRESSION,this.parser=e}return tr(t,[{key:"loadBufferView",value:function(t){var e=this.parser.json,r=e.bufferViews[t];if(r.extensions&&r.extensions[this.name]){var n=r.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){var e=n.byteOffset||0,r=n.byteLength||0,i=n.count,s=n.byteStride,a=new Uint8Array(t,e,r);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(i,s,a,n.mode,n.filter).then((function(t){return t.buffer})):o.ready.then((function(){var t=new ArrayBuffer(i*s);return o.decodeGltfBuffer(new Uint8Array(t),i,s,a,n.mode,n.filter),t}))}))}return null}}]),t}(),$w=function(){function t(e){Ze(this,t),this.name=kw.EXT_MESH_GPU_INSTANCING,this.parser=e}return tr(t,[{key:"createNodeMesh",value:function(t){var e=this,r=this.parser.json,n=r.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;var i,o=yr(r.meshes[n.mesh].primitives);try{for(o.s();!(i=o.n()).done;){var s=i.value;if(s.mode!==hC.TRIANGLES&&s.mode!==hC.TRIANGLE_STRIP&&s.mode!==hC.TRIANGLE_FAN&&void 0!==s.mode)return null}}catch(t){o.e(t)}finally{o.f()}var a=n.extensions[this.name].attributes,u=[],l={},h=function(t){u.push(e.parser.getDependency("accessor",a[t]).then((function(e){return l[t]=e,l[t]})))};for(var c in a)h(c);return u.length<1?null:(u.push(this.parser.createNodeMesh(t)),Promise.all(u).then((function(t){var r,n=t.pop(),i=n.isGroup?n.children:[n],o=t[0].count,s=[],a=yr(i);try{for(a.s();!(r=a.n()).done;){for(var u=r.value,h=new A,c=new B,f=new g,p=new B(1,1,1),d=new M(u.geometry,u.material,o),y=0;y<o;y++)l.TRANSLATION&&c.fromBufferAttribute(l.TRANSLATION,y),l.ROTATION&&f.fromBufferAttribute(l.ROTATION,y),l.SCALE&&p.fromBufferAttribute(l.SCALE,y),d.setMatrixAt(y,h.compose(c,f,p));for(var v in l)if("_COLOR_0"===v){var m=l[v];d.instanceColor=new T(m.array,m.itemSize,m.normalized)}else"TRANSLATION"!==v&&"ROTATION"!==v&&"SCALE"!==v&&u.geometry.setAttribute(v,l[v]);L.prototype.copy.call(d,u),e.parser.assignFinalMaterial(d),s.push(d)}}catch(t){a.e(t)}finally{a.f()}return n.isGroup?(n.clear(),n.add.apply(n,s),n):s[0]})))}}]),t}(),tC="glTF",eC=1313821514,rC=5130562,nC=tr((function t(e){Ze(this,t),this.name=kw.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==tC)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=this.header.length-12,o=new DataView(e,12),s=0;s<i;){var a=o.getUint32(s,!0);s+=4;var u=o.getUint32(s,!0);if(s+=4,u===eC){var l=new Uint8Array(e,12+s,a);this.content=n.decode(l)}else if(u===rC){var h=12+s;this.body=e.slice(h,h+a)}s+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),iC=function(){function t(e,r){if(Ze(this,t),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=kw.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=r,this.dracoLoader.preload()}return tr(t,[{key:"decodePrimitive",value:function(t,e){var r=this.json,n=this.dracoLoader,i=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,s={},a={},u={};for(var l in o){var h=gC[l]||l.toLowerCase();s[h]=o[l]}for(var c in t.attributes){var f=gC[c]||c.toLowerCase();if(void 0!==o[c]){var p=r.accessors[t.attributes[c]],d=cC[p.componentType];u[f]=d.name,a[f]=!0===p.normalized}}return e.getDependency("bufferView",i).then((function(t){return new Promise((function(e,r){n.decodeDracoFile(t,(function(t){for(var r in t.attributes){var n=t.attributes[r],i=a[r];void 0!==i&&(n.normalized=i)}e(t)}),s,u,_,r)}))}))}}]),t}(),oC=function(){function t(){Ze(this,t),this.name=kw.KHR_TEXTURE_TRANSFORM}return tr(t,[{key:"extendTexture",value:function(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}]),t}(),sC=tr((function t(){Ze(this,t),this.name=kw.KHR_MESH_QUANTIZATION})),aC=function(t){rr(r,_t);var e=ur(r);function r(t,n,i,o){return Ze(this,r),e.call(this,t,n,i,o)}return tr(r,[{key:"copySampleValue_",value:function(t){for(var e=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=t*n*3+n,o=0;o!==n;o++)e[o]=r[i+o];return e}},{key:"interpolate_",value:function(t,e,r,n){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,u=3*s,l=n-e,h=(r-e)/l,c=h*h,f=c*h,p=t*u,d=p-u,g=-2*f+3*c,A=f-c,y=1-g,v=A-c+h,m=0;m!==s;m++){var _=o[d+m+s],I=o[d+m+a]*l,E=o[p+m+s],x=o[p+m]*l;i[m]=y*_+v*I+g*E+A*x}return i}}]),r}(),uC=new g,lC=function(t){rr(r,aC);var e=ur(r);function r(){return Ze(this,r),e.apply(this,arguments)}return tr(r,[{key:"interpolate_",value:function(t,e,n,i){var o=hr(nr(r.prototype),"interpolate_",this).call(this,t,e,n,i);return uC.fromArray(o).normalize().toArray(o),o}}]),r}(),hC={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},cC={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},fC={9728:it,9729:P,9984:ot,9985:st,9986:at,9987:D},pC={33071:ut,33648:lt,10497:k},dC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},gC={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},AC={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},yC={CUBICSPLINE:void 0,LINEAR:rt,STEP:ht},vC="OPAQUE",mC="MASK",_C="BLEND";function IC(t,e,r){for(var n in r.extensions)void 0===t[n]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=r.extensions[n])}function EC(t,e){void 0!==e.extras&&("object"===We(e.extras)?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function xC(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var r=0,n=e.weights.length;r<n;r++)t.morphTargetInfluences[r]=e.weights[r];if(e.extras&&Array.isArray(e.extras.targetNames)){var i=e.extras.targetNames;if(t.morphTargetInfluences.length===i.length){t.morphTargetDictionary={};for(var o=0,s=i.length;o<s;o++)t.morphTargetDictionary[i[o]]=o}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function wC(t){var e,r=t.extensions&&t.extensions[kw.KHR_DRACO_MESH_COMPRESSION];if(e=r?"draco:"+r.bufferView+":"+r.indices+":"+CC(r.attributes):t.indices+":"+CC(t.attributes)+":"+t.mode,void 0!==t.targets)for(var n=0,i=t.targets.length;n<i;n++)e+=":"+CC(t.targets[n]);return e}function CC(t){for(var e="",r=Object.keys(t).sort(),n=0,i=r.length;n<i;n++)e+=r[n]+":"+t[r[n]]+";";return e}function bC(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var SC=new A,BC=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ze(this,t),this.json=e,this.extensions={},this.plugins={},this.options=r,this.cache=new Dw,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};var n=!1,i=!1,o=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),o=(i=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||i&&o<98?this.textureLoader=new ft(this.options.manager):this.textureLoader=new pt(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new v(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return tr(t,[{key:"setExtensions",value:function(t){this.extensions=t}},{key:"setPlugins",value:function(t){this.plugins=t}},{key:"parse",value:function(t,e){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(e){var o={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:r,userData:{}};return IC(i,o,n),EC(o,n),Promise.all(r._invokeAll((function(t){return t.afterRoot&&t.afterRoot(o)}))).then((function(){t(o)}))})).catch(e)}},{key:"_markDefs",value:function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],n=0,i=e.length;n<i;n++)for(var o=e[n].joints,s=0,a=o.length;s<a;s++)t[o[s]].isBone=!0;for(var u=0,l=t.length;u<l;u++){var h=t[u];void 0!==h.mesh&&(this._addNodeRef(this.meshCache,h.mesh),void 0!==h.skin&&(r[h.mesh].isSkinnedMesh=!0)),void 0!==h.camera&&this._addNodeRef(this.cameraCache,h.camera)}}},{key:"_addNodeRef",value:function(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}},{key:"_getNodeRef",value:function(t,e,r){var n=this;if(t.refs[e]<=1)return r;var i=r.clone();return function t(e,r){var i=n.associations.get(e);null!=i&&n.associations.set(r,i);var o,s=yr(e.children.entries());try{for(s.s();!(o=s.n()).done;){var a=pr(o.value,2),u=a[0];t(a[1],r.children[u])}}catch(t){s.e(t)}finally{s.f()}}(r,i),i.name+="_instance_"+t.uses[e]++,i}},{key:"_invokeOne",value:function(t){var e=Object.values(this.plugins);e.push(this);for(var r=0;r<e.length;r++){var n=t(e[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(t){var e=Object.values(this.plugins);e.unshift(this);for(var r=[],n=0;n<e.length;n++){var i=t(e[n]);i&&r.push(i)}return r}},{key:"getDependency",value:function(t,e){var r=t+":"+e,n=this.cache.get(r);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":n=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":n=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":n=this.loadCamera(e);break;default:if(!(n=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(t,e)}))))throw new Error("Unknown type: "+t)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(t){var e=this.cache.get(t);if(!e){var r=this,n=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(n.map((function(e,n){return r.getDependency(t,n)}))),this.cache.add(t,e)}return e}},{key:"loadBuffer",value:function(t){var e=this.json.buffers[t],r=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[kw.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(t,i){r.load(y.resolveURL(e.uri,n.path),t,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}},{key:"loadBufferView",value:function(t){var e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){var r=e.byteLength||0,n=e.byteOffset||0;return t.slice(n,n+r)}))}},{key:"loadAccessor",value:function(t){var e=this,r=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse){var i=dC[n.type],o=cC[n.componentType],s=!0===n.normalized,a=new o(n.count*i);return Promise.resolve(new h(a,i,s))}var u=[];return void 0!==n.bufferView?u.push(this.getDependency("bufferView",n.bufferView)):u.push(null),void 0!==n.sparse&&(u.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),u.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(u).then((function(t){var i,o,s=t[0],a=dC[n.type],u=cC[n.componentType],l=u.BYTES_PER_ELEMENT,c=l*a,f=n.byteOffset||0,p=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,d=!0===n.normalized;if(p&&p!==c){var g=Math.floor(f/p),A="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+g+":"+n.count,y=e.cache.get(A);y||(i=new u(s,g*p,n.count*p/l),y=new R(i,p/l),e.cache.add(A,y)),o=new N(y,a,f%p/l,d)}else i=null===s?new u(n.count*a):new u(s,f,n.count*a),o=new h(i,a,d);if(void 0!==n.sparse){var v=dC.SCALAR,m=cC[n.sparse.indices.componentType],_=n.sparse.indices.byteOffset||0,I=n.sparse.values.byteOffset||0,E=new m(t[1],_,n.sparse.count*v),x=new u(t[2],I,n.sparse.count*a);null!==s&&(o=new h(o.array.slice(),o.itemSize,o.normalized));for(var w=0,C=E.length;w<C;w++){var b=E[w];if(o.setX(b,x[w*a]),a>=2&&o.setY(b,x[w*a+1]),a>=3&&o.setZ(b,x[w*a+2]),a>=4&&o.setW(b,x[w*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))}},{key:"loadTexture",value:function(t){var e=this.json,r=this.options,n=e.textures[t].source,i=e.images[n],o=this.textureLoader;if(i.uri){var s=r.manager.getHandler(i.uri);null!==s&&(o=s)}return this.loadTextureImage(t,n,o)}},{key:"loadTextureImage",value:function(t,e,r){var n=this,i=this.json,o=i.textures[t],s=i.images[e],a=(s.uri||s.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];var u=this.loadImageSource(e,r).then((function(e){e.flipY=!1,e.name=o.name||s.name||"",""===e.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(e.name=s.uri);var r=(i.samplers||{})[o.sampler]||{};return e.magFilter=fC[r.magFilter]||P,e.minFilter=fC[r.minFilter]||D,e.wrapS=pC[r.wrapS]||k,e.wrapT=pC[r.wrapT]||k,n.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[a]=u,u}},{key:"loadImageSource",value:function(t,e){var r=this.json,n=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((function(t){return t.clone()}));var i=r.images[t],o=self.URL||self.webkitURL,s=i.uri||"",a=!1;if(void 0!==i.bufferView)s=this.getDependency("bufferView",i.bufferView).then((function(t){a=!0;var e=new Blob([t],{type:i.mimeType});return s=o.createObjectURL(e)}));else if(void 0===i.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");var u=Promise.resolve(s).then((function(t){return new Promise((function(r,i){var o=r;!0===e.isImageBitmapLoader&&(o=function(t){var e=new dt(t);e.needsUpdate=!0,r(e)}),e.load(y.resolveURL(t,n.path),o,void 0,i)}))})).then((function(t){var e;return!0===a&&o.revokeObjectURL(s),t.userData.mimeType=i.mimeType||((e=i.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),t}));return this.sourceCache[t]=u,u}},{key:"assignTexture",value:function(t,e,r,n){var i=this;return this.getDependency("texture",r.index).then((function(o){if(!o)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((o=o.clone()).channel=r.texCoord),i.extensions[kw.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[kw.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var a=i.associations.get(o);o=i.extensions[kw.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),i.associations.set(o,a)}}return void 0!==n&&(o.colorSpace=n),t[e]=o,o}))}},{key:"assignFinalMaterial",value:function(t){var e=t.geometry,r=t.material,n=void 0===e.attributes.tangent,i=void 0!==e.attributes.color,o=void 0===e.attributes.normal;if(t.isPoints){var s="PointsMaterial:"+r.uuid,a=this.cache.get(s);a||(a=new F,Q.prototype.copy.call(a,r),a.color.copy(r.color),a.map=r.map,a.sizeAttenuation=!1,this.cache.add(s,a)),r=a}else if(t.isLine){var u="LineBasicMaterial:"+r.uuid,l=this.cache.get(u);l||(l=new O,Q.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(u,l)),r=l}if(n||i||o){var h="ClonedMaterial:"+r.uuid+":";n&&(h+="derivative-tangents:"),i&&(h+="vertex-colors:"),o&&(h+="flat-shading:");var c=this.cache.get(h);c||(c=r.clone(),i&&(c.vertexColors=!0),o&&(c.flatShading=!0),n&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(h,c),this.associations.set(c,this.associations.get(r))),r=c}t.material=r}},{key:"getMaterialType",value:function(){return U}},{key:"loadMaterial",value:function(t){var e,r=this,n=this.json,i=this.extensions,o=n.materials[t],s={},a=[];if((o.extensions||{})[kw.KHR_MATERIALS_UNLIT]){var u=i[kw.KHR_MATERIALS_UNLIT];e=u.getMaterialType(),a.push(u.extendParams(s,o,r))}else{var l=o.pbrMetallicRoughness||{};if(s.color=new d(1,1,1),s.opacity=1,Array.isArray(l.baseColorFactor)){var h=l.baseColorFactor;s.color.setRGB(h[0],h[1],h[2],_),s.opacity=h[3]}void 0!==l.baseColorTexture&&a.push(r.assignTexture(s,"map",l.baseColorTexture,C)),s.metalness=void 0!==l.metallicFactor?l.metallicFactor:1,s.roughness=void 0!==l.roughnessFactor?l.roughnessFactor:1,void 0!==l.metallicRoughnessTexture&&(a.push(r.assignTexture(s,"metalnessMap",l.metallicRoughnessTexture)),a.push(r.assignTexture(s,"roughnessMap",l.metallicRoughnessTexture))),e=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),a.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,s)}))))}!0===o.doubleSided&&(s.side=G);var c=o.alphaMode||vC;if(c===_C?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,c===mC&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&e!==w&&(a.push(r.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new S(1,1),void 0!==o.normalTexture.scale)){var f=o.normalTexture.scale;s.normalScale.set(f,f)}if(void 0!==o.occlusionTexture&&e!==w&&(a.push(r.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&e!==w){var p=o.emissiveFactor;s.emissive=(new d).setRGB(p[0],p[1],p[2],_)}return void 0!==o.emissiveTexture&&e!==w&&a.push(r.assignTexture(s,"emissiveMap",o.emissiveTexture,C)),Promise.all(a).then((function(){var n=new e(s);return o.name&&(n.name=o.name),EC(n,o),r.associations.set(n,{materials:t}),o.extensions&&IC(i,n,o),n}))}},{key:"createUniqueName",value:function(t){var e=z.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}},{key:"loadGeometries",value:function(t){var e=this,r=this.extensions,n=this.primitiveCache;function i(t){return r[kw.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(r){return MC(r,t,e)}))}for(var o=[],s=0,a=t.length;s<a;s++){var u=t[s],h=wC(u),c=n[h];if(c)o.push(c.promise);else{var f=void 0;f=u.extensions&&u.extensions[kw.KHR_DRACO_MESH_COMPRESSION]?i(u):MC(new l,u,e),n[h]={primitive:u,promise:f},o.push(f)}}return Promise.all(o)}},{key:"loadMesh",value:function(t){for(var e,r=this,n=this.json,i=this.extensions,o=n.meshes[t],s=o.primitives,a=[],u=0,l=s.length;u<l;u++){var h=void 0===s[u].material?(void 0===(e=this.cache).DefaultMaterial&&(e.DefaultMaterial=new U({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ct})),e.DefaultMaterial):this.getDependency("material",s[u].material);a.push(h)}return a.push(r.loadGeometries(s)),Promise.all(a).then((function(e){for(var n=e.slice(0,e.length-1),a=e[e.length-1],u=[],l=0,h=a.length;l<h;l++){var c=a[l],d=s[l],g=void 0,A=n[l];if(d.mode===hC.TRIANGLES||d.mode===hC.TRIANGLE_STRIP||d.mode===hC.TRIANGLE_FAN||void 0===d.mode)!0===(g=!0===o.isSkinnedMesh?new j(c,A):new V(c,A)).isSkinnedMesh&&g.normalizeSkinWeights(),d.mode===hC.TRIANGLE_STRIP?g.geometry=XE(g.geometry,p):d.mode===hC.TRIANGLE_FAN&&(g.geometry=XE(g.geometry,f));else if(d.mode===hC.LINES)g=new H(c,A);else if(d.mode===hC.LINE_STRIP)g=new q(c,A);else if(d.mode===hC.LINE_LOOP)g=new Y(c,A);else{if(d.mode!==hC.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);g=new X(c,A)}Object.keys(g.geometry.morphAttributes).length>0&&xC(g,o),g.name=r.createUniqueName(o.name||"mesh_"+t),EC(g,o),d.extensions&&IC(i,g,d),r.assignFinalMaterial(g),u.push(g)}for(var y=0,v=u.length;y<v;y++)r.associations.set(u[y],{meshes:t,primitives:y});if(1===u.length)return o.extensions&&IC(i,u[0],o),u[0];var m=new W;o.extensions&&IC(i,m,o),r.associations.set(m,{meshes:t});for(var _=0,I=u.length;_<I;_++)m.add(u[_]);return m}))}},{key:"loadCamera",value:function(t){var e,r=this.json.cameras[t],n=r[r.type];if(n)return"perspective"===r.type?e=new J(K.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(e=new Z(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(e.name=this.createUniqueName(r.name)),EC(e,r),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(t){for(var e=this.json.skins[t],r=[],n=0,i=e.joints.length;n<i;n++)r.push(this._loadNodeShallow(e.joints[n]));return void 0!==e.inverseBindMatrices?r.push(this.getDependency("accessor",e.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(t){for(var r=t.pop(),n=t,i=[],o=[],s=0,a=n.length;s<a;s++){var u=n[s];if(u){i.push(u);var l=new A;null!==r&&l.fromArray(r.array,16*s),o.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[s])}return new $(i,o)}))}},{key:"loadAnimation",value:function(t){for(var e=this.json,r=this,n=e.animations[t],i=n.name?n.name:"animation_"+t,o=[],s=[],a=[],u=[],l=[],h=0,c=n.channels.length;h<c;h++){var f=n.channels[h],p=n.samplers[f.sampler],d=f.target,g=d.node,A=void 0!==n.parameters?n.parameters[p.input]:p.input,y=void 0!==n.parameters?n.parameters[p.output]:p.output;void 0!==d.node&&(o.push(this.getDependency("node",g)),s.push(this.getDependency("accessor",A)),a.push(this.getDependency("accessor",y)),u.push(p),l.push(d))}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(a),Promise.all(u),Promise.all(l)]).then((function(t){for(var e=t[0],n=t[1],o=t[2],s=t[3],a=t[4],u=[],l=0,h=e.length;l<h;l++){var c=e[l],f=n[l],p=o[l],d=s[l],g=a[l];if(void 0!==c){c.updateMatrix&&c.updateMatrix();var A=r._createAnimationTracks(c,f,p,d,g);if(A)for(var y=0;y<A.length;y++)u.push(A[y])}}return new tt(i,void 0,u)}))}},{key:"createNodeMesh",value:function(t){var e=this.json,r=this,n=e.nodes[t];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(t){var e=r._getNodeRef(r.meshCache,n.mesh,t);return void 0!==n.weights&&e.traverse((function(t){if(t.isMesh)for(var e=0,r=n.weights.length;e<r;e++)t.morphTargetInfluences[e]=n.weights[e]})),e}))}},{key:"loadNode",value:function(t){for(var e=this,r=this.json.nodes[t],n=e._loadNodeShallow(t),i=[],o=r.children||[],s=0,a=o.length;s<a;s++)i.push(e.getDependency("node",o[s]));var u=void 0===r.skin?Promise.resolve(null):e.getDependency("skin",r.skin);return Promise.all([n,Promise.all(i),u]).then((function(t){var e=t[0],r=t[1],n=t[2];null!==n&&e.traverse((function(t){t.isSkinnedMesh&&t.bind(n,SC)}));for(var i=0,o=r.length;i<o;i++)e.add(r[i]);return e}))}},{key:"_loadNodeShallow",value:function(t){var e=this.json,r=this.extensions,n=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];var i=e.nodes[t],o=i.name?n.createUniqueName(i.name):"",s=[],a=n._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return a&&s.push(a),void 0!==i.camera&&s.push(n.getDependency("camera",i.camera).then((function(t){return n._getNodeRef(n.cameraCache,i.camera,t)}))),n._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){s.push(t)})),this.nodeCache[t]=Promise.all(s).then((function(e){var s;if((s=!0===i.isBone?new et:e.length>1?new W:1===e.length?e[0]:new L)!==e[0])for(var a=0,u=e.length;a<u;a++)s.add(e[a]);if(i.name&&(s.userData.name=i.name,s.name=o),EC(s,i),i.extensions&&IC(r,s,i),void 0!==i.matrix){var l=new A;l.fromArray(i.matrix),s.applyMatrix4(l)}else void 0!==i.translation&&s.position.fromArray(i.translation),void 0!==i.rotation&&s.quaternion.fromArray(i.rotation),void 0!==i.scale&&s.scale.fromArray(i.scale);return n.associations.has(s)||n.associations.set(s,{}),n.associations.get(s).nodes=t,s})),this.nodeCache[t]}},{key:"loadScene",value:function(t){var e=this.extensions,r=this.json.scenes[t],n=this,i=new W;r.name&&(i.name=n.createUniqueName(r.name)),EC(i,r),r.extensions&&IC(e,i,r);for(var o=r.nodes||[],s=[],a=0,u=o.length;a<u;a++)s.push(n.getDependency("node",o[a]));return Promise.all(s).then((function(t){for(var e=0,r=t.length;e<r;e++)i.add(t[e]);return n.associations=function(t){var e,r=new Map,i=yr(n.associations);try{for(i.s();!(e=i.n()).done;){var o=pr(e.value,2),s=o[0],a=o[1];(s instanceof Q||s instanceof dt)&&r.set(s,a)}}catch(t){i.e(t)}finally{i.f()}return t.traverse((function(t){var e=n.associations.get(t);null!=e&&r.set(t,e)})),r}(i),i}))}},{key:"_createAnimationTracks",value:function(t,e,r,n,i){var o,s=[],a=t.name?t.name:t.uuid,u=[];switch(AC[i.path]===AC.weights?t.traverse((function(t){t.morphTargetInfluences&&u.push(t.name?t.name:t.uuid)})):u.push(a),AC[i.path]){case AC.weights:o=At;break;case AC.rotation:o=yt;break;case AC.position:case AC.scale:o=gt;break;default:if(1===r.itemSize)o=At;else o=gt}for(var l=void 0!==n.interpolation?yC[n.interpolation]:rt,h=this._getArrayFromAccessor(r),c=0,f=u.length;c<f;c++){var p=new o(u[c]+"."+AC[i.path],e.array,h,l);"CUBICSPLINE"===n.interpolation&&this._createCubicSplineTrackInterpolant(p),s.push(p)}return s}},{key:"_getArrayFromAccessor",value:function(t){var e=t.array;if(t.normalized){for(var r=bC(e.constructor),n=new Float32Array(e.length),i=0,o=e.length;i<o;i++)n[i]=e[i]*r;e=n}return e}},{key:"_createCubicSplineTrackInterpolant",value:function(t){t.createInterpolant=function(t){return new(this instanceof yt?lC:aC)(this.times,this.values,this.getValueSize()/3,t)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}]),t}();function MC(t,e,r){var n=e.attributes,i=[];function o(e,n){return r.getDependency("accessor",e).then((function(e){t.setAttribute(n,e)}))}for(var s in n){var a=gC[s]||s.toLowerCase();a in t.attributes||i.push(o(n[s],a))}if(void 0!==e.indices&&!t.index){var u=r.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));i.push(u)}return nt.workingColorSpace!==_&&"COLOR_0"in n&&console.warn('THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "'.concat(nt.workingColorSpace,'" not supported.')),EC(t,e),function(t,e,r){var n=e.attributes,i=new vt;if(void 0!==n.POSITION){var o=r.json.accessors[n.POSITION],s=o.min,a=o.max;if(void 0!==s&&void 0!==a){if(i.set(new B(s[0],s[1],s[2]),new B(a[0],a[1],a[2])),o.normalized){var u=bC(cC[o.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}var l=e.targets;if(void 0!==l){for(var h=new B,c=new B,f=0,p=l.length;f<p;f++){var d=l[f];if(void 0!==d.POSITION){var g=r.json.accessors[d.POSITION],A=g.min,y=g.max;if(void 0!==A&&void 0!==y){if(c.setX(Math.max(Math.abs(A[0]),Math.abs(y[0]))),c.setY(Math.max(Math.abs(A[1]),Math.abs(y[1]))),c.setZ(Math.max(Math.abs(A[2]),Math.abs(y[2]))),g.normalized){var v=bC(cC[g.componentType]);c.multiplyScalar(v)}h.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(h)}t.boundingBox=i;var m=new mt;i.getCenter(m.center),m.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,e,r),Promise.all(i).then((function(){return void 0!==e.targets?function(t,e,r){for(var n=!1,i=!1,o=!1,s=0,a=e.length;s<a;s++){var u=e[s];if(void 0!==u.POSITION&&(n=!0),void 0!==u.NORMAL&&(i=!0),void 0!==u.COLOR_0&&(o=!0),n&&i&&o)break}if(!n&&!i&&!o)return Promise.resolve(t);for(var l=[],h=[],c=[],f=0,p=e.length;f<p;f++){var d=e[f];if(n){var g=void 0!==d.POSITION?r.getDependency("accessor",d.POSITION):t.attributes.position;l.push(g)}if(i){var A=void 0!==d.NORMAL?r.getDependency("accessor",d.NORMAL):t.attributes.normal;h.push(A)}if(o){var y=void 0!==d.COLOR_0?r.getDependency("accessor",d.COLOR_0):t.attributes.color;c.push(y)}}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c)]).then((function(e){var r=e[0],s=e[1],a=e[2];return n&&(t.morphAttributes.position=r),i&&(t.morphAttributes.normal=s),o&&(t.morphAttributes.color=a),t.morphTargetsRelative=!0,t}))}(t,e.targets,r):t}))}var TC=function(t){rr(r,Nw);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It;return Ze(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new A,t}return tr(r,[{key:"parse",value:function(t){var e=this,n=hr(nr(r.prototype),"parse",this).call(this,t),i=n.glbBytes.slice().buffer;return new Promise((function(t,r){var o=e.manager,s=e.fetchOptions,a=o.getHandler("path.gltf")||new Pw(o);"include"===s.credentials&&"cors"===s.mode&&a.setCrossOrigin("use-credentials"),"credentials"in s&&a.setWithCredentials("include"===s.credentials),s.headers&&a.setRequestHeader(s.headers);var u=e.workingPath;!/[\\/]$/.test(u)&&u.length&&(u+="/");var l=e.adjustmentTransform;a.parse(i,u,(function(e){var r=n.batchTable,i=n.featureTable,o=e.scene,s=i.getData("RTC_CENTER");s&&(o.position.x+=s[0],o.position.y+=s[1],o.position.z+=s[2]),e.scene.updateMatrix(),e.scene.matrix.multiply(l),e.scene.matrix.decompose(e.scene.position,e.scene.quaternion,e.scene.scale),e.batchTable=r,e.featureTable=i,o.batchTable=r,o.featureTable=i,t(e)}),r)}))}}]),r}(),LC=function(t){rr(r,Lw);var e=ur(r);function r(){return Ze(this,r),e.apply(this,arguments)}return tr(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Rw(e);console.assert("pnts"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=t.slice(28,28+o+s),h=new Mw(l,0,o,s),c=28+o+s,f=t.slice(c,c+a+u),p=new Tw(f,h.getData("BATCH_LENGTH")||h.getData("POINTS_LENGTH"),0,a,u);return Promise.resolve({version:n,featureTable:h,batchTable:p})}}]),r}();var RC={RGB:"color",POSITION:"position"},NC=function(t){rr(r,LC);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It;return Ze(this,r),(t=e.call(this)).manager=n,t}return tr(r,[{key:"parse",value:function(t){var e=this;return hr(nr(r.prototype),"parse",this).call(this,t).then(function(){var t=Ke(Xe().mark((function t(r){var n,i,o,s,a,u,c,f,p,g,A,y,v,m,_,I,E,x,w,C,b,S,M,T,L,R,N,P,D,k,Q,O,U,G,z;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r.featureTable,i=new F,o=n.header.extensions,s=new B,!o||!o["3DTILES_draco_point_compression"]){t.next=19;break}if(u=o["3DTILES_draco_point_compression"],c=u.byteOffset,f=u.byteLength,p=u.properties,null!=(g=e.manager.getHandler("draco.drc"))){t.next=9;break}throw new Error("PNTSLoader: dracoLoader not available.");case 9:for(y in A={},p)y in RC&&y in p&&(A[RC[y]]=p[y]);return v={attributeIDs:A,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},m=n.getBuffer(c,f),t.next=15,g.decodeGeometry(m,v);case 15:(a=t.sent).attributes.color&&(i.vertexColors=!0),t.next=31;break;case 19:if(_=n.getData("POINTS_LENGTH"),I=n.getData("POSITION",_,"FLOAT","VEC3"),E=n.getData("RGB",_,"UNSIGNED_BYTE","VEC3"),x=n.getData("RGBA",_,"UNSIGNED_BYTE","VEC4"),w=n.getData("RGB565",_,"UNSIGNED_SHORT","SCALAR"),C=n.getData("CONSTANT_RGBA",_,"UNSIGNED_BYTE","VEC4"),b=n.getData("POSITION_QUANTIZED",_,"UNSIGNED_SHORT","VEC3"),S=n.getData("QUANTIZED_VOLUME_SCALE",_,"FLOAT","VEC3"),M=n.getData("QUANTIZED_VOLUME_OFFSET",_,"FLOAT","VEC3"),a=new l,b){for(T=new Float32Array(3*_),L=0;L<_;L++)for(R=0;R<3;R++)T[N=3*L+R]=b[N]/65535*S[R];s.x=M[0],s.y=M[1],s.z=M[2],a.setAttribute("position",new h(T,3,!1))}else a.setAttribute("position",new h(I,3,!1));if(null!==x)a.setAttribute("color",new h(x,4,!0)),i.vertexColors=!0,i.transparent=!0,i.depthWrite=!1;else if(null!==E)a.setAttribute("color",new h(E,3,!0)),i.vertexColors=!0;else if(null!==w){for(P=new Uint8Array(3*_),D=0;D<_;D++)for(j=w[D],V=void 0,H=void 0,q=void 0,V=j>>11,H=j>>5&63,q=31&j,k=[Math.round(V/31*255),Math.round(H/63*255),Math.round(q/31*255)],Q=0;Q<3;Q++)P[3*D+Q]=k[Q];a.setAttribute("color",new h(P,3,!0)),i.vertexColors=!0}else null!==C&&(O=new d(C[0],C[1],C[2]),i.color=O,(U=C[3]/255)<1&&(i.opacity=U,i.transparent=!0,i.depthWrite=!1));case 31:return["BATCH_LENGTH","NORMAL","NORMAL_OCT16P"].forEach((function(t){t in n.header&&console.warn('PNTSLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))})),(G=new X(a,i)).position.copy(s),r.scene=G,r.scene.featureTable=n,(z=n.getData("RTC_CENTER"))&&(r.scene.position.x+=z[0],r.scene.position.y+=z[1],r.scene.position.z+=z[2]),t.abrupt("return",r);case 39:case"end":return t.stop()}var j,V,H,q}),t)})));return function(e){return t.apply(this,arguments)}}())}}]),r}(),PC=function(t){rr(r,Lw);var e=ur(r);function r(){return Ze(this,r),e.apply(this,arguments)}return tr(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Rw(e);console.assert("i3dm"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=e.getUint32(28,!0),h=t.slice(32,32+o+s),c=new Mw(h,0,o,s),f=32+o+s,p=t.slice(f,f+a+u),d=new Tw(p,c.getData("INSTANCES_LENGTH"),0,a,u),g=f+a+u,A=new Uint8Array(t,g,i-g),y=null,v=null;if(l)y=A,v=Promise.resolve();else{var m=this.resolveExternalURL(Bw(A));v=fetch(m,this.fetchOptions).then((function(t){if(!t.ok)throw new Error('I3DMLoaderBase : Failed to load file "'.concat(m,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()})).then((function(t){y=new Uint8Array(t)}))}return v.then((function(){return{version:n,featureTable:c,batchTable:d,glbBytes:y}}))}}]),r}(),DC=new B,kC=new B,FC=new B,QC=new B,OC=new g,UC=new B,GC=new A,zC=function(t){rr(r,PC);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It;return Ze(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new A,t}return tr(r,[{key:"resolveExternalURL",value:function(t){return this.manager.resolveURL(hr(nr(r.prototype),"resolveExternalURL",this).call(this,t))}},{key:"parse",value:function(t){var e=this;return hr(nr(r.prototype),"parse",this).call(this,t).then((function(t){var r=t.featureTable,n=t.batchTable,i=t.glbBytes.slice().buffer;return new Promise((function(t,o){var s=e.fetchOptions,a=e.manager,u=a.getHandler("path.gltf")||new Pw(a);"include"===s.credentials&&"cors"===s.mode&&u.setCrossOrigin("use-credentials"),"credentials"in s&&u.setWithCredentials("include"===s.credentials),s.headers&&u.setRequestHeader(s.headers);var l=e.workingPath;/[\\/]$/.test(l)||(l+="/");var h=e.adjustmentTransform;u.parse(i,l,(function(e){var i=r.getData("INSTANCES_LENGTH"),o=r.getData("POSITION",i,"FLOAT","VEC3"),s=r.getData("NORMAL_UP",i,"FLOAT","VEC3"),a=r.getData("NORMAL_RIGHT",i,"FLOAT","VEC3"),u=r.getData("SCALE_NON_UNIFORM",i,"FLOAT","VEC3"),l=r.getData("SCALE",i,"FLOAT","SCALAR");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","EAST_NORTH_UP","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach((function(t){t in r.header&&console.warn('I3DMLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))}));var c=new Map,f=[];e.scene.traverse((function(t){if(t.isMesh){var e=t.geometry,r=t.material,n=new M(e,r,i);n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),f.push(n),c.set(t,n)}}));for(var p=new B,d=0;d<i;d++)p.x+=o[3*d+0]/i,p.y+=o[3*d+1]/i,p.z+=o[3*d+2]/i;c.forEach((function(t,e){var r=e.parent;r&&(r.remove(e),r.add(t),t.updateMatrixWorld(),t.position.copy(p).applyMatrix4(t.matrixWorld))}));for(var g=0;g<i;g++){QC.set(o[3*g+0]-p.x,o[3*g+1]-p.y,o[3*g+2]-p.z),s?(kC.set(s[3*g+0],s[3*g+1],s[3*g+2]),FC.set(a[3*g+0],a[3*g+1],a[3*g+2]),DC.crossVectors(FC,kC).normalize(),GC.makeBasis(FC,kC,DC),OC.setFromRotationMatrix(GC)):OC.set(0,0,0,1),l?UC.setScalar(l[g]):u?UC.set(u[3*g+0],u[3*g+1],u[3*g+2]):UC.set(1,1,1),GC.compose(QC,OC,UC).multiply(h);for(var A=0,y=f.length;A<y;A++){f[A].setMatrixAt(g,GC)}}e.batchTable=n,e.featureTable=r,e.scene.batchTable=n,e.scene.featureTable=r,t(e)}),o)}))}))}}]),r}(),jC=function(t){rr(r,Lw);var e=ur(r);function r(){return Ze(this,r),e.apply(this,arguments)}return tr(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Rw(e);console.assert("cmpt"===r,'CMPTLoader: The magic bytes equal "cmpt".');var n=e.getUint32(4,!0);console.assert(1===n,'CMPTLoader: The version listed in the header is "1".');var i=e.getUint32(8,!0);console.assert(i===t.byteLength,"CMPTLoader: The contents buffer length listed in the header matches the file.");for(var o=e.getUint32(12,!0),s=[],a=16,u=0;u<o;u++){var l=new DataView(t,a,12),h=Rw(l),c=l.getUint32(4,!0),f=l.getUint32(8,!0),p=new Uint8Array(t,a,f);s.push({type:h,buffer:p,version:c}),a+=f}return{version:n,tiles:s}}}]),r}(),VC=function(t){rr(r,jC);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It;return Ze(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new A,t}return tr(r,[{key:"parse",value:function(t){var e=hr(nr(r.prototype),"parse",this).call(this,t),n=this.manager,i=this.adjustmentTransform,o=[];for(var s in e.tiles){var a=e.tiles[s],u=a.type,l=a.buffer;switch(u){case"b3dm":var h=l.slice(),c=new TC(n);c.workingPath=this.workingPath,c.fetchOptions=this.fetchOptions,c.adjustmentTransform.copy(i);var f=c.parse(h.buffer);o.push(f);break;case"pnts":var p=l.slice(),d=new NC(n);d.workingPath=this.workingPath,d.fetchOptions=this.fetchOptions;var g=d.parse(p.buffer);o.push(g);break;case"i3dm":var A=l.slice(),y=new zC(n);y.workingPath=this.workingPath,y.fetchOptions=this.fetchOptions,y.adjustmentTransform.copy(i);var v=y.parse(A.buffer);o.push(v)}}return Promise.all(o).then((function(t){var e=new W;return t.forEach((function(t){e.add(t.scene)})),{tiles:t,scene:e}}))}}]),r}(),HC=function(){function t(){Ze(this,t),this.name="CESIUM_RTC"}return tr(t,[{key:"afterRoot",value:function(t){if(t.parser.json.extensions&&t.parser.json.extensions.CESIUM_RTC){var e=t.parser.json.extensions.CESIUM_RTC.center;e&&(t.scene.position.x+=e[0],t.scene.position.y+=e[1],t.scene.position.z+=e[2])}}}]),t}(),qC=function(t){rr(r,Lw);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It;return Ze(this,r),(t=e.call(this)).manager=n,t}return tr(r,[{key:"parse",value:function(t){var e=this;return new Promise((function(r,n){var i=e.manager,o=e.fetchOptions,s=i.getHandler("path.gltf")||i.getHandler("path.glb");s||((s=new Pw(i)).register((function(){return new HC})),"include"===o.credentials&&"cors"===o.mode&&s.setCrossOrigin("use-credentials"),"credentials"in o&&s.setWithCredentials("include"===o.credentials),o.headers&&s.setRequestHeader(o.headers));var a=s.resourcePath||s.path||e.workingPath;!/[\\/]$/.test(a)&&a.length&&(a+="/"),s.parse(t,a,(function(t){r(t)}),n)}))}}]),r}(),YC=new A,XC=function(t){rr(r,W);var e=ur(r);function r(t){var n;return Ze(this,r),(n=e.call(this)).name="TilesRenderer.TilesGroup",n.tilesRenderer=t,n}return tr(r,[{key:"raycast",value:function(t,e){this.tilesRenderer.optimizeRaycast&&this.tilesRenderer.raycast(t,e)}},{key:"updateMatrixWorld",value:function(t){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||t){null===this.parent?YC.copy(this.matrix):YC.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;for(var e=YC.elements,r=this.matrixWorld.elements,n=!1,i=0;i<16;i++){var o=e[i],s=r[i];if(Math.abs(o-s)>Number.EPSILON){n=!0;break}}if(n){this.matrixWorld.copy(YC);for(var a=this.children,u=0,l=a.length;u<l;u++)a[u].updateMatrixWorld()}}}}]),r}(),WC=new A,JC=new Et,KC=new B,ZC=[];function $C(t,e){return t.distance-e.distance}function tb(t,e,r){t.traverse((function(t){Object.getPrototypeOf(t).raycast.call(t,e,r)}))}function eb(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=t.group,o=t.activeTiles;t.ensureChildrenArePreprocessed(e),null===n&&(n=JC,WC.copy(i.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(WC));for(var s=[],a=e.children,u=0,l=a.length;u<l;u++){var h=a[u];if(h.__used)null!==h.cached.boundingVolume.intersectRay(n,KC)&&(KC.applyMatrix4(i.matrixWorld),s.push({distance:KC.distanceToSquared(r.ray.origin),tile:h}))}s.sort($C);var c=null,f=1/0;if(o.has(e)){var p=function(t,e){tb(t,e,ZC),ZC.sort($C);var r=ZC[0]||null;return ZC.length=0,r}(e.cached.scene,r);p&&(c=p,f=p.distance*p.distance)}for(var d=0,g=s.length;d<g;d++){var A=s[d],y=A.distance,v=A.tile;if(y>f)break;var m=eb(t,v,r,n);if(m){var _=m.distance*m.distance;_<f&&(c=m,f=_)}}return c}function rb(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=t.group,s=t.activeTiles,a=e.cached,u=a.scene,l=a.boundingVolume;if(t.ensureChildrenArePreprocessed(e),null===i&&(i=JC,WC.copy(o.matrixWorld).invert(),i.copy(r.ray).applyMatrix4(WC)),e.__used&&l.intersectsRay(i)){s.has(e)&&tb(u,r,n);for(var h=e.children,c=0,f=h.length;c<f;c++)rb(t,h[c],r,n,i)}}var nb=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new vt,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new A;Ze(this,t),this.box=e.clone(),this.transform=r.clone(),this.inverseTransform=new A,this.points=new Array(8).fill().map((function(){return new B}))}return tr(t,[{key:"update",value:function(){var t=this.points,e=this.inverseTransform,r=this.transform,n=this.box;e.copy(r).invert();for(var i=n.min,o=n.max,s=0,a=-1;a<=1;a+=2)for(var u=-1;u<=1;u+=2)for(var l=-1;l<=1;l+=2)t[s].set(a<0?i.x:o.x,u<0?i.y:o.y,l<0?i.z:o.z).applyMatrix4(r),s++}},{key:"intersectsFrustum",value:function(t){for(var e=this.points,r=t.planes,n=0;n<6;n++){for(var i=r[n],o=-1/0,s=0;s<8;s++){var a=e[s],u=i.distanceToPoint(a);o=o<u?u:o}if(o<0)return!1}return!0}}]),t}(),ib=new xt,ob=new B,sb={};function ab(t){var e=t.x,r=t.y,n=t.z;t.x=n,t.y=e,t.z=r}function ub(t){return-(t-Math.PI/2)}function lb(t){return-t+Math.PI/2}function hb(t){var e=t<0?arguments.length>2&&void 0!==arguments[2]?arguments[2]:"W":arguments.length>1&&void 0!==arguments[1]?arguments[1]:"E",r=~~(t=Math.abs(t)),n=60*(t-r),i=~~n,o=~~(60*(n-i));return"".concat(r,"° ").concat(i,"' ").concat(o,'" ').concat(e)}var cb=Object.freeze({__proto__:null,swapToGeoFrame:ab,swapToThreeFrame:function(t){var e=t.x,r=t.y,n=t.z;t.z=e,t.x=r,t.y=n},sphericalPhiToLatitude:ub,latitudeToSphericalPhi:lb,toLatLonString:function(t,e){var r,n,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ib.theta=e,ib.phi=lb(t),ob.setFromSpherical(ib),ib.setFromVector3(ob),r.lat=ub(ib.phi),r.lon=ib.theta,r}(t,e,sb);return i?(r="".concat((K.RAD2DEG*o.lat).toFixed(4),"°"),n="".concat((K.RAD2DEG*o.lon).toFixed(4),"°")):(r=hb(K.RAD2DEG*o.lat,"N","S"),n=hb(K.RAD2DEG*o.lon,"E","W")),"".concat(r," ").concat(n)}}),fb=new xt,pb=new B,db=new B,gb=new B,Ab=new B,yb=new B,vb=new B,mb=new B,_b=new B,Ib=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;Ze(this,t),this.radius=new B(e,r,n)}return tr(t,[{key:"constructLatLonFrame",value:function(t,e,r){return this.getCartographicToPosition(t,e,0,_b),this.getCartographicToNormal(t,e,mb),this.getNorthernTangent(t,e,vb),yb.crossVectors(vb,mb),r.makeBasis(yb,vb,mb).setPosition(_b)}},{key:"getNorthernTangent",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ab,i=1,o=t+1e-7;t>Math.PI/4&&(i=-1,o=t-1e-7);var s=this.getCartographicToNormal(t,e,db).normalize(),a=this.getCartographicToNormal(o,e,gb).normalize();return n.crossVectors(s,a).normalize().multiplyScalar(i),r.crossVectors(n,s).normalize()}},{key:"getCartographicToPosition",value:function(t,e,r,n){this.getCartographicToNormal(t,e,pb);var i=this.radius;db.copy(pb),db.x*=Math.pow(i.x,2),db.y*=Math.pow(i.y,2),db.z*=Math.pow(i.z,2);var o=Math.sqrt(pb.dot(db));return db.divideScalar(o),n.copy(db).addScaledVector(pb,r)}},{key:"getPositionToCartographic",value:function(t,e){this.getPositionToSurfacePoint(t,db),this.getPositionToNormal(t,pb);var r=gb.subVectors(t,db);return e.lon=Math.atan2(pb.y,pb.x),e.lat=Math.asin(pb.z),e.height=Math.sign(r.dot(t))*r.length(),e}},{key:"getCartographicToNormal",value:function(t,e,r){return fb.set(1,lb(t),e),r.setFromSpherical(fb).normalize(),ab(r),r}},{key:"getPositionToNormal",value:function(t,e){var r=this.radius;return e.copy(t),e.x/=Math.pow(r.x,2),e.y/=Math.pow(r.y,2),e.z/=Math.pow(r.z,2),e.normalize(),e}},{key:"getPositionToSurfacePoint",value:function(t,e){var r=this.radius,n=1/Math.pow(r.x,2),i=1/Math.pow(r.y,2),o=1/Math.pow(r.z,2),s=t.x*t.x*n,a=t.y*t.y*i,u=t.z*t.z*o,l=s+a+u,h=Math.sqrt(1/l),c=db.copy(t).multiplyScalar(h);if(l<.1)return isFinite(h)?e.copy(c):null;var f,p,d,g,A,y,v,m=gb.set(c.x*n*2,c.y*i*2,c.z*o*2),_=(1-h)*t.length()/(.5*m.length()),I=0;do{I=(f=s*(A=(p=1/(1+(_-=I)*n))*p)+a*(y=(d=1/(1+_*i))*d)+u*(v=(g=1/(1+_*o))*g)-1)/(-2*(s*(A*p)*n+a*(y*d)*i+u*(v*g)*o))}while(Math.abs(f)>1e-12);return e.set(t.x*p,t.y*d,t.z*g)}}]),t}(),Eb=Math.PI,xb=Eb/2,wb=new B,Cb=new B,bb=new B,Sb=new A,Bb=0,Mb=[];function Tb(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?(Mb[Bb]||(Mb[Bb]=new B),Bb++,Mb[Bb-1]):new B}function Lb(){Bb=0}var Rb=function(t){rr(r,Ib);var e=ur(r);function r(t,n,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-xb,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:xb,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Eb,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0;return Ze(this,r),(o=e.call(this,t,n,i)).latStart=s,o.latEnd=a,o.lonStart=u,o.lonEnd=l,o.heightStart=h,o.heightEnd=c,o}return tr(r,[{key:"_getPoints",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.latStart,r=this.latEnd,n=this.lonStart,i=this.lonEnd,o=this.heightStart,s=this.heightEnd,a=K.mapLinear(.5,0,1,e,r),u=K.mapLinear(.5,0,1,n,i),l=Math.floor(n/xb)*xb,h=[[-Eb/2,0],[Eb/2,0],[0,l],[0,l+Eb/2],[0,l+Eb],[0,l+3*Eb/2],[e,i],[r,i],[e,n],[r,n],[0,n],[0,i],[a,u],[e,u],[r,u],[a,n],[a,i]],c=[],f=h.length,p=0;p<=1;p++)for(var d=K.mapLinear(p,0,1,o,s),g=0,A=f;g<A;g++){var y=pr(h[g],2),v=y[0],m=y[1];if(v>=e&&v<=r&&m>=n&&m<=i){var _=Tb(t);c.push(_),this.getCartographicToPosition(v,m,d,_)}}return c}},{key:"getBoundingBox",value:function(t,e){Lb();var r=this.latStart,n=this.latEnd,i=this.lonStart,o=this.lonEnd;if(n-r<Eb/2){var s=K.mapLinear(.5,0,1,r,n),a=K.mapLinear(.5,0,1,i,o);this.getCartographicToNormal(s,a,bb),Cb.set(0,0,1),wb.crossVectors(Cb,bb),Cb.crossVectors(wb,bb),e.makeBasis(wb,Cb,bb)}else wb.set(1,0,0),Cb.set(0,1,0),bb.set(0,0,1),e.makeBasis(wb,Cb,bb);Sb.copy(e).invert();for(var u=this._getPoints(!0),l=0,h=u.length;l<h;l++)u[l].applyMatrix4(Sb);t.makeEmpty(),t.setFromPoints(u)}},{key:"getBoundingSphere",value:function(t,e){Lb();var r=this._getPoints(!0);t.makeEmpty(),t.setFromPoints(r,e)}}]),r}();function Nb(t){return Nb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nb(t)}function Pb(t){var e=function(t,e){if("object"!==Nb(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==Nb(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===Nb(e)?e:String(e)}function Db(t,e,r){return(e=Pb(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kb(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const Fb=1/Math.PI*180,Qb=1/180*Math.PI,Ob={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function Ub(t,{precision:e=Ob.precision}={}){return t=function(t){return Math.round(t/Ob.EPSILON)*Ob.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function Gb(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function zb(t){return function(t,e){return Hb(t,(t=>t*Qb),e)}(t)}function jb(t){return function(t,e){return Hb(t,(t=>t*Fb),e)}(t)}function Vb(t,e,r){const n=Ob.EPSILON;r&&(Ob.EPSILON=r);try{if(t===e)return!0;if(Gb(t)&&Gb(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!Vb(t[r],e[r]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):"number"==typeof t&&"number"==typeof e&&Math.abs(t-e)<=Ob.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{Ob.EPSILON=n}}function Hb(t,e,r){if(Gb(t)){const n=t;r=r||function(t){return t.clone?t.clone():new Array(t.length)}(n);for(let i=0;i<r.length&&i<n.length;++i)r[i]=e(t[i],i,r);return r}return e(t)}class qb extends(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Array)){clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+e];return this.check()}toArray(t=[],e=0){for(let r=0;r<this.ELEMENTS;++r)t[e+r]=this[r];return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Gb(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Ob)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+Ub(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!Vb(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,r){if(void 0===r)return this.lerp(this,t,e);for(let n=0;n<this.ELEMENTS;++n){const i=t[n];this[n]=i+r*(e[n]-i)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),e[r]);return this.check()}add(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]+=e[t];return this.check()}subtract(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]-=e[t];return this.check()}scale(t){if("number"==typeof t)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;else for(let e=0;e<this.ELEMENTS&&e<t.length;++e)this[e]*=t[e];return this.check()}multiplyByScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}check(){if(Ob.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),e);return this.check()}get elements(){return this}}function Yb(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function Xb(t,e,r=""){if(Ob.debug&&!function(t,e){if(t.length!==e)return!1;for(let e=0;e<t.length;++e)if(!Number.isFinite(t[e]))return!1;return!0}(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}class Wb extends qb{get x(){return this[0]}set x(t){this[0]=Yb(t)}get y(){return this[1]}set y(t){this[1]=Yb(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let r=0;r<this.ELEMENTS;++r){const n=this[r]-t[r];e+=n*n}return Yb(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return Yb(e)}normalize(){const t=this.magnitude();if(0!==t)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e[t];return this.check()}divide(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return kb(t>=0&&t<this.ELEMENTS,"index is out of range"),Yb(this[t])}setComponent(t,e){return kb(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}var Jb,Kb=1e-6,Zb="undefined"!=typeof Float32Array?Float32Array:Array;function $b(t,e,r){const n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o||1;return t[0]=(r[0]*n+r[4]*i+r[8]*o)/s,t[1]=(r[1]*n+r[5]*i+r[9]*o)/s,t[2]=(r[2]*n+r[6]*i+r[10]*o)/s,t}function tS(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function eS(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Jb=new Zb(2),Zb!=Float32Array&&(Jb[0]=0,Jb[1]=0),function(){var t=function(){var t=new Zb(3);return Zb!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}()}();const rS=[0,0,0];let nS;class iS extends Wb{static get ZERO(){return nS||(nS=new iS(0,0,0),Object.freeze(nS)),nS}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&Gb(t)?this.copy(t):(Ob.debug&&(Yb(t),Yb(e),Yb(r)),this[0]=t,this[1]=e,this[2]=r)}set(t,e,r){return this[0]=t,this[1]=e,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Ob.debug&&(Yb(t.x),Yb(t.y),Yb(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=Yb(t)}angle(t){return r=t,n=(e=this)[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2],l=Math.sqrt(n*n+i*i+o*o)*Math.sqrt(s*s+a*a+u*u),h=l&&tS(e,r)/l,Math.acos(Math.min(Math.max(h,-1),1));var e,r,n,i,o,s,a,u,l,h}cross(t){return function(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2];t[0]=i*u-o*a,t[1]=o*s-n*u,t[2]=n*a-i*s}(this,this,t),this.check()}rotateX({radians:t,origin:e=rS}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}rotateY({radians:t,origin:e=rS}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=rS}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return eS(this,this,t),this.check()}transformAsVector(t){return $b(this,this,t),this.check()}transformByMatrix3(t){return function(t,e,r){var n=e[0],i=e[1],o=e[2];t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8]}(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){const n=e[0],i=e[1];t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return function(t,e,r){var n=r[0],i=r[1],o=r[2],s=r[3],a=e[0],u=e[1],l=e[2],h=i*l-o*u,c=o*a-n*l,f=n*u-i*a,p=i*f-o*c,d=o*h-n*f,g=n*c-i*h,A=2*s;h*=A,c*=A,f*=A,p*=2,d*=2,g*=2,t[0]=a+h+p,t[1]=u+c+d,t[2]=l+f+g}(this,this,t),this.check()}}class oS extends qb{toString(){let t="[";if(Ob.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+e])}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=" ".concat(this[e])}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,r){return this[e*this.RANK+t]=Yb(r),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)e[t]=this[r+t];return e}setColumn(t,e){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)this[r+t]=e[t];return this}}function sS(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],l=e[6],h=e[7],c=e[8],f=e[9],p=e[10],d=e[11],g=e[12],A=e[13],y=e[14],v=e[15],m=r[0],_=r[1],I=r[2],E=r[3];return t[0]=m*n+_*a+I*c+E*g,t[1]=m*i+_*u+I*f+E*A,t[2]=m*o+_*l+I*p+E*y,t[3]=m*s+_*h+I*d+E*v,m=r[4],_=r[5],I=r[6],E=r[7],t[4]=m*n+_*a+I*c+E*g,t[5]=m*i+_*u+I*f+E*A,t[6]=m*o+_*l+I*p+E*y,t[7]=m*s+_*h+I*d+E*v,m=r[8],_=r[9],I=r[10],E=r[11],t[8]=m*n+_*a+I*c+E*g,t[9]=m*i+_*u+I*f+E*A,t[10]=m*o+_*l+I*p+E*y,t[11]=m*s+_*h+I*d+E*v,m=r[12],_=r[13],I=r[14],E=r[15],t[12]=m*n+_*a+I*c+E*g,t[13]=m*i+_*u+I*f+E*A,t[14]=m*o+_*l+I*p+E*y,t[15]=m*s+_*h+I*d+E*v,t}var aS=function(t,e,r,n,i){var o,s=1/Math.tan(e/2);return t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n),t};var uS,lS=function(t,e,r,n,i,o,s){var a=1/(e-r),u=1/(n-i),l=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*a,t[13]=(i+n)*u,t[14]=(s+o)*l,t[15]=1,t};!function(){var t=function(){var t=new Zb(4);return Zb!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}(),function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"}(uS||(uS={}));const hS=45*Math.PI/180,cS=1,fS=.1,pS=500,dS=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class gS extends oS{static get IDENTITY(){return function(){yS||(yS=new gS,Object.freeze(yS));return yS}()}static get ZERO(){return function(){AS||(AS=new gS([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(AS));return AS}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return uS}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=o,this[6]=s,this[7]=a,this[8]=u,this[9]=l,this[10]=h,this[11]=c,this[12]=f,this[13]=p,this[14]=d,this[15]=g,this.check()}setRowMajor(t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g){return this[0]=t,this[1]=i,this[2]=u,this[3]=f,this[4]=e,this[5]=o,this[6]=l,this[7]=p,this[8]=r,this[9]=s,this[10]=h,this[11]=d,this[12]=n,this[13]=a,this[14]=c,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(dS)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=r+r,a=n+n,u=i+i,l=r*s,h=n*s,c=n*a,f=i*s,p=i*a,d=i*u,g=o*s,A=o*a,y=o*u;t[0]=1-c-d,t[1]=h+y,t[2]=f-A,t[3]=0,t[4]=h-y,t[5]=1-l-d,t[6]=p+g,t[7]=0,t[8]=f+A,t[9]=p-g,t[10]=1-l-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum(t){const{left:e,right:r,bottom:n,top:i,near:o=fS,far:s=pS}=t;return s===1/0?function(t,e,r,n,i,o){const s=2*o/(r-e),a=2*o/(i-n),u=(r+e)/(r-e),l=(i+n)/(i-n),h=-1,c=-1,f=-2*o;t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=u,t[9]=l,t[10]=h,t[11]=c,t[12]=0,t[13]=0,t[14]=f,t[15]=0}(this,e,r,n,i,o):function(t,e,r,n,i,o,s){var a=1/(r-e),u=1/(i-n),l=1/(o-s);t[0]=2*o*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(i+n)*u,t[10]=(s+o)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*l,t[15]=0}(this,e,r,n,i,o,s),this.check()}lookAt(t){const{eye:e,center:r=[0,0,0],up:n=[0,1,0]}=t;return function(t,e,r,n){var i,o,s,a,u,l,h,c,f,p,d=e[0],g=e[1],A=e[2],y=n[0],v=n[1],m=n[2],_=r[0],I=r[1],E=r[2];Math.abs(d-_)<Kb&&Math.abs(g-I)<Kb&&Math.abs(A-E)<Kb?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(h=d-_,c=g-I,f=A-E,i=v*(f*=p=1/Math.hypot(h,c,f))-m*(c*=p),o=m*(h*=p)-y*f,s=y*c-v*h,(p=Math.hypot(i,o,s))?(i*=p=1/p,o*=p,s*=p):(i=0,o=0,s=0),a=c*s-f*o,u=f*i-h*s,l=h*o-c*i,(p=Math.hypot(a,u,l))?(a*=p=1/p,u*=p,l*=p):(a=0,u=0,l=0),t[0]=i,t[1]=a,t[2]=h,t[3]=0,t[4]=o,t[5]=u,t[6]=c,t[7]=0,t[8]=s,t[9]=l,t[10]=f,t[11]=0,t[12]=-(i*d+o*g+s*A),t[13]=-(a*d+u*g+l*A),t[14]=-(h*d+c*g+f*A),t[15]=1)}(this,e,r,n),this.check()}ortho(t){const{left:e,right:r,bottom:n,top:i,near:o=fS,far:s=pS}=t;return lS(this,e,r,n,i,o,s),this.check()}orthographic(t){const{fovy:e=hS,aspect:r=cS,focalDistance:n=1,near:i=fS,far:o=pS}=t;vS(e);const s=e/2,a=n*Math.tan(s),u=a*r;return this.ortho({left:-u,right:u,bottom:-a,top:a,near:i,far:o})}perspective(t){const{fovy:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}=t;return vS(e),aS(this,e,r,n,i),this.check()}determinant(){return e=(t=this)[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],u=t[7],l=t[8],h=t[9],c=t[10],f=t[11],p=t[12],d=t[13],g=t[14],A=t[15],(e*s-r*o)*(c*A-f*g)-(e*a-n*o)*(h*A-f*d)+(e*u-i*o)*(h*g-c*d)+(r*a-n*s)*(l*A-f*p)-(r*u-i*s)*(l*g-c*p)+(n*u-i*a)*(l*d-h*p);var t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g,A}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const r=this.getScale(e),n=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const r=this.getScale(e),n=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*n,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*n,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],s=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=s,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],u=e[6],l=e[7],h=e[8],c=e[9],f=e[10],p=e[11],d=e[12],g=e[13],A=e[14],y=e[15],v=r*a-n*s,m=r*u-i*s,_=r*l-o*s,I=n*u-i*a,E=n*l-o*a,x=i*l-o*u,w=h*g-c*d,C=h*A-f*d,b=h*y-p*d,S=c*A-f*g,B=c*y-p*g,M=f*y-p*A,T=v*M-m*B+_*S+I*b-E*C+x*w;T&&(T=1/T,t[0]=(a*M-u*B+l*S)*T,t[1]=(i*B-n*M-o*S)*T,t[2]=(g*x-A*E+y*I)*T,t[3]=(f*E-c*x-p*I)*T,t[4]=(u*b-s*M-l*C)*T,t[5]=(r*M-i*b+o*C)*T,t[6]=(A*_-d*x-y*m)*T,t[7]=(h*x-f*_+p*m)*T,t[8]=(s*B-a*b+l*w)*T,t[9]=(n*b-r*B-o*w)*T,t[10]=(d*E-g*_+y*v)*T,t[11]=(c*_-h*E-p*v)*T,t[12]=(a*C-s*S-u*w)*T,t[13]=(r*S-n*C+i*w)*T,t[14]=(g*m-d*I-A*v)*T,t[15]=(h*I-c*m+f*v)*T)}(this,this),this.check()}multiplyLeft(t){return sS(this,t,this),this.check()}multiplyRight(t){return sS(this,this,t),this.check()}rotateX(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],s=e[5],a=e[6],u=e[7],l=e[8],h=e[9],c=e[10],f=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+l*n,t[5]=s*i+h*n,t[6]=a*i+c*n,t[7]=u*i+f*n,t[8]=l*i-o*n,t[9]=h*i-s*n,t[10]=c*i-a*n,t[11]=f*i-u*n}(this,this,t),this.check()}rotateY(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],s=e[1],a=e[2],u=e[3],l=e[8],h=e[9],c=e[10],f=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-l*n,t[1]=s*i-h*n,t[2]=a*i-c*n,t[3]=u*i-f*n,t[8]=o*n+l*i,t[9]=s*n+h*i,t[10]=a*n+c*i,t[11]=u*n+f*i}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],s=e[1],a=e[2],u=e[3],l=e[4],h=e[5],c=e[6],f=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+l*n,t[1]=s*i+h*n,t[2]=a*i+c*n,t[3]=u*i+f*n,t[4]=l*i-o*n,t[5]=h*i-s*n,t[6]=c*i-a*n,t[7]=f*i-u*n}(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return function(t,e,r,n){var i,o,s,a,u,l,h,c,f,p,d,g,A,y,v,m,_,I,E,x,w,C,b,S,B=n[0],M=n[1],T=n[2],L=Math.hypot(B,M,T);L<Kb||(B*=L=1/L,M*=L,T*=L,i=Math.sin(r),s=1-(o=Math.cos(r)),a=e[0],u=e[1],l=e[2],h=e[3],c=e[4],f=e[5],p=e[6],d=e[7],g=e[8],A=e[9],y=e[10],v=e[11],m=B*B*s+o,_=M*B*s+T*i,I=T*B*s-M*i,E=B*M*s-T*i,x=M*M*s+o,w=T*M*s+B*i,C=B*T*s+M*i,b=M*T*s-B*i,S=T*T*s+o,t[0]=a*m+c*_+g*I,t[1]=u*m+f*_+A*I,t[2]=l*m+p*_+y*I,t[3]=h*m+d*_+v*I,t[4]=a*E+c*x+g*w,t[5]=u*E+f*x+A*w,t[6]=l*E+p*x+y*w,t[7]=h*E+d*x+v*w,t[8]=a*C+c*b+g*S,t[9]=u*C+f*b+A*S,t[10]=l*C+p*b+y*S,t[11]=h*C+d*b+v*S,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return function(t,e,r){var n=r[0],i=r[1],o=r[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return function(t,e,r){var n,i,o,s,a,u,l,h,c,f,p,d,g=r[0],A=r[1],y=r[2];e===t?(t[12]=e[0]*g+e[4]*A+e[8]*y+e[12],t[13]=e[1]*g+e[5]*A+e[9]*y+e[13],t[14]=e[2]*g+e[6]*A+e[10]*y+e[14],t[15]=e[3]*g+e[7]*A+e[11]*y+e[15]):(n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],l=e[6],h=e[7],c=e[8],f=e[9],p=e[10],d=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=s,t[4]=a,t[5]=u,t[6]=l,t[7]=h,t[8]=c,t[9]=f,t[10]=p,t[11]=d,t[12]=n*g+a*A+c*y+e[12],t[13]=i*g+u*A+f*y+e[13],t[14]=o*g+l*A+p*y+e[14],t[15]=s*g+h*A+d*y+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=function(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,t}(e||[-0,-0,-0,-0],t,this),Xb(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:r}=t;let n;switch(r){case 2:n=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t}(e||[-0,-0],t,this);break;case 3:n=eS(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Xb(n,t.length),n}transformAsVector(t,e){let r;switch(t.length){case 2:r=function(t,e,r){const n=e[0],i=e[1],o=r[3]*n+r[7]*i||1;return t[0]=(r[0]*n+r[4]*i)/o,t[1]=(r[1]*n+r[5]*i)/o,t}(e||[-0,-0],t,this);break;case 3:r=$b(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Xb(r,t.length),r}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,r){return this.identity().translate([t,e,r])}}let AS,yS;function vS(t){if(t>2*Math.PI)throw Error("expected radians")}var mS=.1,_S=1e-12,IS=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;function ES(t){return t}function xS(t,e=[]){return function(t,e=[],r=ES){return"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):"x"in t?(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}(t,e,Ob._cartographicRadians?ES:zb)}function wS(t,e){return function(t,e,r=ES){return"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):"x"in e?(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}(t,e,Ob._cartographicRadians?ES:jb)}new iS;const CS=new iS,bS=new iS,SS=new iS;const BS=new iS,MS={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},TS={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},LS={east:new iS,north:new iS,up:new iS,west:new iS,south:new iS,down:new iS},RS=new iS,NS=new iS,PS=new iS;function DS(t,e,r,n,i,o){const s=MS[e]&&MS[e][r];let a,u,l;kb(s&&(!n||n===s));const h=BS.copy(i);if(Vb(h.x,0,1e-14)&&Vb(h.y,0,1e-14)){const t=Math.sign(h.z);a=RS.fromArray(TS[e]),"east"!==e&&"west"!==e&&a.scale(t),u=NS.fromArray(TS[r]),"east"!==r&&"west"!==r&&u.scale(t),l=PS.fromArray(TS[n]),"east"!==n&&"west"!==n&&l.scale(t)}else{const{up:i,east:o,north:s}=LS;o.set(-h.y,h.x,0).normalize(),t.geodeticSurfaceNormal(h,i),s.copy(i).cross(o);const{down:c,west:f,south:p}=LS;c.copy(i).scale(-1),f.copy(o).scale(-1),p.copy(s).scale(-1),a=LS[e],u=LS[r],l=LS[n]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=u.x,o[5]=u.y,o[6]=u.z,o[7]=0,o[8]=l.x,o[9]=l.y,o[10]=l.z,o[11]=0,o[12]=h.x,o[13]=h.y,o[14]=h.z,o[15]=1,o}const kS=new iS,FS=new iS,QS=new iS,OS=new iS,US=new iS,GS=new iS;class zS{constructor(t=0,e=0,r=0){Db(this,"radii",void 0),Db(this,"radiiSquared",void 0),Db(this,"radiiToTheFourth",void 0),Db(this,"oneOverRadii",void 0),Db(this,"oneOverRadiiSquared",void 0),Db(this,"minimumRadius",void 0),Db(this,"maximumRadius",void 0),Db(this,"centerToleranceSquared",mS),Db(this,"squaredXOverSquaredZ",void 0),kb(t>=0),kb(e>=0),kb(r>=0),this.radii=new iS(t,e,r),this.radiiSquared=new iS(t*t,e*e,r*r),this.radiiToTheFourth=new iS(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new iS(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new iS(0===t?0:1/(t*t),0===e?0:1/(e*e),0===r?0:1/(r*r)),this.minimumRadius=Math.min(t,e,r),this.maximumRadius=Math.max(t,e,r),0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const r=FS,n=QS,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const o=Math.sqrt(r.dot(n));return n.scale(1/o),r.scale(i),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){GS.from(t);const r=this.scaleToGeodeticSurface(GS,OS);if(!r)return;const n=this.geodeticSurfaceNormal(r,FS),i=US;i.copy(GS).subtract(r);const o=Math.atan2(n.y,n.x),s=Math.asin(n.z),a=Math.sign(tS(i,GS))*function(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}(i);return wS([o,s,a],e)}eastNorthUpToFixedFrame(t,e=new gS){return DS(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,i=new gS){return DS(this,t,e,r,n,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return kS.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=xS(t),n=r[0],i=r[1],o=Math.cos(i);return kS.set(o*Math.cos(n),o*Math.sin(n),Math.sin(i)).normalize(),kS.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return kS.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=[]){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:o}=e;CS.from(t);const s=CS.x,a=CS.y,u=CS.z,l=n.x,h=n.y,c=n.z,f=s*s*l*l,p=a*a*h*h,d=u*u*c*c,g=f+p+d,A=Math.sqrt(1/g);if(!Number.isFinite(A))return;const y=bS;if(y.copy(t).scale(A),g<o)return y.to(r);const v=i.x,m=i.y,_=i.z,I=SS;I.set(y.x*v*2,y.y*m*2,y.z*_*2);let E,x,w,C,b=(1-A)*CS.len()/(.5*I.len()),S=0;do{b-=S,E=1/(1+b*v),x=1/(1+b*m),w=1/(1+b*_);const t=E*E,e=x*x,r=w*w;C=f*t+p*e+d*r-1,S=C/(-2*(f*(t*E)*v+p*(e*x)*m+d*(r*w)*_))}while(Math.abs(C)>_S);return CS.scale([E,x,w]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){OS.from(t);const r=OS.x,n=OS.y,i=OS.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(r*r*o.x+n*n*o.y+i*i*o.z);return OS.multiplyScalar(s).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return OS.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return OS.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){kb(Vb(this.radii.x,this.radii.y,IS)),kb(this.radii.z>0),OS.from(t);const n=OS.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return OS.set(0,0,n).to(r)}}Db(zS,"WGS84",new zS(6378137,6378137,6356752.314245179));var jS=new B,VS=new B,HS=new B,qS=new B,YS=new B,XS=new B,WS=new Et,JS=new B,KS=new A,ZS=new B,$S=new B,tB=new B,eB=new g,rB=new B,nB=new B,iB=function(){function t(e,r,n,i,o){Ze(this,t),this.sphere=null,this.obb=null,this.region=null,this.regionObb=null,this.scale=null,this.threeLayer=e,this.heightOffset=r,this.xOffset=n,this.yOffset=i,this.yScale=o}return tr(t,[{key:"intersectsRay",value:function(t){var e=this.sphere,r=this.obb||this.regionObb;return!(e&&!t.intersectsSphere(e))&&!(r&&(WS.copy(t).applyMatrix4(r.inverseTransform),!WS.intersectsBox(r.box)))}},{key:"intersectRay",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.sphere,n=this.obb||this.regionObb,i=-1/0,o=-1/0;r&&t.intersectSphere(r,YS)&&(i=r.containsPoint(t.origin)?0:t.origin.distanceToSquared(YS)),n&&(WS.copy(t).applyMatrix4(n.inverseTransform),WS.intersectBox(n.box,XS)&&(o=n.box.containsPoint(WS.origin)?0:WS.origin.distanceToSquared(XS)));var s=Math.max(i,o);return s===-1/0?null:(t.at(Math.sqrt(s),e),e)}},{key:"distanceToPoint",value:function(t){var e=this.sphere,r=this.obb||this.regionObb,n=-1/0,i=-1/0;return e&&(n=Math.max(e.distanceToPoint(t),0)),r&&(qS.copy(t).applyMatrix4(r.inverseTransform),i=r.box.distanceToPoint(qS)),n>i?n:i}},{key:"intersectsFrustum",value:function(t){var e=this.obb||this.regionObb,r=this.sphere;return!(r&&!t.intersectsSphere(r))&&(!(e&&!e.intersectsFrustum(t))&&Boolean(r||e))}},{key:"getOBB",value:function(t,e){var r=this.obb||this.regionObb;r?(t.copy(r.box),e.copy(r.transform)):(this.getAABB(t),e.identity())}},{key:"getAABB",value:function(t){if(this.sphere)this.sphere.getBoundingBox(t);else{var e=this.obb||this.regionObb;t.copy(e.box).applyMatrix4(e.transform)}}},{key:"getSphere",value:function(t){if(this.sphere)t.copy(this.sphere);else if(this.region)this.region.getBoundingSphere(t);else{var e=this.obb||this.regionObb;e.box.getBoundingSphere(t),t.applyMatrix4(e.transform)}}},{key:"setObbData",value:function(t,e,r){var n=new nb,i=new B,o=this.threeLayer.distanceToVector3(t[3],t[3]).x,s=this.threeLayer.distanceToVector3(t[4],t[4]).x,a=this.threeLayer.distanceToVector3(t[5],t[5]).x;jS.set(o,s,a);var u=this.threeLayer.distanceToVector3(t[6],t[6]).x*this.yScale,l=this.threeLayer.distanceToVector3(t[7],t[7]).x*this.yScale,h=this.threeLayer.distanceToVector3(t[8],t[8]).x*this.yScale;VS.set(u,l,h);var c=this.threeLayer.distanceToVector3(t[9],t[9]).x,f=this.threeLayer.distanceToVector3(t[10],t[10]).x,p=this.threeLayer.distanceToVector3(t[11],t[11]).x;HS.set(c,f,p),ZS.set(t[3],t[4],t[5]),$S.set(t[6],t[7],t[8]),tB.set(t[9],t[10],t[11]);var d=jS.length(),g=VS.length(),A=HS.length(),y=ZS.length(),v=$S.length(),m=tB.length();if(i.set(d/y,g/v,A/m),this.scale=i,jS.normalize(),VS.normalize(),HS.normalize(),0===d&&jS.crossVectors(VS,HS),0===g&&VS.crossVectors(jS,HS),0===A&&HS.crossVectors(jS,VS),n.transform.set(jS.x,VS.x,HS.x,t[0],jS.y,VS.y,HS.y,t[1],jS.z,VS.z,HS.z,t[2],0,0,0,1).premultiply(e),r){r.decompose(nB,eB,rB);var _=KS.makeRotationFromQuaternion(eB);n.transform.multiply(_)}var I=zS.WGS84.cartesianToCartographic([n.transform.elements[12],n.transform.elements[13],n.transform.elements[14]],JS),E=this.threeLayer.coordinateToVector3([I.x,I.y],I.z),x=this.threeLayer.distanceToVector3(E.z+this.heightOffset,E.z+this.heightOffset).x;n.transform.elements[12]=E.x+this.xOffset,n.transform.elements[13]=E.y+this.yOffset,n.transform.elements[14]=x,n.box.min.set(-d,-g,-A),n.box.max.set(d,g,A),n.update(),this.obb=n}},{key:"setSphereData",value:function(t,e,r,n,i){var o=new mt;o.center.set(t,e,r),o.radius=n,o.applyMatrix4(i),this.sphere=o}},{key:"setRegionData",value:function(t,e,r,n,i,o){var s=new Rb(fw,fw,dw,e,n,t,r,i,o),a=new nb;s.getBoundingBox(a.box,a.transform),a.update(),this.region=s,this.regionObb=a}}]),t}(),oB=Symbol("INITIAL_FRUSTUM_CULLED"),sB=new A,aB=new A,uB=new B,lB=new B,hB=new B,cB=new g,fB=new B(1,0,0),pB=new B(0,1,0);function dB(t,e){t.traverse((function(t){t.frustumCulled=t[oB]&&e}))}var gB=function(t){rr(r,Sw);var e=ur(r);function r(){var t;Ze(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];(t=e.call.apply(e,[this].concat(i))).group=new XC(ar(t)),t.cameras=[],t.cameraMap=new Map,t.cameraInfo=[],t.activeTiles=new Set,t.visibleTiles=new Set,t._autoDisableRendererCulling=!0,t.optimizeRaycast=!0,t.onLoadTileSet=null,t.onLoadModel=null,t.onDisposeModel=null,t.onTileVisibilityChange=null;var s=new wt;s.setURLModifier((function(e){return t.preprocessURL?t.preprocessURL(e):e})),t.manager=s;var a=ar(t);return t._overridenRaycast=function(t,e){a.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,t,e)},t}return tr(r,[{key:"autoDisableRendererCulling",get:function(){return this._autoDisableRendererCulling},set:function(t){this._autoDisableRendererCulling!==t&&(fr(nr(r.prototype),"_autoDisableRendererCulling",t,this,!0),this.forEachLoadedModel((function(e){dB(e,!t)})))}},{key:"getBounds",value:function(t){if(!this.root)return!1;var e=this.root.cached.boundingVolume;return!e||(e.getAABB(t),!0)}},{key:"getOrientedBounds",value:function(t,e){if(!this.root)return!1;var r=this.root.cached.boundingVolume;return!r||(r.getOBB(t,e),!0)}},{key:"getBoundingSphere",value:function(t){if(!this.root)return!1;var e=this.root.cached.boundingVolume;return!!e&&(e.getSphere(t),!0)}},{key:"forEachLoadedModel",value:function(t){this.traverse((function(e){var r=e.cached.scene;r&&t(r,e)}))}},{key:"raycast",value:function(t,e){if(this.root)if(t.firstHitOnly){var r=eb(this,this.root,t);r&&e.push(r)}else rb(this,this.root,t,e)}},{key:"hasCamera",value:function(t){return this.cameraMap.has(t)}},{key:"setCamera",value:function(t){var e=this.cameras,r=this.cameraMap;return!r.has(t)&&(r.set(t,new S),e.push(t),!0)}},{key:"setResolution",value:function(t,e,r){var n=this.cameraMap;return!!n.has(t)&&(e instanceof S?n.get(t).copy(e):n.get(t).set(e,r),!0)}},{key:"setResolutionFromRenderer",value:function(t,e){var r=this.cameraMap;if(!r.has(t))return!1;var n=r.get(t);return e.getSize(n),n.multiplyScalar(e.getPixelRatio()),!0}},{key:"deleteCamera",value:function(t){var e=this.cameras,r=this.cameraMap;if(r.has(t)){var n=e.indexOf(t);return e.splice(n,1),r.delete(t),!0}return!1}},{key:"fetchTileSet",value:function(t){for(var e,n=this,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];var a=(e=hr(nr(r.prototype),"fetchTileSet",this)).call.apply(e,[this,t].concat(o));return a.then((function(e){n.onLoadTileSet&&Promise.resolve().then((function(){n.onLoadTileSet(e,t)}))})),a}},{key:"update",value:function(){var t=this.group,e=this.cameras,n=this.cameraMap,i=this.cameraInfo;if(0!==e.length){for(;i.length>e.length;)i.pop();for(;i.length<e.length;)i.push({frustum:new Ct,isOrthographic:!1,sseDenominator:-1,position:new B,invScale:-1,pixelSize:0});aB.copy(t.matrixWorld).invert(),uB.setFromMatrixScale(aB);var o=uB.x;Math.abs(Math.max(uB.x-uB.y,uB.x-uB.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(var s=0,a=i.length;s<a;s++){var u=e[s],l=i[s],h=l.frustum,c=l.position,f=n.get(u);0!==f.width&&0!==f.height||console.warn("TilesRenderer: resolution for camera error calculation is not set.");var p=u.projectionMatrix.elements;if(l.isOrthographic=1===p[15],l.isOrthographic){var d=2/p[0],g=2/p[5];l.pixelSize=Math.max(g/f.height,d/f.width)}else l.sseDenominator=2/p[5]/f.height;l.invScale=o,sB.copy(t.matrixWorld),sB.premultiply(u.matrixWorldInverse),sB.premultiply(u.projectionMatrix),h.setFromProjectionMatrix(sB),c.set(0,0,0),c.applyMatrix4(u.matrixWorld),c.applyMatrix4(aB)}hr(nr(r.prototype),"update",this).call(this)}else console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}},{key:"preprocessNode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;hr(nr(r.prototype),"preprocessNode",this).call(this,t,e,n);var i=new A;if(t.transform)for(var o=t.transform,s=0;s<16;s++)i.elements[s]=o[s];else i.identity();n&&i.premultiply(n.cached.transform);var a=(new A).copy(i).invert(),u=new iB(this.threeLayer,this.heightOffset,this.xOffset,this.yOffset,this.yScale);"sphere"in t.boundingVolume&&u.setSphereData.apply(u,dr(t.boundingVolume.sphere).concat([i])),"box"in t.boundingVolume&&u.setObbData(t.boundingVolume.box,i,a),"region"in t.boundingVolume&&u.setRegionData.apply(u,dr(t.boundingVolume.region)),t.cached={loadIndex:0,transform:i,transformInverse:a,active:!1,inFrustum:[],boundingVolume:u,scene:null,geometry:null,material:null}}},{key:"parseTile",value:function(t,e,r){var n=this;e._loadIndex=e._loadIndex||0,e._loadIndex++;var i=e.content.uri.split(/[\\\/]/g);i.pop();var o=i.join("/"),s=this.fetchOptions,a=this.manager,u=e._loadIndex,l=null,h=this.rootTileSet.asset&&this.rootTileSet.asset.gltfUpAxis||"y",c=e.cached,f=c.transform,p=c.boundingVolume.scale,d=c.transformInverse,g=new A;switch(h.toLowerCase()){case"x":g.makeRotationAxis(pB,-Math.PI/2);break;case"y":g.makeRotationAxis(fB,Math.PI/2);break;case"z":g.identity()}var y=(Rw(t)||r).toLowerCase();switch(y){case"b3dm":var v=new TC(a);v.workingPath=o,v.fetchOptions=s,v.adjustmentTransform.copy(g),l=v.parse(t);break;case"pnts":var m=new NC(a);m.workingPath=o,m.fetchOptions=s,l=m.parse(t);break;case"i3dm":var _=new zC(a);_.workingPath=o,_.fetchOptions=s,_.adjustmentTransform.copy(g),l=_.parse(t);break;case"cmpt":var I=new VC(a);I.workingPath=o,I.fetchOptions=s,I.adjustmentTransform.copy(g),l=I.parse(t).then((function(t){return t.scene}));break;case"gltf":case"glb":var E=new qC(a);E.workingPath=o,E.fetchOptions=s,l=E.parse(t);break;default:console.warn('TilesRenderer: Content type "'.concat(y,'" not supported.')),l=Promise.resolve(null)}return l.then((function(t){var r,i;if(t.isObject3D?(r=t,i=null):(r=t.scene,i=t),e._loadIndex===u){r.updateMatrix(),"glb"!==y&&"gltf"!==y||r.matrix.multiply(g),r.matrix.premultiply(f);var o=zS.WGS84.cartesianToCartographic([r.matrix.elements[12],r.matrix.elements[13],r.matrix.elements[14]],uB),s=n.threeLayer.coordinateToVector3([o.x,o.y],o.z),a=n.threeLayer.distanceToVector3(s.z+n.heightOffset,s.z+n.heightOffset).x;r.matrix.elements[12]=s.x+n.xOffset,r.matrix.elements[13]=s.y+n.yOffset,r.matrix.elements[14]=a,r.matrix.decompose(r.position,r.quaternion,r.scale),d.decompose(lB,cB,hB),r.applyQuaternion(cB),r.scale.copy(p),r.traverse((function(t){t[oB]=t.frustumCulled})),dB(r,!n.autoDisableRendererCulling),r.traverse((function(t){t.raycast=n._overridenRaycast}));var l=[],h=[],A=[];r.traverse((function(t){if(t.geometry&&h.push(t.geometry),t.material){var e=t.material;for(var r in l.push(t.material),e){var n=e[r];n&&n.isTexture&&A.push(n)}}})),c.materials=l,c.geometry=h,c.textures=A,c.scene=r,c.metadata=i,n.onLoadModel&&n.onLoadModel(r,e)}}))}},{key:"disposeTile",value:function(t){var e=t.cached;if(e.scene){for(var r=e.materials,n=e.geometry,i=e.textures,o=e.scene.parent,s=0,a=n.length;s<a;s++)n[s].dispose();for(var u=0,l=r.length;u<l;u++)r[u].dispose();for(var h=0,c=i.length;h<c;h++){i[h].dispose()}o&&o.remove(e.scene),this.onDisposeModel&&this.onDisposeModel(e.scene,t),e.scene=null,e.materials=null,e.textures=null,e.geometry=null,e.metadata=null}this.activeTiles.delete(t),this.visibleTiles.delete(t),t._loadIndex++}},{key:"setTileVisible",value:function(t,e){var r=t.cached.scene,n=this.visibleTiles,i=this.group;e?(i.add(r),n.add(t),r.updateMatrixWorld(!0)):(i.remove(r),n.delete(t)),this.onTileVisibilityChange&&this.onTileVisibilityChange(r,t,e)}},{key:"setTileActive",value:function(t,e){var r=this.activeTiles;e?r.add(t):r.delete(t)}},{key:"calculateError",value:function(t){for(var e=t.cached,r=e.inFrustum,n=this.cameras,i=this.cameraInfo,o=e.boundingVolume,s=-1/0,a=1/0,u=0,l=n.length;u<l;u++)if(r[u]){var h=i[u],c=h.invScale,f=void 0;if(h.isOrthographic){var p=h.pixelSize;f=t.geometricError/(p*c)}else{var d=o.distanceToPoint(h.position)*c,g=h.sseDenominator;f=t.geometricError/(d*g),a=Math.min(a,d)}s=Math.max(s,f)}t.__distanceFromCamera=a,t.__error=s}},{key:"tileInView",value:function(t){for(var e=t.cached,r=e.boundingVolume,n=e.inFrustum,i=this.cameraInfo,o=!1,s=0,a=i.length;s<a;s++){var u=i[s].frustum;r.intersectsFrustum(u)?(o=!0,n[s]=!0):n[s]=!1}return o}}]),r}(),AB=new B,yB=["x","y","z"],vB=function(t){rr(r,H);var e=ur(r);function r(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:40;Ze(this,r);for(var s=new l,a=[],u=0;u<3;u++){var c=yB[u],f=yB[(u+1)%3];AB.set(0,0,0);for(var p=0;p<o;p++){var d=void 0;d=2*Math.PI*p/(o-1),AB[c]=Math.sin(d),AB[f]=Math.cos(d),a.push(AB.x,AB.y,AB.z),d=2*Math.PI*(p+1)/(o-1),AB[c]=Math.sin(d),AB[f]=Math.cos(d),a.push(AB.x,AB.y,AB.z)}}return s.setAttribute("position",new h(new Float32Array(a),3)),s.computeBoundingSphere(),(n=e.call(this,s,new O({color:i,toneMapped:!1}))).sphere=t,n.type="SphereHelper",n}return tr(r,[{key:"updateMatrixWorld",value:function(t){var e=this.sphere;this.position.copy(e.center),this.scale.setScalar(e.radius),hr(nr(r.prototype),"updateMatrixWorld",this).call(this,t)}}]),r}(),mB=new B,_B=new B,IB=new B,EB=new B,xB=new B;function wB(t){for(var e=t.latStart,r=void 0===e?-Math.PI/2:e,n=t.latEnd,i=void 0===n?Math.PI/2:n,o=t.lonStart,s=void 0===o?0:o,a=t.lonEnd,u=void 0===a?2*Math.PI:a,l=t.heightStart,h=void 0===l?0:l,c=t.heightEnd,f=void 0===c?0:c,p=new St(1,1,1,32,32),d=p.attributes,g=d.normal,A=d.position,y=A.clone(),v=0,m=A.count;v<m;v++){IB.fromBufferAttribute(A,v);var _=K.mapLinear(IB.x,-.5,.5,r,i),I=K.mapLinear(IB.y,-.5,.5,s,u),E=h;t.getCartographicToNormal(_,I,mB),IB.z<0&&(E=f),t.getCartographicToPosition(_,I,E,IB),A.setXYZ.apply(A,[v].concat(dr(IB)))}p.computeVertexNormals();for(var x=0,w=y.count;x<w;x++){IB.fromBufferAttribute(y,x);var C=K.mapLinear(IB.x,-.5,.5,r,i),b=K.mapLinear(IB.y,-.5,.5,s,u);mB.fromBufferAttribute(g,x),t.getCartographicToNormal(C,b,_B),Math.abs(mB.dot(_B))>.1&&(IB.z>0&&_B.multiplyScalar(-1),g.setXYZ.apply(g,[x].concat(dr(_B))))}return p}var CB=function(t){rr(r,H);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Rb,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;return Ze(this,r),(t=e.call(this)).ellipsoidRegion=n,t.material.color.set(i),t.update(),t}return tr(r,[{key:"update",value:function(){var t=wB(this.ellipsoidRegion);this.geometry.dispose(),this.geometry=new bt(t,80)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),r}(),bB=function(t){rr(r,V);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Rb,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;return Ze(this,r),(t=e.call(this)).ellipsoidRegion=n,t.material.color.set(i),t.update(),t}return tr(r,[{key:"update",value:function(){this.geometry.dispose();var t=wB(this.ellipsoidRegion),e=this.lonStart;this.lonEnd-e>=2*Math.PI?(t.groups.splice(2,2),this.geometry=function(t){var e,r=(t=t.toNonIndexed()).groups,n=t.attributes,i=n.position,o=n.normal,s=[],a=[],u=yr(r);try{for(u.s();!(e=u.n()).done;)for(var c=e.value,f=c.start,p=c.count,d=f,g=f+p;d<g;d++)EB.fromBufferAttribute(i,d),xB.fromBufferAttribute(o,d),a.push.apply(a,dr(EB)),s.push.apply(s,dr(xB))}catch(t){u.e(t)}finally{u.f()}var A=new l;return A.setAttribute("position",new h(new Float32Array(a),3)),A.setAttribute("normal",new h(new Float32Array(s),3)),A}(t)):this.geometry=t}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),r}(),SB=Symbol("ORIGINAL_MATERIAL"),BB=Symbol("HAS_RANDOM_COLOR"),MB=Symbol("HAS_RANDOM_NODE_COLOR"),TB=Symbol("LOAD_TIME");function LB(){}var RB=0,NB=1,PB=2,DB=3,kB=4,FB=5,QB=6,OB=7,UB=8,GB=9,zB=10,jB=new mt,VB=function(t){rr(r,gB);var e=ur(r);function r(){var t;Ze(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];var s=(t=e.call.apply(e,[this].concat(i))).group,a=new W;a.name="DebugTilesRenderer.boxGroup",s.add(a);var u=new W;u.name="DebugTilesRenderer.sphereGroup",s.add(u);var l=new W;return l.name="DebugTilesRenderer.regionGroup",s.add(l),t.displayBoxBounds=!1,t.displaySphereBounds=!1,t.displayRegionBounds=!1,t.colorMode=0,t.customColorCallback=null,t.boxGroup=a,t.sphereGroup=u,t.regionGroup=l,t.maxDebugDepth=-1,t.maxDebugDistance=-1,t.maxDebugError=-1,t.getDebugColor=function(t,e){e.setRGB(t,t,t)},t.extremeDebugDepth=-1,t.extremeDebugError=-1,t}return tr(r,[{key:"initExtremes",value:function(){var t=-1;this.traverse((function(e){t=Math.max(t,e.__depth)}));var e=-1;this.traverse((function(t){e=Math.max(e,t.geometricError)})),this.extremeDebugDepth=t,this.extremeDebugError=e}},{key:"fetchTileSet",value:function(){for(var t,e=this,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];var s=(t=hr(nr(r.prototype),"fetchTileSet",this)).call.apply(t,[this].concat(i));return s.then((function(){Promise.resolve().then((function(){e.initExtremes()}))})).catch((function(){})),s}},{key:"getTileInformationFromActiveObject",value:function(t){var e=null;return this.activeTiles.forEach((function(r){if(e)return!0;var n=r.cached.scene;n&&n.traverse((function(n){n===t&&(e=r)}))})),e?{distanceToCamera:e.__distanceFromCamera,geometricError:e.geometricError,screenSpaceError:e.__error,depth:e.__depth,isLeaf:e.__isLeaf}:null}},{key:"update",value:function(){var t=this;if(hr(nr(r.prototype),"update",this).call(this),this.root){this.boxGroup.visible=this.displayBoxBounds,this.sphereGroup.visible=this.displaySphereBounds,this.regionGroup.visible=this.displayRegionBounds;var e=-1;e=-1===this.maxDebugDepth?this.extremeDebugDepth:this.maxDebugDepth;var n=-1;n=-1===this.maxDebugError?this.extremeDebugError:this.maxDebugError;var i=-1;-1===this.maxDebugDistance?(this.root.cached.boundingVolume.getSphere(jB),i=jB.radius):i=this.maxDebugDistance;var o,s=this.errorTarget,a=this.colorMode,u=this.visibleTiles;10===a&&(o=Array.from(u).sort((function(t,e){return t[TB]-e[TB]}))),u.forEach((function(r){var u,l,h,c=r.cached.scene;7===a&&(u=Math.random(),l=.5+.5*Math.random(),h=.375+.25*Math.random()),c.traverse((function(c){8===a&&(u=Math.random(),l=.5+.5*Math.random(),h=.375+.25*Math.random());var f=c.material;if(f){var p=c[SB];if(0===a&&f!==p)c.material.dispose(),c.material=c[SB];else if(0!==a&&f===p)if(c.isPoints){var d=new F;d.size=p.size,d.sizeAttenuation=p.sizeAttenuation,c.material=d}else c.material=new U,c.material.flatShading=!0;switch(7!==a&&delete c.material[BB],8!==a&&delete c.material[MB],a){case 4:var g=r.__depth/e;t.getDebugColor(g,c.material.color);break;case 5:var A=r.__depthFromRenderedParent/e;t.getDebugColor(A,c.material.color);break;case 1:var y=r.__error/s;y>1?c.material.color.setRGB(1,0,0):t.getDebugColor(y,c.material.color);break;case 2:var v=Math.min(r.geometricError/n,1);t.getDebugColor(v,c.material.color);break;case 3:var m=Math.min(r.__distanceFromCamera/i,1);t.getDebugColor(m,c.material.color);break;case 6:r.children&&0!==r.children.length?t.getDebugColor(0,c.material.color):t.getDebugColor(1,c.material.color);break;case 8:c.material[MB]||(c.material.color.setHSL(u,l,h),c.material[MB]=!0);break;case 7:c.material[BB]||(c.material.color.setHSL(u,l,h),c.material[BB]=!0);break;case 9:t.customColorCallback?t.customColorCallback(r,c):console.warn("DebugTilesRenderer: customColorCallback not defined");break;case 10:var _=o.indexOf(r);t.getDebugColor(_/(o.length-1),c.material.color)}}}))}))}}},{key:"parseTile",value:function(t,e,n){var i=this;return hr(nr(r.prototype),"parseTile",this).call(this,t,e,n).then((function(){var t=e.cached,r=t.scene;if(r){var n=t.boundingVolume,o=n.sphere,s=n.obb,a=n.region;if(s){var u=new W;u.name="DebugTilesRenderer.boxHelperGroup",u.matrix.copy(s.transform),u.matrixAutoUpdate=!1;var l=new Bt(s.box,nw(e.__depth));l.raycast=LB,u.add(l),t.boxHelperGroup=u,i.visibleTiles.has(e)&&i.displayBoxBounds&&(i.boxGroup.add(u),u.updateMatrixWorld(!0))}if(o){var h=new vB(o,nw(e.__depth));h.raycast=LB,t.sphereHelper=h,i.visibleTiles.has(e)&&i.displaySphereBounds&&(i.sphereGroup.add(h),h.updateMatrixWorld(!0))}if(a){var c,f=new CB(a,nw(e.__depth));f.raycast=LB;var p=new mt;a.getBoundingSphere(p),f.position.copy(p.center),p.center.multiplyScalar(-1),(c=f.geometry).translate.apply(c,dr(p.center)),t.regionHelper=f,i.visibleTiles.has(e)&&i.displayRegionBounds&&(i.regionGroup.add(f),f.updateMatrixWorld(!0))}r.traverse((function(t){var e=t.material;e&&(t[SB]=e)}))}}))}},{key:"setTileVisible",value:function(t,e){hr(nr(r.prototype),"setTileVisible",this).call(this,t,e);var n=t.cached,i=this.sphereGroup,o=this.boxGroup,s=this.regionGroup,a=n.boxHelperGroup,u=n.sphereHelper,l=n.regionHelper;e?(a&&(o.add(a),a.updateMatrixWorld(!0)),u&&(i.add(u),u.updateMatrixWorld(!0)),l&&(s.add(l),l.updateMatrixWorld(!0))):(a&&o.remove(a),u&&i.remove(u),l&&s.remove(l))}},{key:"disposeTile",value:function(t){hr(nr(r.prototype),"disposeTile",this).call(this,t);var e=t.cached;e.boxHelperGroup&&(e.boxHelperGroup.children[0].geometry.dispose(),delete e.boxHelperGroup),e.sphereHelper&&(e.sphereHelper.geometry.dispose(),delete e.sphereHelper)}}]),r}(),HB=new Ib(fw,fw,dw),qB=function(){function t(){Ze(this,t),this.creditsCount={}}return tr(t,[{key:"_adjustCredits",value:function(t,e){for(var r=this.creditsCount,n=t.split(/;/g),i=0,o=n.length;i<o;i++){var s=n[i];s in r||(r[s]=0),r[s]+=e?1:-1,r[s]<=0&&delete r[s]}}},{key:"addCredits",value:function(t){this._adjustCredits(t,!0)}},{key:"removeCredits",value:function(t){this._adjustCredits(t,!1)}},{key:"toString",value:function(){return Object.keys(this.creditsCount).sort().join(", ")}}]),t}(),YB="".concat("https://tile.googleapis.com","/v1/3dtiles/root.json"),XB=new A,WB=new Mt,JB=function(t){return function(t){rr(r,t);var e=ur(r);function r(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:YB;return Ze(this,r),(n=e.call(this,new URL("".concat(i,"?key=").concat(t)).toString()))._credits=new qB,n.fetchOptions.mode="cors",n.parseQueue.maxJobs=10,n.downloadQueue.maxJobs=30,n.lruCache.minSize=3e3,n.lruCache.maxSize=5e3,n.errorTarget=20,n.onLoadTileSet=function(e){var r;n.traverse((function(t){return!(!t.content||!t.content.uri)&&(r=new URL(t.content.uri).searchParams.get("session"),!0)})),n.preprocessURL=function(e){return e=new URL(e),/^http/.test(e.protocol)&&(e.searchParams.append("session",r),e.searchParams.append("key",t)),e.toString()},n.onLoadTileSet=null},n.onTileVisibilityChange=function(t,e,r){var i=e.cached.metadata.asset.copyright||"";r?n._credits.addCredits(i):n._credits.removeCredits(i)},n}return tr(r,[{key:"ellipsoid",get:function(){return HB}},{key:"getCreditsString",value:function(){return this._credits.toString()}},{key:"setLatLonToYUp",value:function(t,e){var r=this.ellipsoid,n=this.group;WB.set(Math.PI/2,Math.PI/2,0),XB.makeRotationFromEuler(WB),r.constructLatLonFrame(t,e,n.matrix).multiply(XB).invert().decompose(n.position,n.quaternion,n.scale)}}]),r}(t)},KB=JB(gB),ZB=JB(VB),$B=function(t){return function(t){rr(r,t);var e=ur(r);function r(t,n){var i;return Ze(this,r),(i=e.call(this))._tokenState=0,i._ionAccessToken=n,i._ionAssetId=t,i._tileSetVersion=-1,i.preprocessURL=function(t){return t=new URL(t),/^http/.test(t.protocol)&&-1!=i._tileSetVersion&&t.searchParams.append("v",i._tileSetVersion),t.toString()},i}return tr(r,[{key:"update",value:function(){var t=this,e=this._tokenState;if(0===e){this._tokenState=1;var n=new URL("https://api.cesium.com/v1/assets/".concat(this._ionAssetId,"/endpoint"));n.searchParams.append("access_token",this._ionAccessToken),fetch(n,{mode:"cors"}).then((function(t){return t.ok?t.json():Promise.reject("".concat(t.status," : ").concat(t.statusText))})).then((function(e){t._tokenState=2;var r=new URL(e.url);t._tileSetVersion=r.searchParams.get("v"),t.rootURL=r,t.fetchOptions.headers=t.fetchOptions.headers||{},t.fetchOptions.headers.Authorization="Bearer ".concat(e.accessToken)})).catch((function(){t._tokenState=3}))}else 2===e&&hr(nr(r.prototype),"update",this).call(this)}}]),r}(t)},tM=$B(gB),eM=$B(VB),rM=new WeakMap,nM=function(t){rr(r,m);var e=ur(r);function r(t){var n;return Ze(this,r),(n=e.call(this,t)).decoderPath="",n.decoderConfig={},n.decoderBinary=null,n.decoderPending=null,n.workerLimit=4,n.workerPool=[],n.workerNextTaskID=1,n.workerSourceURL="",n.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},n.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},n}return tr(r,[{key:"setDecoderPath",value:function(t){return this.decoderPath=t,this}},{key:"setDecoderConfig",value:function(t){return this.decoderConfig=t,this}},{key:"setWorkerLimit",value:function(t){return this.workerLimit=t,this}},{key:"load",value:function(t,e,r,n){var i=this,o=new v(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){i.parse(t,e,n)}),r,n)}},{key:"parse",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};this.decodeDracoFile(t,e,null,null,C).catch(r)}},{key:"decodeDracoFile",value:function(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:_,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:function(){},s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:i};return this.decodeGeometry(t,s).then(e).catch(o)}},{key:"decodeGeometry",value:function(t,e){var r,n=this,i=JSON.stringify(e);if(rM.has(t)){var o=rM.get(t);if(o.key===i)return o.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,a=t.byteLength,u=this._getWorker(s,a).then((function(n){return r=n,new Promise((function(n,i){r._callbacks[s]={resolve:n,reject:i},r.postMessage({type:"decode",id:s,taskConfig:e,buffer:t},[t])}))})).then((function(t){return n._createGeometry(t.geometry)}));return u.catch((function(){return!0})).then((function(){r&&s&&n._releaseTask(r,s)})),rM.set(t,{key:i,promise:u}),u}},{key:"_createGeometry",value:function(t){var e=new l;t.index&&e.setIndex(new h(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var n=t.attributes[r],i=n.name,o=n.array,s=n.itemSize,a=new h(o,s);"color"===i&&(this._assignVertexColorSpace(a,n.vertexColorSpace),a.normalized=o instanceof Float32Array==!1),e.setAttribute(i,a)}return e}},{key:"_assignVertexColorSpace",value:function(t,e){if(e===C)for(var r=new d,n=0,i=t.count;n<i;n++)r.fromBufferAttribute(t,n).convertSRGBToLinear(),t.setXYZ(n,r.r,r.g,r.b)}},{key:"_loadLibrary",value:function(t,e){var r=new v(this.manager);return r.setPath(this.decoderPath),r.setResponseType(e),r.setWithCredentials(this.withCredentials),new Promise((function(e,n){r.load(t,e,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var t=this;if(this.decoderPending)return this.decoderPending;var e="object"!==("undefined"==typeof WebAssembly?"undefined":We(WebAssembly))||"js"===this.decoderConfig.type,r=[];return e?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];e||(t.decoderConfig.wasmBinary=r[1]);var i=iM.toString(),o=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}},{key:"_getWorker",value:function(t,e){var r=this;return this._initDecoder().then((function(){if(r.workerPool.length<r.workerLimit){var n=new Worker(r.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(t){var e=t.data;switch(e.type){case"decode":n._callbacks[e.id].resolve(e);break;case"error":n._callbacks[e.id].reject(e);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+e.type+'"')}},r.workerPool.push(n)}else r.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));var i=r.workerPool[r.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i}))}},{key:"_releaseTask",value:function(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(t){return t._taskLoad})))}},{key:"dispose",value:function(){for(var t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}]),r}();function iM(){var t,e;function r(t,e,r,n,i,o){var s=o.num_components(),a=r.num_points()*s,u=a*i.BYTES_PER_ELEMENT,l=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,i),h=t._malloc(u);e.GetAttributeDataArrayForAllPoints(r,o,l,u,h);var c=new i(t.HEAPF32.buffer,h,a).slice();return t._free(h),{name:n,array:c,itemSize:s}}onmessage=function(n){var i=n.data;switch(i.type){case"init":t=i.decoderConfig,e=new Promise((function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)}));break;case"decode":var o=i.buffer,s=i.taskConfig;e.then((function(t){var e=t.draco,n=new e.Decoder;try{var a=function(t,e,n,i){var o,s,a=i.attributeIDs,u=i.attributeTypes,l=e.GetEncodedGeometryType(n);if(l===t.TRIANGULAR_MESH)o=new t.Mesh,s=e.DecodeArrayToMesh(n,n.byteLength,o);else{if(l!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new t.PointCloud,s=e.DecodeArrayToPointCloud(n,n.byteLength,o)}if(!s.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+s.error_msg());var h={index:null,attributes:[]};for(var c in a){var f=self[u[c]],p=void 0,d=void 0;if(i.useUniqueIDs)d=a[c],p=e.GetAttributeByUniqueId(o,d);else{if(-1===(d=e.GetAttributeId(o,t[a[c]])))continue;p=e.GetAttribute(o,d)}var g=r(t,e,o,c,f,p);"color"===c&&(g.vertexColorSpace=i.vertexColorSpace),h.attributes.push(g)}l===t.TRIANGULAR_MESH&&(h.index=function(t,e,r){var n=r.num_faces(),i=3*n,o=4*i,s=t._malloc(o);e.GetTrianglesUInt32Array(r,o,s);var a=new Uint32Array(t.HEAPF32.buffer,s,i).slice();return t._free(s),{array:a,itemSize:1}}(t,e,o));return t.destroy(o),h}(e,n,new Int8Array(o),s),u=a.attributes.map((function(t){return t.array.buffer}));a.index&&u.push(a.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:a},u)}catch(t){console.error(t),self.postMessage({type:"error",id:i.id,error:t.message})}finally{e.destroy(n)}}))}}}var oM,sM,aM,uM=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;Ze(this,t),this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return tr(t,[{key:"_initWorker",value:function(t){if(!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}},{key:"_getIdleWorker",value:function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}},{key:"_onMessage",value:function(t,e){var r=this.workersResolve[t];if(r&&r(e),this.queue.length){var n=this.queue.shift(),i=n.resolve,o=n.msg,s=n.transfer;this.workersResolve[t]=i,this.workers[t].postMessage(o,s)}else this.workerStatus^=1<<t}},{key:"setWorkerCreator",value:function(t){this.workerCreator=t}},{key:"setWorkerLimit",value:function(t){this.pool=t}},{key:"postMessage",value:function(t,e){var r=this;return new Promise((function(n){var i=r._getIdleWorker();-1!==i?(r._initWorker(i),r.workerStatus|=1<<i,r.workersResolve[i]=n,r.workers[i].postMessage(t,e)):r.queue.push({resolve:n,msg:t,transfer:e})}))}},{key:"dispose",value:function(){this.workers.forEach((function(t){return t.terminate()})),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}]),t}(),lM=0,hM=2,cM=2,fM=0,pM=1,dM=10,gM=tr((function t(){Ze(this,t),this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null})),AM=function(){function t(e,r,n,i){Ze(this,t),this._dataView=new DataView(e.buffer,e.byteOffset+r,n),this._littleEndian=i,this._offset=0}return tr(t,[{key:"_nextUint8",value:function(){var t=this._dataView.getUint8(this._offset);return this._offset+=1,t}},{key:"_nextUint16",value:function(){var t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}},{key:"_nextUint32",value:function(){var t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}},{key:"_nextUint64",value:function(){var t=this._dataView.getUint32(this._offset,this._littleEndian)+Math.pow(2,32)*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}},{key:"_nextInt32",value:function(){var t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}},{key:"_skip",value:function(t){return this._offset+=t,this}},{key:"_scan",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this._offset,n=0;this._dataView.getUint8(this._offset)!==e&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}]),t}(),yM=[171,75,84,88,32,50,48,187,13,10,26,10];function vM(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")}function mM(t){var e=new Uint8Array(t.buffer,t.byteOffset,yM.length);if(e[0]!==yM[0]||e[1]!==yM[1]||e[2]!==yM[2]||e[3]!==yM[3]||e[4]!==yM[4]||e[5]!==yM[5]||e[6]!==yM[6]||e[7]!==yM[7]||e[8]!==yM[8]||e[9]!==yM[9]||e[10]!==yM[10]||e[11]!==yM[11])throw new Error("Missing KTX 2.0 identifier.");var r=new gM,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new AM(t,yM.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();var o=i._nextUint32();r.supercompressionScheme=i._nextUint32();for(var s=i._nextUint32(),a=i._nextUint32(),u=i._nextUint32(),l=i._nextUint32(),h=i._nextUint64(),c=i._nextUint64(),f=new AM(t,yM.length+n,3*o*8,!0),p=0;p<o;p++)r.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+f._nextUint64(),f._nextUint64()),uncompressedByteLength:f._nextUint64()});for(var d=new AM(t,s,a,!0),g={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},A=(g.descriptorBlockSize/4-6)/4,y=0;y<A;y++){var v={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelType:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&v.channelType?(v.sampleLower=d._nextInt32(),v.sampleUpper=d._nextInt32()):(v.sampleLower=d._nextUint32(),v.sampleUpper=d._nextUint32()),g.samples[y]=v}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(g);for(var m=new AM(t,u,l,!0);m._offset<l;){var _=m._nextUint32(),I=m._scan(_),E=vM(I),x=m._scan(_-I.byteLength);r.keyValue[E]=E.match(/^ktx/i)?vM(x):x,m._offset%4&&m._skip(4-m._offset%4)}if(c<=0)return r;for(var w=new AM(t,h,c,!0),C=w._nextUint16(),b=w._nextUint16(),S=w._nextUint32(),B=w._nextUint32(),M=w._nextUint32(),T=w._nextUint32(),L=[],R=0;R<o;R++)L.push({imageFlags:w._nextUint32(),rgbSliceByteOffset:w._nextUint32(),rgbSliceByteLength:w._nextUint32(),alphaSliceByteOffset:w._nextUint32(),alphaSliceByteLength:w._nextUint32()});var N=h+w._offset,P=N+S,D=P+B,k=D+M,F=new Uint8Array(t.buffer,t.byteOffset+N,S),Q=new Uint8Array(t.buffer,t.byteOffset+P,B),O=new Uint8Array(t.buffer,t.byteOffset+D,M),U=new Uint8Array(t.buffer,t.byteOffset+k,T);return r.globalData={endpointCount:C,selectorCount:b,imageDescs:L,endpointsData:F,selectorsData:Q,tablesData:O,extendedData:U},r}var _M,IM,EM,xM={env:{emscripten_notify_memory_growth:function(t){aM=new Uint8Array(sM.exports.memory.buffer)}}},wM=function(){function t(){Ze(this,t)}return tr(t,[{key:"init",value:function(){return oM||(oM="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+CM).then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.instantiate(t,xM)})).then(this._init):WebAssembly.instantiate(Buffer.from(CM,"base64"),xM).then(this._init))}},{key:"_init",value:function(t){sM=t.instance,xM.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!sM)throw new Error("ZSTDDecoder: Await .init() before decoding.");var r=t.byteLength,n=sM.exports.malloc(r);aM.set(t,n),e=e||Number(sM.exports.ZSTD_findDecompressedSize(n,r));var i=sM.exports.malloc(e),o=sM.exports.ZSTD_decompress(i,e,n,r),s=aM.slice(i,i+o);return sM.exports.free(n),sM.exports.free(i),s}}]),t}(),CM="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",bM=new WeakMap,SM=0,BM=function(t){rr(n,m);var e,r=ur(n);function n(t){var e;return Ze(this,n),(e=r.call(this,t)).transcoderPath="",e.transcoderBinary=null,e.transcoderPending=null,e.workerPool=new uM,e.workerSourceURL="",e.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'),e}return tr(n,[{key:"setTranscoderPath",value:function(t){return this.transcoderPath=t,this}},{key:"setWorkerLimit",value:function(t){return this.workerPool.setWorkerLimit(t),this}},{key:"detectSupport",value:function(t){return!0===t.isWebGPURenderer?this.workerConfig={astcSupported:t.hasFeature("texture-compression-astc"),etc1Supported:!1,etc2Supported:t.hasFeature("texture-compression-etc2"),dxtSupported:t.hasFeature("texture-compression-bc"),bptcSupported:!1,pvrtcSupported:!1}:(this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},t.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1)),this}},{key:"init",value:function(){var t=this;if(!this.transcoderPending){var e=new v(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);var r=e.loadAsync("basis_transcoder.js"),i=new v(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);var o=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([r,o]).then((function(e){var r=pr(e,2),i=r[0],o=r[1],s=n.BasisWorker.toString(),a=["/* constants */","let _EngineFormat = "+JSON.stringify(n.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(n.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(n.BasisFormat),"/* basis_transcoder.js */",i,"/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([a])),t.transcoderBinary=o,t.workerPool.setWorkerCreator((function(){var e=new Worker(t.workerSourceURL),r=t.transcoderBinary.slice(0);return e.postMessage({type:"init",config:t.workerConfig,transcoderBinary:r},[r]),e}))})),SM>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),SM++}return this.transcoderPending}},{key:"load",value:function(t,e,r,n){var i=this;if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");var o=new v(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){if(bM.has(t))return bM.get(t).promise.then(e).catch(n);i._createTexture(t).then((function(t){return e?e(t):null})).catch(n)}),r,n)}},{key:"_createTextureFrom",value:function(t,e){var r,n=t.faces,i=t.width,o=t.height,s=t.format,a=t.type,u=t.error,l=t.dfdFlags;if("error"===a)return Promise.reject(u);if(6===e.faceCount)r=new Ft(n,s,kt);else{var h=n[0].mipmaps;r=e.layerCount>1?new Qt(h,i,o,e.layerCount,s,kt):new Ot(h,i,o,s,kt)}return r.minFilter=1===n[0].mipmaps.length?P:D,r.magFilter=P,r.generateMipmaps=!1,r.needsUpdate=!0,r.colorSpace=PM(e),r.premultiplyAlpha=!!(1&l),r}},{key:"_createTexture",value:(e=Ke(Xe().mark((function t(e){var r,n,i,o,s=this,a=arguments;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=a.length>1&&void 0!==a[1]?a[1]:{},0===(n=mM(new Uint8Array(e))).vkFormat){t.next=4;break}return t.abrupt("return",RM(n));case 4:return i=r,o=this.init().then((function(){return s.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])})).then((function(t){return s._createTextureFrom(t.data,n)})),bM.set(e,{promise:o}),t.abrupt("return",o);case 8:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"dispose",value:function(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),SM--,this}}]),n}();BM.BasisFormat={ETC1S:0,UASTC_4x4:1},BM.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},BM.EngineFormat={RGBAFormat:Tt,RGBA_ASTC_4x4_Format:Ut,RGBA_BPTC_Format:Gt,RGBA_ETC2_EAC_Format:zt,RGBA_PVRTC_4BPPV1_Format:jt,RGBA_S3TC_DXT5_Format:Vt,RGB_ETC1_Format:Ht,RGB_ETC2_Format:qt,RGB_PVRTC_4BPPV1_Format:Yt,RGB_S3TC_DXT1_Format:Xt},BM.BasisWorker=function(){var t,e,r,n=_EngineFormat,i=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(s){var c,f=s.data;switch(f.type){case"init":t=f.config,c=f.transcoderBinary,e=new Promise((function(t){r={wasmBinary:c,onRuntimeInitialized:t},BASIS(r)})).then((function(){r.initializeBasis(),void 0===r.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":e.then((function(){try{var e=function(e){var s=new r.KTX2File(new Uint8Array(e));function c(){s.close(),s.delete()}if(!s.isValid())throw c(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");var f=s.isUASTC()?o.UASTC_4x4:o.ETC1S,p=s.getWidth(),d=s.getHeight(),g=s.getLayers()||1,A=s.getLevels(),y=s.getFaces(),v=s.getHasAlpha(),m=s.getDFDFlags(),_=function(e,r,s,h){for(var c,f,p=e===o.ETC1S?a:u,d=0;d<p.length;d++){var g=p[d];if(t[g.if]&&(g.basisFormat.includes(e)&&!(h&&g.transcoderFormat.length<2)&&(!g.needsPowerOfTwo||l(r)&&l(s))))return{transcoderFormat:c=g.transcoderFormat[h?1:0],engineFormat:f=g.engineFormat[h?1:0]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),c=i.RGBA32,f=n.RGBAFormat,{transcoderFormat:c,engineFormat:f}}(f,p,d,v),I=_.transcoderFormat,E=_.engineFormat;if(!p||!d||!A)throw c(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!s.startTranscoding())throw c(),new Error("THREE.KTX2Loader: .startTranscoding failed");for(var x=[],w=[],C=0;C<y;C++){for(var b=[],S=0;S<A;S++){for(var B=[],M=void 0,T=void 0,L=0;L<g;L++){var R=s.getImageLevelInfo(S,L,C);0!==C||0!==S||0!==L||R.origWidth%4==0&&R.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),A>1?(M=R.origWidth,T=R.origHeight):(M=R.width,T=R.height);var N=new Uint8Array(s.getImageTranscodedSizeInBytes(S,L,0,I));if(!s.transcodeImage(N,S,L,C,I,0,-1,-1))throw c(),new Error("THREE.KTX2Loader: .transcodeImage failed.");B.push(N)}var P=h(B);b.push({data:P,width:M,height:T}),w.push(P.buffer)}x.push({mipmaps:b,width:p,height:d,format:E})}return c(),{faces:x,buffers:w,width:p,height:d,hasAlpha:v,format:E,dfdFlags:m}}(f.buffer),s=e.faces,c=e.buffers,p=e.width,d=e.height,g=e.hasAlpha,A=e.format,y=e.dfdFlags;self.postMessage({type:"transcode",id:f.id,faces:s,width:p,height:d,hasAlpha:g,format:A,dfdFlags:y},c)}catch(t){console.error(t),self.postMessage({type:"error",id:f.id,error:t.message})}}))}}));var s=[{if:"astcSupported",basisFormat:[o.UASTC_4x4],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.BC1,i.BC3],engineFormat:[n.RGB_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.ETC1],engineFormat:[n.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],a=s.sort((function(t,e){return t.priorityETC1S-e.priorityETC1S})),u=s.sort((function(t,e){return t.priorityUASTC-e.priorityUASTC}));function l(t){return t<=2||0==(t&t-1)&&0!==t}function h(t){if(1===t.length)return t[0];for(var e=0,r=0;r<t.length;r++){e+=t[r].byteLength}for(var n=new Uint8Array(e),i=0,o=0;o<t.length;o++){var s=t[o];n.set(s,i),i+=s.byteLength}return n}};var MM=new Set([Tt,Lt,Rt]),TM=(er(_M={},109,Tt),er(_M,97,Tt),er(_M,37,Tt),er(_M,43,Tt),er(_M,103,Lt),er(_M,83,Lt),er(_M,16,Lt),er(_M,22,Lt),er(_M,100,Rt),er(_M,76,Rt),er(_M,15,Rt),er(_M,9,Rt),er(_M,166,Nt),er(_M,165,Nt),_M),LM=(er(IM={},109,Pt),er(IM,97,Dt),er(IM,37,kt),er(IM,43,kt),er(IM,103,Pt),er(IM,83,Dt),er(IM,16,kt),er(IM,22,kt),er(IM,100,Pt),er(IM,76,Dt),er(IM,15,kt),er(IM,9,kt),er(IM,166,kt),er(IM,165,kt),IM);function RM(t){return NM.apply(this,arguments)}function NM(){return NM=Ke(Xe().mark((function t(e){var r,n,i,o,s,a,u,l,h,c,f;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.vkFormat,void 0!==TM[r]){t.next=3;break}throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");case 3:if(e.supercompressionScheme!==hM){t.next=8;break}return EM||(EM=new Promise(function(){var t=Ke(Xe().mark((function t(e){var r;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new wM,t.next=3,r.init();case 3:e(r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())),t.next=7,EM;case 7:n=t.sent;case 8:i=[],o=0;case 10:if(!(o<e.levels.length)){t.next=31;break}if(s=Math.max(1,e.pixelWidth>>o),a=Math.max(1,e.pixelHeight>>o),u=e.pixelDepth?Math.max(1,e.pixelDepth>>o):0,l=e.levels[o],h=void 0,e.supercompressionScheme!==lM){t.next=20;break}h=l.levelData,t.next=25;break;case 20:if(e.supercompressionScheme!==hM){t.next=24;break}h=n.decode(l.levelData,l.uncompressedByteLength),t.next=25;break;case 24:throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");case 25:c=void 0,c=LM[r]===Pt?new Float32Array(h.buffer,h.byteOffset,h.byteLength/Float32Array.BYTES_PER_ELEMENT):LM[r]===Dt?new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT):h,i.push({data:c,width:s,height:a,depth:u});case 28:o++,t.next=10;break;case 31:if(!MM.has(TM[r])){t.next=35;break}f=0===e.pixelDepth?new Zt(i[0].data,e.pixelWidth,e.pixelHeight):new $t(i[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth),t.next=38;break;case 35:if(!(e.pixelDepth>0)){t.next=37;break}throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");case 37:f=new Ot(i,e.pixelWidth,e.pixelHeight);case 38:return f.mipmaps=i,f.type=LM[r],f.format=TM[r],f.colorSpace=PM(e),f.needsUpdate=!0,t.abrupt("return",Promise.resolve(f));case 44:case"end":return t.stop()}}),t)}))),NM.apply(this,arguments)}function PM(t){var e=t.dataFormatDescriptor[0];return e.colorPrimaries===pM?e.transferFunction===cM?C:_:e.colorPrimaries===dM?e.transferFunction===cM?Wt:Jt:(e.colorPrimaries===fM||console.warn('THREE.KTX2Loader: Unsupported color primaries, "'.concat(e.colorPrimaries,'"')),Kt)}var DM=!1,kM=!1,FM=0,QM=function(){function t(e,r,n,i){var o=this;Ze(this,t),this.threelayer=n,this.map=n.map,this.layerClass=i,this.statsUpdate=r.statsUpdate;var s=n.getScene(),a=n.getRenderer().context;1*u.REVISION<152&&(a.outputEncoding=u.sRGBEncoding);var l=n.getCamera();this.scene=s,this.renderer=a,this.camera=l,this.multiles=[],this.meshs=[],this._raycaster=new u.Raycaster,this._raycaster.firstHitOnly=!0,this._mouse=new u.Vector2;var h=new nM;h.setDecoderPath(r.decoderPath);var c=new BM;c.setTranscoderPath(r.transcoderPath),c.detectSupport(a),e.forEach((function(t){var e=new gB(t.url,n);if(e.errorTarget=t.errorTarget||6,e.maxDepth=t.maxDepth||1/0,e.displayBoxBounds=DM,e.displaySphereBounds=kM,e.colorMode=parseFloat(FM),e.heightOffset=t.heightOffset||0,e.xOffset=t.xOffset||0,e.yOffset=t.yOffset||0,e.yScale="EPSG:4326"===n.getMap().getProjection().code?t.yScale||.7945:1,e.lruCache.minSize=t.cacheMinSize||600,e.lruCache.maxSize=t.cacheMaxSize||800,e.parseQueue.maxJobs=t.parseJobs||1,e.downloadQueue.maxJobs=t.downJobs||4,e.setCamera(l),e.setResolutionFromRenderer(l,a),o.multiles.length>0){var r=o.multiles[0];e.lruCache=r.lruCache,e.downloadQueue=r.downloadQueue}e.fetchOptions.mode="cors";var i=new Pw(e.manager);i.setDRACOLoader(h),i.setKTX2Loader(c),e.manager.addHandler(/\.gltf$/,i),o.meshs.push(e.group),o.scene.add(e.group),o.multiles.push(e)})),this.layerClass.updatables.push(this)}return tr(t,[{key:"identify",value:function(t,e){var r=this.map.coordToContainerPoint(t),n=r.x,i=r.y,o=this._raycaster,s=this._mouse,a=this.camera,u=this.map.getSize(),l=u.width,h=u.height;return s.x=n/l*2-1,s.y=-i/h*2+1,o.setFromCamera(s,a),e&&e.length?o.intersectObjects(e,!0):o.intersectObjects(this.meshs,!0)}},{key:"tick",value:function(t){this.multiles.forEach((function(t){t.update()})),this.statsUpdate&&this.statsUpdate()}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"findRoot",value:function(t){for(;t.position.x<=0;)t=t.parent;return t}},{key:"selectGeometry",value:function(t,e){var r,n=this,i=(null==e?void 0:e.hidePosition)||-999,o=void 0===(null==e?void 0:e.hideGeoFlag)||(null==e?void 0:e.hideGeoFlag),s=[],a={},l=[];t.forEach((function(t){var e=t[0],r=t[1];if(e.geometry.getAttribute("_batchid")){for(var l=e;!l.batchTable;)l=l.parent;var h=n.findRoot(e);h.updateMatrix();var c=[];o&&(a[r]={object:e,values:c});for(var f=e.geometry.attributes.position.array,p=e.geometry.attributes.normal.array,d=e.geometry.index.array,g=e.geometry.attributes._batchid.array,A=[],y=[],v=[],m=-1,_=0;_<g.length;_++)g[_]===r&&(A.push(f[3*_+0]),A.push(f[3*_+1]),A.push(f[3*_+2]),y.push(p[3*_+0]),y.push(p[3*_+1]),y.push(p[3*_+2]),o&&(c.push([3*_+0,f[3*_+0]]),c.push([3*_+1,f[3*_+1]]),c.push([3*_+2,f[3*_+2]]),f[3*_+0]=i,f[3*_+1]=i,f[3*_+2]=i),-1===m&&(m=d[_]),v.push(d[_]-m));o&&(e.geometry.attributes.position.needsUpdate=!0);var I=new u.BufferGeometry;I.setAttribute("position",new u.BufferAttribute(new Float32Array(A),3)),I.setAttribute("normal",new u.BufferAttribute(new Float32Array(y),3)),I.setIndex(new u.Uint16BufferAttribute(new Uint16Array(v),1)),I.computeBoundingBox(),s.push([I,h])}})),r=null!=e&&e.material?null==e?void 0:e.material:new u.MeshBasicMaterial({color:(null==e?void 0:e.color)||"red",side:u.DoubleSide,transparent:!0,opacity:(null==e?void 0:e.opacity)||.5});var h=new u.Vector3,c=new u.Vector3,f=new u.Quaternion,p=s.length,d=new u.BatchedMesh(p,18e3*p,9e4*p,r);d.frustumCulled=!1,d.perObjectFrustumCulled=!1,null!=e&&e.data&&(d.userData.data=e.data),this.scene.add(d);var g=new u.Vector3,A=new u.Vector3,y=new u.Quaternion;return s.forEach((function(t,e){var r=d.addGeometry(t[0]);if(0===e)t[1].matrix.decompose(g,y,A),d.rotation.x=Math.PI/2,d.applyMatrix4(t[1].matrix);else{t[1].matrix.decompose(h,f,c);var n=c.x/A.x,i=c.y/A.y,o=c.z/A.z,s=n/c.x,a=i/c.y,l=o/c.z,p=h.x-g.x,v=h.y-g.y,m=h.z-g.z,_=y.angleTo(f);_>0&&console.log(_,"需要旋转的角度");var I=new u.Matrix4;I.compose(new u.Vector3(p*s,m*l,-v*a),new u.Quaternion,new u.Vector3(n,i,o)),d.setMatrixAt(r,I)}})),l.push(d),{meshs:l,hideObjects:a,material:r}}},{key:"cancelSelect",value:function(t){var e=this,r=t.meshs,n=t.hideObjects,i=t.material;r.forEach((function(t){e.scene.remove(t),t.geometry&&t.geometry.dispose()})),null==i||i.dispose();var o=function(){var t=n[s],e=t.object,r=t.values,i=e.geometry.attributes.position.array;r.forEach((function(t){i[t[0]]=t[1]})),e.geometry.attributes.position.needsUpdate=!0};for(var s in n)o()}},{key:"findObjectInfo",value:function(t){var e=new maptalks.Coordinate({x:t[0],y:t[1]}),r=this.identify(e);if(r.length>0&&r[0].object.material){var n=r[0],i=n.face,o=n.object,s=o.geometry.getAttribute("_batchid");if(s){for(var a=o;!a.batchTable;)a=a.parent;var l=a.batchTable,h=s.getX(i.a),c=l.getKeys(),f=this.findRoot(o);f.updateMatrix();for(var p=o.geometry.attributes.position.array,d=o.geometry.index.array,g=o.geometry.attributes._batchid.array,A=[],y=[],v=-1,m=0;m<g.length;m++)g[m]===h&&(A.push(p[3*m+0]),A.push(p[3*m+1]),A.push(p[3*m+2]),-1===v&&(v=d[m]),y.push(d[m]-v));var _=new u.BufferGeometry;_.setAttribute("position",new u.BufferAttribute(new Float32Array(A),3)),_.setIndex(new u.Uint16BufferAttribute(new Uint16Array(y),1)),_.computeBoundingBox();var I=new u.Mesh(_,new u.MeshBasicMaterial({color:"yellow",side:u.DoubleSide,transparent:!0,opacity:.5}));return I.rotation.x=Math.PI/2,I.applyMatrix4(f.matrix),this.scene.add(I),{batchData:c.map((function(t){return{key:t,value:l.getData(t)[h]}})),object:o,hoveredBatchid:h,mesh:I}}}}},{key:"cancelFindResult",value:function(t){this.scene.remove(t),t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()}},{key:"dispose",value:function(){this.threelayer.removeMesh(this.meshs),this.multiles.forEach((function(t){t.dispose()})),this.removeAnimation()}}]),t}(),OM={radius:100,altitude:0},UM=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),o=t.Util.extend({},OM,o,{layer:s,coordinate:e}),(a=r.call(this))._initOptions(o);var u=o.altitude;a._createGroup(),a.getObject3d().add(i);var l=s.distanceToVector3(u,u).x,h=s.coordinateToVector3(e,l);return a.getObject3d().position.copy(h),a}return tr(n)}(),GM=function(){function t(e,r,n){Ze(this,t),this.threeLayer=r,this.groupId=n;var i=new u.LoadingManager,o=new Pw(i),s=new nM(i);s.setDecoderPath(e),o.setDRACOLoader(s),i.addHandler(/\.gltf$/,o),i.addHandler(/\.glb$/,o),this.loader=new qC(i)}var e;return tr(t,[{key:"addModel",value:(e=Ke(Xe().mark((function t(e,r,n){var i,o,s=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loader.workingPath=this.loader.workingPathForURL(e),t.next=3,this.loader.load(e);case 3:return i=t.sent,(o=new UM([parseFloat(r.longitude),parseFloat(r.latitude)],i.scene,n,this.threeLayer)).setProperties(r),this.groupId?this.threeLayer.addMesh1(o,this.groupId):this.threeLayer.addMesh(o),this.clickFunc=n.clickFunc,this.model=o,n.zoomChange&&(this.model.zoomChange=function(){n.zoomChange(s.model)}),this._bindMapEvents(),t.abrupt("return",this);case 12:case"end":return t.stop()}}),t,this)}))),function(t,r,n){return e.apply(this,arguments)})},{key:"_bindMapEvents",value:function(){this.model&&this.model.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.model&&this.model.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){var e=t.target.getProperties();"click"===t.type&&e&&this.clickFunc&&this.clickFunc(e)}},{key:"hide",value:function(){this.model.hide()}},{key:"show",value:function(){this.model.show()}},{key:"dispose",value:function(){if(this._closeEvent(),this.model){this.groupId?this.threeLayer.removeMesh1(this.model,this.groupId):this.threeLayer.removeMesh(this.model);var t=this.model.object3d.children[0];t.traverse((function(e){"Mesh"===e.type&&(e.geometry.dispose(),e.material.dispose(),t.remove(e))}))}}}]),t}(),zM=function(t){rr(r,u.Group);var e=ur(r);function r(t,n){var i;return Ze(this,r),(i=e.call(this)).name=n,i.customId=ZE(),t.add(ar(i)),i.customType="layer",i}return tr(r)}(),jM=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};try{URL.revokeObjectURL(jM(""))}catch(t){jM=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)}}var VM=Uint8Array,HM=Uint16Array,qM=Uint32Array,YM=new VM([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),XM=new VM([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),WM=new VM([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),JM=function(t,e){for(var r=new HM(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];var i=new qM(r[30]);for(n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},KM=JM(YM,2),ZM=KM[0],$M=KM[1];ZM[28]=258,$M[258]=28;for(var tT=JM(XM,0)[0],eT=new HM(32768),rT=0;rT<32768;++rT){var nT=(43690&rT)>>>1|(21845&rT)<<1;nT=(61680&(nT=(52428&nT)>>>2|(13107&nT)<<2))>>>4|(3855&nT)<<4,eT[rT]=((65280&nT)>>>8|(255&nT)<<8)>>>1}var iT=function(t,e,r){for(var n=t.length,i=0,o=new HM(e);i<n;++i)++o[t[i]-1];var s,a=new HM(e);for(i=0;i<e;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){s=new HM(1<<e);var u=15-e;for(i=0;i<n;++i)if(t[i])for(var l=i<<4|t[i],h=e-t[i],c=a[t[i]-1]++<<h,f=c|(1<<h)-1;c<=f;++c)s[eT[c]>>>u]=l}else for(s=new HM(n),i=0;i<n;++i)t[i]&&(s[i]=eT[a[t[i]-1]++]>>>15-t[i]);return s},oT=new VM(288);for(rT=0;rT<144;++rT)oT[rT]=8;for(rT=144;rT<256;++rT)oT[rT]=9;for(rT=256;rT<280;++rT)oT[rT]=7;for(rT=280;rT<288;++rT)oT[rT]=8;var sT=new VM(32);for(rT=0;rT<32;++rT)sT[rT]=5;var aT=iT(oT,9,1),uT=iT(sT,5,1),lT=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},hT=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&r},cT=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&e)},fT=function(t){return(t/8|0)+(7&t&&1)},pT=function(t,e,r){var n=t.length;if(!n||r&&!r.l&&n<5)return e||new VM(0);var i=!e||r,o=!r||r.i;r||(r={}),e||(e=new VM(3*n));var s=function(t){var r=e.length;if(t>r){var n=new VM(Math.max(2*r,t));n.set(e),e=n}},a=r.f||0,u=r.p||0,l=r.b||0,h=r.l,c=r.d,f=r.m,p=r.n,d=8*n;do{if(!h){r.f=a=hT(t,u,1);var g=hT(t,u+1,3);if(u+=3,!g){var A=t[(S=fT(u)+4)-4]|t[S-3]<<8,y=S+A;if(y>n){if(o)throw"unexpected EOF";break}i&&s(l+A),e.set(t.subarray(S,y),l),r.b=l+=A,r.p=u=8*y;continue}if(1==g)h=aT,c=uT,f=9,p=5;else{if(2!=g)throw"invalid block type";var v=hT(t,u,31)+257,m=hT(t,u+10,15)+4,_=v+hT(t,u+5,31)+1;u+=14;for(var I=new VM(_),E=new VM(19),x=0;x<m;++x)E[WM[x]]=hT(t,u+3*x,7);u+=3*m;var w=lT(E),C=(1<<w)-1,b=iT(E,w,1);for(x=0;x<_;){var S,B=b[hT(t,u,C)];if(u+=15&B,(S=B>>>4)<16)I[x++]=S;else{var M=0,T=0;for(16==S?(T=3+hT(t,u,3),u+=2,M=I[x-1]):17==S?(T=3+hT(t,u,7),u+=3):18==S&&(T=11+hT(t,u,127),u+=7);T--;)I[x++]=M}}var L=I.subarray(0,v),R=I.subarray(v);f=lT(L),p=lT(R),h=iT(L,f,1),c=iT(R,p,1)}if(u>d){if(o)throw"unexpected EOF";break}}i&&s(l+131072);for(var N=(1<<f)-1,P=(1<<p)-1,D=u;;D=u){var k=(M=h[cT(t,u)&N])>>>4;if((u+=15&M)>d){if(o)throw"unexpected EOF";break}if(!M)throw"invalid length/literal";if(k<256)e[l++]=k;else{if(256==k){D=u,h=null;break}var F=k-254;if(k>264){var Q=YM[x=k-257];F=hT(t,u,(1<<Q)-1)+ZM[x],u+=Q}var O=c[cT(t,u)&P],U=O>>>4;if(!O)throw"invalid distance";u+=15&O;R=tT[U];if(U>3){Q=XM[U];R+=cT(t,u)&(1<<Q)-1,u+=Q}if(u>d){if(o)throw"unexpected EOF";break}i&&s(l+131072);for(var G=l+F;l<G;l+=4)e[l]=e[l-R],e[l+1]=e[l+1-R],e[l+2]=e[l+2-R],e[l+3]=e[l+3-R];l=G}}r.l=h,r.p=D,r.b=l,h&&(a=1,r.m=f,r.d=c,r.n=p)}while(!a);return l==e.length?e:function(t,e,r){(null==e||e<0)&&(e=0),(null==r||r>t.length)&&(r=t.length);var n=new(t instanceof HM?HM:t instanceof qM?qM:VM)(r-e);return n.set(t.subarray(e,r)),n}(e,0,l)},dT=new VM(0);var gT="undefined"!=typeof TextDecoder&&new TextDecoder;try{gT.decode(dT,{stream:!0}),1}catch(t){}function AT(t,e,r){var n=r.length-t-1;if(e>=r[n])return n-1;if(e<=r[t])return t;for(var i=t,o=n,s=Math.floor((i+o)/2);e<r[s]||e>=r[s+1];)e<r[s]?o=s:i=s,s=Math.floor((i+o)/2);return s}function yT(t,e){for(var r=1,n=2;n<=t;++n)r*=n;for(var i=1,o=2;o<=e;++o)i*=o;for(var s=2;s<=t-e;++s)i*=s;return r/i}function vT(t,e,r,n,i){var o=function(t,e,r,n,i){for(var o=i<t?i:t,s=[],a=AT(t,n,e),u=function(t,e,r,n,i){for(var o=[],s=0;s<=r;++s)o[s]=0;for(var a=[],u=0;u<=n;++u)a[u]=o.slice(0);for(var l=[],h=0;h<=r;++h)l[h]=o.slice(0);l[0][0]=1;for(var c=o.slice(0),f=o.slice(0),p=1;p<=r;++p){c[p]=e-i[t+1-p],f[p]=i[t+p]-e;for(var d=0,g=0;g<p;++g){var A=f[g+1],y=c[p-g];l[p][g]=A+y;var v=l[g][p-1]/l[p][g];l[g][p]=d+A*v,d=y*v}l[p][p]=d}for(var m=0;m<=r;++m)a[0][m]=l[m][r];for(var _=0;_<=r;++_){for(var I=0,E=1,x=[],w=0;w<=r;++w)x[w]=o.slice(0);x[0][0]=1;for(var C=1;C<=n;++C){var b=0,S=_-C,B=r-C;_>=C&&(x[E][0]=x[I][0]/l[B+1][S],b=x[E][0]*l[S][B]);for(var M=_-1<=B?C-1:r-_,T=S>=-1?1:-S;T<=M;++T)x[E][T]=(x[I][T]-x[I][T-1])/l[B+1][S+T],b+=x[E][T]*l[S+T][B];_<=B&&(x[E][C]=-x[I][C-1]/l[B+1][_],b+=x[E][C]*l[_][B]),a[C][_]=b;var L=I;I=E,E=L}}for(var R=r,N=1;N<=n;++N){for(var P=0;P<=r;++P)a[N][P]*=R;R*=r-N}return a}(a,n,t,o,e),l=[],h=0;h<r.length;++h){var c=r[h].clone(),f=c.w;c.x*=f,c.y*=f,c.z*=f,l[h]=c}for(var p=0;p<=o;++p){for(var d=l[a-t].clone().multiplyScalar(u[p][0]),g=1;g<=t;++g)d.add(l[a-t+g].clone().multiplyScalar(u[p][g]));s[p]=d}for(var A=o+1;A<=i+1;++A)s[A]=new te(0,0,0);return s}(t,e,r,n,i);return function(t){for(var e=t.length,r=[],n=[],i=0;i<e;++i){var o=t[i];r[i]=new B(o.x,o.y,o.z),n[i]=o.w}for(var s=[],a=0;a<e;++a){for(var u=r[a].clone(),l=1;l<=a;++l)u.sub(s[a-l].clone().multiplyScalar(yT(a,l)*n[l]));s[a]=u.divideScalar(n[0])}return s}(o)}var mT,_T,IT,ET=function(t){rr(r,ee);var e=ur(r);function r(t,n,i,o,s){var a;Ze(this,r),(a=e.call(this)).degree=t,a.knots=n,a.controlPoints=[],a.startKnot=o||0,a.endKnot=s||a.knots.length-1;for(var u=0;u<i.length;++u){var l=i[u];a.controlPoints[u]=new te(l.x,l.y,l.z,l.w)}return a}return tr(r,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new B,r=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),n=function(t,e,r,n){for(var i=AT(t,n,e),o=function(t,e,r,n){var i=[],o=[],s=[];i[0]=1;for(var a=1;a<=r;++a){o[a]=e-n[t+1-a],s[a]=n[t+a]-e;for(var u=0,l=0;l<a;++l){var h=s[l+1],c=o[a-l],f=i[l]/(h+c);i[l]=u+h*f,u=c*f}i[a]=u}return i}(i,n,t,e),s=new te(0,0,0,0),a=0;a<=t;++a){var u=r[i-t+a],l=o[a],h=u.w*l;s.x+=u.x*h,s.y+=u.y*h,s.z+=u.z*h,s.w+=u.w*l}return s}(this.degree,this.knots,this.controlPoints,r);return 1!==n.w&&n.divideScalar(n.w),e.set(n.x,n.y,n.z)}},{key:"getTangent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new B,r=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),n=vT(this.degree,this.knots,this.controlPoints,r,1);return e.copy(n[1]).normalize(),e}}]),r}(),xT=function(t){rr(r,m);var e=ur(r);function r(t){return Ze(this,r),e.call(this,t)}return tr(r,[{key:"load",value:function(t,e,r,n){var i=this,o=""===i.path?y.extractUrlBase(t):i.path,s=new v(this.manager);s.setPath(i.path),s.setResponseType("arraybuffer"),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(t,(function(r){try{e(i.parse(r,o))}catch(e){n?n(e):console.error(e),i.manager.itemError(t)}}),r,n)}},{key:"parse",value:function(t,e){if(function(t){var e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===UT(t,0,e.length)}(t))mT=(new BT).parse(t);else{var r=UT(t);if(!function(t){var e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0;function n(e){var n=t[e-1];return t=t.slice(r+e),r++,n}for(var i=0;i<e.length;++i){if(n(1)===e[i])return!1}return!0}(r))throw new Error("THREE.FBXLoader: Unknown format.");if(LT(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+LT(r));mT=(new ST).parse(r)}var n=new ft(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new wT(n,this.manager).parse(mT)}}]),r}(),wT=function(){function t(e,r){Ze(this,t),this.textureLoader=e,this.manager=r}return tr(t,[{key:"parse",value:function(){_T=this.parseConnections();var t=this.parseImages(),e=this.parseTextures(t),r=this.parseMaterials(e),n=this.parseDeformers(),i=(new CT).parse(n);return this.parseScene(n,i,r),IT}},{key:"parseConnections",value:function(){var t=new Map;"Connections"in mT&&mT.Connections.connections.forEach((function(e){var r=e[0],n=e[1],i=e[2];t.has(r)||t.set(r,{parents:[],children:[]});var o={ID:n,relationship:i};t.get(r).parents.push(o),t.has(n)||t.set(n,{parents:[],children:[]});var s={ID:r,relationship:i};t.get(n).children.push(s)}));return t}},{key:"parseImages",value:function(){var t={},e={};if("Video"in mT.Objects){var r=mT.Objects.Video;for(var n in r){var i=r[n];if(t[parseInt(n)]=i.RelativeFilename||i.Filename,"Content"in i){var o=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,s="string"==typeof i.Content&&""!==i.Content;if(o||s){var a=this.parseImage(r[n]);e[i.RelativeFilename||i.Filename]=a}}}}for(var u in t){var l=t[u];void 0!==e[l]?t[u]=e[l]:t[u]=t[u].split("\\").pop()}return t}},{key:"parseImage",value:function(t){var e,r=t.Content,n=t.RelativeFilename||t.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":e="image/bmp";break;case"jpg":case"jpeg":e="image/jpeg";break;case"png":e="image/png";break;case"tif":e="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),e="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof r)return"data:"+e+";base64,"+r;var o=new Uint8Array(r);return window.URL.createObjectURL(new Blob([o],{type:e}))}},{key:"parseTextures",value:function(t){var e=new Map;if("Texture"in mT.Objects){var r=mT.Objects.Texture;for(var n in r){var i=this.parseTexture(r[n],t);e.set(parseInt(n),i)}}return e}},{key:"parseTexture",value:function(t,e){var r=this.loadTexture(t,e);r.ID=t.id,r.name=t.attrName;var n=t.WrapModeU,i=t.WrapModeV,o=void 0!==n?n.value:0,s=void 0!==i?i.value:0;if(r.wrapS=0===o?k:ut,r.wrapT=0===s?k:ut,"Scaling"in t){var a=t.Scaling.value;r.repeat.x=a[0],r.repeat.y=a[1]}if("Translation"in t){var u=t.Translation.value;r.offset.x=u[0],r.offset.y=u[1]}return r}},{key:"loadTexture",value:function(t,e){var r,n,i=this.textureLoader.path,o=_T.get(t.id).children;void 0!==o&&o.length>0&&void 0!==e[o[0].ID]&&(0!==(r=e[o[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0));var s=t.FileName.slice(-3).toLowerCase();if("tga"===s){var a=this.manager.getHandler(".tga");null===a?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),n=new dt):(a.setPath(this.textureLoader.path),n=a.load(r))}else if("dds"===s){var u=this.manager.getHandler(".dds");null===u?(console.warn("FBXLoader: DDS loader not found, creating placeholder texture for",t.RelativeFilename),n=new dt):(u.setPath(this.textureLoader.path),n=u.load(r))}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),n=new dt):n=this.textureLoader.load(r);return this.textureLoader.setPath(i),n}},{key:"parseMaterials",value:function(t){var e=new Map;if("Material"in mT.Objects){var r=mT.Objects.Material;for(var n in r){var i=this.parseMaterial(r[n],t);null!==i&&e.set(parseInt(n),i)}}return e}},{key:"parseMaterial",value:function(t,e){var r=t.id,n=t.attrName,i=t.ShadingModel;if("object"===We(i)&&(i=i.value),!_T.has(r))return null;var o,s=this.parseParameters(t,e,r);switch(i.toLowerCase()){case"phong":o=new re;break;case"lambert":o=new ne;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),o=new re}return o.setValues(s),o.name=n,o}},{key:"parseParameters",value:function(t,e,r){var n={};t.BumpFactor&&(n.bumpScale=t.BumpFactor.value),t.Diffuse?n.color=(new d).fromArray(t.Diffuse.value).convertSRGBToLinear():!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(n.color=(new d).fromArray(t.DiffuseColor.value).convertSRGBToLinear()),t.DisplacementFactor&&(n.displacementScale=t.DisplacementFactor.value),t.Emissive?n.emissive=(new d).fromArray(t.Emissive.value).convertSRGBToLinear():!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(n.emissive=(new d).fromArray(t.EmissiveColor.value).convertSRGBToLinear()),t.EmissiveFactor&&(n.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(n.opacity=parseFloat(t.Opacity.value)),n.opacity<1&&(n.transparent=!0),t.ReflectionFactor&&(n.reflectivity=t.ReflectionFactor.value),t.Shininess&&(n.shininess=t.Shininess.value),t.Specular?n.specular=(new d).fromArray(t.Specular.value).convertSRGBToLinear():t.SpecularColor&&"Color"===t.SpecularColor.type&&(n.specular=(new d).fromArray(t.SpecularColor.value).convertSRGBToLinear());var i=this;return _T.get(r).children.forEach((function(t){var r=t.relationship;switch(r){case"Bump":n.bumpMap=i.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":n.aoMap=i.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=i.getTexture(e,t.ID),void 0!==n.map&&(n.map.colorSpace=C);break;case"DisplacementColor":n.displacementMap=i.getTexture(e,t.ID);break;case"EmissiveColor":n.emissiveMap=i.getTexture(e,t.ID),void 0!==n.emissiveMap&&(n.emissiveMap.colorSpace=C);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=i.getTexture(e,t.ID);break;case"ReflectionColor":n.envMap=i.getTexture(e,t.ID),void 0!==n.envMap&&(n.envMap.mapping=ie,n.envMap.colorSpace=C);break;case"SpecularColor":n.specularMap=i.getTexture(e,t.ID),void 0!==n.specularMap&&(n.specularMap.colorSpace=C);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=i.getTexture(e,t.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(t,e){return"LayeredTexture"in mT.Objects&&e in mT.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=_T.get(e).children[0].ID),t.get(e)}},{key:"parseDeformers",value:function(){var t={},e={};if("Deformer"in mT.Objects){var r=mT.Objects.Deformer;for(var n in r){var i=r[n],o=_T.get(parseInt(n));if("Skin"===i.attrType){var s=this.parseSkeleton(o,r);s.ID=n,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),s.geometryID=o.parents[0].ID,t[n]=s}else if("BlendShape"===i.attrType){var a={id:n};a.rawTargets=this.parseMorphTargets(o,r),a.id=n,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[n]=a}}}return{skeletons:t,morphTargets:e}}},{key:"parseSkeleton",value:function(t,e){var r=[];return t.children.forEach((function(t){var n=e[t.ID];if("Cluster"===n.attrType){var i={ID:t.ID,indices:[],weights:[],transformLink:(new A).fromArray(n.TransformLink.a)};"Indexes"in n&&(i.indices=n.Indexes.a,i.weights=n.Weights.a),r.push(i)}})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(t,e){for(var r=[],n=0;n<t.children.length;n++){var i=t.children[n],o=e[i.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;s.geoID=_T.get(parseInt(i.ID)).children.filter((function(t){return void 0===t.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(t,e,r){IT=new W;var n=this.parseModels(t.skeletons,e,r),i=mT.Objects.Model,o=this;n.forEach((function(t){var e=i[t.ID];o.setLookAtProperties(t,e),_T.get(t.ID).parents.forEach((function(e){var r=n.get(e.ID);void 0!==r&&r.add(t)})),null===t.parent&&IT.add(t)})),this.bindSkeleton(t.skeletons,e,n),this.addGlobalSceneSettings(),IT.traverse((function(t){if(t.userData.transformData){t.parent&&(t.userData.transformData.parentMatrix=t.parent.matrix,t.userData.transformData.parentMatrixWorld=t.parent.matrixWorld);var e=FT(t.userData.transformData);t.applyMatrix4(e),t.updateWorldMatrix()}}));var s=(new bT).parse();1===IT.children.length&&IT.children[0].isGroup&&(IT.children[0].animations=s,IT=IT.children[0]),IT.animations=s}},{key:"parseModels",value:function(t,e,r){var n=new Map,i=mT.Objects.Model;for(var o in i){var s=parseInt(o),a=i[o],u=_T.get(s),l=this.buildSkeleton(u,t,s,a.attrName);if(!l){switch(a.attrType){case"Camera":l=this.createCamera(u);break;case"Light":l=this.createLight(u);break;case"Mesh":l=this.createMesh(u,e,r);break;case"NurbsCurve":l=this.createCurve(u,e);break;case"LimbNode":case"Root":l=new et;break;default:l=new W}l.name=a.attrName?z.sanitizeNodeName(a.attrName):"",l.userData.originalName=a.attrName,l.ID=s}this.getTransformData(l,a),n.set(s,l)}return n}},{key:"buildSkeleton",value:function(t,e,r,n){var i=null;return t.parents.forEach((function(t){var o=function(){var o=e[s];o.rawBones.forEach((function(e,s){if(e.ID===t.ID){var a=i;(i=new et).matrixWorld.copy(e.transformLink),i.name=n?z.sanitizeNodeName(n):"",i.userData.originalName=n,i.ID=r,o.bones[s]=i,null!==a&&i.add(a)}}))};for(var s in e)o()})),i}},{key:"createCamera",value:function(t){var e,r;if(t.children.forEach((function(t){var e=mT.Objects.NodeAttribute[t.ID];void 0!==e&&(r=e)})),void 0===r)e=new L;else{var n=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1);var i=1;void 0!==r.NearPlane&&(i=r.NearPlane.value/1e3);var o=1e3;void 0!==r.FarPlane&&(o=r.FarPlane.value/1e3);var s=window.innerWidth,a=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(s=r.AspectWidth.value,a=r.AspectHeight.value);var u=s/a,l=45;void 0!==r.FieldOfView&&(l=r.FieldOfView.value);var h=r.FocalLength?r.FocalLength.value:null;switch(n){case 0:e=new J(l,u,i,o),null!==h&&e.setFocalLength(h);break;case 1:e=new Z(-s/2,s/2,a/2,-a/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),e=new L}}return e}},{key:"createLight",value:function(t){var e,r;if(t.children.forEach((function(t){var e=mT.Objects.NodeAttribute[t.ID];void 0!==e&&(r=e)})),void 0===r)e=new L;else{var n;n=void 0===r.LightType?0:r.LightType.value;var i=16777215;void 0!==r.Color&&(i=(new d).fromArray(r.Color.value).convertSRGBToLinear());var o=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(o=0);var s=0;void 0!==r.FarAttenuationEnd&&(s=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value);switch(n){case 0:e=new E(i,o,s,1);break;case 1:e=new x(i,o);break;case 2:var a=Math.PI/3;void 0!==r.InnerAngle&&(a=K.degToRad(r.InnerAngle.value));var u=0;void 0!==r.OuterAngle&&(u=K.degToRad(r.OuterAngle.value),u=Math.max(u,1)),e=new I(i,o,s,a,u,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),e=new E(i,o)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(e.castShadow=!0)}return e}},{key:"createMesh",value:function(t,e,r){var n,i=null,o=null,s=[];return t.children.forEach((function(t){e.has(t.ID)&&(i=e.get(t.ID)),r.has(t.ID)&&s.push(r.get(t.ID))})),s.length>1?o=s:s.length>0?o=s[0]:(o=new re({name:m.DEFAULT_MATERIAL_NAME,color:13421772}),s.push(o)),"color"in i.attributes&&s.forEach((function(t){t.vertexColors=!0})),i.FBX_Deformer?(n=new j(i,o)).normalizeSkinWeights():n=new V(i,o),n}},{key:"createCurve",value:function(t,e){var r=t.children.reduce((function(t,r){return e.has(r.ID)&&(t=e.get(r.ID)),t}),null),n=new O({name:m.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new q(r,n)}},{key:"getTransformData",value:function(t,e){var r={};"InheritType"in e&&(r.inheritType=parseInt(e.InheritType.value)),r.eulerOrder="RotationOrder"in e?QT(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(r.translation=e.Lcl_Translation.value),"PreRotation"in e&&(r.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(r.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(r.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(r.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(r.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(r.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(r.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(r.rotationPivot=e.RotationPivot.value),t.userData.transformData=r}},{key:"setLookAtProperties",value:function(t,e){"LookAtProperty"in e&&_T.get(t.ID).children.forEach((function(e){if("LookAtProperty"===e.relationship){var r=mT.Objects.Model[e.ID];if("Lcl_Translation"in r){var n=r.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(n),IT.add(t.target)):t.lookAt((new B).fromArray(n))}}}))}},{key:"bindSkeleton",value:function(t,e,r){var n=this.parsePoseNodes(),i=function(){var i=t[o];_T.get(parseInt(i.ID)).parents.forEach((function(t){if(e.has(t.ID)){var o=t.ID;_T.get(o).parents.forEach((function(t){r.has(t.ID)&&r.get(t.ID).bind(new $(i.bones),n[t.ID])}))}}))};for(var o in t)i()}},{key:"parsePoseNodes",value:function(){var t={};if("Pose"in mT.Objects){var e=mT.Objects.Pose;for(var r in e)if("BindPose"===e[r].attrType&&e[r].NbPoseNodes>0){var n=e[r].PoseNode;Array.isArray(n)?n.forEach((function(e){t[e.Node]=(new A).fromArray(e.Matrix.a)})):t[n.Node]=(new A).fromArray(n.Matrix.a)}}return t}},{key:"addGlobalSceneSettings",value:function(){if("GlobalSettings"in mT){if("AmbientColor"in mT.GlobalSettings){var t=mT.GlobalSettings.AmbientColor.value,e=t[0],r=t[1],n=t[2];if(0!==e||0!==r||0!==n){var i=new d(e,r,n).convertSRGBToLinear();IT.add(new oe(i,1))}}"UnitScaleFactor"in mT.GlobalSettings&&(IT.userData.unitScaleFactor=mT.GlobalSettings.UnitScaleFactor.value)}}}]),t}(),CT=function(){function t(){Ze(this,t),this.negativeMaterialIndices=!1}return tr(t,[{key:"parse",value:function(t){var e=new Map;if("Geometry"in mT.Objects){var r=mT.Objects.Geometry;for(var n in r){var i=_T.get(parseInt(n)),o=this.parseGeometry(i,r[n],t);e.set(parseInt(n),o)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),e}},{key:"parseGeometry",value:function(t,e,r){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,r);case"NurbsCurve":return this.parseNurbsGeometry(e)}}},{key:"parseMeshGeometry",value:function(t,e,r){var n=r.skeletons,i=[],o=t.parents.map((function(t){return mT.Objects.Model[t.ID]}));if(0!==o.length){var s=t.children.reduce((function(t,e){return void 0!==n[e.ID]&&(t=n[e.ID]),t}),null);t.children.forEach((function(t){void 0!==r.morphTargets[t.ID]&&i.push(r.morphTargets[t.ID])}));var a=o[0],u={};"RotationOrder"in a&&(u.eulerOrder=QT(a.RotationOrder.value)),"InheritType"in a&&(u.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(u.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(u.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(u.scale=a.GeometricScaling.value);var l=FT(u);return this.genGeometry(e,s,i,l)}}},{key:"genGeometry",value:function(t,e,r,n){var i=new l;t.attrName&&(i.name=t.attrName);var o=this.parseGeoNode(t,e),s=this.genBuffers(o),a=new se(s.vertex,3);if(a.applyMatrix4(n),i.setAttribute("position",a),s.colors.length>0&&i.setAttribute("color",new se(s.colors,3)),e&&(i.setAttribute("skinIndex",new ae(s.weightsIndices,4)),i.setAttribute("skinWeight",new se(s.vertexWeights,4)),i.FBX_Deformer=e),s.normal.length>0){var u=(new ue).getNormalMatrix(n),h=new se(s.normal,3);h.applyNormalMatrix(u),i.setAttribute("normal",h)}if(s.uvs.forEach((function(t,e){var r=0===e?"uv":"uv".concat(e);i.setAttribute(r,new se(s.uvs[e],2))})),o.material&&"AllSame"!==o.material.mappingType){var c=s.materialIndex[0],f=0;if(s.materialIndex.forEach((function(t,e){t!==c&&(i.addGroup(f,e-f,c),c=t,f=e)})),i.groups.length>0){var p=i.groups[i.groups.length-1],d=p.start+p.count;d!==s.materialIndex.length&&i.addGroup(d,s.materialIndex.length-d,c)}0===i.groups.length&&i.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(i,t,r,n),i}},{key:"parseGeoNode",value:function(t,e){var r={};if(r.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],r.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(r.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(r.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(r.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){r.uv=[];for(var n=0;t.LayerElementUV[n];)t.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(t.LayerElementUV[n])),n++}return r.weightTable={},null!==e&&(r.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(n,i){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:e,weight:t.weights[i]})}))}))),r}},{key:"genBuffers",value:function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,i=!1,o=[],s=[],a=[],u=[],l=[],h=[],c=this;return t.vertexIndices.forEach((function(f,p){var d,g=!1;f<0&&(f^=-1,g=!0);var A=[],y=[];if(o.push(3*f,3*f+1,3*f+2),t.color){var v=PT(p,r,f,t.color);a.push(v[0],v[1],v[2])}if(t.skeleton){if(void 0!==t.weightTable[f]&&t.weightTable[f].forEach((function(t){y.push(t.weight),A.push(t.id)})),y.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var m=[0,0,0,0],_=[0,0,0,0];y.forEach((function(t,e){var r=t,n=A[e];_.forEach((function(t,e,i){if(r>t){i[e]=r,r=t;var o=m[e];m[e]=n,n=o}}))})),A=m,y=_}for(;y.length<4;)y.push(0),A.push(0);for(var I=0;I<4;++I)l.push(y[I]),h.push(A[I])}if(t.normal){var E=PT(p,r,f,t.normal);s.push(E[0],E[1],E[2])}t.material&&"AllSame"!==t.material.mappingType&&(d=PT(p,r,f,t.material)[0])<0&&(c.negativeMaterialIndices=!0,d=0),t.uv&&t.uv.forEach((function(t,e){var n=PT(p,r,f,t);void 0===u[e]&&(u[e]=[]),u[e].push(n[0]),u[e].push(n[1])})),n++,g&&(c.genFace(e,t,o,d,s,a,u,l,h,n),r++,n=0,o=[],s=[],a=[],u=[],l=[],h=[])})),e}},{key:"getNormalNewell",value:function(t){for(var e=new B(0,0,0),r=0;r<t.length;r++){var n=t[r],i=t[(r+1)%t.length];e.x+=(n.y-i.y)*(n.z+i.z),e.y+=(n.z-i.z)*(n.x+i.x),e.z+=(n.x-i.x)*(n.y+i.y)}return e.normalize(),e}},{key:"getNormalTangentAndBitangent",value:function(t){var e=this.getNormalNewell(t),r=(Math.abs(e.z)>.5?new B(0,1,0):new B(0,0,1)).cross(e).normalize(),n=e.clone().cross(r).normalize();return{normal:e,tangent:r,bitangent:n}}},{key:"flattenVertex",value:function(t,e,r){return new S(t.dot(e),t.dot(r))}},{key:"genFace",value:function(t,e,r,n,i,o,s,a,u,l){var h;if(l>3){for(var c=[],f=0;f<r.length;f+=3)c.push(new B(e.vertexPositions[r[f]],e.vertexPositions[r[f+1]],e.vertexPositions[r[f+2]]));for(var p=this.getNormalTangentAndBitangent(c),d=p.tangent,g=p.bitangent,A=[],y=0,v=c;y<v.length;y++){var m=v[y];A.push(this.flattenVertex(m,d,g))}h=le.triangulateShape(A,[])}else h=[[0,1,2]];var _,I=yr(h);try{var E=function(){var l=pr(_.value,3),h=l[0],c=l[1],f=l[2];t.vertex.push(e.vertexPositions[r[3*h]]),t.vertex.push(e.vertexPositions[r[3*h+1]]),t.vertex.push(e.vertexPositions[r[3*h+2]]),t.vertex.push(e.vertexPositions[r[3*c]]),t.vertex.push(e.vertexPositions[r[3*c+1]]),t.vertex.push(e.vertexPositions[r[3*c+2]]),t.vertex.push(e.vertexPositions[r[3*f]]),t.vertex.push(e.vertexPositions[r[3*f+1]]),t.vertex.push(e.vertexPositions[r[3*f+2]]),e.skeleton&&(t.vertexWeights.push(a[4*h]),t.vertexWeights.push(a[4*h+1]),t.vertexWeights.push(a[4*h+2]),t.vertexWeights.push(a[4*h+3]),t.vertexWeights.push(a[4*c]),t.vertexWeights.push(a[4*c+1]),t.vertexWeights.push(a[4*c+2]),t.vertexWeights.push(a[4*c+3]),t.vertexWeights.push(a[4*f]),t.vertexWeights.push(a[4*f+1]),t.vertexWeights.push(a[4*f+2]),t.vertexWeights.push(a[4*f+3]),t.weightsIndices.push(u[4*h]),t.weightsIndices.push(u[4*h+1]),t.weightsIndices.push(u[4*h+2]),t.weightsIndices.push(u[4*h+3]),t.weightsIndices.push(u[4*c]),t.weightsIndices.push(u[4*c+1]),t.weightsIndices.push(u[4*c+2]),t.weightsIndices.push(u[4*c+3]),t.weightsIndices.push(u[4*f]),t.weightsIndices.push(u[4*f+1]),t.weightsIndices.push(u[4*f+2]),t.weightsIndices.push(u[4*f+3])),e.color&&(t.colors.push(o[3*h]),t.colors.push(o[3*h+1]),t.colors.push(o[3*h+2]),t.colors.push(o[3*c]),t.colors.push(o[3*c+1]),t.colors.push(o[3*c+2]),t.colors.push(o[3*f]),t.colors.push(o[3*f+1]),t.colors.push(o[3*f+2])),e.material&&"AllSame"!==e.material.mappingType&&(t.materialIndex.push(n),t.materialIndex.push(n),t.materialIndex.push(n)),e.normal&&(t.normal.push(i[3*h]),t.normal.push(i[3*h+1]),t.normal.push(i[3*h+2]),t.normal.push(i[3*c]),t.normal.push(i[3*c+1]),t.normal.push(i[3*c+2]),t.normal.push(i[3*f]),t.normal.push(i[3*f+1]),t.normal.push(i[3*f+2])),e.uv&&e.uv.forEach((function(e,r){void 0===t.uvs[r]&&(t.uvs[r]=[]),t.uvs[r].push(s[r][2*h]),t.uvs[r].push(s[r][2*h+1]),t.uvs[r].push(s[r][2*c]),t.uvs[r].push(s[r][2*c+1]),t.uvs[r].push(s[r][2*f]),t.uvs[r].push(s[r][2*f+1])}))};for(I.s();!(_=I.n()).done;)E()}catch(t){I.e(t)}finally{I.f()}}},{key:"addMorphTargets",value:function(t,e,r,n){if(0!==r.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var i=this;r.forEach((function(r){r.rawTargets.forEach((function(r){var o=mT.Objects.Geometry[r.geoID];void 0!==o&&i.genMorphGeometry(t,e,o,n,r.name)}))}))}}},{key:"genMorphGeometry",value:function(t,e,r,n,i){for(var o=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],s=void 0!==r.Vertices?r.Vertices.a:[],a=void 0!==r.Indexes?r.Indexes.a:[],u=3*t.attributes.position.count,l=new Float32Array(u),h=0;h<a.length;h++){var c=3*a[h];l[c]=s[3*h],l[c+1]=s[3*h+1],l[c+2]=s[3*h+2]}var f={vertexIndices:o,vertexPositions:l},p=this.genBuffers(f),d=new se(p.vertex,3);d.name=i||r.attrName,d.applyMatrix4(n),t.morphAttributes.position.push(d)}},{key:"parseNormals",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.Normals.a,i=[];return"IndexToDirect"===r&&("NormalIndex"in t?i=t.NormalIndex.a:"NormalsIndex"in t&&(i=t.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseUVs",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.UV.a,i=[];return"IndexToDirect"===r&&(i=t.UVIndex.a),{dataSize:2,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseVertexColors",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.Colors.a,i=[];"IndexToDirect"===r&&(i=t.ColorIndex.a);for(var o=0,s=new d;o<n.length;o+=4)s.fromArray(n,o).convertSRGBToLinear().toArray(n,o);return{dataSize:4,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseMaterialIndices",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if("NoMappingInformation"===e)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=t.Materials.a,i=[],o=0;o<n.length;++o)i.push(o);return{dataSize:1,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseNurbsGeometry",value:function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new l;for(var r,n,i=e-1,o=t.KnotVector.a,s=[],a=t.Points.a,u=0,h=a.length;u<h;u+=4)s.push((new te).fromArray(a,u));if("Closed"===t.Form)s.push(s[0]);else if("Periodic"===t.Form){r=i,n=o.length-1-r;for(var c=0;c<i;++c)s.push(s[c])}var f=new ET(i,o,s,r,n).getPoints(12*s.length);return(new l).setFromPoints(f)}}]),t}(),bT=function(){function t(){Ze(this,t)}return tr(t,[{key:"parse",value:function(){var t=[],e=this.parseClips();if(void 0!==e)for(var r in e){var n=e[r],i=this.addClip(n);t.push(i)}return t}},{key:"parseClips",value:function(){if(void 0!==mT.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var e=this.parseAnimationLayers(t);return this.parseAnimStacks(e)}}},{key:"parseAnimationCurveNodes",value:function(){var t=mT.Objects.AnimationCurveNode,e=new Map;for(var r in t){var n=t[r];if(null!==n.attrName.match(/S|R|T|DeformPercent/)){var i={id:n.id,attr:n.attrName,curves:{}};e.set(i.id,i)}}return e}},{key:"parseAnimationCurves",value:function(t){var e=mT.Objects.AnimationCurve;for(var r in e){var n={id:e[r].id,times:e[r].KeyTime.a.map(RT),values:e[r].KeyValueFloat.a},i=_T.get(n.id);if(void 0!==i){var o=i.parents[0].ID,s=i.parents[0].relationship;s.match(/X/)?t.get(o).curves.x=n:s.match(/Y/)?t.get(o).curves.y=n:s.match(/Z/)?t.get(o).curves.z=n:s.match(/DeformPercent/)&&t.has(o)&&(t.get(o).curves.morph=n)}}}},{key:"parseAnimationLayers",value:function(t){var e=mT.Objects.AnimationLayer,r=new Map,n=function(){var e=[],n=_T.get(parseInt(i));void 0!==n&&(n.children.forEach((function(r,n){if(t.has(r.ID)){var i=t.get(r.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===e[n]){var o=_T.get(r.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID;if(void 0!==o){var s=mT.Objects.Model[o.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",r);var a={modelName:s.attrName?z.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};IT.traverse((function(t){t.ID===s.id&&(a.transform=t.matrix,t.userData.transformData&&(a.eulerOrder=t.userData.transformData.eulerOrder))})),a.transform||(a.transform=new A),"PreRotation"in s&&(a.preRotation=s.PreRotation.value),"PostRotation"in s&&(a.postRotation=s.PostRotation.value),e[n]=a}}e[n]&&(e[n][i.attr]=i)}else if(void 0!==i.curves.morph){if(void 0===e[n]){var u=_T.get(r.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID,l=_T.get(u).parents[0].ID,h=_T.get(l).parents[0].ID,c=_T.get(h).parents[0].ID,f=mT.Objects.Model[c],p={modelName:f.attrName?z.sanitizeNodeName(f.attrName):"",morphName:mT.Objects.Deformer[u].attrName};e[n]=p}e[n][i.attr]=i}}})),r.set(parseInt(i),e))};for(var i in e)n();return r}},{key:"parseAnimStacks",value:function(t){var e=mT.Objects.AnimationStack,r={};for(var n in e){var i=_T.get(parseInt(n)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var o=t.get(i[0].ID);r[n]={name:e[n].attrName,layer:o}}return r}},{key:"addClip",value:function(t){var e=[],r=this;return t.layer.forEach((function(t){e=e.concat(r.generateTracks(t))})),new tt(t.name,-1,e)}},{key:"generateTracks",value:function(t){var e=[],r=new B,n=new B;if(t.transform&&t.transform.decompose(r,new g,n),r=r.toArray(),n=n.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){var i=this.generateVectorTrack(t.modelName,t.T.curves,r,"position");void 0!==i&&e.push(i)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){var o=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);void 0!==o&&e.push(o)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){var s=this.generateVectorTrack(t.modelName,t.S.curves,n,"scale");void 0!==s&&e.push(s)}if(void 0!==t.DeformPercent){var a=this.generateMorphTrack(t);void 0!==a&&e.push(a)}return e}},{key:"generateVectorTrack",value:function(t,e,r,n){var i=this.getTimesForAllAxes(e),o=this.getKeyframeTrackValues(i,e,r);return new gt(t+"."+n,i,o)}},{key:"generateRotationTrack",value:function(t,e,r,n,i){var o,s;if(void 0!==e.x&&void 0!==e.y&&void 0!==e.z){var a=this.interpolateRotations(e.x,e.y,e.z,i);o=a[0],s=a[1]}void 0!==r&&((r=r.map(K.degToRad)).push(i),r=(new Mt).fromArray(r),r=(new g).setFromEuler(r)),void 0!==n&&((n=n.map(K.degToRad)).push(i),n=(new Mt).fromArray(n),n=(new g).setFromEuler(n).invert());var u=new g,l=new Mt,h=[];if(!s||!o)return new yt(t+".quaternion",[],[]);for(var c=0;c<s.length;c+=3){if(l.set(s[c],s[c+1],s[c+2],i),u.setFromEuler(l),void 0!==r&&u.premultiply(r),void 0!==n&&u.multiply(n),c>2)(new g).fromArray(h,(c-3)/3*4).dot(u)<0&&u.set(-u.x,-u.y,-u.z,-u.w);u.toArray(h,c/3*4)}return new yt(t+".quaternion",o,h)}},{key:"generateMorphTrack",value:function(t){var e=t.DeformPercent.curves.morph,r=e.values.map((function(t){return t/100})),n=IT.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new At(t.modelName+".morphTargetInfluences["+n+"]",e.times,r)}},{key:"getTimesForAllAxes",value:function(t){var e=[];if(void 0!==t.x&&(e=e.concat(t.x.times)),void 0!==t.y&&(e=e.concat(t.y.times)),void 0!==t.z&&(e=e.concat(t.z.times)),(e=e.sort((function(t,e){return t-e}))).length>1){for(var r=1,n=e[0],i=1;i<e.length;i++){var o=e[i];o!==n&&(e[r]=o,n=o,r++)}e=e.slice(0,r)}return e}},{key:"getKeyframeTrackValues",value:function(t,e,r){var n=r,i=[],o=-1,s=-1,a=-1;return t.forEach((function(t){if(e.x&&(o=e.x.times.indexOf(t)),e.y&&(s=e.y.times.indexOf(t)),e.z&&(a=e.z.times.indexOf(t)),-1!==o){var r=e.x.values[o];i.push(r),n[0]=r}else i.push(n[0]);if(-1!==s){var u=e.y.values[s];i.push(u),n[1]=u}else i.push(n[1]);if(-1!==a){var l=e.z.values[a];i.push(l),n[2]=l}else i.push(n[2])})),i}},{key:"interpolateRotations",value:function(t,e,r,n){var i=[],o=[];i.push(t.times[0]),o.push(K.degToRad(t.values[0])),o.push(K.degToRad(e.values[0])),o.push(K.degToRad(r.values[0]));for(var s=1;s<t.values.length;s++){var a=[t.values[s-1],e.values[s-1],r.values[s-1]];if(!(isNaN(a[0])||isNaN(a[1])||isNaN(a[2]))){var u=a.map(K.degToRad),l=[t.values[s],e.values[s],r.values[s]];if(!(isNaN(l[0])||isNaN(l[1])||isNaN(l[2]))){var h=l.map(K.degToRad),c=[l[0]-a[0],l[1]-a[1],l[2]-a[2]],f=[Math.abs(c[0]),Math.abs(c[1]),Math.abs(c[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){var p=Math.max.apply(Math,f)/180,d=sr(Mt,dr(u).concat([n])),A=sr(Mt,dr(h).concat([n])),y=(new g).setFromEuler(d),v=(new g).setFromEuler(A);y.dot(v)&&v.set(-v.x,-v.y,-v.z,-v.w);for(var m=t.times[s-1],_=t.times[s]-m,I=new g,E=new Mt,x=0;x<1;x+=1/p)I.copy(y.clone().slerp(v.clone(),x)),i.push(m+x*_),E.setFromQuaternion(I,n),o.push(E.x),o.push(E.y),o.push(E.z)}else i.push(t.times[s]),o.push(K.degToRad(t.values[s])),o.push(K.degToRad(e.values[s])),o.push(K.degToRad(r.values[s]))}}}return[i,o]}}]),t}(),ST=function(){function t(){Ze(this,t)}return tr(t,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(t){this.nodeStack.push(t),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),this.currentIndent-=1}},{key:"setCurrentProp",value:function(t,e){this.currentProp=t,this.currentPropName=e}},{key:"parse",value:function(t){this.currentIndent=0,this.allNodes=new TT,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach((function(t,n){var i=t.match(/^[\s\t]*;/),o=t.match(/^[\s\t]*$/);if(!i&&!o){var s=t.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),a=t.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=t.match("^\\t{"+(e.currentIndent-1)+"}}");s?e.parseNodeBegin(t,s):a?e.parseNodeProperty(t,a,r[++n]):u?e.popStack():t.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(t)}})),this.allNodes}},{key:"parseNodeBegin",value:function(t,e){var r=e[1].trim().replace(/^"/,"").replace(/"$/,""),n=e[2].split(",").map((function(t){return t.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:r},o=this.parseNodeAttr(n),s=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(r,i):r in s?("PoseNode"===r?s.PoseNode.push(i):void 0!==s[r].id&&(s[r]={},s[r][s[r].id]=s[r]),""!==o.id&&(s[r][o.id]=i)):"number"==typeof o.id?(s[r]={},s[r][o.id]=i):"Properties70"!==r&&(s[r]="PoseNode"===r?[i]:i),"number"==typeof o.id&&(i.id=o.id),""!==o.name&&(i.attrName=o.name),""!==o.type&&(i.attrType=o.type),this.pushStack(i)}},{key:"parseNodeAttr",value:function(t){var e=t[0];""!==t[0]&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",n="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),n=t[2]),{id:e,name:r,type:n}}},{key:"parseNodeProperty",value:function(t,e,r){var n=e[1].replace(/^"/,"").replace(/"$/,"").trim(),i=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===n&&","===i&&(i=r.replace(/"/g,"").replace(/,$/,"").trim());var o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===n){var s=i.split(",").slice(1),a=parseInt(s[0]),u=parseInt(s[1]),l=i.split(",").slice(3);n="connections",function(t,e){for(var r=0,n=t.length,i=e.length;r<i;r++,n++)t[n]=e[r]}(i=[a,u],l=l.map((function(t){return t.trim().replace(/^"/,"")}))),void 0===o[n]&&(o[n]=[])}"Node"===n&&(o.id=i),n in o&&Array.isArray(o[n])?o[n].push(i):"a"!==n?o[n]=i:o.a=i,this.setCurrentProp(o,n),"a"===n&&","!==i.slice(-1)&&(o.a=OT(i))}else this.parseNodeSpecialProperty(t,n,i)}},{key:"parseNodePropertyContinued",value:function(t){var e=this.getCurrentNode();e.a+=t,","!==t.slice(-1)&&(e.a=OT(e.a))}},{key:"parseNodeSpecialProperty",value:function(t,e,r){var n=r.split('",').map((function(t){return t.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=n[0],o=n[1],s=n[2],a=n[3],u=n[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":u=parseFloat(u);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":u=OT(u)}this.getPrevNode()[i]={type:o,type2:s,flag:a,value:u},this.setCurrentProp(this.getPrevNode(),i)}}]),t}(),BT=function(){function t(){Ze(this,t)}return tr(t,[{key:"parse",value:function(t){var e=new MT(t);e.skip(23);var r=e.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new TT;!this.endOfContent(e);){var i=this.parseNode(e,r);null!==i&&n.add(i.name,i)}return n}},{key:"endOfContent",value:function(t){return t.size()%16==0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}},{key:"parseNode",value:function(t,e){var r={},n=e>=7500?t.getUint64():t.getUint32(),i=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();var o=t.getUint8(),s=t.getString(o);if(0===n)return null;for(var a=[],u=0;u<i;u++)a.push(this.parseProperty(t));var l=a.length>0?a[0]:"",h=a.length>1?a[1]:"",c=a.length>2?a[2]:"";for(r.singleProperty=1===i&&t.getOffset()===n;n>t.getOffset();){var f=this.parseNode(t,e);null!==f&&this.parseSubNode(s,r,f)}return r.propertyList=a,"number"==typeof l&&(r.id=l),""!==h&&(r.attrName=h),""!==c&&(r.attrType=c),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(t,e,r){if(!0===r.singleProperty){var n=r.propertyList[0];Array.isArray(n)?(e[r.name]=r,r.a=n):e[r.name]=n}else if("Connections"===t&&"C"===r.name){var i=[];r.propertyList.forEach((function(t,e){0!==e&&i.push(t)})),void 0===e.connections&&(e.connections=[]),e.connections.push(i)}else if("Properties70"===r.name){Object.keys(r).forEach((function(t){e[t]=r[t]}))}else if("Properties70"===t&&"P"===r.name){var o,s=r.propertyList[0],a=r.propertyList[1],u=r.propertyList[2],l=r.propertyList[3];0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===a||"ColorRGB"===a||"Vector"===a||"Vector3D"===a||0===a.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],e[s]={type:a,type2:u,flag:l,value:o}}else void 0===e[r.name]?"number"==typeof r.id?(e[r.name]={},e[r.name][r.id]=r):e[r.name]=r:"PoseNode"===r.name?(Array.isArray(e[r.name])||(e[r.name]=[e[r.name]]),e[r.name].push(r)):void 0===e[r.name][r.id]&&(e[r.name][r.id]=r)}},{key:"parseProperty",value:function(t){var e,r=t.getString(1);switch(r){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return e=t.getUint32(),t.getArrayBuffer(e);case"S":return e=t.getUint32(),t.getString(e);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var n=t.getUint32(),i=t.getUint32(),o=t.getUint32();if(0===i)switch(r){case"b":case"c":return t.getBooleanArray(n);case"d":return t.getFloat64Array(n);case"f":return t.getFloat32Array(n);case"i":return t.getInt32Array(n);case"l":return t.getInt64Array(n)}var s=function(t,e){return pT((function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"}(t),t.subarray(2,-4)),e)}(new Uint8Array(t.getArrayBuffer(o))),a=new MT(s.buffer);switch(r){case"b":case"c":return a.getBooleanArray(n);case"d":return a.getFloat64Array(n);case"f":return a.getFloat32Array(n);case"i":return a.getInt32Array(n);case"l":return a.getInt64Array(n)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+r)}}}]),t}(),MT=function(){function t(e,r){Ze(this,t),this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===r||r,this._textDecoder=new TextDecoder}return tr(t,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(t){this.offset+=t}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e}},{key:"getUint8",value:function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t}},{key:"getInt16",value:function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}},{key:"getInt32",value:function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getInt32Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e}},{key:"getUint32",value:function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getInt64",value:function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),2147483648&e?(e=4294967295&~e,4294967295===(t=4294967295&~t)&&(e=e+1&4294967295),-(4294967296*e+(t=t+1&4294967295))):4294967296*e+t}},{key:"getInt64Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e}},{key:"getUint64",value:function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),4294967296*e+t}},{key:"getFloat32",value:function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getFloat32Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e}},{key:"getFloat64",value:function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}},{key:"getFloat64Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e}},{key:"getArrayBuffer",value:function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}},{key:"getString",value:function(t){var e=this.offset,r=new Uint8Array(this.dv.buffer,e,t);this.skip(t);var n=r.indexOf(0);return n>=0&&(r=new Uint8Array(this.dv.buffer,e,n)),this._textDecoder.decode(r)}}]),t}(),TT=function(){function t(){Ze(this,t)}return tr(t,[{key:"add",value:function(t,e){this[t]=e}}]),t}();function LT(t){var e=t.match(/FBXVersion: (\d+)/);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function RT(t){return t/46186158e3}var NT=[];function PT(t,e,r,n){var i;switch(n.mappingType){case"ByPolygonVertex":i=t;break;case"ByPolygon":i=e;break;case"ByVertice":i=r;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}"IndexToDirect"===n.referenceType&&(i=n.indices[i]);var o=i*n.dataSize,s=o+n.dataSize;return function(t,e,r,n){for(var i=r,o=0;i<n;i++,o++)t[o]=e[i];return t}(NT,n.buffer,o,s)}var DT=new Mt,kT=new B;function FT(t){var e=new A,r=new A,n=new A,i=new A,o=new A,s=new A,a=new A,u=new A,l=new A,h=new A,c=new A,f=new A,p=t.inheritType?t.inheritType:0;if(t.translation&&e.setPosition(kT.fromArray(t.translation)),t.preRotation){var d=t.preRotation.map(K.degToRad);d.push(t.eulerOrder||Mt.DEFAULT_ORDER),r.makeRotationFromEuler(DT.fromArray(d))}if(t.rotation){var g=t.rotation.map(K.degToRad);g.push(t.eulerOrder||Mt.DEFAULT_ORDER),n.makeRotationFromEuler(DT.fromArray(g))}if(t.postRotation){var y=t.postRotation.map(K.degToRad);y.push(t.eulerOrder||Mt.DEFAULT_ORDER),i.makeRotationFromEuler(DT.fromArray(y)),i.invert()}t.scale&&o.scale(kT.fromArray(t.scale)),t.scalingOffset&&a.setPosition(kT.fromArray(t.scalingOffset)),t.scalingPivot&&s.setPosition(kT.fromArray(t.scalingPivot)),t.rotationOffset&&u.setPosition(kT.fromArray(t.rotationOffset)),t.rotationPivot&&l.setPosition(kT.fromArray(t.rotationPivot)),t.parentMatrixWorld&&(c.copy(t.parentMatrix),h.copy(t.parentMatrixWorld));var v=r.clone().multiply(n).multiply(i),m=new A;m.extractRotation(h);var _=new A;_.copyPosition(h);var I=_.clone().invert().multiply(h),E=m.clone().invert().multiply(I),x=o,w=new A;if(0===p)w.copy(m).multiply(v).multiply(E).multiply(x);else if(1===p)w.copy(m).multiply(E).multiply(v).multiply(x);else{var C=(new A).scale((new B).setFromMatrixScale(c)).clone().invert(),b=E.clone().multiply(C);w.copy(m).multiply(v).multiply(b).multiply(x)}var S=l.clone().invert(),M=s.clone().invert(),T=e.clone().multiply(u).multiply(l).multiply(r).multiply(n).multiply(i).multiply(S).multiply(a).multiply(s).multiply(o).multiply(M),L=(new A).copyPosition(T),R=h.clone().multiply(L);return f.copyPosition(R),(T=f.clone().multiply(w)).premultiply(h.invert()),T}function QT(t){var e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(t=t||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[t]}function OT(t){return t.split(",").map((function(t){return parseFloat(t)}))}function UT(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=t.byteLength),(new TextDecoder).decode(new Uint8Array(t,e,r))}var GT=function(){function t(e,r,n,i,o){Ze(this,t),this.threelayer=i,this.map=i.map,this.groupId=o,this.loader=new xT,this.loader.load(e,(function(t){t.traverse((function(t){t instanceof u.Mesh&&(t.geometry.computeVertexNormals(),t.scale.set(.04,.04,.04),t.rotation.set(1*Math.PI/2,1*-Math.PI/2,0))}));var e=i.toModel(t,{coordinate:r,altitude:n.altitude||0});o?i.addMesh1(e,o):i.addMesh(e),e.object3d.rotation.z=Math.PI/2}))}return tr(t,[{key:"dispose",value:function(){}}]),t}(),zT={altitude:0,speed:.015,height:10},jT=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s,a){var u;Ze(this,n),Array.isArray(e)&&(e=new t.Polygon([e])),i=t.Util.extend({},zT,i,{layer:s,polygon:e}),(u=r.call(this)).parent=a,u._initOptions(i);var l=i,h=l.altitude,c=l.height,f=u.createGeometry(e,s,c);u._createMesh(f,o);var p=s.altitudeToVector3(h,h).x,d=s.coordinateToVector3(e.getCenter(),p);return u.getObject3d().position.copy(d),u}return tr(n,[{key:"createGeometry",value:function(t,e,r){r=e.altitudeToVector3(r,r).x;var n=e.coordinateToVector3(t.getCenter()),i=t.getShell(),o=[],s=[];i.forEach((function(t){var r=e.coordinateToVector3(t).sub(n);o.push(r),s.push(r.x),s.push(r.y)}));for(var a=s,l=[],h=0,c=0;h<a.length-2;h+=2,c++)0===h?l[0]=Math.sqrt((a[2]-a[0])*(a[2]-a[0])+(a[3]-a[1])*(a[3]-a[1])):l[c]=l[c-1]+Math.sqrt((a[h+2]-a[h])*(a[h+2]-a[h])+(a[h+3]-a[h+1])*(a[h+3]-a[h+1]));for(var f=[],p=[],d=l[l.length-1],g=0,A=f.length,y=p.length;g<o.length-1;g++){var v=o[g],m=o[g+1],_=l[g];f[A++]=v.x,f[A++]=v.y,f[A++]=0,p[y++]=0===g?0:l[g-1]/d,p[y++]=0,f[A++]=m.x,f[A++]=m.y,f[A++]=0,p[y++]=_/d,p[y++]=0,f[A++]=v.x,f[A++]=v.y,f[A++]=r,p[y++]=0===g?0:l[g-1]/d,p[y++]=1,f[A++]=v.x,f[A++]=v.y,f[A++]=r,p[y++]=0===g?0:l[g-1]/d,p[y++]=1,f[A++]=m.x,f[A++]=m.y,f[A++]=0,p[y++]=_/d,p[y++]=0,f[A++]=m.x,f[A++]=m.y,f[A++]=r,p[y++]=_/d,p[y++]=1}var I=new u.BufferGeometry;return I.setAttribute("position",new u.BufferAttribute(new Float32Array(f),3)),I.setAttribute("uv",new u.BufferAttribute(new Float32Array(p),2)),I}}]),n}(),VT=function(){function t(e,r,n,i,o){Ze(this,t),this.threelayer=n,this.map=n.map,this.groupId=i,this.layerClass=o,this.opacity=r.opacity||.8,this.fadeOpacity=r.fadeOpacity||.65,this.color=r.color||"#0099FF",this.fadeColor=r.fadeColor||"#000",this.num=r.num||5,this.hiz=r.hiz||.15,this.data=e.data,this.coords=e.coords,this._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new u.Color(this.color)},fadeColor:{type:"uvs",value:new u.Color(this.fadeColor)},opacity:{type:"pv2",value:this.opacity},num:{type:"pv2",value:this.num},hiz:{type:"pv2",value:this.hiz},fadeOpacity:{value:this.fadeOpacity}};var s=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n precision lowp float;\n precision lowp int;\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n precision lowp float;\n precision lowp int;\n uniform float time;\n uniform float opacity;\n uniform vec3 color;\n uniform vec3 fadeColor;\n uniform float fadeOpacity;\n uniform float num;\n uniform float hiz;\n varying vec2 vUv;\n void main() {\n vec4 fragColor = vec4(0.);\n float sin = sin((vUv.y - time * hiz) * 10. * num);\n float high = 0.92;\n float medium = 0.4;\n if (sin > high) {\n fragColor = vec4(mix(vec3(.8, 1., 1.), color, (1. - sin) / (1. - high)), 1.);\n } else if(sin > medium) {\n fragColor = vec4(color, mix(1., 0., 1.-(sin - medium) / (high - medium)));\n } else {\n fragColor = vec4(color, 0.);\n }\n //vec3 fade = mix(color, vec3(0., 0., 0.), vUv.y);\n vec3 fade = mix(color, fadeColor, vUv.y);\n //fragColor = mix(fragColor, vec4(fade, 1.), 0.85);\n fragColor = mix(fragColor, vec4(fade, 1.), fadeOpacity);\n gl_FragColor = vec4(fragColor.rgb, fragColor.a * opacity * (1. - vUv.y));\n }\n ",blending:u.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:u.DoubleSide});this.interactive=void 0===r.interactive||r.interactive,this.groundWall=new jT(this.coords,{height:r.height||1e3,interactive:this.interactive},s,n,this),i?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this),this.clickFunc=r.clickFunc,this._bindMapEvents()}return tr(t,[{key:"_bindMapEvents",value:function(){this.groundWall&&this.groundWall.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.groundWall&&this.groundWall.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){var e=t.target.parent.data;"click"===t.type&&e&&this.clickFunc&&this.clickFunc(e)}},{key:"tick",value:function(t){this._uniforms.time.value+=this.hiz/10*60*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this._closeEvent(),this.groundWall&&(this.groupId?this.threelayer.removeMesh1(this.groundWall,this.groupId):this.threelayer.removeMesh(this.groundWall),this.groundWall.object3d.geometry&&this.groundWall.object3d.geometry.dispose(),this.groundWall.object3d.material&&(this.groundWall.object3d.material.dispose(),delete this.m))}}]),t}(),HT=function(){function t(e,r,n,i,o){if(Ze(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,this.opacity=r.opacity||.8,this.color=r.color||"#0099FF",this.fadeColor=r.fadeColor||"#000",this.repeatX=r.repeatX||10,this.speed=r.speed||.01,r.imgUrl){this.loader=new u.TextureLoader,this.texture=this.loader.load(r.imgUrl),this._uniforms={time:{type:"pv2",value:0},map:{value:this.texture},repeatX:{value:this.repeatX},uvTransform:{value:this.elements}};var s=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n uniform mat3 uvTransform;\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n //vUv = (uvTransform * vec3(uv,1.0) ).xy;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n uniform float repeatX;\n void main() {\n vec4 fragColor = texture2D(map, vec2(1.0 - fract(vUv.x * repeatX + time * 2.), vUv.y));\n //vec4 fragColor = texture2D(map, vUv.x, vec2(fract(vUv.y * repeatX + time * 2.));\n //vec4 fragColor = texture2D(map, vec2(vUv.x, fract(vUv.y * repeatX + time * 2.)));\n gl_FragColor = fragColor;\n }\n ",transparent:!0,depthWrite:!1,depthTest:!1,side:u.DoubleSide});this.groundWall=new jT(e,{height:r.height||1e3},s,n),this.groupId?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this)}}return tr(t,[{key:"setUvTransform",value:function(t,e,r,n,i,o,s){this.elements=1}},{key:"tick",value:function(t){this._uniforms.time.value+=60*this.speed*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.groundWall&&(this.groupId?this.threelayer.removeMesh1(this.groundWall,this.groupId):this.threelayer.removeMesh(this.groundWall),this.groundWall.object3d.geometry&&this.groundWall.object3d.geometry.dispose(),this.groundWall.object3d.material&&(this.groundWall.object3d.material.dispose(),delete this.m),this.texture&&this.texture.dispose())}}]),t}();he.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new S(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},ce.line={uniforms:fe.merge([he.common,he.fog,he.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var qT,YT,XT=function(t){rr(r,pe);var e=ur(r);function r(t){var n;return Ze(this,r),(n=e.call(this,{type:"LineMaterial",uniforms:fe.clone(ce.line.uniforms),vertexShader:ce.line.vertexShader,fragmentShader:ce.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(ar(n),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===t?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),n.setValues(t),n}return tr(r)}(),WT=function(){function e(t,r,n,i){Ze(this,e),this.map=n.map,this.threeLayer=n,this.groupId=i,this.dashed=void 0!==r.dashed&&r.dashed,this.dashScale=void 0!==r.dashScale?r.dashScale:2,this.dashSize=void 0!==r.dashSize?r.dashSize:1,this.gapSize=void 0!==r.gapSize?r.gapSize:1,this.dashed?this.lineMaterial=new XT({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1,dashed:!0,defines:{USE_DASH:""},dashScale:this.dashScale,dashSize:this.dashSize,gapSize:this.gapSize}):this.lineMaterial=new XT({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1});var o=[];t.features.forEach((function(t){var e=t.geometry;o.push(e)})),this.lineItems=o}var r;return tr(e,[{key:"addLine",value:(r=Ke(Xe().mark((function e(){var r,n,i=this;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[],this.lineItems.forEach((function(e){"Polygon"===e.type?e.coordinates.forEach((function(e){var n=new t.LineString(e);r.push(n)})):e.coordinates.forEach((function(e){var n=new t.LineString(e[0]);r.push(n)}))})),r.length>0&&(n=this.threeLayer.toFatLines(r,{altitude:1,interactive:!1},this.lineMaterial),this.dashed&&(n.zoomChange=function(){if(i.map){var t=i.map.pixelToDistance(1,0);i.lineMaterial.dashScale=18.93/t}}),this.groupId?this.threeLayer.addMesh1(n,this.groupId):this.threeLayer.addMesh(n),this.line=n),e.abrupt("return",this);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"dispose",value:function(){this.groupId?this.threeLayer.removeMesh1(this.line,this.groupId):this.threeLayer.removeMesh(this.line),this.line.object3d.geometry&&this.line.object3d.geometry.dispose(),this.line.object3d.material&&this.line.object3d.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose()}}]),e}(),JT={altitude:0},KT=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({layer:s},JT,i),(a=r.call(this))._initOptions(i),a.height=i.height||50;for(var l=1/0,h=1/0,c=-1/0,f=-1/0,p=0;p<e.length;p++){var d=e[p].getCenter();l=Math.min(l,d.x),h=Math.min(h,d.y),c=Math.max(c,d.x),f=Math.max(f,d.y)}var g=new t.Coordinate((l+c)/2,(h+f)/2),A=s.coordinateToVector3(g),y=s.altitudeToVector3(a.height,a.height).x,v=[];a._geometriesAttributes=[],a._colorMap={};for(var m=0;m<e.length;m++){var _=nx(A,e[m],s,y),I=_.attributes.position.array;a._geometriesAttributes[m]={position:{count:I.length/3}},v.push(_)}a._datas=e,a._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new u.Color("#0099FF")},fadeColor:{type:"uvs",value:new u.Color("#000")},opacity:{type:"pv2",value:a.opacity},num:{type:"pv2",value:5},hiz:{type:"pv2",value:.15}},new u.ShaderMaterial({uniforms:a._uniforms,vertexShader:"\n precision lowp float;\n precision lowp int;\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n precision lowp float;\n precision lowp int;\n uniform float time;\n uniform float opacity;\n uniform vec3 color;\n uniform vec3 fadeColor;\n uniform float num;\n uniform float hiz;\n varying vec2 vUv;\n void main() {\n vec4 fragColor = vec4(0.);\n float sin = sin((vUv.y - time * hiz) * 10. * num);\n float high = 0.92;\n float medium = 0.4;\n if (sin > high) {\n fragColor = vec4(mix(vec3(.8, 1., 1.), color, (1. - sin) / (1. - high)), 1.);\n } else if(sin > medium) {\n fragColor = vec4(color, mix(1., 0., 1.-(sin - medium) / (high - medium)));\n } else {\n fragColor = vec4(color, 0.);\n }\n //vec3 fade = mix(color, vec3(0., 0., 0.), vUv.y);\n vec3 fade = mix(color, fadeColor, vUv.y);\n //fragColor = mix(fragColor, vec4(fade, 1.), 0.85);\n fragColor = mix(fragColor, vec4(fade, 1.), 0.65);\n gl_FragColor = vec4(fragColor.rgb, fragColor.a * opacity * (1. - vUv.y));\n }\n ",blending:u.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:u.DoubleSide});var E=new u.MeshBasicMaterial({side:u.DoubleSide,transparent:!0,opacity:.5,depthTest:!1,color:"blue"});a._createMesh(v[0],E);var x=s.coordinateToVector3(g,0);return a.getObject3d().position.copy(x),a._setPickObject3d(),a._init(),a}return tr(n,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"_setPickObject3d",value:function(){if(this._colorMap){for(var t=this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),r=this._geometriesAttributes.length,n=ix(this._geometriesAttributes),i=0,o=0;o<r;o++){var s=e.getColor(),a=s.getHex();this._colorMap[a]=o;var l=this._geometriesAttributes[o].position.count;this._datas[o].colorIndex=a;for(var h=0;h<l;h++)n[i]=s.r,n[i+1]=s.g,n[i+2]=s.b,i+=3}t.setAttribute("pickColor",new u.BufferAttribute(n,3,!0));var c=new u.ShaderMaterial({vertexShader:"\n attribute vec3 pickColor;\n varying vec3 vPickColor;\n void main(){\n vPickColor = pickColor;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec3 vPickColor;\n void main() {\n gl_FragColor = vec4(vPickColor, 1.0);\n }",side:u.DoubleSide,transparent:!0}),f=e.getColor().getHex(),p=new u.Mesh(t,c);p.position.copy(this.getObject3d().position),p._colorIndex=f,this.setPickObject3d(p)}}},{key:"getSelectMesh",value:function(){return console.log(this._datas[this.index]),this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}}]),n}(),ZT=function(){function e(t,r,n,i,o){Ze(this,e),this.map=n.map,this.threeLayer=n,this.groupId=i,this.layerClass=o;var s=[];t.features.forEach((function(t){var e=t.geometry;s.push(e)})),this.lineItems=s}var r;return tr(e,[{key:"addLine",value:(r=Ke(Xe().mark((function e(){var r,n;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],this.lineItems.forEach((function(e){"Polygon"===e.type?r.push(e):e.coordinates.forEach((function(e){var n=new t.Polygon(e);r.push(n)}))})),n=new KT(r,{},null,this.threeLayer),this.groupId?this.threeLayer.addMesh1(n,this.groupId):this.threeLayer.addMesh(n);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})}]),e}(),$T=new vt,tL=new B,eL=function(t){rr(r,Ae);var e=ur(r);function r(){var t;Ze(this,r),(t=e.call(this)).isLineSegmentsGeometry=!0,t.type="LineSegmentsGeometry";return t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new se([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),t.setAttribute("uv",new se([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return tr(r,[{key:"applyMatrix4",value:function(t){var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),r.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var r=new de(e,6,1);return this.setAttribute("instanceStart",new N(r,3,0)),this.setAttribute("instanceEnd",new N(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var r=new de(e,6,1);return this.setAttribute("instanceColorStart",new N(r,3,0)),this.setAttribute("instanceColorEnd",new N(r,3,3)),this}},{key:"fromWireframeGeometry",value:function(t){return this.setPositions(t.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(t){return this.setPositions(t.attributes.position.array),this}},{key:"fromMesh",value:function(t){return this.fromWireframeGeometry(new ge(t.geometry)),this}},{key:"fromLineSegments",value:function(t){var e=t.geometry;return this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new vt);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),$T.setFromBufferAttribute(e),this.boundingBox.union($T))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new mt),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var n=0,i=0,o=t.count;i<o;i++)tL.fromBufferAttribute(t,i),n=Math.max(n,r.distanceToSquared(tL)),tL.fromBufferAttribute(e,i),n=Math.max(n,r.distanceToSquared(tL));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}]),r}(),rL=new B,nL=new B,iL=new te,oL=new te,sL=new te,aL=new B,uL=new A,lL=new ye,hL=new B,cL=new vt,fL=new mt,pL=new te;function dL(t,e,r){return pL.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),pL.multiplyScalar(1/pL.w),pL.x=YT/r.width,pL.y=YT/r.height,pL.applyMatrix4(t.projectionMatrixInverse),pL.multiplyScalar(1/pL.w),Math.abs(Math.max(pL.x,pL.y))}var gL=function(t){rr(r,V);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new eL,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new XT({color:16777215*Math.random()});return Ze(this,r),(t=e.call(this,n,i)).isLineSegments2=!0,t.type="LineSegments2",t}return tr(r,[{key:"computeLineDistances",value:function(){for(var t=this.geometry,e=t.attributes.instanceStart,r=t.attributes.instanceEnd,n=new Float32Array(2*e.count),i=0,o=0,s=e.count;i<s;i++,o+=2)rL.fromBufferAttribute(e,i),nL.fromBufferAttribute(r,i),n[o]=0===o?0:n[o-1],n[o+1]=n[o]+rL.distanceTo(nL);var a=new de(n,2,1);return t.setAttribute("instanceDistanceStart",new N(a,1,0)),t.setAttribute("instanceDistanceEnd",new N(a,1,1)),this}},{key:"raycast",value:function(t,e){var r=this.material.worldUnits,n=t.camera;null!==n||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');var i=void 0!==t.params.Line2&&t.params.Line2.threshold||0;qT=t.ray;var o,s=this.matrixWorld,a=this.geometry,u=this.material;(YT=u.linewidth+i,null===a.boundingSphere&&a.computeBoundingSphere(),fL.copy(a.boundingSphere).applyMatrix4(s),r)?o=.5*YT:o=dL(n,Math.max(n.near,fL.distanceToPoint(qT.origin)),u.resolution);if(fL.radius+=o,!1!==qT.intersectsSphere(fL)){var l;if(null===a.boundingBox&&a.computeBoundingBox(),cL.copy(a.boundingBox).applyMatrix4(s),r)l=.5*YT;else l=dL(n,Math.max(n.near,cL.distanceToPoint(qT.origin)),u.resolution);cL.expandByScalar(l),!1!==qT.intersectsBox(cL)&&(r?function(t,e){for(var r=t.matrixWorld,n=t.geometry,i=n.attributes.instanceStart,o=n.attributes.instanceEnd,s=0,a=Math.min(n.instanceCount,i.count);s<a;s++){lL.start.fromBufferAttribute(i,s),lL.end.fromBufferAttribute(o,s),lL.applyMatrix4(r);var u=new B,l=new B;qT.distanceSqToSegment(lL.start,lL.end,l,u),l.distanceTo(u)<.5*YT&&e.push({point:l,pointOnLine:u,distance:qT.origin.distanceTo(l),object:t,face:null,faceIndex:s,uv:null,uv2:null})}}(this,e):function(t,e,r){var n=e.projectionMatrix,i=t.material.resolution,o=t.matrixWorld,s=t.geometry,a=s.attributes.instanceStart,u=s.attributes.instanceEnd,l=Math.min(s.instanceCount,a.count),h=-e.near;qT.at(1,sL),sL.w=1,sL.applyMatrix4(e.matrixWorldInverse),sL.applyMatrix4(n),sL.multiplyScalar(1/sL.w),sL.x*=i.x/2,sL.y*=i.y/2,sL.z=0,aL.copy(sL),uL.multiplyMatrices(e.matrixWorldInverse,o);for(var c=0,f=l;c<f;c++)if(iL.fromBufferAttribute(a,c),oL.fromBufferAttribute(u,c),iL.w=1,oL.w=1,iL.applyMatrix4(uL),oL.applyMatrix4(uL),!(iL.z>h&&oL.z>h)){if(iL.z>h){var p=iL.z-oL.z,d=(iL.z-h)/p;iL.lerp(oL,d)}else if(oL.z>h){var g=oL.z-iL.z,A=(oL.z-h)/g;oL.lerp(iL,A)}iL.applyMatrix4(n),oL.applyMatrix4(n),iL.multiplyScalar(1/iL.w),oL.multiplyScalar(1/oL.w),iL.x*=i.x/2,iL.y*=i.y/2,oL.x*=i.x/2,oL.y*=i.y/2,lL.start.copy(iL),lL.start.z=0,lL.end.copy(oL),lL.end.z=0;var y=lL.closestPointToPointParameter(aL,!0);lL.at(y,hL);var v=K.lerp(iL.z,oL.z,y),m=v>=-1&&v<=1,_=aL.distanceTo(hL)<.5*YT;if(m&&_){lL.start.fromBufferAttribute(a,c),lL.end.fromBufferAttribute(u,c),lL.start.applyMatrix4(o),lL.end.applyMatrix4(o);var I=new B,E=new B;qT.distanceSqToSegment(lL.start,lL.end,E,I),r.push({point:E,pointOnLine:I,distance:qT.origin.distanceTo(E),object:t,face:null,faceIndex:c,uv:null,uv2:null})}}}(this,n,e))}}}]),r}(),AL=function(t){rr(r,eL);var e=ur(r);function r(){var t;return Ze(this,r),(t=e.call(this)).isLineGeometry=!0,t.type="LineGeometry",t}return tr(r,[{key:"setPositions",value:function(t){for(var e=t.length-3,n=new Float32Array(2*e),i=0;i<e;i+=3)n[2*i]=t[i],n[2*i+1]=t[i+1],n[2*i+2]=t[i+2],n[2*i+3]=t[i+3],n[2*i+4]=t[i+4],n[2*i+5]=t[i+5];return hr(nr(r.prototype),"setPositions",this).call(this,n),this}},{key:"setColors",value:function(t){for(var e=t.length-3,n=new Float32Array(2*e),i=0;i<e;i+=3)n[2*i]=t[i],n[2*i+1]=t[i+1],n[2*i+2]=t[i+2],n[2*i+3]=t[i+3],n[2*i+4]=t[i+4],n[2*i+5]=t[i+5];return hr(nr(r.prototype),"setColors",this).call(this,n),this}},{key:"fromLine",value:function(t){var e=t.geometry;return this.setPositions(e.attributes.position.array),this}}]),r}(),yL=function(t){rr(r,gL);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new AL,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new XT({color:16777215*Math.random()});return Ze(this,r),(t=e.call(this,n,i)).isLine2=!0,t.type="Line2",t}return tr(r)}(),vL={altitude:0,height:10},mL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({},vL,i,{layer:s,coordinate:e}),a=r.call(this);var u=i,l=u.altitude,h=u.height;a._initOptions(i),a.map=s.map;var c=s.altitudeToVector3(h,h).x;a.beginSizeZoom=i.beginSizeZoom||3,a.endSizeZoom=i.endSizeZoom||12,a.spanSizeZoom=a.endSizeZoom-a.beginSizeZoom,a.stepSize=1/(a.endSizeZoom-a.beginSizeZoom+1);var f=[];f.push(0,0,c),f.push(0,0,0);var p=new AL;p.setPositions(f),a.object3d=new yL(p,o),a.object3d.computeLineDistances(),a.object3d.scale.set(1,1,1),a.object3d.__parent=ar(a);var d=s.distanceToVector3(l,l).x,g=s.coordinateToVector3(e,d);return a.getObject3d().position.copy(g),i.closeZoomChange||(a.zoomChange=function(){var t=a.getMap();if(t){var e=t.pixelToDistance(1,0);p.attributes.instanceStart.data.array[2]=c*e*a._getRate(),p.attributes.instanceStart.needsUpdate=!0}}),a}return tr(n,[{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}}]),n}(),_L=function(){function e(t,r,n,i){var o=this;Ze(this,e),0!=t.length?(this.map=n.map,this.threeLayer=n,this.groupId=i,this.height=r.height||50,this.renderOrder=r.renderOrder||0,this.isGradient=void 0===r.isGradient||r.isGradient,this.closeZoomChange=r.closeZoomChange||!1,this.dashed=void 0!==r.dashed&&r.dashed,this.dashScale=void 0!==r.dashScale?r.dashScale:2,this.dashSize=void 0!==r.dashSize?r.dashSize:1,this.gapSize=void 0!==r.gapSize?r.gapSize:1,this.meshs=[],t.forEach((function(t){var e;e=o.dashed?new XT({color:t.color||"#35FFAC",transparent:!0,linewidth:r.linewidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:o.dashScale,dashSize:o.dashSize,gapSize:o.gapSize}):new XT({color:t.color||"#35FFAC",linewidth:r.lineWidth||4,dashed:!1,transparent:!0,opacity:r.opacity||1}),o._setMaterialRes(n,e);var i=new mL([t.longitude,t.latitude],{height:t.height||o.height,interactive:!1,beginSizeZoom:r.beginSizeZoom||9,endSizeZoom:r.endSizeZoom||16,closeZoomChange:o.closeZoomChange},e,n);i.object3d.renderOrder=o.renderOrder,o.dashed&&(i.zoomChange=function(){if(o.map){var t=o.map.pixelToDistance(1,0);e.dashScale=18.93/t}}),o.isGradient&&(e.onBeforeCompile=function(t){t.vertexShader=t.vertexShader.replace("uniform float linewidth;","\n varying vec3 vPos;\n uniform float linewidth;\n "),t.vertexShader=t.vertexShader.replace("void main() {","\n void main() {\n vPos = position;\n "),t.fragmentShader=t.fragmentShader.replace("#include <common>","\n varying vec3 vPos;\n #include <common>\n "),t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( diffuseColor.rgb, alpha );","\n vec3 origin = vec3(0., 0., 0.);\n vec3 dis = vec3(0.,vPos.y, 0.);\n float distance = clamp(length(dis - origin), 0., 1.0);\n float opacity = 1. - distance / 1.;\n //float opacity = 1.;\n gl_FragColor = vec4( diffuseColor.rgb, alpha * opacity );\n ")}),void 0!==t.visible&&!1===t.visible&&i.hide(),o.meshs.push(i)})),i?this.threeLayer.addMesh1(this.meshs,this.groupId):this.threeLayer.addMesh(this.meshs),this.dataItems=t):console.error("需要绘制的点位数量为0")}return tr(e,[{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"_bindMapEvents",value:function(t){t&&t.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){"click"===t.type&&this.callback&&this.callback(t.target.data)}},{key:"show",value:function(){this.meshs.forEach((function(t){t.show()}))}},{key:"hide",value:function(){this.meshs.forEach((function(t){t.hide()}))}},{key:"pointShowHideByCode",value:function(e,r,n){for(var i=1/0,o=1/0,s=-1/0,a=-1/0,u=0;u<this.dataItems.length;u++){var l=this.dataItems[u];e.includes(l.code)?(i=Math.min(i,this.dataItems[u].longitude),o=Math.min(o,this.dataItems[u].latitude),s=Math.max(s,this.dataItems[u].longitude),a=Math.max(a,this.dataItems[u].latitude),l.visibility=1):l.visibility=.1}this.updateByVisibility(),r&&this.map.fitExtent(new t.Extent(i,o,s,a),n||0)}},{key:"updateByVisibility",value:function(){var t=this;this.meshs.forEach((function(e,r){.1===t.dataItems[r].visibility?e.hide():e.show()}))}},{key:"dispose",value:function(){var t=this;this.meshs.forEach((function(e){t.groupId?t.threeLayer.removeMesh1(e,t.groupId):t.threeLayer.removeMesh(e),e.object3d.geometry&&e.object3d.geometry.dispose(),e.object3d.material&&e.object3d.material.dispose()}))}}]),e}(),IL={altitude:0,height:0},EL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),o=t.Util.extend({},IL,o,{layer:s}),a=r.call(this);var l=o,h=l.width,c=l.height,f=l.altitude;a._initOptions(o);var p=new u.PlaneGeometry(h,c);a._createMesh(p,i);var d=s.distanceToVector3(f,f).x,g=s.coordinateToVector3(e,d);return a.getObject3d().position.copy(g),a}return tr(n)}(),xL=function(){function e(r,n,i,o,s,a,l){var h=this;Ze(this,e),this.threelayer=s,this.map=s.map,this.layerClass=a,this.groupId=l,this.millsec=o.millsec||1e3,this.duration=o.duration||75;var c=r.split(","),f=n.split(","),p=parseFloat(c[0]),d=parseFloat(c[1]),g=parseFloat(f[0]),A=parseFloat(f[1]),y=new t.Extent(p,d,g,A),v=1/0,m=1/0,_=-1/0,I=-1/0;[[p,d],[p,A],[g,A],[g,d]].forEach((function(t){var e=h.threelayer.coordinateToVector3(t),r=e.x,n=e.y;v=Math.min(r,v),m=Math.min(n,m),_=Math.max(r,_),I=Math.max(n,I)}));var E=Math.abs(_-v),x=Math.abs(I-m);i.length>1&&Ox.generateGifTexture(i,o.width,o.height).then((function(t){h.texture=t.texture,h.annie=new Nx(t.texture,t.colNum,t.rowNum,i.length,h.duration,t.colNum==t.rowNum);var e=new u.MeshBasicMaterial({map:t.texture,transparent:!0,opacity:void 0!==o.opacity?parseFloat(o.opacity):1}),r=new EL(y.getCenter(),e,{width:E,height:x,interactive:!1},s);h.groupId?h.threelayer.addMesh1(r,h.groupId):h.threelayer.addMesh(r),h.imgObj=r,h.layerClass.updatables.push(h)}))}return tr(e,[{key:"show",value:function(){var t;null===(t=this.imgObj)||void 0===t||t.show()}},{key:"hide",value:function(){var t;null===(t=this.imgObj)||void 0===t||t.hide()}},{key:"tick",value:function(t){var e;null===(e=this.annie)||void 0===e||e.update(this.millsec*t)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.imgObj,this.groupId):this.threelayer.removeMesh(this.imgObj),this.imgObj.object3d.geometry&&this.imgObj.object3d.geometry.dispose(),this.imgObj.object3d.material&&this.imgObj.object3d.material.dispose(),null===(t=this.texture)||void 0===t||t.dispose()}}]),e}(),wL={radius:50,altitude:0},CL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({},wL,i,{layer:s}),a=r.call(this),i.altitude,a._initOptions(i);var l=rx(e),h=s.coordinateToVector3(l),c=[];e.forEach((function(t){var e=s.coordinateToVector3(t);e.sub(h),c.push(e)}));var f=new u.CatmullRomCurve3(c),p=s.distanceToVector3(i.radius,i.radius).x,d=new u.TubeGeometry(f,2,p,20,!1);return a._createMesh(d,o),a.parent=null,a.getObject3d().position.set(h.x,h.y,p/2),a}return tr(n)}(),bL=function(){function t(e,r,n,i){Ze(this,t),this.threelayer=n,this.map=n.map,this.groupId=i;var o=new u.MeshMatcapMaterial({color:r.color||"red",side:u.DoubleSide});this.m=o;var s=new CL(e,{radius:r.radius||2},o,n);s.parent=this,this.groupId?this.threelayer.addMesh1(s,this.groupId):this.threelayer.addMesh(s),this.mesh=s}return tr(t,[{key:"dispose",value:function(){this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose(),this.mesh.object3d.material&&(this.mesh.object3d.material.dispose(),delete this.m)}}]),t}(),SL={radius:100,altitude:0},BL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s,a){var u;Ze(this,n),i=t.Util.extend({},SL,i,{layer:a,coordinate:e}),(u=r.call(this))._initOptions(i);var l=i.altitude;u.object3d=new yL(o,s),u.object3d.computeLineDistances(),u.object3d.scale.set(1,1,1),u.object3d.__parent=ar(u);var h=a.distanceToVector3(l,l).x,c=a.coordinateToVector3(e,h);return u.getObject3d().position.copy(c),u}return tr(n)}(),ML={altitude:0,height:0},TL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),o=t.Util.extend({},ML,o,{layer:s}),a=r.call(this);var l=o.altitude;a._initOptions(o);var h=o.scaleFactor||1,c=[],f=new u.ConeGeometry(1*h,2*h,10);f.translate(0,2.5*h,0),c.push(f);var p=new u.CylinderGeometry(.4*h,.6*h,3*h,10);c.push(p);var d=WE(c);d.computeVertexNormals(),a._createMesh(d,i);var g=s.distanceToVector3(l,l).x,A=s.coordinateToVector3(e,g);return a.getObject3d().position.copy(A),a}return tr(n)}(),LL=function(){function e(r,n,i,o,s){Ze(this,e),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s;var a=void 0===n.lineFlag||!1!==n.lineFlag,l=n.heightDiv||4,h=n.pointsLen||20,c=n.arrowColor||"rgb(0,255,255)",f=n.arrowNum||5;this.speedFactor=n.speedFactor||2e-4,this.material=null,this.curve=null,this.meshs=[],this.arrows=[],this.up=new u.Vector3(0,1,0),this.axis=new u.Vector3,a&&(this.lineMaterial=new XT({color:n.lineColor||"red",transparent:!0,linewidth:n.linewidth||4}),this._setMaterialRes(i,this.lineMaterial));var p=new u.MeshBasicMaterial({color:c,side:u.DoubleSide,transparent:!0});this.material=p;var d=new t.LineString(r),g=ax(d)/l,A=i.distanceToVector3(g,g).x,y=r[0],v=r[1],m=[y[0]/2+v[0]/2,y[1]/2+v[1]/2],_=i.coordinateToVector3(d.getCenter()),I=i.coordinateToVector3(y).sub(_),E=i.coordinateToVector3(v).sub(_),x=i.coordinateToVector3(m,A).sub(_),w=new u.CatmullRomCurve3([I,x,E],!1,"catmullrom");this.curve=w,this.centerPt=_;var C=w.getPoints(h),b=[];C.forEach((function(t){b.push(t.x,t.y,t.z)}));var S=new AL;S.setPositions(b);var B=new BL(d.getCenter(),{interactive:!1},S,this.lineMaterial,i);this.meshs.push(B),this.ArrowNum=f;var M=1/this.ArrowNum;this.addSpan=Math.floor(100*M)/100;for(var T=0;T<this.ArrowNum;T++){var L=new TL(r[0],p,{scaleFactor:n.scaleFactor||1},i);L.object3d.renderOrder=n.arrowOrder||1,this.arrows.push(L)}this.groupId?(this.threelayer.addMesh1(B,this.groupId),this.threelayer.addMesh1(this.arrows,this.groupId)):(this.threelayer.addMesh(B),this.threelayer.addMesh(this.arrows)),this.layerClass.updatables.push(this)}var r;return tr(e,[{key:"tick",value:function(t){if(this.curve)for(var e=this.speedFactor*performance.now(),r=0;r<this.ArrowNum;r++){var n=(e+this.addSpan*r)%1,i=this.curve.getPointAt(n).add(this.centerPt);this.arrows[r].getObject3d().position.copy(i);var o=this.curve.getTangentAt(n);this.axis.crossVectors(this.up,o).normalize();var s=Math.acos(this.up.dot(o));this.arrows[r].getObject3d().quaternion.setFromAxisAngle(this.axis,s)}}},{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"loadTexture",value:(r=Ke(Xe().mark((function t(e){var r;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.promiseToDoSomething(e);case 2:return r=t.sent,this.texture=new u.CanvasTexture(r.canvas),this.material=new u.MeshBasicMaterial({map:this.texture,side:u.DoubleSide,transparent:!0}),t.abrupt("return",this.material);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"promiseToDoSomething",value:function(t){return new Promise((function(e){var r=document.createElement("canvas").getContext("2d");r.canvas.width=64,r.canvas.height=64,r.translate(35,32),r.rotate(.5*-Math.PI),r.fillStyle=t,r.textAlign="center",r.textBaseline="middle",r.font="48px sans-serif",r.fillText("➡︎",0,0),setTimeout((function(){return e(r)}),4)}))}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.meshs&&(this.groupId?this.threelayer.removeMesh1(this.meshs,this.groupId):this.threelayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.arrows&&(this.groupId?this.threelayer.removeMesh1(this.arrows,this.groupId):this.threelayer.removeMesh(this.arrows),this.arrows.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.material&&this.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose(),this.texture&&this.texture.dispose(),this.curve&&delete this.curve}}]),e}(),RL=function(){function e(r,n,i,o,s){var a=this;Ze(this,e),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s;var l=void 0===n.lineFlag||!1!==n.lineFlag,h=n.pointsLen||20,c=n.arrowColor||"rgb(0,255,255)",f=n.arrowNum||5;this.speedFactor=n.speedFactor||2e-4,this.overFunc=n.overFunc,this.outFunc=n.outFunc,this.material=null,this.curve=null,this.arrows=[],this.up=new u.Vector3(0,1,0),this.axis=new u.Vector3,l&&(this.lineMaterial=new XT({transparent:!0,linewidth:n.linewidth||4,vertexColors:!0}),this._setMaterialRes(i,this.lineMaterial));var p=new u.MeshBasicMaterial({color:c,side:u.DoubleSide,transparent:!0});this.material=p;var d=[];r.forEach((function(t){d.push(t.coordinate)}));var g=new t.LineString(d),A=[],y=i.coordinateToVector3(g.getCenter());d.forEach((function(t){var e=i.coordinateToVector3(t).sub(y);if(t[2]){var r=i.distanceToVector3(t[2],t[2]).x;e.z=r}A.push(e)}));var v=new u.CatmullRomCurve3(A,!1,"catmullrom");this.curve=v,this.centerPt=y;var m=v.getPoints(h),_=[],I=[];m.forEach((function(t){_.push(t.x,t.y,t.z);var e=t.add(y),r=a.map.pointAtResToCoord(e,a.map.getGLRes());I.push([r.x,r.y])}));var E=vx(I,d,r,m),x=E.allColors,w=E.snapPoints,C=E.snapPointsH;this.snapPoints=w,this.snapPointsH=C;var b=new AL;b.setPositions(_),b.setColors(x);var S=new BL(g.getCenter(),{interactive:n.interactive||!1},b,this.lineMaterial,i);this._bindMapEvents(S),this.mesh=S,this.ArrowNum=f;var B=1/this.ArrowNum;this.addSpan=Math.floor(100*B)/100;for(var M=function(){var t=new TL(d[0],p,{scaleFactor:n.scaleFactor||1},i);t.object3d.renderOrder=n.arrowOrder||1,n.zoomChange&&(t.zoomChange=function(){n.zoomChange(t)}),a.arrows.push(t)},T=0;T<this.ArrowNum;T++)M();this.groupId?(this.threelayer.addMesh1(S,this.groupId),this.threelayer.addMesh1(this.arrows,this.groupId)):(this.threelayer.addMesh(S),this.threelayer.addMesh(this.arrows)),this.layerClass.updatables.push(this)}return tr(e,[{key:"_bindMapEvents",value:function(t){t&&t.on("click empty mouseover mouseout",this._setEvent,this)}},{key:"_closeEvent",value:function(){this.mesh&&this.mesh.off("click empty mouseover mouseout",this._setEvent,this)}},{key:"_setEvent",value:function(t){"mouseover"===t.type&&this.overFunc?this.overFunc():"mouseout"===t.type&&this.outFunc&&this.outFunc()}},{key:"findItemIndex",value:function(t,e,r){for(var n=0;n<t.length;n++)if(t[n].x===e&&t[n].y===r)return n}},{key:"tick",value:function(t){if(this.curve)for(var e=this.speedFactor*performance.now(),r=0;r<this.ArrowNum;r++){var n=(e+this.addSpan*r)%1,i=this.curve.getPointAt(n).add(this.centerPt);this.arrows[r].getObject3d().position.copy(i);var o=this.curve.getTangentAt(n);this.axis.crossVectors(this.up,o).normalize();var s=Math.acos(this.up.dot(o));this.arrows[r].getObject3d().quaternion.setFromAxisAngle(this.axis,s)}}},{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"addAnimation",value:function(){this.layerClass.updatables.push(this)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"hideArrows",value:function(){this.arrows.forEach((function(t){t.hide()}))}},{key:"showArrows",value:function(){this.arrows.forEach((function(t){t.show()}))}},{key:"dispose",value:function(){this.removeAnimation(),this.mesh&&(this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose()),this.arrows&&(this.groupId?this.threelayer.removeMesh1(this.arrows,this.groupId):this.threelayer.removeMesh(this.arrows),this.arrows.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.material&&this.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose(),this.texture&&this.texture.dispose(),this.curve&&delete this.curve}}]),e}(),NL=function(){function e(r,n,i,o,s){var a=this;Ze(this,e),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s;var l=n.heightDiv||4,h=n.pointsLen||20;this.speedFactor=n.speedFactor||.01,this.sum=0,this.meshs=[];var c=new t.LineString(r),f=ax(c)/l,p=i.distanceToVector3(f,f).x,d=r[0],g=r[1],A=[d[0]/2+g[0]/2,d[1]/2+g[1]/2],y=i.coordinateToVector3(c.getCenter()),v=i.coordinateToVector3(d).sub(y),m=i.coordinateToVector3(g).sub(y),_=i.coordinateToVector3(A,p).sub(y);this.lineMaterialDash=new XT({color:n.lineDashColor||"red",transparent:!0,linewidth:n.lineDashWidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:1,dashSize:n.dashSize||20,gapSize:1}),this.lineMaterial=new XT({color:n.lineColor||"red",transparent:!0,linewidth:n.lineWidth||2,opacity:n.lineOpacity||.4}),this._setMaterialRes(i,this.lineMaterialDash),this._setMaterialRes(i,this.lineMaterial);var I=new u.CatmullRomCurve3([v,_,m],!1,"catmullrom").getPoints(h),E=[];I.forEach((function(t){E.push(t.x,t.y,t.z)}));var x=new AL;x.setPositions(E);var w=new BL(c.getCenter(),{interactive:!1},x,this.lineMaterialDash,i),C=new BL(c.getCenter(),{interactive:!1},x,this.lineMaterial,i),b=C.object3d.geometry.attributes.instanceDistanceEnd.array;this.len=b[b.length-1],this.dur=this.len/3,this.lineMaterialDash.onBeforeCompile=function(t){t.uniforms.actionRatio={value:0},t.uniforms.lineLength={value:a.len},t.fragmentShader=t.fragmentShader.replace("#include <common>","\n uniform float actionRatio;\n uniform float lineLength;\n #include <common>\n "),t.fragmentShader=t.fragmentShader.replace("if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard;","\n float halfDash = dashSize * 0.5;\n float currPos = (lineLength + dashSize) * actionRatio;\n float d = (vLineDistance + halfDash) - currPos;\n if (abs(d) > halfDash ) discard;\n \n float grad = ((vLineDistance + halfDash) - (currPos - halfDash)) / halfDash;\n ").replace("gl_FragColor = vec4( diffuseColor.rgb, alpha );","\n gl_FragColor = vec4( diffuseColor.rgb, alpha * grad);\n "),a.shaderDash=t},this.groupId?(this.threelayer.addMesh1(C,this.groupId),this.threelayer.addMesh1(w,this.groupId)):(this.threelayer.addMesh(C),this.threelayer.addMesh(w)),this.meshs.push(C),this.meshs.push(w),this.layerClass.updatables.push(this)}return tr(e,[{key:"tick",value:function(t){this.shaderDash&&(this.sum+=this.dur*t*this.speedFactor,this.sum%=1,this.shaderDash.uniforms.actionRatio.value=this.sum)}},{key:"setPath",value:function(t,e,r,n){for(var i=t.geometry.attributes.position,o=new u.CatmullRomCurve3([e,n,r],!1,"catmullrom").getPoints(20),s=0;s<=19;s++){var a=o[s];i.setXYZ(s,a.x,a.y,a.z)}i.needsUpdate=!0,t.computeLineDistances(),t.geometry.attributes.lineDistance.needsUpdate=!0,t.material.dashSize=20}},{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.meshs&&(this.groupId?this.threelayer.removeMesh1(this.meshs,this.groupId):this.threelayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.lineMaterialDash&&this.lineMaterialDash.dispose(),this.lineMaterial&&this.lineMaterial.dispose()}}]),e}(),PL={altitude:0},DL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({},PL,i,{layer:s}),(a=r.call(this))._initOptions(i),i.altitude;var l=e.length;0===l&&console.error("polygons is empty");for(var h=1/0,c=1/0,f=-1/0,p=-1/0,d=0;d<l;d++){var g=e[d],A=g.getCenter?g.getCenter():getGeoJSONCenter(g),y=void 0,v=void 0;Array.isArray(A)?(y=A[0],v=A[1]):A instanceof t.Coordinate&&(y=A.x,v=A.y),h=Math.min(h,y),c=Math.min(c,v),f=Math.max(f,y),p=Math.max(p,v)}var m=new t.Coordinate((h+f)/2,(c+p)/2);a.centerPt=s.coordinateToVector3(m,0);var _=[];a._geometriesAttributes=[],a._colorMap={};for(var I=0;I<e.length;I++){var E=a.getGeometry(e[I],s),x=E.attributes.position.array;a._geometriesAttributes[I]={position:{count:x.length/3}};for(var w=new u.Color(e[I].properties.color),C=new Float32Array(x.length),b=0;b<x.length;b++)C[3*b]=w.r,C[3*b+1]=w.g,C[3*b+2]=w.b;E.setAttribute("color1",new u.Float32BufferAttribute(C,3)),_.push(E)}a._datas=e;var S=WE(_);return a._createMesh(S,o),a.getObject3d().position.copy(a.centerPt),!0===i.interactive&&(a._setPickObject3d(),a._init()),a}return tr(n,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"_setPickObject3d",value:function(){if(this._colorMap){for(var t=this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),r=this._geometriesAttributes.length,n=ix(this._geometriesAttributes),i=0,o=0;o<r;o++){var s=e.getColor(),a=s.getHex();this._colorMap[a]=o;var l=this._geometriesAttributes[o].position.count;this._datas[o].colorIndex=a;for(var h=0;h<l;h++)n[i]=s.r,n[i+1]=s.g,n[i+2]=s.b,i+=3}t.setAttribute("pickColor",new u.BufferAttribute(n,3,!0));var c=new u.ShaderMaterial({vertexShader:"\n attribute vec3 pickColor;\n varying vec3 vPickColor;\n void main(){\n vPickColor = pickColor;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec3 vPickColor;\n void main() {\n gl_FragColor = vec4(vPickColor, 1.0);\n }",side:u.DoubleSide,transparent:!0}),f=e.getColor().getHex(),p=new u.Mesh(t,c);p.position.copy(this.getObject3d().position),p._colorIndex=f,this.setPickObject3d(p)}}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}},{key:"getGeometry",value:function(e,r){var n=[],i=[];if(e instanceof t.MultiPolygon)for(var o=e.getCoordinates(),s=0,a=o.length;s<a;s++){var l=this.getSingleGeometry(o[s],r,this.centerPt),h=l.positionsV,c=l.faces;if(s>0)for(var f=n.length,p=0,d=c.length;p<d;p++)c[p]+=f;h.forEach((function(t){n.push(t)})),c.forEach((function(t){i.push(t)}))}else{var g=this.getSingleGeometry(e,r,this.centerPt),A=g.positionsV,y=g.faces;n=A,i=y}var v=(new u.BufferGeometry).setFromPoints(n);return v.setIndex(i),v}},{key:"getSingleGeometry",value:function(e,r,n){Array.isArray(e)&&(e=new t.Polygon(e));var i=e.getShell(),o=e.getHoles(),s=[],a=[],u=[];i.forEach((function(t){var e=r.coordinateToVector3(t).sub(n);s.push(e.x,e.y,e.z),u.push(e)})),o&&o.length>0&&o.forEach((function(t){a.push(u.length),t.forEach((function(t){var e=r.coordinateToVector3(t).sub(n);s.push(e.x,e.y,e.z),u.push(e)}))}));var l=a.length>0?a:void 0,h=Ms(s,l,3);return{positionsV:u,faces:h}}}]),n}(),kL=function(){function e(r,n,i,o){var s=this;Ze(this,e),this.map=i.map,this.threeLayer=i,this.groupId=o,this.isToolTip=void 0!==n.isToolTip&&n.isToolTip,this.interactive=void 0!==n.interactive&&n.interactive,this.isSimplify=void 0!==n.isSimplify&&n.isSimplify,this.order=void 0!==n.renderOrder?n.renderOrder:0;var a={tolerance:n.tolerance||.01,highQuality:!0};this.clickFunc=n.clickFunc||null;var l=[];r.features.forEach((function(e){if(s.isSimplify){var r=Go(e,a),n=r.geometry.type;if(["Polygon","MultiPolygon"].includes(n)){var i=r.properties,o=t.GeoJSON.toGeometry(r);o.setProperties(i),l.push(o)}}else{var u=e.geometry.type;if(["Polygon","MultiPolygon"].includes(u)){var h=e.properties,c=t.GeoJSON.toGeometry(e);c.setProperties(h),l.push(c)}}})),this.material=new u.MeshBasicMaterial({vertexColors:!0,transparent:!0,opacity:void 0!==n.opacity?n.opacity:1}),this.dataItems=l}var r,n;return tr(e,[{key:"generatePolygon",value:(n=Ke(Xe().mark((function t(){var e,r,n=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.dataItems){t.next=2;break}return t.abrupt("return",null);case 2:return this.material.onBeforeCompile=function(t){e=n._createMergePolygonShaderPol(t),n.shader=e},(r=new DL(this.dataItems,{interactive:this.interactive},this.material,this.threeLayer)).parent=this,this.groupId?this.threeLayer.addMesh1(r,this.groupId):this.threeLayer.addMesh(r),this.mesh=r,r.object3d.renderOrder=this.order,!0===this.interactive&&(r.pickObject3d.renderOrder=this.order,this._bindMapEvents(r)),t.abrupt("return",this);case 10:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"_bindMapEvents",value:function(t){t&&t.on("click empty mousemove",this._setEvent,this)}},{key:"_closeEvent",value:function(){this.mesh&&this.mesh.off("click empty mousemove",this._setEvent,this)}},{key:"addContent",value:(r=Ke(Xe().mark((function t(e){return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(e);case 2:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"_setEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var r=e.properties.name;if(this.isToolTip){var n=this.mesh.getToolTip();n?n._content="".concat(r):this.mesh.setToolTip("".concat(r),{showTimeout:0,eventsPropagation:!0,dx:10})}}"click"===t.type&&e&&this.clickFunc&&this.addContent(e)}},{key:"dispose",value:function(){this.isToolTip&&this.mesh&&this.mesh.removeToolTip(),this.mesh&&(this.groupId?this.threeLayer.removeMesh1(this.mesh,this.groupId):this.threeLayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose(),this.mesh.object3d.material&&(this.mesh.object3d.material.userData&&delete this.mesh.object3d.material.userData,this.mesh.object3d.material.dispose()),!0===this.interactive&&(this.mesh.pickObject3d.geometry&&this.mesh.pickObject3d.geometry.dispose(),this.mesh.pickObject3d.material&&this.mesh.pickObject3d.material.dispose(),delete this.mesh.pickObject3d),delete this.mesh.object3d,delete this.mesh)}},{key:"_createMergePolygonShaderPol",value:function(t){return t.vertexShader="\n attribute vec3 color1;\n ".concat(t.vertexShader,"\n ").replace("#include <color_vertex>","#include <color_vertex>\n //vColor = texture(colors, vec2(colorIdx / 7., 0.)).rgb; // divide colorIdx by (amount of colors (3) - 1, thus 2)\n vColor = color1; // divide colorIdx by (amount of colors (3) - 1, thus 2)\n "),t}}]),e}(),FL={altitude:0,height:0},QL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),o=t.Util.extend({},FL,o,{layer:s}),a=r.call(this);var l=o,h=l.width,c=l.height,f=l.triW,p=l.triH,d=l.altitude;a._initOptions(o);var g=[],A=new u.BufferGeometry,y=new Float32Array([-f/2,-p/2,0,0,p/2,0,f/2,-p/2,0]),v=new Float32Array([0,0,1]),m=new Float32Array([0,1,.5,.5,1,1]);A.setIndex(new u.Uint16BufferAttribute([0,1,2],1)),A.setAttribute("position",new u.BufferAttribute(y,3)),A.setAttribute("normal",new u.BufferAttribute(v,3)),A.setAttribute("uv",new u.BufferAttribute(m,2)),A.computeBoundingBox(),A.translate(0,-A.boundingBox.max.y,0),g.push(A);var _=new u.PlaneGeometry(h,c);_.computeBoundingBox(),_.translate(0,-_.boundingBox.max.y-p,0),g.push(_);var I=WE(g);I.computeVertexNormals(),a._createMesh(I,i);var E=s.distanceToVector3(d,d).x,x=s.coordinateToVector3(e,E);return a.getObject3d().position.copy(x),a}return tr(n)}(),OL=function(){function t(e,r,n,i){Ze(this,t),this.threelayer=n,this.map=n.map,this.groupId=i,r.lineImgSrc,r.arrowImgSrc,this.imgWidth=r.imgWidth||80,this.imgHeight=r.imgHeight||160;var o=r.rotation||0,s=r.width||20,a=r.height||10,l=n.distanceToVector3(s,s).x,h=n.distanceToVector3(a,a).x;r.anchor;var c=-(o+180)*Math.PI/180;this.material=new u.MeshBasicMaterial({color:r.color||"white",side:u.DoubleSide,depthTest:!1,transparent:!0}),this.mesh=new QL(e,this.material,{width:l,height:h,triW:r.triW||1.6,triH:r.triH||2},n),this.mesh.object3d.renderOrder=r.renderOrder||0,this.mesh.object3d.rotation.z=c,this.groupId?this.threelayer.addMesh1(this.mesh,this.groupId):this.threelayer.addMesh(this.mesh)}var e;return tr(t,[{key:"loadTexture",value:(e=Ke(Xe().mark((function t(e){var r,n,i,o;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e,!e.includes(".svg")){t.next=8;break}return t.next=4,fetch(e);case 4:return n=t.sent,t.next=7,n.text();case 7:r=t.sent;case 8:return new DOMParser,t.next=11,Ox.addImageProcess(r);case 11:return i=t.sent,o=Ox.generateTextureOne(i,this.imgWidth,this.imgHeight),t.abrupt("return",o);case 14:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"dispose",value:function(){this.mesh&&(this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose()),this.material&&this.material.dispose()}}]),t}(),UL=function(){function e(r,n,i,o){var s=this;Ze(this,e),this.map=i.map,this.threeLayer=i,this.groupId=o,this.meshs=[],this.lineStrings=[];var a=n.lineColor||"#377EE8",l=n.lineWidth||1;this.fatLineMaterial=new XT({color:new u.Color(a),transparent:!0,linewidth:l,blending:u.AdditiveBlending}),r.features.forEach((function(e){var r=e.geometry;t.GeoJSON.toGeometry(e);var n=e.properties,o=.1;s.isExtrusion&&(o=n.height?200*n.height:.1),r.coordinates.forEach((function(r){var n=new t.LineString(r[0]),a=i.toFatLine(n,{altitude:.1===o?1:o,interactive:!1},s.fatLineMaterial);a.setProperties(e.properties),a.getObject3d().layers.enable(1),s.meshs.push(a),s.lineStrings.push(n)}))})),this.groupId?i.addMesh1(this.meshs,this.groupId):i.addMesh(this.meshs)}return tr(e,[{key:"dispose",value:function(){this.meshs&&(this.groupId?this.threeLayer.removeMesh1(this.meshs,this.groupId):this.threeLayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()})),this.meshs=[]),this.fatLineMaterial&&this.fatLineMaterial.dispose()}}]),e}(),GL="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",zL=0,jL=1,VL=2,HL=3,qL=4,YL=5,XL=6,WL=7,JL=8,KL=9,ZL=10,$L=11,tR=12,eR=13,rR=14,nR=15,iR=16,oR=17,sR=18,aR=19,uR=20,lR=21,hR=22,cR=23,fR=24,pR=25,dR=26,gR=27,AR=28,yR=29,vR=30,mR=31,_R=32,IR="srgb",ER="srgb-linear",xR=1,wR=2,CR=0,bR=1,SR=2,BR={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},MR=0,TR=2,LR=3,RR=Number(ve.replace(/\D+/g,"")),NR=RR>=152,PR=new Map([[Se,ER],[Be,IR]]),DR=new Map([[ER,Se],[IR,Be]]);function kR(t){return null===t?null:NR?t.outputColorSpace:PR.get(t.outputEncoding)}function FR(t,e){null!==t&&(NR?t.colorSpace=e:t.encoding=DR.get(e))}function QR(t){return RR<154?t.replace("colorspace_fragment","encodings_fragment"):t}var OR=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],UR=class extends pe{constructor(t=new te){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new Me(null),texelSize:new Me(new te),scale:new Me(1),kernel:new Me(0)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;\n#include <colorspace_fragment>\n}",vertexShader:"uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.fragmentShader=QR(this.fragmentShader),this.setTexelSize(t.x,t.y),this.kernelSize=TR}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.inputBuffer=t}get kernelSequence(){return OR[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(t){this.uniforms.scale.value=t}getScale(){return this.uniforms.scale.value}setScale(t){this.uniforms.scale.value=t}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(t){this.uniforms.kernel.value=t}setKernel(t){this.kernel=t}setTexelSize(t,e){this.uniforms.texelSize.value.set(t,e,.5*t,.5*e)}setSize(t,e){const r=1/t,n=1/e;this.uniforms.texelSize.value.set(r,n,.5*r,.5*n)}},GR=class extends pe{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new Me(null),opacity:new Me(1)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <dithering_pars_fragment>\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;\n#include <colorspace_fragment>\n#include <dithering_fragment>\n}",vertexShader:GL}),this.fragmentShader=QR(this.fragmentShader)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}getOpacity(t){return this.uniforms.opacity.value}setOpacity(t){this.uniforms.opacity.value=t}},zR=class extends pe{constructor(t=null,e){super({name:"DepthComparisonMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new Me(null),cameraNear:new Me(.3),cameraFar:new Me(1e3)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <packing>\n#include <clipping_planes_pars_fragment>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform float cameraNear;uniform float cameraFar;centroid varying float vViewZ;centroid varying vec4 vProjTexCoord;void main(){\n#include <clipping_planes_fragment>\nvec2 projTexCoord=(vProjTexCoord.xy/vProjTexCoord.w)*0.5+0.5;projTexCoord=clamp(projTexCoord,0.002,0.998);\n#if DEPTH_PACKING == 3201\nfloat fragCoordZ=unpackRGBAToDepth(texture2D(depthBuffer,projTexCoord));\n#else\nfloat fragCoordZ=texture2D(depthBuffer,projTexCoord).r;\n#endif\n#ifdef PERSPECTIVE_CAMERA\nfloat viewZ=perspectiveDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#else\nfloat viewZ=orthographicDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#endif\nfloat depthTest=(-vViewZ>-viewZ)?1.0:0.0;gl_FragColor.rg=vec2(0.0,depthTest);}",vertexShader:"#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include <skinbase_vertex>\n#include <begin_vertex>\n#include <morphtarget_vertex>\n#include <skinning_vertex>\n#include <project_vertex>\nvViewZ=mvPosition.z;vProjTexCoord=gl_Position;\n#include <clipping_planes_vertex>\n}"}),this.depthBuffer=t,this.depthPacking=Re,this.copyCameraSettings(e)}set depthBuffer(t){this.uniforms.depthBuffer.value=t}set depthPacking(t){this.defines.DEPTH_PACKING=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer(t,e=Re){this.depthBuffer=t,this.depthPacking=e}adoptCameraSettings(t){this.copyCameraSettings(t)}copyCameraSettings(t){t&&(this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far,t instanceof J?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},jR=class extends pe{constructor(){super({name:"DepthMaskMaterial",defines:{DEPTH_EPSILON:"0.0001",DEPTH_PACKING_0:"0",DEPTH_PACKING_1:"0",DEPTH_TEST_STRATEGY:xR},uniforms:{inputBuffer:new Me(null),depthBuffer0:new Me(null),depthBuffer1:new Me(null),cameraNearFar:new Me(new S(1,1))},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <packing>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer0;uniform highp sampler2D depthBuffer1;\n#else\nuniform mediump sampler2D depthBuffer0;uniform mediump sampler2D depthBuffer1;\n#endif\nuniform sampler2D inputBuffer;uniform vec2 cameraNearFar;float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#endif\n}varying vec2 vUv;void main(){vec2 depth;\n#if DEPTH_PACKING_0 == 3201\ndepth.x=unpackRGBAToDepth(texture2D(depthBuffer0,vUv));\n#else\ndepth.x=texture2D(depthBuffer0,vUv).r;\n#ifdef LOG_DEPTH\nfloat d=pow(2.0,depth.x*log2(cameraNearFar.y+1.0))-1.0;float a=cameraNearFar.y/(cameraNearFar.y-cameraNearFar.x);float b=cameraNearFar.y*cameraNearFar.x/(cameraNearFar.x-cameraNearFar.y);depth.x=a+b/d;\n#endif\n#endif\n#if DEPTH_PACKING_1 == 3201\ndepth.y=unpackRGBAToDepth(texture2D(depthBuffer1,vUv));\n#else\ndepth.y=texture2D(depthBuffer1,vUv).r;\n#ifdef LOG_DEPTH\nfloat d=pow(2.0,depth.y*log2(cameraNearFar.y+1.0))-1.0;float a=cameraNearFar.y/(cameraNearFar.y-cameraNearFar.x);float b=cameraNearFar.y*cameraNearFar.x/(cameraNearFar.x-cameraNearFar.y);depth.y=a+b/d;\n#endif\n#endif\nbool isMaxDepth=(depth.x==1.0);\n#ifdef PERSPECTIVE_CAMERA\ndepth.x=viewZToOrthographicDepth(getViewZ(depth.x),cameraNearFar.x,cameraNearFar.y);depth.y=viewZToOrthographicDepth(getViewZ(depth.y),cameraNearFar.x,cameraNearFar.y);\n#endif\n#if DEPTH_TEST_STRATEGY == 0\nbool keep=depthTest(depth.x,depth.y);\n#elif DEPTH_TEST_STRATEGY == 1\nbool keep=isMaxDepth||depthTest(depth.x,depth.y);\n#else\nbool keep=!isMaxDepth&&depthTest(depth.x,depth.y);\n#endif\nif(keep){gl_FragColor=texture2D(inputBuffer,vUv);}else{discard;}}",vertexShader:GL}),this.depthMode=De}set depthBuffer0(t){this.uniforms.depthBuffer0.value=t}set depthPacking0(t){this.defines.DEPTH_PACKING_0=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer0(t,e=be){this.depthBuffer0=t,this.depthPacking0=e}set depthBuffer1(t){this.uniforms.depthBuffer1.value=t}set depthPacking1(t){this.defines.DEPTH_PACKING_1=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer1(t,e=be){this.depthBuffer1=t,this.depthPacking1=e}get maxDepthStrategy(){return Number(this.defines.DEPTH_TEST_STRATEGY)}set maxDepthStrategy(t){this.defines.DEPTH_TEST_STRATEGY=t.toFixed(0),this.needsUpdate=!0}get keepFar(){return this.maxDepthStrategy}set keepFar(t){this.maxDepthStrategy=t?xR:wR}getMaxDepthStrategy(){return this.maxDepthStrategy}setMaxDepthStrategy(t){this.maxDepthStrategy=t}get epsilon(){return Number(this.defines.DEPTH_EPSILON)}set epsilon(t){this.defines.DEPTH_EPSILON=t.toFixed(16),this.needsUpdate=!0}getEpsilon(){return this.epsilon}setEpsilon(t){this.epsilon=t}get depthMode(){return Number(this.defines.DEPTH_MODE)}set depthMode(t){let e;switch(t){case ze:e="false";break;case Ge:e="true";break;case Ne:e="abs(d1 - d0) <= DEPTH_EPSILON";break;case Pe:e="abs(d1 - d0) > DEPTH_EPSILON";break;case De:e="d0 > d1";break;case Ue:e="d0 >= d1";break;case Oe:e="d0 <= d1";break;default:e="d0 < d1"}this.defines.DEPTH_MODE=t.toFixed(0),this.defines["depthTest(d0, d1)"]=e,this.needsUpdate=!0}getDepthMode(){return this.depthMode}setDepthMode(t){this.depthMode=t}adoptCameraSettings(t){this.copyCameraSettings(t)}copyCameraSettings(t){t&&(this.uniforms.cameraNearFar.value.set(t.near,t.far),t instanceof J?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},VR=class extends pe{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new Me(null),texelSize:new Me(new S)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#define WEIGHT_INNER 0.125\n#define WEIGHT_OUTER 0.0555555\nvarying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c;\n#include <colorspace_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.fragmentShader=QR(this.fragmentShader)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setSize(t,e){this.uniforms.texelSize.value.set(1/t,1/e)}},HR=class extends pe{constructor(t,e,r,n,i=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:ve.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new Me(null),depthBuffer:new Me(null),resolution:new Me(new S),texelSize:new Me(new S),cameraNear:new Me(.3),cameraFar:new Me(1e3),aspect:new Me(1),time:new Me(0)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:i}),t&&this.setShaderParts(t),e&&this.setDefines(e),r&&this.setUniforms(r),this.copyCameraSettings(n)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(t){this.uniforms.depthBuffer.value=t}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(t){this.defines.DEPTH_PACKING=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer(t,e=be){this.depthBuffer=t,this.depthPacking=e}setShaderData(t){this.setShaderParts(t.shaderParts),this.setDefines(t.defines),this.setUniforms(t.uniforms),this.setExtensions(t.extensions)}setShaderParts(t){return this.fragmentShader="#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if THREE_REVISION >= 137\nvec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE color0.a=clamp(color0.a,0.0,1.0);gl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include <colorspace_fragment>\n#endif\n#include <dithering_fragment>\n}".replace(BR.FRAGMENT_HEAD,t.get(BR.FRAGMENT_HEAD)||"").replace(BR.FRAGMENT_MAIN_UV,t.get(BR.FRAGMENT_MAIN_UV)||"").replace(BR.FRAGMENT_MAIN_IMAGE,t.get(BR.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}".replace(BR.VERTEX_HEAD,t.get(BR.VERTEX_HEAD)||"").replace(BR.VERTEX_MAIN_SUPPORT,t.get(BR.VERTEX_MAIN_SUPPORT)||""),this.fragmentShader=QR(this.fragmentShader),this.needsUpdate=!0,this}setDefines(t){for(const e of t.entries())this.defines[e[0]]=e[1];return this.needsUpdate=!0,this}setUniforms(t){for(const e of t.entries())this.uniforms[e[0]]=e[1];return this}setExtensions(t){this.extensions={};for(const e of t)this.extensions[e]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(t){this.encodeOutput!==t&&(t?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(t){return this.encodeOutput}setOutputEncodingEnabled(t){this.encodeOutput=t}get time(){return this.uniforms.time.value}set time(t){this.uniforms.time.value=t}setDeltaTime(t){this.uniforms.time.value+=t}adoptCameraSettings(t){this.copyCameraSettings(t)}copyCameraSettings(t){t&&(this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far,t instanceof J?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(t,e){const r=this.uniforms;r.resolution.value.set(t,e),r.texelSize.value.set(1/t,1/e),r.aspect.value=t/e}static get Section(){return BR}},qR=class extends pe{constructor(t=!1,e=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:ve.replace(/\D+/g,"")},uniforms:{inputBuffer:new Me(null),threshold:new Me(0),smoothing:new Me(1),range:new Me(null)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef RANGE\nuniform vec2 range;\n#elif defined(THRESHOLD)\nuniform float threshold;uniform float smoothing;\n#endif\nvarying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);\n#ifdef RANGE\nfloat low=step(range.x,l);float high=step(l,range.y);l*=low*high;\n#elif defined(THRESHOLD)\nl=smoothstep(threshold,threshold+smoothing,l);\n#endif\n#ifdef COLOR\ngl_FragColor=vec4(texel.rgb*l,l);\n#else\ngl_FragColor=vec4(l);\n#endif\n}",vertexShader:GL}),this.colorOutput=t,this.luminanceRange=e}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}get threshold(){return this.uniforms.threshold.value}set threshold(t){this.smoothing>0||t>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=t}getThreshold(){return this.threshold}setThreshold(t){this.threshold=t}get smoothing(){return this.uniforms.smoothing.value}set smoothing(t){this.threshold>0||t>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=t}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(t){this.smoothing=t}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(t){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(t){t?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(t){return this.colorOutput}setColorOutputEnabled(t){this.colorOutput=t}get useRange(){return null!==this.luminanceRange}set useRange(t){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(t){null!==t?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=t,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(t){this.luminanceRange=t}},YR=class extends pe{constructor(t=new S){super({name:"OutlineMaterial",uniforms:{inputBuffer:new Me(null),texelSize:new Me(new S)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"uniform lowp sampler2D inputBuffer;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 c0=texture2D(inputBuffer,vUv0).rg;vec2 c1=texture2D(inputBuffer,vUv1).rg;vec2 c2=texture2D(inputBuffer,vUv2).rg;vec2 c3=texture2D(inputBuffer,vUv3).rg;float d0=(c0.x-c1.x)*0.5;float d1=(c2.x-c3.x)*0.5;float d=length(vec2(d0,d1));float a0=min(c0.y,c1.y);float a1=min(c2.y,c3.y);float visibilityFactor=min(a0,a1);gl_FragColor.rg=(1.0-visibilityFactor>0.001)?vec2(d,0.0):vec2(0.0,d);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=vec2(uv.x+texelSize.x,uv.y);vUv1=vec2(uv.x-texelSize.x,uv.y);vUv2=vec2(uv.x,uv.y+texelSize.y);vUv3=vec2(uv.x,uv.y-texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.uniforms.texelSize.value.set(t.x,t.y),this.uniforms.maskTexture=this.uniforms.inputBuffer}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}setTexelSize(t,e){this.uniforms.texelSize.value.set(t,e)}setSize(t,e){this.uniforms.texelSize.value.set(1/t,1/e)}},XR=class extends pe{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new Me(null),supportBuffer:new Me(null),texelSize:new Me(new S),radius:new Me(.85)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;\n#else\nuniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;\n#endif\nuniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius);\n#include <colorspace_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.fragmentShader=QR(this.fragmentShader)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}set supportBuffer(t){this.uniforms.supportBuffer.value=t}get radius(){return this.uniforms.radius.value}set radius(t){this.uniforms.radius.value=t}setSize(t,e){this.uniforms.texelSize.value.set(1/t,1/e)}},WR=new Le,JR=null;var KR=class t{constructor(t="Pass",e=new Ce,r=WR){this.name=t,this.renderer=null,this.scene=e,this.camera=r,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(t){if(this.rtt===t){const e=this.fullscreenMaterial;null!==e&&(e.needsUpdate=!0),this.rtt=!t}}set mainScene(t){}set mainCamera(t){}setRenderer(t){this.renderer=t}isEnabled(){return this.enabled}setEnabled(t){this.enabled=t}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(t){let e=this.screen;null!==e?e.material=t:(e=new V(function(){if(null===JR){const t=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]);void 0!==(JR=new l).setAttribute?(JR.setAttribute("position",new h(t,3)),JR.setAttribute("uv",new h(e,2))):(JR.addAttribute("position",new h(t,3)),JR.addAttribute("uv",new h(e,2)))}return JR}(),t),e.frustumCulled=!1,null===this.scene&&(this.scene=new Ce),this.scene.add(e),this.screen=e)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(t){this.fullscreenMaterial=t}getDepthTexture(){return null}setDepthTexture(t,e=be){}render(t,e,r,n,i){throw new Error("Render method not implemented!")}setSize(t,e){}initialize(t,e,r){}dispose(){for(const e of Object.keys(this)){const r=this[e];(r instanceof xe||r instanceof Q||r instanceof dt||r instanceof t)&&this[e].dispose()}}},ZR=class extends KR{constructor(t,e=!0){super("CopyPass"),this.fullscreenMaterial=new GR,this.needsSwap=!1,this.renderTarget=t,void 0===t&&(this.renderTarget=new xe(1,1,{minFilter:P,magFilter:P,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=e}get resize(){return this.autoResize}set resize(t){this.autoResize=t}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(t){this.autoResize=t}render(t,e,r,n,i){this.fullscreenMaterial.inputBuffer=e.texture,t.setRenderTarget(this.renderToScreen?null:this.renderTarget),t.render(this.scene,this.camera)}setSize(t,e){this.autoResize&&this.renderTarget.setSize(t,e)}initialize(t,e,r){void 0!==r&&(this.renderTarget.texture.type=r,r!==kt?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":kR(t)===IR&&FR(this.renderTarget.texture,IR))}},$R=class extends KR{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(t,e,r,n,i){const o=t.state.buffers.stencil;o.setLocked(!1),o.setTest(!1)}},tN=new d,eN=class extends KR{constructor(t=!0,e=!0,r=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=t,this.depth=e,this.stencil=r,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(t,e,r){this.color=t,this.depth=e,this.stencil=r}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(t){this.overrideClearColor=t}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(t){this.overrideClearAlpha=t}render(t,e,r,n,i){const o=this.overrideClearColor,s=this.overrideClearAlpha,a=t.getClearAlpha(),u=null!==o,l=s>=0;u?(t.getClearColor(tN),t.setClearColor(o,l?s:a)):l&&t.setClearAlpha(s),t.setRenderTarget(this.renderToScreen?null:e),t.clear(this.color,this.depth,this.stencil),u?t.setClearColor(tN,a):l&&t.setClearAlpha(a)}},rN=class extends KR{constructor(t,e,r=null){super("RenderPass",t,e),this.needsSwap=!1,this.clearPass=new eN,this.overrideMaterialManager=null===r?null:new gN(r),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(t){this.scene=t}set mainCamera(t){this.camera=t}get renderToScreen(){return super.renderToScreen}set renderToScreen(t){super.renderToScreen=t,this.clearPass.renderToScreen=t}get overrideMaterial(){const t=this.overrideMaterialManager;return null!==t?t.material:null}set overrideMaterial(t){const e=this.overrideMaterialManager;null!==t?null!==e?e.setMaterial(t):this.overrideMaterialManager=new gN(t):null!==e&&(e.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(t){this.overrideMaterial=t}get clear(){return this.clearPass.enabled}set clear(t){this.clearPass.enabled=t}getSelection(){return this.selection}setSelection(t){this.selection=t}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(t){this.ignoreBackground=t}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(t){this.skipShadowMapUpdate=t}getClearPass(){return this.clearPass}render(t,e,r,n,i){const o=this.scene,s=this.camera,a=this.selection,u=s.layers.mask,l=o.background,h=t.shadowMap.autoUpdate,c=this.renderToScreen?null:e;null!==a&&s.layers.set(a.getLayer()),this.skipShadowMapUpdate&&(t.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(o.background=null),this.clearPass.enabled&&this.clearPass.render(t,e),t.setRenderTarget(c),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(t,o,s):t.render(o,s),s.layers.mask=u,o.background=l,t.shadowMap.autoUpdate=h}},nN=class extends KR{constructor(t,e,{renderTarget:r,resolutionScale:n=1,width:i=yN.AUTO_SIZE,height:o=yN.AUTO_SIZE,resolutionX:s=i,resolutionY:a=o}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new rN(t,e,new ke({depthPacking:Re}));const u=this.renderPass;u.skipShadowMapUpdate=!0,u.ignoreBackground=!0;const l=u.clearPass;l.overrideClearColor=new d(16777215),l.overrideClearAlpha=1,this.renderTarget=r,void 0===this.renderTarget&&(this.renderTarget=new xe(1,1,{minFilter:it,magFilter:it}),this.renderTarget.texture.name="DepthPass.Target");const h=this.resolution=new yN(this,s,a,n);h.addEventListener("change",(t=>this.setSize(h.baseWidth,h.baseHeight)))}set mainScene(t){this.renderPass.mainScene=t}set mainCamera(t){this.renderPass.mainCamera=t}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}render(t,e,r,n,i){const o=this.renderToScreen?null:this.renderTarget;this.renderPass.render(t,o)}setSize(t,e){const r=this.resolution;r.setBaseSize(t,e),this.renderTarget.setSize(r.width,r.height)}};function iN(t,e,r){for(const n of e){const e="$1"+t+n.charAt(0).toUpperCase()+n.slice(1),i=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(const t of r.entries())null!==t[1]&&r.set(t[0],t[1].replace(i,e))}}function oN(t,e,r){let n=e.getFragmentShader(),i=e.getVertexShader();const o=void 0!==n&&/mainImage/.test(n),s=void 0!==n&&/mainUv/.test(n);if(r.attributes|=e.getAttributes(),void 0===n)throw new Error(`Missing fragment shader (${e.name})`);if(s&&0!=(r.attributes&SR))throw new Error(`Effects that transform UVs are incompatible with convolution effects (${e.name})`);if(!o&&!s)throw new Error(`Could not find mainImage or mainUv function (${e.name})`);{const a=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,u=r.shaderParts;let l=u.get(BR.FRAGMENT_HEAD)||"",h=u.get(BR.FRAGMENT_MAIN_UV)||"",c=u.get(BR.FRAGMENT_MAIN_IMAGE)||"",f=u.get(BR.VERTEX_HEAD)||"",p=u.get(BR.VERTEX_MAIN_SUPPORT)||"";const d=new Set,g=new Set;if(s&&(h+=`\t${t}MainUv(UV);\n`,r.uvTransformation=!0),null!==i&&/mainSupport/.test(i)){const e=/mainSupport *\([\w\s]*?uv\s*?\)/.test(i);p+=`\t${t}MainSupport(`,p+=e?"vUv);\n":");\n";for(const t of i.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const e of t[1].split(/\s*,\s*/))r.varyings.add(e),d.add(e),g.add(e);for(const t of i.matchAll(a))g.add(t[1])}for(const t of n.matchAll(a))g.add(t[1]);for(const t of e.defines.keys())g.add(t.replace(/\([\w\s,]*\)/g,""));for(const t of e.uniforms.keys())g.add(t);g.delete("while"),g.delete("for"),g.delete("if"),e.uniforms.forEach(((e,n)=>r.uniforms.set(t+n.charAt(0).toUpperCase()+n.slice(1),e))),e.defines.forEach(((e,n)=>r.defines.set(t+n.charAt(0).toUpperCase()+n.slice(1),e)));const A=new Map([["fragment",n],["vertex",i]]);iN(t,g,r.defines),iN(t,g,A),n=A.get("fragment"),i=A.get("vertex");const y=e.blendMode;if(r.blendModes.set(y.blendFunction,y),o){null!==e.inputColorSpace&&e.inputColorSpace!==r.colorSpace&&(c+=e.inputColorSpace===IR?"color0 = LinearTosRGB(color0);\n\t":"color0 = sRGBToLinear(color0);\n\t"),""!==e.outputColorSpace?r.colorSpace=e.outputColorSpace:null!==e.inputColorSpace&&(r.colorSpace=e.inputColorSpace);const i=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;c+=`${t}MainImage(color0, UV, `,0!=(r.attributes&bR)&&i.test(n)&&(c+="depth, ",r.readDepth=!0),c+="color1);\n\t";const o=t+"BlendOpacity";r.uniforms.set(o,y.opacity),c+=`color0 = blend${y.blendFunction}(color0, color1, ${o});\n\n\t`,l+=`uniform float ${o};\n\n`}if(l+=n+"\n",null!==i&&(f+=i+"\n"),u.set(BR.FRAGMENT_HEAD,l),u.set(BR.FRAGMENT_MAIN_UV,h),u.set(BR.FRAGMENT_MAIN_IMAGE,c),u.set(BR.VERTEX_HEAD,f),u.set(BR.VERTEX_MAIN_SUPPORT,p),null!==e.extensions)for(const t of e.extensions)r.extensions.add(t)}}var sN=class extends KR{constructor(t,...e){super("EffectPass"),this.fullscreenMaterial=new HR(null,null,null,t),this.listener=t=>this.handleEvent(t),this.effects=[],this.setEffects(e),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(t){for(const e of this.effects)e.mainScene=t}set mainCamera(t){this.fullscreenMaterial.copyCameraSettings(t);for(const e of this.effects)e.mainCamera=t}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(t){this.fullscreenMaterial.encodeOutput=t}get dithering(){return this.fullscreenMaterial.dithering}set dithering(t){const e=this.fullscreenMaterial;e.dithering=t,e.needsUpdate=!0}setEffects(t){for(const t of this.effects)t.removeEventListener("change",this.listener);this.effects=t.sort(((t,e)=>e.attributes-t.attributes));for(const t of this.effects)t.addEventListener("change",this.listener)}updateMaterial(){const t=new pN;let e=0;for(const r of this.effects)if(r.blendMode.blendFunction===KL)t.attributes|=r.getAttributes()&bR;else{if(0!=(t.attributes&r.getAttributes()&SR))throw new Error(`Convolution effects cannot be merged (${r.name})`);oN("e"+e++,r,t)}let r=t.shaderParts.get(BR.FRAGMENT_HEAD),n=t.shaderParts.get(BR.FRAGMENT_MAIN_IMAGE),i=t.shaderParts.get(BR.FRAGMENT_MAIN_UV);const o=/\bblend\b/g;for(const e of t.blendModes.values())r+=e.getShaderCode().replace(o,`blend${e.blendFunction}`)+"\n";0!=(t.attributes&bR)?(t.readDepth&&(n="float depth = readDepth(UV);\n\n\t"+n),this.needsDepthTexture=null===this.getDepthTexture()):this.needsDepthTexture=!1,t.colorSpace===IR&&(n+="color0 = sRGBToLinear(color0);\n\t"),t.uvTransformation?(i="vec2 transformedUv = vUv;\n"+i,t.defines.set("UV","transformedUv")):t.defines.set("UV","vUv"),t.shaderParts.set(BR.FRAGMENT_HEAD,r),t.shaderParts.set(BR.FRAGMENT_MAIN_IMAGE,n),t.shaderParts.set(BR.FRAGMENT_MAIN_UV,i);for(const[e,r]of t.shaderParts)null!==r&&t.shaderParts.set(e,r.trim().replace(/^#/,"\n#"));this.skipRendering=0===e,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(t)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(t,e=be){this.fullscreenMaterial.depthBuffer=t,this.fullscreenMaterial.depthPacking=e;for(const r of this.effects)r.setDepthTexture(t,e)}render(t,e,r,n,i){for(const r of this.effects)r.update(t,e,n);if(!this.skipRendering||this.renderToScreen){const i=this.fullscreenMaterial;i.inputBuffer=e.texture,i.time+=n*this.timeScale,t.setRenderTarget(this.renderToScreen?null:r),t.render(this.scene,this.camera)}}setSize(t,e){this.fullscreenMaterial.setSize(t,e);for(const r of this.effects)r.setSize(t,e)}initialize(t,e,r){this.renderer=t;for(const n of this.effects)n.initialize(t,e,r);this.updateMaterial(),void 0!==r&&r!==kt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const t of this.effects)t.removeEventListener("change",this.listener),t.dispose()}handleEvent(t){if("change"===t.type)this.recompile()}},aN=class extends KR{constructor({kernelSize:t=TR,resolutionScale:e=.5,width:r=yN.AUTO_SIZE,height:n=yN.AUTO_SIZE,resolutionX:i=r,resolutionY:o=n}={}){super("KawaseBlurPass"),this.renderTargetA=new xe(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const s=this.resolution=new yN(this,i,o,e);s.addEventListener("change",(t=>this.setSize(s.baseWidth,s.baseHeight))),this._blurMaterial=new UR,this._blurMaterial.kernelSize=t,this.copyMaterial=new GR}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(t){this._blurMaterial=t}get dithering(){return this.copyMaterial.dithering}set dithering(t){this.copyMaterial.dithering=t}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(t){this.blurMaterial.kernelSize=t}get width(){return this.resolution.width}set width(t){this.resolution.preferredWidth=t}get height(){return this.resolution.height}set height(t){this.resolution.preferredHeight=t}get scale(){return this.blurMaterial.scale}set scale(t){this.blurMaterial.scale=t}getScale(){return this.blurMaterial.scale}setScale(t){this.blurMaterial.scale=t}getKernelSize(){return this.kernelSize}setKernelSize(t){this.kernelSize=t}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}render(t,e,r,n,i){const o=this.scene,s=this.camera,a=this.renderTargetA,u=this.renderTargetB,l=this.blurMaterial,h=l.kernelSequence;let c=e;this.fullscreenMaterial=l;for(let e=0,r=h.length;e<r;++e){const r=0==(1&e)?a:u;l.kernel=h[e],l.inputBuffer=c.texture,t.setRenderTarget(r),t.render(o,s),c=r}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=c.texture,t.setRenderTarget(this.renderToScreen?null:r),t.render(o,s)}setSize(t,e){const r=this.resolution;r.setBaseSize(t,e);const n=r.width,i=r.height;this.renderTargetA.setSize(n,i),this.renderTargetB.setSize(n,i),this.blurMaterial.setSize(t,e)}initialize(t,e,r){void 0!==r&&(this.renderTargetA.texture.type=r,this.renderTargetB.texture.type=r,r!==kt?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):kR(t)===IR&&(FR(this.renderTargetA.texture,IR),FR(this.renderTargetB.texture,IR)))}static get AUTO_SIZE(){return yN.AUTO_SIZE}},uN=class extends KR{constructor({renderTarget:t,luminanceRange:e,colorOutput:r,resolutionScale:n=1,width:i=yN.AUTO_SIZE,height:o=yN.AUTO_SIZE,resolutionX:s=i,resolutionY:a=o}={}){super("LuminancePass"),this.fullscreenMaterial=new qR(r,e),this.needsSwap=!1,this.renderTarget=t,void 0===this.renderTarget&&(this.renderTarget=new xe(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const u=this.resolution=new yN(this,s,a,n);u.addEventListener("change",(t=>this.setSize(u.baseWidth,u.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(t,e,r,n,i){this.fullscreenMaterial.inputBuffer=e.texture,t.setRenderTarget(this.renderToScreen?null:this.renderTarget),t.render(this.scene,this.camera)}setSize(t,e){const r=this.resolution;r.setBaseSize(t,e),this.renderTarget.setSize(r.width,r.height)}initialize(t,e,r){void 0!==r&&r!==kt&&(this.renderTarget.texture.type=r,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},lN=class extends KR{constructor(t,e){super("MaskPass",t,e),this.needsSwap=!1,this.clearPass=new eN(!1,!1,!0),this.inverse=!1}set mainScene(t){this.scene=t}set mainCamera(t){this.camera=t}get inverted(){return this.inverse}set inverted(t){this.inverse=t}get clear(){return this.clearPass.enabled}set clear(t){this.clearPass.enabled=t}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(t){this.inverted=t}render(t,e,r,n,i){const o=t.getContext(),s=t.state.buffers,a=this.scene,u=this.camera,l=this.clearPass,h=this.inverted?0:1,c=1-h;s.color.setMask(!1),s.depth.setMask(!1),s.color.setLocked(!0),s.depth.setLocked(!0),s.stencil.setTest(!0),s.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),s.stencil.setFunc(o.ALWAYS,h,4294967295),s.stencil.setClear(c),s.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?l.render(t,null):(l.render(t,e),l.render(t,r))),this.renderToScreen?(t.setRenderTarget(null),t.render(a,u)):(t.setRenderTarget(e),t.render(a,u),t.setRenderTarget(r),t.render(a,u)),s.color.setLocked(!1),s.depth.setLocked(!1),s.stencil.setLocked(!1),s.stencil.setFunc(o.EQUAL,1,4294967295),s.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),s.stencil.setLocked(!0)}},hN=class extends KR{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new xe(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new VR,this.upsamplingMaterial=new XR,this.resolution=new S}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(t){if(this.levels!==t){const e=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let r=0;r<t;++r){const t=e.clone();t.texture.name="Downsampling.Mipmap"+r,this.downsamplingMipmaps.push(t)}this.upsamplingMipmaps.push(e);for(let r=1,n=t-1;r<n;++r){const t=e.clone();t.texture.name="Upsampling.Mipmap"+r,this.upsamplingMipmaps.push(t)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(t){this.upsamplingMaterial.radius=t}render(t,e,r,n,i){const{scene:o,camera:s}=this,{downsamplingMaterial:a,upsamplingMaterial:u}=this,{downsamplingMipmaps:l,upsamplingMipmaps:h}=this;let c=e;this.fullscreenMaterial=a;for(let e=0,r=l.length;e<r;++e){const r=l[e];a.setSize(c.width,c.height),a.inputBuffer=c.texture,t.setRenderTarget(r),t.render(o,s),c=r}this.fullscreenMaterial=u;for(let e=h.length-1;e>=0;--e){const r=h[e];u.setSize(c.width,c.height),u.inputBuffer=c.texture,u.supportBuffer=l[e].texture,t.setRenderTarget(r),t.render(o,s),c=r}}setSize(t,e){const r=this.resolution;r.set(t,e);let n=r.width,i=r.height;for(let t=0,e=this.downsamplingMipmaps.length;t<e;++t)n=Math.round(.5*n),i=Math.round(.5*i),this.downsamplingMipmaps[t].setSize(n,i),t<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[t].setSize(n,i)}initialize(t,e,r){if(void 0!==r){const e=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(const t of e)t.texture.type=r;if(r!==kt)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(kR(t)===IR)for(const t of e)FR(t.texture,IR)}}dispose(){super.dispose();for(const t of this.downsamplingMipmaps.concat(this.upsamplingMipmaps))t.dispose()}},cN=class extends KR{constructor(t,e="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=t,this.input=e}setInput(t){this.input=t}render(t,e,r,n,i){const o=this.fullscreenMaterial.uniforms;null!==e&&void 0!==o&&void 0!==o[this.input]&&(o[this.input].value=e.texture),t.setRenderTarget(this.renderToScreen?null:r),t.render(this.scene,this.camera)}initialize(t,e,r){void 0!==r&&r!==kt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},fN=.001,pN=class{constructor(){this.shaderParts=new Map([[BR.FRAGMENT_HEAD,null],[BR.FRAGMENT_MAIN_UV,null],[BR.FRAGMENT_MAIN_IMAGE,null],[BR.VERTEX_HEAD,null],[BR.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=CR,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=ER}},dN=!1,gN=class{constructor(t=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(t),this.meshCount=0,this.replaceMaterial=t=>{if(t.isMesh){let e;if(t.material.flatShading)switch(t.material.side){case G:e=this.materialsFlatShadedDoubleSide;break;case we:e=this.materialsFlatShadedBackSide;break;default:e=this.materialsFlatShaded}else switch(t.material.side){case G:e=this.materialsDoubleSide;break;case we:e=this.materialsBackSide;break;default:e=this.materials}this.originalMaterials.set(t,t.material),t.isSkinnedMesh?t.material=e[2]:t.isInstancedMesh?t.material=e[1]:t.material=e[0],++this.meshCount}}}cloneMaterial(t){if(!(t instanceof pe))return t.clone();const e=t.uniforms,r=new Map;for(const t in e){const n=e[t].value;n.isRenderTargetTexture&&(e[t].value=null,r.set(t,n))}const n=t.clone();for(const t of r)e[t[0]].value=t[1],n.uniforms[t[0]].value=t[1];return n}setMaterial(t){if(this.disposeMaterials(),this.material=t,null!==t){const e=this.materials=[this.cloneMaterial(t),this.cloneMaterial(t),this.cloneMaterial(t)];for(const r of e)r.uniforms=Object.assign({},t.uniforms),r.side=ct;e[2].skinning=!0,this.materialsBackSide=e.map((e=>{const r=this.cloneMaterial(e);return r.uniforms=Object.assign({},t.uniforms),r.side=we,r})),this.materialsDoubleSide=e.map((e=>{const r=this.cloneMaterial(e);return r.uniforms=Object.assign({},t.uniforms),r.side=G,r})),this.materialsFlatShaded=e.map((e=>{const r=this.cloneMaterial(e);return r.uniforms=Object.assign({},t.uniforms),r.flatShading=!0,r})),this.materialsFlatShadedBackSide=e.map((e=>{const r=this.cloneMaterial(e);return r.uniforms=Object.assign({},t.uniforms),r.flatShading=!0,r.side=we,r})),this.materialsFlatShadedDoubleSide=e.map((e=>{const r=this.cloneMaterial(e);return r.uniforms=Object.assign({},t.uniforms),r.flatShading=!0,r.side=G,r}))}}render(t,e,r){const n=t.shadowMap.enabled;if(t.shadowMap.enabled=!1,dN){const n=this.originalMaterials;this.meshCount=0,e.traverse(this.replaceMaterial),t.render(e,r);for(const t of n)t[0].material=t[1];this.meshCount!==n.size&&n.clear()}else{const n=e.overrideMaterial;e.overrideMaterial=this.material,t.render(e,r),e.overrideMaterial=n}t.shadowMap.enabled=n}disposeMaterials(){if(null!==this.material){const t=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const e of t)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return dN}static set workaroundEnabled(t){dN=t}},AN=-1,yN=class extends Fe{constructor(t,e=-1,r=-1,n=1){super(),this.resizable=t,this.baseSize=new S(1,1),this.preferredSize=new S(e,r),this.target=this.preferredSize,this.s=n,this.effectiveSize=new S,this.addEventListener("change",(()=>this.updateEffectiveSize())),this.updateEffectiveSize()}updateEffectiveSize(){const t=this.baseSize,e=this.preferredSize,r=this.effectiveSize,n=this.scale;e.width!==AN?r.width=e.width:e.height!==AN?r.width=Math.round(e.height*(t.width/Math.max(t.height,1))):r.width=Math.round(t.width*n),e.height!==AN?r.height=e.height:e.width!==AN?r.height=Math.round(e.width/Math.max(t.width/Math.max(t.height,1),1)):r.height=Math.round(t.height*n)}get width(){return this.effectiveSize.width}set width(t){this.preferredWidth=t}get height(){return this.effectiveSize.height}set height(t){this.preferredHeight=t}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(t){this.s!==t&&(this.s=t,this.preferredSize.setScalar(AN),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(t){this.scale=t}get baseWidth(){return this.baseSize.width}set baseWidth(t){this.baseSize.width!==t&&(this.baseSize.width=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(t){this.baseWidth=t}get baseHeight(){return this.baseSize.height}set baseHeight(t){this.baseSize.height!==t&&(this.baseSize.height=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(t){this.baseHeight=t}setBaseSize(t,e){this.baseSize.width===t&&this.baseSize.height===e||(this.baseSize.set(t,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(t){this.preferredSize.width!==t&&(this.preferredSize.width=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(t){this.preferredWidth=t}get preferredHeight(){return this.preferredSize.height}set preferredHeight(t){this.preferredSize.height!==t&&(this.preferredSize.height=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(t){this.preferredHeight=t}setPreferredSize(t,e){this.preferredSize.width===t&&this.preferredSize.height===e||(this.preferredSize.set(t,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(t){this.s=t.scale,this.baseSize.set(t.baseWidth,t.baseHeight),this.preferredSize.set(t.preferredWidth,t.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return AN}},vN=class extends Set{constructor(t,e=10){super(),this.l=e,this.exclusive=!1,void 0!==t&&this.set(t)}get layer(){return this.l}set layer(t){const e=this.l;for(const r of this)r.layers.disable(e),r.layers.enable(t);this.l=t}getLayer(){return this.layer}setLayer(t){this.layer=t}isExclusive(){return this.exclusive}setExclusive(t){this.exclusive=t}clear(){const t=this.layer;for(const e of this)e.layers.disable(t);return super.clear()}set(t){this.clear();for(const e of t)this.add(e);return this}indexOf(t){return this.has(t)?0:-1}add(t){return this.exclusive?t.layers.set(this.layer):t.layers.enable(this.layer),super.add(t)}delete(t){return this.has(t)&&t.layers.disable(this.layer),super.delete(t)}toggle(t){let e;return this.has(t)?(this.delete(t),e=!1):(this.add(t),e=!0),e}setVisible(t){for(const e of this)t?e.layers.enable(0):e.layers.disable(0);return this}},mN=new Map([[zL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}"],[jL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}"],[VL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}"],[HL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[qL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}"],[YL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}"],[XL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}"],[WL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}"],[JL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}"],[KL,null],[ZL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}"],[$L,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}"],[tR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}"],[eR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}"],[rR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}"],[nR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}"],[iR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}"],[oR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}"],[sR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}"],[aR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}"],[uR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[lR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}"],[hR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}"],[cR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}"],[fR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(2.0*y*x,1.0-2.0*(1.0-y)*(1.0-x),step(0.5,x));return mix(x,z,opacity);}"],[pR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 z=mix(mix(y2,x,step(0.5*x,y)),max(vec4(0.0),y2-1.0),step(x,(y2-1.0)));return mix(x,z,opacity);}"],[dR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(min(x*x/max(1.0-y,1e-12),1.0),y,step(1.0,y));return mix(x,z,opacity);}"],[gR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.r,yHSL.g,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[AR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y-min(x*y,1.0),opacity);}"],[yR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 w=step(0.5,y);vec4 z=mix(x-(1.0-y2)*x*(1.0-x),mix(x+(y2-1.0)*(sqrt(x)-x),x+(y2-1.0)*x*((16.0*x-12.0)*x+3.0),w*(1.0-step(0.25,x))),w);return mix(x,z,opacity);}"],[vR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}"],[mR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x+y-1.0,0.0),opacity);}"],[_R,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(max(1.0-min((1.0-x)/(2.0*y),1.0),0.0),min(x/(2.0*(1.0-y)),1.0),step(0.5,y));return mix(x,z,opacity);}"]]),_N=class extends Fe{constructor(t,e=1){super(),this._blendFunction=t,this.opacity=new Me(e)}getOpacity(){return this.opacity.value}setOpacity(t){this.opacity.value=t}get blendFunction(){return this._blendFunction}set blendFunction(t){this._blendFunction=t,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(t){this.blendFunction=t}getShaderCode(){return mN.get(this.blendFunction)}},IN=class extends Fe{constructor(t,e,{attributes:r=CR,blendFunction:n=cR,defines:i=new Map,uniforms:o=new Map,extensions:s=null,vertexShader:a=null}={}){super(),this.name=t,this.renderer=null,this.attributes=r,this.fragmentShader=e,this.vertexShader=a,this.defines=i,this.uniforms=o,this.extensions=s,this.blendMode=new _N(n),this.blendMode.addEventListener("change",(t=>this.setChanged())),this._inputColorSpace=ER,this._outputColorSpace=""}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(t){this._inputColorSpace=t,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t,this.setChanged()}set mainScene(t){}set mainCamera(t){}getName(){return this.name}setRenderer(t){this.renderer=t}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(t){this.attributes=t,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(t){this.fragmentShader=t,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(t){this.vertexShader=t,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(t,e=be){}update(t,e,r){}setSize(t,e){}initialize(t,e,r){}dispose(){for(const t of Object.keys(this)){const e=this[t];(e instanceof xe||e instanceof Q||e instanceof dt||e instanceof KR)&&this[t].dispose()}}},EN=class extends IN{constructor({blendFunction:t=AR,luminanceThreshold:e=.9,luminanceSmoothing:r=.025,mipmapBlur:n=!1,intensity:i=1,radius:o=.85,levels:s=8,kernelSize:a=LR,resolutionScale:u=.5,width:l=yN.AUTO_SIZE,height:h=yN.AUTO_SIZE,resolutionX:c=l,resolutionY:f=h}={}){super("BloomEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D map;\n#else\nuniform lowp sampler2D map;\n#endif\nuniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 texel=texture2D(map,uv);outputColor=vec4(texel.rgb*intensity,texel.a);}",{blendFunction:t,uniforms:new Map([["map",new Me(null)],["intensity",new Me(i)]])}),this.renderTarget=new xe(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new aN({kernelSize:a}),this.luminancePass=new uN({colorOutput:!0}),this.luminanceMaterial.threshold=e,this.luminanceMaterial.smoothing=r,this.mipmapBlurPass=new hN,this.mipmapBlurPass.enabled=n,this.mipmapBlurPass.radius=o,this.mipmapBlurPass.levels=s,this.uniforms.get("map").value=n?this.mipmapBlurPass.texture:this.renderTarget.texture;const p=this.resolution=new yN(this,c,f,u);p.addEventListener("change",(t=>this.setSize(p.baseWidth,p.baseHeight)))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(t){this.resolution.preferredWidth=t}get height(){return this.resolution.height}set height(t){this.resolution.preferredHeight=t}get dithering(){return this.blurPass.dithering}set dithering(t){this.blurPass.dithering=t}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(t){this.blurPass.kernelSize=t}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(t){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(t){this.uniforms.get("intensity").value=t}getIntensity(){return this.intensity}setIntensity(t){this.intensity=t}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}update(t,e,r){const n=this.renderTarget,i=this.luminancePass;i.enabled?(i.render(t,e),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(t,i.renderTarget):this.blurPass.render(t,i.renderTarget,n)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(t,e):this.blurPass.render(t,e,n)}setSize(t,e){const r=this.resolution;r.setBaseSize(t,e),this.renderTarget.setSize(r.width,r.height),this.blurPass.resolution.copy(r),this.luminancePass.setSize(t,e),this.mipmapBlurPass.setSize(t,e)}initialize(t,e,r){this.blurPass.initialize(t,e,r),this.luminancePass.initialize(t,e,r),this.mipmapBlurPass.initialize(t,e,r),void 0!==r&&(this.renderTarget.texture.type=r,kR(t)===IR&&FR(this.renderTarget.texture,IR))}},xN=class extends IN{constructor(t,e,{blendFunction:r=AR,patternTexture:n=null,patternScale:i=1,edgeStrength:o=1,pulseSpeed:s=0,visibleEdgeColor:a=16777215,hiddenEdgeColor:u=2230538,kernelSize:l=MR,blur:h=!1,xRay:c=!0,multisampling:f=0,resolutionScale:p=.5,width:g=yN.AUTO_SIZE,height:A=yN.AUTO_SIZE,resolutionX:y=g,resolutionY:v=A}={}){super("OutlineEffect","uniform lowp sampler2D edgeTexture;uniform lowp sampler2D maskTexture;uniform vec3 visibleEdgeColor;uniform vec3 hiddenEdgeColor;uniform float pulse;uniform float edgeStrength;\n#ifdef USE_PATTERN\nuniform lowp sampler2D patternTexture;varying vec2 vUvPattern;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec2 edge=texture2D(edgeTexture,uv).rg;vec2 mask=texture2D(maskTexture,uv).rg;\n#ifndef X_RAY\nedge.y=0.0;\n#endif\nedge*=(edgeStrength*mask.x*pulse);vec3 color=edge.x*visibleEdgeColor+edge.y*hiddenEdgeColor;float visibilityFactor=0.0;\n#ifdef USE_PATTERN\nvec4 patternColor=texture2D(patternTexture,vUvPattern);\n#ifdef X_RAY\nfloat hiddenFactor=0.5;\n#else\nfloat hiddenFactor=0.0;\n#endif\nvisibilityFactor=(1.0-mask.y>0.0)?1.0:hiddenFactor;visibilityFactor*=(1.0-mask.x)*patternColor.a;color+=visibilityFactor*patternColor.rgb;\n#endif\nfloat alpha=max(max(edge.x,edge.y),visibilityFactor);\n#ifdef ALPHA\noutputColor=vec4(color,alpha);\n#else\noutputColor=vec4(color,max(alpha,inputColor.a));\n#endif\n}",{uniforms:new Map([["maskTexture",new Me(null)],["edgeTexture",new Me(null)],["edgeStrength",new Me(o)],["visibleEdgeColor",new Me(new d(a))],["hiddenEdgeColor",new Me(new d(u))],["pulse",new Me(1)],["patternScale",new Me(i)],["patternTexture",new Me(null)]])}),this.blendMode.addEventListener("change",(t=>{this.blendMode.blendFunction===jL?this.defines.set("ALPHA","1"):this.defines.delete("ALPHA"),this.setChanged()})),this.blendMode.blendFunction=r,this.patternTexture=n,this.xRay=c,this.scene=t,this.camera=e,this.renderTargetMask=new xe(1,1),this.renderTargetMask.samples=f,this.renderTargetMask.texture.name="Outline.Mask",this.uniforms.get("maskTexture").value=this.renderTargetMask.texture,this.renderTargetOutline=new xe(1,1,{depthBuffer:!1}),this.renderTargetOutline.texture.name="Outline.Edges",this.uniforms.get("edgeTexture").value=this.renderTargetOutline.texture,this.clearPass=new eN,this.clearPass.overrideClearColor=new d(0),this.clearPass.overrideClearAlpha=1,this.depthPass=new nN(t,e),this.maskPass=new rN(t,e,new zR(this.depthPass.texture,e));const m=this.maskPass.clearPass;m.overrideClearColor=new d(16777215),m.overrideClearAlpha=1,this.blurPass=new aN({resolutionScale:p,resolutionX:y,resolutionY:v,kernelSize:l}),this.blurPass.enabled=h;const _=this.blurPass.resolution;_.addEventListener("change",(t=>this.setSize(_.baseWidth,_.baseHeight))),this.outlinePass=new cN(new YR);this.outlinePass.fullscreenMaterial.inputBuffer=this.renderTargetMask.texture,this.time=0,this.forceUpdate=!0,this.selection=new vN,this.selection.layer=10,this.pulseSpeed=s}set mainScene(t){this.scene=t,this.depthPass.mainScene=t,this.maskPass.mainScene=t}set mainCamera(t){this.camera=t,this.depthPass.mainCamera=t,this.maskPass.mainCamera=t,this.maskPass.overrideMaterial.copyCameraSettings(t)}get resolution(){return this.blurPass.resolution}getResolution(){return this.blurPass.getResolution()}get multisampling(){return this.renderTargetMask.samples}set multisampling(t){this.renderTargetMask.samples=t,this.renderTargetMask.dispose()}get patternScale(){return this.uniforms.get("patternScale").value}set patternScale(t){this.uniforms.get("patternScale").value=t}get edgeStrength(){return this.uniforms.get("edgeStrength").value}set edgeStrength(t){this.uniforms.get("edgeStrength").value=t}get visibleEdgeColor(){return this.uniforms.get("visibleEdgeColor").value}set visibleEdgeColor(t){this.uniforms.get("visibleEdgeColor").value=t}get hiddenEdgeColor(){return this.uniforms.get("hiddenEdgeColor").value}set hiddenEdgeColor(t){this.uniforms.get("hiddenEdgeColor").value=t}getBlurPass(){return this.blurPass}getSelection(){return this.selection}getPulseSpeed(){return this.pulseSpeed}setPulseSpeed(t){this.pulseSpeed=t}get width(){return this.resolution.width}set width(t){this.resolution.preferredWidth=t}get height(){return this.resolution.height}set height(t){this.resolution.preferredHeight=t}get selectionLayer(){return this.selection.layer}set selectionLayer(t){this.selection.layer=t}get dithering(){return this.blurPass.dithering}set dithering(t){this.blurPass.dithering=t}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(t){this.blurPass.kernelSize=t}get blur(){return this.blurPass.enabled}set blur(t){this.blurPass.enabled=t}get xRay(){return this.defines.has("X_RAY")}set xRay(t){this.xRay!==t&&(t?this.defines.set("X_RAY","1"):this.defines.delete("X_RAY"),this.setChanged())}isXRayEnabled(){return this.xRay}setXRayEnabled(t){this.xRay=t}get patternTexture(){return this.uniforms.get("patternTexture").value}set patternTexture(t){null!==t?(t.wrapS=t.wrapT=k,this.defines.set("USE_PATTERN","1"),this.setVertexShader("uniform float patternScale;varying vec2 vUvPattern;void mainSupport(const in vec2 uv){vUvPattern=uv*vec2(aspect,1.0)*patternScale;}")):(this.defines.delete("USE_PATTERN"),this.setVertexShader(null)),this.uniforms.get("patternTexture").value=t,this.setChanged()}setPatternTexture(t){this.patternTexture=t}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}setSelection(t){return this.selection.set(t),this}clearSelection(){return this.selection.clear(),this}selectObject(t){return this.selection.add(t),this}deselectObject(t){return this.selection.delete(t),this}update(t,e,r){const n=this.scene,i=this.camera,o=this.selection,s=this.uniforms.get("pulse"),a=n.background,u=i.layers.mask;(this.forceUpdate||o.size>0)&&(n.background=null,s.value=1,this.pulseSpeed>0&&(s.value=.375*Math.cos(this.time*this.pulseSpeed*10)+.625),this.time+=r,o.setVisible(!1),this.depthPass.render(t),o.setVisible(!0),i.layers.set(o.layer),this.maskPass.render(t,this.renderTargetMask),i.layers.mask=u,n.background=a,this.outlinePass.render(t,null,this.renderTargetOutline),this.blurPass.enabled&&this.blurPass.render(t,this.renderTargetOutline,this.renderTargetOutline)),this.forceUpdate=o.size>0}setSize(t,e){this.blurPass.setSize(t,e),this.renderTargetMask.setSize(t,e);const r=this.resolution;r.setBaseSize(t,e);const n=r.width,i=r.height;this.depthPass.setSize(n,i),this.renderTargetOutline.setSize(n,i),this.outlinePass.fullscreenMaterial.setSize(n,i)}initialize(t,e,r){this.blurPass.initialize(t,e,kt),void 0!==r&&(this.depthPass.initialize(t,e,r),this.maskPass.initialize(t,e,r),this.outlinePass.initialize(t,e,r))}},wN=class extends EN{constructor(t,e,r){super(r),this.setAttributes(this.getAttributes()|bR),this.camera=e,this.depthPass=new nN(t,e),this.clearPass=new eN(!0,!1,!1),this.clearPass.overrideClearColor=new d(0),this.depthMaskPass=new cN(new jR);const n=this.depthMaskMaterial;n.copyCameraSettings(e),n.depthBuffer1=this.depthPass.texture,n.depthPacking1=Re,n.depthMode=Ne,this.renderTargetMasked=new xe(1,1,{depthBuffer:!1}),this.renderTargetMasked.texture.name="Bloom.Masked",this.selection=new vN,this.selection.layer=11,this._inverted=!1,this._ignoreBackground=!1}set mainScene(t){this.depthPass.mainScene=t}set mainCamera(t){this.camera=t,this.depthPass.mainCamera=t,this.depthMaskMaterial.copyCameraSettings(t)}getSelection(){return this.selection}get depthMaskMaterial(){return this.depthMaskPass.fullscreenMaterial}get inverted(){return this._inverted}set inverted(t){this._inverted=t,this.depthMaskMaterial.depthMode=t?Pe:Ne}isInverted(){return this.inverted}setInverted(t){this.inverted=t}get ignoreBackground(){return this._ignoreBackground}set ignoreBackground(t){this._ignoreBackground=t,this.depthMaskMaterial.maxDepthStrategy=t?wR:xR}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(t){this.ignoreBackground=t}setDepthTexture(t,e=be){this.depthMaskMaterial.depthBuffer0=t,this.depthMaskMaterial.depthPacking0=e}update(t,e,r){const n=this.camera,i=this.selection,o=this.inverted;let s=e;if(this.ignoreBackground||!o||i.size>0){const r=n.layers.mask;n.layers.set(i.layer),this.depthPass.render(t),n.layers.mask=r,s=this.renderTargetMasked,this.clearPass.render(t,s),this.depthMaskPass.render(t,e,s)}super.update(t,s,r)}setSize(t,e){super.setSize(t,e),this.renderTargetMasked.setSize(t,e),this.depthPass.setSize(t,e)}initialize(t,e,r){super.initialize(t,e,r),this.clearPass.initialize(t,e,r),this.depthPass.initialize(t,e,r),this.depthMaskPass.initialize(t,e,r),t.capabilities.logarithmicDepthBuffer&&(this.depthMaskPass.fullscreenMaterial.defines.LOG_DEPTH="1"),void 0!==r&&(this.renderTargetMasked.texture.type=r,kR(t)===IR&&FR(this.renderTargetMasked.texture,IR))}},CN=function(){function t(e,r){Ze(this,t),this.layer=e;var n=e.getCamera(),i=e.getScene();this.effect=new wN(i,n,{blendFunction:zL,mipmapBlur:!0,luminanceThreshold:(null==r?void 0:r.threshold)||.4,luminanceSmoothing:(null==r?void 0:r.smoothing)||.2,intensity:(null==r?void 0:r.intensity)||5}),this.effectPass=new sN(n,this.effect),e.getComposer().addPass(this.effectPass)}return tr(t,[{key:"addSelection",value:function(t){this.effect.selection.add(t)}},{key:"delSelection",value:function(t){this.effect.selection.delete(t)}},{key:"clearSelection",value:function(){this.effect.selection.clear()}},{key:"dispose",value:function(){this.clearSelection(),this.layer.getComposer().removePass(this.effectPass)}}]),t}(),bN=function(){function t(e,r){Ze(this,t),this.layer=e;var n=e.getCamera(),i=e.getScene(),o=e.getRenderer().context;this.effect=new xN(i,n,{blendFunction:AR,multisampling:Math.min(4,o.capabilities.maxSamples),edgeStrength:r.strength||10,pulseSpeed:0,visibleEdgeColor:r.visibleEdgeColor||"#fff",hiddenEdgeColor:r.hiddenEdgeColor||2230538,height:480,blur:!1,xRay:!0}),this.effect.blurPass.enabled=void 0===r.blurPassState||r.blurPassState,this.effect.blurPass.blurMaterial.kernelSize=r.blurPassValue||5,this.effectPass=new sN(n,this.effect),e.getComposer().addPass(this.effectPass)}return tr(t,[{key:"addSelection",value:function(t){this.effect.selection.add(t)}},{key:"delSelection",value:function(t){this.effect.selection.delete(t)}},{key:"clearSelection",value:function(){this.effect.selection.clear()}},{key:"dispose",value:function(){this.clearSelection(),this.layer.getComposer().removePass(this.effectPass)}}]),t}(),SN=function t(){var e=0,r=document.createElement("div");function n(t){return r.appendChild(t.dom),t}function i(t){for(var n=0;n<r.children.length;n++)r.children[n].style.display=n===t?"block":"none";e=t}r.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",r.addEventListener("click",(function(t){t.preventDefault(),i(++e%r.children.length)}),!1);var o=(performance||Date).now(),s=o,a=0,u=n(new t.Panel("FPS","#0ff","#002")),l=n(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var h=n(new t.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:r,addPanel:n,showPanel:i,begin:function(){o=(performance||Date).now()},end:function(){a++;var t=(performance||Date).now();if(l.update(t-o,200),t>=s+1e3&&(u.update(1e3*a/(t-s),100),s=t,a=0,h)){var e=performance.memory;h.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){o=this.end()},domElement:r,setMode:i}};SN.Panel=function(t,e,r){var n=1/0,i=0,o=Math.round,s=o(window.devicePixelRatio||1),a=80*s,u=48*s,l=3*s,h=2*s,c=3*s,f=15*s,p=74*s,d=30*s,g=document.createElement("canvas");g.width=a,g.height=u,g.style.cssText="width:80px;height:48px";var A=g.getContext("2d");return A.font="bold "+9*s+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=r,A.fillRect(0,0,a,u),A.fillStyle=e,A.fillText(t,l,h),A.fillRect(c,f,p,d),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(c,f,p,d),{dom:g,update:function(u,y){n=Math.min(n,u),i=Math.max(i,u),A.fillStyle=r,A.globalAlpha=1,A.fillRect(0,0,a,f),A.fillStyle=e,A.fillText(o(u)+" "+t+" ("+o(n)+"-"+o(i)+")",l,h),A.drawImage(g,c+s,f,p-s,d,c,f,p-s,d),A.fillRect(c+p-s,f,s,d),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(c+p-s,f,s,o((1-u/y)*d))}}};var BN={radius:40,altitude:0},MN=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),Array.isArray(e)||(e=[e]);var l=rx(e);a=r.call(this),i=t.Util.extend({center:l,layer:s},BN,i),a._initOptions(i);for(var h=s.coordinateToVector3(l),c=new u.Vector3(0,0,0),f=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1]),p=i.height,d=[],g=0,A=e.length;g<A;g++)if(g!==e.length-1){var y=e[g][0],v=e[g][1],m=p,_=e[g+1][0],I=e[g+1][1],E=p,x=s.distanceToVector3(m,m).x,w=s.coordinateToVector3([y,v],x),C=s.distanceToVector3(E,E).x,b=s.coordinateToVector3([_,I],C),S=new Float32Array(12);c.x=w.x,c.y=w.y,c.z=w.z,c.sub(h),S[0]=c.x,S[1]=c.y,S[2]=c.z,S[6]=c.x,S[7]=c.y,S[8]=0,c.x=b.x,c.y=b.y,c.z=b.z,c.sub(h),S[3]=c.x,S[4]=c.y,S[5]=c.z,S[9]=c.x,S[10]=c.y,S[11]=0;var B=new u.BufferGeometry;B.setAttribute("position",new u.BufferAttribute(S,3)),B.setAttribute("normal",new u.BufferAttribute(f,3)),B.setIndex([0,2,1,2,3,1]),d.push(B)}var M=WE(d);a._createMesh(M,o);var T=s.distanceToVector3(0,0).x,L=s.coordinateToVector3(l,T);return a.getObject3d().position.copy(L),a._data=i.data,a}return tr(n)}(),TN=function(){function t(e,r,n,i){Ze(this,t),this.map=n.map,this.threelayer=n,this.groupId=i,this.clickFunc=r.clickFunc;var o=new u.MeshBasicMaterial({side:u.DoubleSide,transparent:!0,opacity:r.opacity||.8,color:r.color||"#FF0000"}),s=new MN(e[0].coordinates,{height:r.height||400,data:e},o,n);this.groupId?this.threelayer.addMesh1(s,this.groupId):this.threelayer.addMesh(s),this.mesh=s,this._bindMapEvents()}return tr(t,[{key:"_bindMapEvents",value:function(){this.mesh&&this.mesh.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.mesh&&this.mesh.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){var e=t.target._data;"click"===t.type&&e&&this.clickFunc&&this.clickFunc(e)}},{key:"hide",value:function(){this.mesh.hide()}},{key:"show",value:function(){this.mesh.show()}},{key:"dispose",value:function(){this._closeEvent(),this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose(),this.mesh.object3d.material&&this.mesh.object3d.material.dispose()}}]),t}(),LN=function(t){rr(r,je);var e=ur(r);function r(t){var n;return Ze(this,r),(n=e.call(this,t)).type=Dt,n}return tr(r,[{key:"parse",value:function(t){var e=function(t,e){switch(t){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(e||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(e||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(e||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(e||""))}},r=function(t,e,r){e=e||1024;for(var n=t.pos,i=-1,o=0,s="",a=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));0>(i=a.indexOf("\n"))&&o<e&&n<t.byteLength;)s+=a,o+=a.length,n+=128,a+=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));return-1<i&&(!1!==r&&(t.pos+=o+i+1),s+a.slice(0,i))},n=function(t,e,r,n){var i=t[e+3],o=Math.pow(2,i-128)/255;r[n+0]=t[e+0]*o,r[n+1]=t[e+1]*o,r[n+2]=t[e+2]*o,r[n+3]=1},i=function(t,e,r,n){var i=t[e+3],o=Math.pow(2,i-128)/255;r[n+0]=Ve.toHalfFloat(Math.min(t[e+0]*o,65504)),r[n+1]=Ve.toHalfFloat(Math.min(t[e+1]*o,65504)),r[n+2]=Ve.toHalfFloat(Math.min(t[e+2]*o,65504)),r[n+3]=Ve.toHalfFloat(1)},o=new Uint8Array(t);o.pos=0;var s,a,u,l=function(t){var n,i,o=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,u=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,l={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for((t.pos>=t.byteLength||!(n=r(t)))&&e(1,"no header found"),(i=n.match(/^#\?(\S+)/))||e(3,"bad initial token"),l.valid|=1,l.programtype=i[1],l.string+=n+"\n";!1!==(n=r(t));)if(l.string+=n+"\n","#"!==n.charAt(0)){if((i=n.match(o))&&(l.gamma=parseFloat(i[1])),(i=n.match(s))&&(l.exposure=parseFloat(i[1])),(i=n.match(a))&&(l.valid|=2,l.format=i[1]),(i=n.match(u))&&(l.valid|=4,l.height=parseInt(i[1],10),l.width=parseInt(i[2],10)),2&l.valid&&4&l.valid)break}else l.comments+=n+"\n";return 2&l.valid||e(3,"missing format specifier"),4&l.valid||e(3,"missing image size specifier"),l}(o),h=l.width,c=l.height,f=function(t,r,n){var i=r;if(i<8||i>32767||2!==t[0]||2!==t[1]||128&t[2])return new Uint8Array(t);i!==(t[2]<<8|t[3])&&e(3,"wrong scanline width");var o=new Uint8Array(4*r*n);o.length||e(4,"unable to allocate buffer space");for(var s=0,a=0,u=4*i,l=new Uint8Array(4),h=new Uint8Array(u),c=n;c>0&&a<t.byteLength;){a+4>t.byteLength&&e(1),l[0]=t[a++],l[1]=t[a++],l[2]=t[a++],l[3]=t[a++],2==l[0]&&2==l[1]&&(l[2]<<8|l[3])==i||e(3,"bad rgbe scanline format");for(var f=0,p=void 0;f<u&&a<t.byteLength;){var d=(p=t[a++])>128;if(d&&(p-=128),(0===p||f+p>u)&&e(3,"bad scanline data"),d)for(var g=t[a++],A=0;A<p;A++)h[f++]=g;else h.set(t.subarray(a,a+p),f),f+=p,a+=p}for(var y=i,v=0;v<y;v++){var m=0;o[s]=h[v+m],m+=i,o[s+1]=h[v+m],m+=i,o[s+2]=h[v+m],m+=i,o[s+3]=h[v+m],s+=4}c--}return o}(o.subarray(o.pos),h,c);switch(this.type){case Pt:u=f.length/4;for(var p=new Float32Array(4*u),d=0;d<u;d++)n(f,4*d,p,4*d);s=p,a=Pt;break;case Dt:u=f.length/4;for(var g=new Uint16Array(4*u),A=0;A<u;A++)i(f,4*A,g,4*A);s=g,a=Dt;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:h,height:c,data:s,header:l.string,gamma:l.gamma,exposure:l.exposure,type:a}}},{key:"setDataType",value:function(t){return this.type=t,this}},{key:"load",value:function(t,e,n,i){return hr(nr(r.prototype),"load",this).call(this,t,(function(t,r){switch(t.type){case Pt:case Dt:t.colorSpace=_,t.minFilter=P,t.magFilter=P,t.generateMipmaps=!1,t.flipY=!0}e&&e(t,r)}),n,i)}}]),r}(),RN="__webglFramebuffer",NN=new u.Vector4,PN={bloom:!0},DN=1*u.REVISION>154?Math.PI:1;function kN(t,e){if(t){t.layers&&t.layers.set(e);var r=t.children;if(r&&r.length)for(var n=0,i=r.length;n<i;n++)kN(r[n],e)}}qe.prototype.renderScene=function(t){if(this.layer._callbackBaseObjectAnimation(),this._syncCamera(),t&&t.renderTarget){var e=t.renderTarget.fbo,r=e.width,n=e.height;this._renderTarget?(this._renderTarget.viewport.set(0,0,r,n),this._renderTarget.scissor.set(0,0,r,n)):(this._renderTarget=new u.WebGLRenderTarget(r,n,{depthBuffer:!1}),this.context.setRenderTarget(this._renderTarget),this.context.render(this.scene,this.camera));var i=this.context.properties.get(this._renderTarget),o=i[RN];i[RN]=t.renderTarget.getFramebuffer(t.renderTarget.fbo),this.context.setRenderTarget(this._renderTarget);var s=1===t.bloom&&t.sceneFilter,a=this.scene.children||[],l=!1;if(s){var h=t.sceneFilter;l=h(PN);for(var c=0,f=a.length;c<f;c++)if(a[c]&&a[c].layers){var p=a[c].__parent;a[c].bloom=!1,p&&(a[c].bloom=p.bloom);var d=0;(a[c]&&h(a[c])||!p)&&l&&(d=1),a[c].__layer!==d&&(kN(a[c],d),a[c].__layer=d)}}else for(var g=0,A=a.length;g<A;g++)a[g]&&a[g].layers&&0!==a[g].__layer&&(kN(a[g],0),a[g].__layer=0);this.camera.layers.set(l?1:0),this.context.render(this.scene,this.camera),i[RN]=o}else{var y=this.canvas,v=y.width,m=y.height,_=this.context.getViewport(NN);_.width===v&&_.height===m||this.context.setViewport(0,0,v,m),this.context.render(this.scene,this.camera),this.layer.updateComposer()}this.context.setRenderTarget(null),this.completeRender()},Ye.prototype.initEnvironment=function(t){var e=this.getScene(),r=(new LN).load(t,(function(){r.mapping=u.EquirectangularReflectionMapping,e.environment=r}))},Ye.prototype.initBloom=function(){var t=this.getThreeRenderer(),e=this.getScene(),r=this.getCamera();this.composer=new class{constructor(t=null,{depthBuffer:e=!0,stencilBuffer:r=!1,multisampling:n=0,frameBufferType:i}={}){this.renderer=null,this.inputBuffer=this.createBuffer(e,r,i,n),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new ZR,this.depthTexture=null,this.passes=[],this.timer=new class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(t){"undefined"!=typeof document&&void 0!==document.hidden&&(t?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=t)}get delta(){return this._delta*fN}get fixedDelta(){return this._fixedDelta*fN}set fixedDelta(t){this._fixedDelta=1e3*t}get elapsed(){return this._elapsed*fN}update(t){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(void 0!==t?t:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}handleEvent(t){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},this.autoRenderToScreen=!0,this.setRenderer(t)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(t){const e=this.inputBuffer,r=this.multisampling;r>0&&t>0?(this.inputBuffer.samples=t,this.outputBuffer.samples=t,this.inputBuffer.dispose(),this.outputBuffer.dispose()):r!==t&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(e.depthBuffer,e.stencilBuffer,e.texture.type,t),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(t){if(this.renderer=t,null!==t){const e=t.getSize(new S),r=t.getContext().getContextAttributes().alpha,n=this.inputBuffer.texture.type;n===kt&&kR(t)===IR&&(FR(this.inputBuffer.texture,IR),FR(this.outputBuffer.texture,IR),this.inputBuffer.dispose(),this.outputBuffer.dispose()),t.autoClear=!1,this.setSize(e.width,e.height);for(const e of this.passes)e.initialize(t,r,n)}}replaceRenderer(t,e=!0){const r=this.renderer,n=r.domElement.parentNode;return this.setRenderer(t),e&&null!==n&&(n.removeChild(r.domElement),n.appendChild(t.domElement)),r}createDepthTexture(){const t=this.depthTexture=new me;return this.inputBuffer.depthTexture=t,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(t.format=_e,t.type=Ie):t.type=Ee,t}deleteDepthTexture(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const t of this.passes)t.setDepthTexture(null)}}createBuffer(t,e,r,n){const i=this.renderer,o=null===i?new S:i.getDrawingBufferSize(new S),s={minFilter:P,magFilter:P,stencilBuffer:e,depthBuffer:t,type:r},a=new xe(o.width,o.height,s);return n>0&&(a.ignoreDepthForMultisampleCopy=!1,a.samples=n),r===kt&&kR(i)===IR&&FR(a.texture,IR),a.texture.name="EffectComposer.Buffer",a.texture.generateMipmaps=!1,a}setMainScene(t){for(const e of this.passes)e.mainScene=t}setMainCamera(t){for(const e of this.passes)e.mainCamera=t}addPass(t,e){const r=this.passes,n=this.renderer,i=n.getDrawingBufferSize(new S),o=n.getContext().getContextAttributes().alpha,s=this.inputBuffer.texture.type;if(t.setRenderer(n),t.setSize(i.width,i.height),t.initialize(n,o,s),this.autoRenderToScreen&&(r.length>0&&(r[r.length-1].renderToScreen=!1),t.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==e?r.splice(e,0,t):r.push(t),this.autoRenderToScreen&&(r[r.length-1].renderToScreen=!0),t.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){const e=this.createDepthTexture();for(t of r)t.setDepthTexture(e)}else t.setDepthTexture(this.depthTexture)}removePass(t){const e=this.passes,r=e.indexOf(t);if(-1!==r&&e.splice(r,1).length>0){if(null!==this.depthTexture){const r=(t,e)=>t||e.needsDepthTexture;e.reduce(r,!1)||(t.getDepthTexture()===this.depthTexture&&t.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&r===e.length&&(t.renderToScreen=!1,e.length>0&&(e[e.length-1].renderToScreen=!0))}}removeAllPasses(){const t=this.passes;this.deleteDepthTexture(),t.length>0&&(this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!1),this.passes=[])}render(t){const e=this.renderer,r=this.copyPass;let n,i,o,s=this.inputBuffer,a=this.outputBuffer,u=!1;void 0===t&&(this.timer.update(),t=this.timer.delta);for(const l of this.passes)l.enabled&&(l.render(e,s,a,t,u),l.needsSwap&&(u&&(r.renderToScreen=l.renderToScreen,n=e.getContext(),i=e.state.buffers.stencil,i.setFunc(n.NOTEQUAL,1,4294967295),r.render(e,s,a,t,u),i.setFunc(n.EQUAL,1,4294967295)),o=s,s=a,a=o),l instanceof lN?u=!0:l instanceof $R&&(u=!1))}setSize(t,e,r){const n=this.renderer,i=n.getSize(new S);void 0!==t&&void 0!==e||(t=i.width,e=i.height),i.width===t&&i.height===e||n.setSize(t,e,r);const o=n.getDrawingBufferSize(new S);this.inputBuffer.setSize(o.width,o.height),this.outputBuffer.setSize(o.width,o.height);for(const t of this.passes)t.setSize(o.width,o.height)}reset(){const t=this.timer.autoReset;this.dispose(),this.autoRenderToScreen=!0,this.timer.autoReset=t}dispose(){for(const t of this.passes)t.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}}(t,{frameBufferType:u.HalfFloatType}),this.composer.addPass(new rN(e,r))},Ye.prototype.delComposer=function(){var t;null===(t=this.composer)||void 0===t||t.dispose()},Ye.prototype.updateComposer=function(){var t;null===(t=this.composer)||void 0===t||t.render()},Ye.prototype.getComposer=function(){return this.composer},Ye.prototype._recursionMesh=function(t){for(;t&&t.parent!==this.getScene()&&!t.parent.customType;)t=t.parent;return t},Ye.prototype.identify=function(e,r){var n=this;if(!e)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(e)&&(e=new t.Coordinate(e)),!(e instanceof t.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var i=this.getMap().coordToContainerPoint(e);this._containerPoint=i;var o=i.x,s=i.y;this._initRaycaster(),this.fire("identify",{coordinate:e,options:r});var a=this._raycaster,l=this._mouse,h=this.getCamera(),c=this.getScene(),f=this.getMap().getSize();if(!c)return[];var p=f.width,d=f.height;l.x=o/p*2-1,l.y=-s/d*2+1,a.setFromCamera(l,h),a.layers&&a.layers.enableAll&&a.layers.enableAll(),function(t,e){t.linePrecision=e}(a,this._getLinePrecision(this.getMap().getResolution()));var g=[],A=[];c.children.forEach((function(e){var r=e.__parent;if(r&&r.getOptions){var n=r;n.getOptions().interactive&&n.isVisible()&&(n.identify&&t.Util.isFunction(n.identify)?A.push(n):g.push(e))}else(e instanceof u.Mesh||e instanceof u.Group)&&e.customType&&e.children.forEach((function(e){var r=e.__parent;if(r&&r.getOptions){var n=r;n.getOptions().interactive&&n.isVisible()&&(n.identify&&t.Util.isFunction(n.identify)?A.push(n):g.push(e))}}))}));var y=[],v=a.intersectObjects(g,!0);v&&Array.isArray(v)&&v.length&&(y=v.map((function(e){var r=e.object,i=e.instanceId,o=(r=n._recursionMesh(r)||{}).__parent||r;return o.faceIndex=e.faceIndex,o.index=e.index,o.intersect=e,t.Util.isNumber(i)&&(o.instanceId=i),o}))),this.renderPickScene(),A.length&&A.forEach((function(t){t.identify(e)&&y.push(t)}));for(var m=y.length,_=0;_<m;_++)if(y[_])for(var I=_+1;I<m;I++)y[_]===y[I]&&y.splice(I,1);var E=(r=t.Util.extend({},r)).count;return t.Util.isNumber(E)&&E>0?y.slice(0,E):y},Ye.prototype._zoomend=function(){var e=this.getScene();if(e){var r=this.getMap().getZoom();e.children.forEach((function(e){if(e.customType)e.children.forEach((function(e){var n=e.__parent;if(n&&n.getOptions){var i=n;i.zoomChange&&t.Util.isFunction(i.zoomChange)&&i.zoomChange(r);var o=i.getMinZoom(),s=i.getMaxZoom();r<o||r>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=r&&r<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}));else{var n=e.__parent;if(n&&n.getOptions){var i=n;i.zoomChange&&t.Util.isFunction(i.zoomChange)&&i.zoomChange(r);var o=i.getMinZoom(),s=i.getMaxZoom();r<o||r>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=r&&r<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}}))}},Ye.prototype.addMesh1=function(t,e){var r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=void 0;if(e&&(o=i.getObjectByProperty("customId",e)),t.forEach((function(t){if(t instanceof He){var e;if(o)o.add(t.getObject3d());else console.log("组不存在,销毁创建的对象"),null===(e=t.parent)||void 0===e||e.dispose();t.isAdd||(t.isAdd=!0,t.options.layer=r,t._fire("add",{target:t}))}})),this._zoomend(),n){var s=this._getRenderer();s&&s.setToRedraw()}return this},Ye.prototype.removeMesh1=function(e,r){var n=this,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return this;Array.isArray(e)||(e=[e]);var o=this.getScene(),s=o.getObjectByProperty("customId",r);if(e.forEach((function(e){if(e instanceof He){s?s.remove(e.getObject3d()):o.remove(e.getObject3d()),e.isAdd&&(e.isAdd=!1,e._fire("remove",{target:e})),e._animation&&t.Util.isFunction(e._animation)&&delete n._animationBaseObjectMap[e.getObject3d().uuid];var r=n._delayMeshes;if(r.length)for(var i=0,a=r.length;i<a;i++)if(r[i]===e){r.splice(i,1);break}}else e instanceof u.Object3D&&o.remove(e)})),i){var a=this._getRenderer();a&&a.setToRedraw()}return this};var FN=function(){function t(e,r,n){var i=this;Ze(this,t),this.map=r,this.animationId=null,this.updatables=[];var o=ZE();this.threeLayer=new Ye(o,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new u.Clock;var s=function t(){i.threeLayer._needsUpdate=!i.threeLayer._needsUpdate,i.threeLayer._needsUpdate&&i.threeLayer.redraw();var e,r=i.clock.getDelta(),n=yr(i.updatables);try{for(n.s();!(e=n.n()).done;){e.value.tick(r)}}catch(t){n.e(t)}finally{n.f()}i.statsFlag&&i.stats.update(),i.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new u.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),s()},this.threeLayer.addTo(r),this.layerId=o,this.layerName=e,this.dirty=!1,this.initFlag=!1,this.bloomFlag=n||!1,this.bloomStrength=null==n?void 0:n.bloomStrength,this.bloomThreshold=null==n?void 0:n.bloomThreshold,this.bloomRadius=null==n?void 0:n.bloomRadius,this.hdrPath=null==n?void 0:n.hdrPath,this.stats=new SN,this.stats.dom.style.display="none",document.body.appendChild(this.stats.dom),this.statsFlag=!1}var e;return tr(t,[{key:"createGroup",value:(e=Ke(Xe().mark((function t(e){return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,$E(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new zM(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=ZE();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function e(){t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate&&t.threeLayer.redraw();var r,n=t.clock.getDelta(),i=yr(t.updatables);try{for(i.s();!(r=i.n()).done;){r.value.tick(n)}}catch(t){i.e(t)}finally{i.f()}t.statsFlag&&t.stats.update(),t.animationId=requestAnimationFrame(e)};return new Promise((function(r){var n=t;t.threeLayer.prepareToDraw=function(t,i,o){n.hdrPath&&this.initEnvironment(n.hdrPath);var s=new u.DirectionalLight(16777215,1*DN);s.position.set(0,-10,10).normalize(),i.add(s),i.add(new u.AmbientLight(16777215,1*DN)),e(),this.initBloom(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new wx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new wx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar1",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Cx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Cx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar2",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar3",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Sx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Sx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new Tx(t,e,r||{},i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new Tx(t,e,r||{},i.threeLayer,n);o(s)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Px(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Px(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new Ix(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new Ix(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new shockEffect(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new shockEffect(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPoybyHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new TN(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new TN(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new ew(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new ew(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new QM(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new QM(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new GM(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new GM(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new GT(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new GT(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new VT(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new VT(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new HT(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new HT(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawBloomLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new UL(t,e,n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new UL(t,e,n.threeLayer,r);i(o)}))}))}},{key:"createBloomClass",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new CN(e.threeLayer,t);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new CN(e.threeLayer,t);r(n)}))}))}},{key:"createOutlineBloom",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new bN(e.threeLayer,t);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new bN(e.threeLayer,t);r(n)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new WT(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new WT(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new kL(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new kL(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ZT(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ZT(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _L(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _L(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bL(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bL(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new xL(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new xL(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new LL(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new LL(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripHeight1",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new RL(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new RL(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new NL(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new NL(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new OL(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new OL(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"setStateFlag",value:function(){this.statsFlag=!this.statsFlag,this.statsFlag?this.stats.dom.style.display="":this.stats.dom.style.display="none"}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.delComposer(),this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]),t}(),QN=function(){function t(e,r){var n=this;Ze(this,t),this.map=r,this.animationId=null,this.updatables=[];var i=ZE();this.threeLayer=new Ye(i,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new u.Clock;var o=function t(){var e;(n.threeLayer._needsUpdate=!n.threeLayer._needsUpdate,n.threeLayer._needsUpdate)&&(null===(e=n.threeLayer)||void 0===e||null===(e=e.getRenderer())||void 0===e||e.clearCanvas(),n.threeLayer.renderScene());var r,i=n.clock.getDelta(),o=yr(n.updatables);try{for(o.s();!(r=o.n()).done;){r.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}n.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new u.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),o()},this.threeLayer.addTo(r),this.layerId=i,this.layerName=e,this.dirty=!1,this.initFlag=!1}var e;return tr(t,[{key:"createGroup",value:(e=Ke(Xe().mark((function t(e){return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,$E(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new zM(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=ZE();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function e(){var r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(r=t.threeLayer)||void 0===r||null===(r=r.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var n,i=t.clock.getDelta(),o=yr(t.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(r){t.threeLayer.prepareToDraw=function(t,n,i){var o=new u.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),n.add(o),n.add(new u.AmbientLight(16777215)),e(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new wx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new wx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Tx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Tx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Px(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Px(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new Ix(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new Ix(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new Fx(t,e||{},r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new Fx(t,e||{},r.threeLayer,r);n(i)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new ew(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new ew(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new QM(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new QM(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new GM(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new GM(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new GT(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new GT(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new VT(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new VT(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new HT(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new HT(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new WT(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new WT(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new kL(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new kL(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ZT(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ZT(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _L(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _L(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bL(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bL(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new xL(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new xL(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new LL(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new LL(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new NL(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new NL(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new OL(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new OL(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]),t}(),ON=function(){function e(r,n,i,o){Ze(this,e),this.map=o,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new t.DrawTool({mode:r,symbol:{lineColor:i.lineColor||"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:i.polygonFill||"#E40D56",polygonOpacity:.2}}).addTo(this.map).enable(),this._bindEvent(),this._drawEnd=n,this.mode=r,this.toolLayer=new t.VectorLayer(t.Util.GUID(),{geometryEvents:!1,hitDetect:!1}).addTo(this.map),this.geometry&&(this.toolLayer.addGeometry(this.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(this.geometry.getCoordinates(),this.geometry.getRadius()):this._drawEnd(this.geometry.getCoordinates()))),i.zIndex&&this.toolLayer.setZIndex(i.zIndex),this.type="drawTool"}return tr(e,[{key:"getZIndex",value:function(){this.toolLayer&&this.toolLayer.getZIndex()}},{key:"setZIndex",value:function(t){this.toolLayer&&this.toolLayer.setZIndex(t)}},{key:"selectGeometryByPoint",value:function(){this.map.on("click",this._selectGeometry,this)}},{key:"endSelect",value:function(){this.toolLayer&&this.selectGeometry&&(this._changeSymbol(!1),this.selectGeometry.endEdit(),this.selectGeometry=null),this.map.off("click",this._selectGeometry,this)}},{key:"_selectGeometry",value:function(t){if(this.disableTool(),this.toolLayer){var e=this.toolLayer.identify(t.coordinate);this.selectGeometry&&(this.selectGeometry.endEdit(),this._changeSymbol(!1)),e&&(this.selectGeometry=e[0]),this.selectGeometry&&this._changeSymbol(!0)}}},{key:"_closeMapEvent",value:function(){this.map.off("click",this._selectGeometry,this)}},{key:"_changeSymbol",value:function(t){t?this.selectGeometry.setSymbol({lineColor:"#00ffff",lineWidth:2,lineDasharray:[5,5],polygonFill:"#00ffff",polygonOpacity:.2}):this.selectGeometry.setSymbol({lineColor:"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:"#E40D56",polygonOpacity:.2})}},{key:"deleteGeometry",value:function(){this.toolLayer&&this.selectGeometry&&(this.selectGeometry.endEdit(),this.toolLayer.removeGeometry(this.selectGeometry))}},{key:"undoDrawGeometry",value:function(){if(this.toolLayer){var t=this.toolLayer.getGeometries();if(t.length<1)return;this.toolLayer.removeGeometry(t[t.length-1])}}},{key:"_bindEvent",value:function(){this.drawTool.on("drawend",this.drawEnd,this)}},{key:"_closeEvent",value:function(){this.drawTool.off("drawend",this.drawEnd,this)}},{key:"drawEnd",value:function(t){this.toolLayer&&this.toolLayer.addGeometry(t.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(t.geometry.getCoordinates(),t.geometry.getRadius()):this._drawEnd(t.geometry.getCoordinates())),this.geometry=t.geometry}},{key:"disableTool",value:function(){this.drawTool.disable()}},{key:"clearGeometry",value:function(){this.toolLayer&&this.toolLayer.clear()}},{key:"setMode",value:function(t,e){this._drawEnd&&delete this._drawEnd,this._drawEnd=e,this.drawTool.setMode(t).enable(),this.mode=t}},{key:"startEdit",value:function(){this.disableTool(),this.selectGeometry&&this.selectGeometry.startEdit()}},{key:"endEdit",value:function(t){this.selectGeometry&&(this.selectGeometry.endEdit(),t&&("Circle"===this.mode?t(this.selectGeometry.getCoordinates(),this.geometry.getRadius()):t(this.selectGeometry.getCoordinates())))}},{key:"dispose",value:function(){this.drawTool&&(this._closeEvent(),this.endEdit(),this.disableTool(),delete this.drawTool),this._drawEnd&&delete this._drawEnd,this.geometry&&delete this.geometry,this.selectGeometry&&delete this.selectGeometry,this.map&&this._closeMapEvent(),this.map.removeLayer(this.toolLayer),delete this.toolLayer}}]),e}();function UN(){this.PI=3.141592653589793,this.x_PI=52.35987755982988,this.a=6378245,this.ee=.006693421622965943,this.EARTHRADIUS=6370996.81,this.MCBAND=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],this.LLBAND=[75,60,45,30,15,0],this.MC2LL=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],this.LL2MC=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],this._transformlat=function(t,e){var r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,r+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},this._transformlng=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,r+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},this._out_of_china=function(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271||!1},this._getLoop=function(t,e,r){for(;t>r;)t-=r-e;for(;t<e;)t+=r-e;return t},this._getRange=function(t,e,r){return null!=e&&(t=Math.max(t,e)),null!=r&&(t=Math.min(t,r)),t}}UN.prototype.BD2GCJ=function(t,e){var r=t-.0065,n=e-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_PI),o=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_PI);return[i*Math.cos(o),i*Math.sin(o)]},UN.prototype.GCJ2BD=function(t,e){var r=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*this.x_PI),n=Math.atan2(e,t)+3e-6*Math.cos(t*this.x_PI);return[r*Math.cos(n)+.0065,r*Math.sin(n)+.006]},UN.prototype.WGS2GCJ=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[t+(n=180*n/(this.a/s*Math.cos(i)*this.PI)),e+r]},UN.prototype.GCJ2WGS=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[2*t-(t+(n=180*n/(this.a/s*Math.cos(i)*this.PI))),2*e-(e+r)]},UN.prototype.WGS2BD=function(t,e){var r=this.WGS2GCJ(t,e);return r=this.GCJ2BD(r[0],r[1])},UN.prototype.BD2WGS=function(t,e){var r=this.BD2GCJ(t,e);return r=this.GCJ2WGS(r[0],r[1])},UN.prototype.BD_MKT2WGS=function(t,e){var r=null;t=Math.abs(t),e=Math.abs(e);for(var n=0;n<this.MCBAND.length;n++)if(e>=this.MCBAND[n]){r=this.MC2LL[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]},UN.prototype.BD_WGS2MKT=function(t,e){var r=null;t=this._getLoop(t,-180,180),e=this._getRange(e,-74,74);for(var n=0;n<this.LLBAND.length;n++)if(e>=this.LLBAND[n]){r=this.LL2MC[n];break}if(null!=r)for(n=this.LLBAND.length-1;n>=0;n--)if(e<=-this.LLBAND[n]){r=this.LL2MC[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]};var GN=function(){function e(r,n,i){Ze(this,e),this.map=n,this.overlayer=new t.VectorLayer("overLayer",{geometryEvents:!1,hitDetect:!1,forceRenderOnMoving:!0,forceRenderOnRotating:!0,enableSimplify:!1}),this.overlayer.addTo(this.map);var o=new t.MultiPolygon(r,{symbol:{polygonFill:i.color||"#000",polygonOpacity:i.opacity||1,lineWidth:0}});this.overlayer.addGeometry(o)}return tr(e,[{key:"dispose",value:function(){this.map.removeLayer(this.overlayer),delete this.toolLayer}}]),e}();
|
|
156
|
+
***************************************************************************** */function Od(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var Ud=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function Gd(t,e){return t>e?1:t<e?-1:0}function zd(t,e,r){for(var n=new Ud(null,null),i=n,o=n;;){var s=r(t,e.key);if(s<0){if(null===e.left)break;if(r(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(r(t,e.right.key)>0){a=e.right;if(e.right=a.left,a.left=e,null===(e=a).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function jd(t,e,r,n){var i=new Ud(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=zd(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function Vd(t,e,r){var n=null,i=null;if(e){var o=r((e=zd(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function Hd(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&Hd(t.left,o,!1,n,i),t.right&&Hd(t.right,o,!0,n,i)}}var qd=function(){function t(t){void 0===t&&(t=Gd),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=jd(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new Ud(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=zd(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=zd(t,e,r)).key)?(null===e.left?n=e.right:(n=zd(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=zd(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=zd(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,r=[],n=!1,i=new Ud(null,null),o=i;for(;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&Wd(t,e,0,n-1,i),null===this._root)this._root=Yd(t,e,0,n),this._size=n;else{var o=function(t,e,r){var n=new Ud(null,null),i=n,o=t,s=e;for(;null!==o&&null!==s;)r(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;null!==o?i.next=o:null!==s&&(i.next=s);return n.next}(this.toList(),function(t,e){for(var r=new Ud(null,null),n=r,i=0;i<t.length;i++)n=n.next=new Ud(t[i],e[i]);return n.next=null,r.next}(t,e),i);n=this._size+n,this._root=Xd({head:o},0,n)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return Hd(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=Vd(t,this._root,n),o=i.left,s=i.right;n(t,e)<0?s=jd(e,r,s,n):o=jd(e,r,o,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=zd(t.key,e,r)).left=t),e)}(o,s,n)},t.prototype.split=function(t){return Vd(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t,e,r;return Od(this,(function(n){switch(n.label){case 0:t=this._root,e=[],r=!1,n.label=1;case 1:return r?[3,6]:null===t?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return 0===e.length?[3,4]:[4,t=e.pop()];case 3:return n.sent(),t=t.right,[3,5];case 4:r=!0,n.label=5;case 5:return[3,1];case 6:return[2]}}))},t}();function Yd(t,e,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),s=t[o],a=e[o],u=new Ud(s,a);return u.left=Yd(t,e,r,o),u.right=Yd(t,e,o+1,n),u}return null}function Xd(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=Xd(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=Xd(t,i+1,r),s}return null}function Wd(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,a=n+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}Wd(t,e,r,a,i),Wd(t,e,a+1,n,i)}}function Jd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Kd(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Zd(t,e,r){return e&&Kd(t.prototype,e),r&&Kd(t,r),t}var $d=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},tg=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},eg=Number.EPSILON;void 0===eg&&(eg=Math.pow(2,-52));var rg=eg*eg,ng=function(t,e){if(-eg<t&&t<eg&&-eg<e&&e<eg)return 0;var r=t-e;return r*r<rg*t*e?0:t<e?-1:1},ig=function(){function t(){Jd(this,t),this.reset()}return Zd(t,[{key:"reset",value:function(){this.xRounder=new og,this.yRounder=new og}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),og=function(){function t(){Jd(this,t),this.tree=new qd,this.round(0)}return Zd(t,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===ng(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===ng(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),t}(),sg=new ig,ag=function(t,e){return t.x*e.y-t.y*e.x},ug=function(t,e){return t.x*e.x+t.y*e.y},lg=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=ag(n,i);return ng(o,0)},hg=function(t){return Math.sqrt(ug(t,t))},cg=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return ug(i,n)/hg(i)/hg(n)},fg=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},pg=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},dg=function(){function t(e,r){Jd(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return Zd(t,null,[{key:"compare",value:function(e,r){var n=t.comparePoints(e.point,r.point);return 0!==n?n:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:Ag.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),Zd(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&(r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,a,u,l=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=l.point,a={x:o.x-i.x,y:o.y-i.y},u={x:s.x-i.x,y:s.y-i.y},ag(u,a)/hg(u)/hg(a)),cosine:cg(e.point,t.point,l.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,a=r.get(e),u=a.sine,l=a.cosine;return o>=0&&u>=0?s<l?1:s>l?-1:0:o<0&&u<0?s<l?-1:s>l?1:0:u<o?-1:u>o?1:0}}}]),t}(),gg=0,Ag=function(){function t(e,r,n,i){Jd(this,t),this.id=++gg,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return Zd(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(r<n){if(a<s&&a<u)return 1;if(a>s&&a>u)return-1;var h=t.comparePoint(e.leftSE.point);if(h<0)return 1;if(h>0)return-1;var c=e.comparePoint(t.rightSE.point);return 0!==c?c:-1}if(r>n){if(s<a&&s<l)return-1;if(s>a&&s>l)return 1;var f=e.comparePoint(t.leftSE.point);if(0!==f)return f;var p=t.comparePoint(e.rightSE.point);return p<0?1:p>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var d=e.comparePoint(t.rightSE.point);if(0!==d)return d}if(i>o){var g=t.comparePoint(e.rightSE.point);if(g<0)return 1;if(g>0)return-1}if(i!==o){var A=u-s,y=i-r,v=l-a,m=o-n;if(A>y&&v<m)return 1;if(A<y&&v>m)return-1}return i>o?1:i<o||u<l?-1:u>l?1:t.id<e.id?-1:t.id>e.id?1:0}}]),Zd(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,a=e.y+s*n.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=tg(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=$d(e,s)&&0===this.comparePoint(s),l=$d(r,i)&&0===t.comparePoint(i),h=$d(e,a)&&0===this.comparePoint(a),c=$d(r,o)&&0===t.comparePoint(o);if(l&&u)return c&&!h?o:!c&&h?a:null;if(l)return h&&i.x===a.x&&i.y===a.y?null:i;if(u)return c&&o.x===s.x&&o.y===s.y?null:s;if(c&&h)return null;if(c)return o;if(h)return a;var f=function(t,e,r,n){if(0===e.x)return pg(r,n,t.x);if(0===n.x)return pg(t,e,r.x);if(0===e.y)return fg(r,n,t.y);if(0===n.y)return fg(t,e,r.y);var i=ag(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=ag(o,e)/i,a=ag(o,n)/i;return{x:(t.x+a*e.x+(r.x+s*n.x))/2,y:(t.y+a*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===f?null:$d(n,f)?sg.round(f.x,f.y):null}},{key:"split",value:function(e){var r=[],n=void 0!==e.events,i=new dg(e,!0),o=new dg(e,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return dg.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),dg.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var r=this,n=e;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=t.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var a=0,u=n.rings.length;a<u;a++){var l=n.rings[a],h=n.windings[a],c=r.rings.indexOf(l);-1===c?(r.rings.push(l),r.windings.push(h)):r.windings[c]+=h}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),r.push(a)):r[u]+=a}for(var l=[],h=[],c=0,f=e.length;c<f;c++)if(0!==r[c]){var p=e[c],d=p.poly;if(-1===h.indexOf(d))if(p.isExterior)l.push(d);else{-1===h.indexOf(d)&&h.push(d);var g=l.indexOf(p.poly);-1!==g&&l.splice(g,1)}}for(var A=0,y=l.length;A<y;A++){var v=l[A].multiPoly;-1===n.indexOf(v)&&n.push(v)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Sg.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===Sg.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat(Sg.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,n){var i,o,s,a=dg.comparePoints(e,r);if(a<0)i=e,o=r,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,s=-1}return new t(new dg(i,!0),new dg(o,!1),[n],[s])}}]),t}(),yg=function(){function t(e,r,n){if(Jd(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=sg.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if("number"!=typeof e[s][0]||"number"!=typeof e[s][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=sg.round(e[s][0],e[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(Ag.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(Ag.fromRing(o,i,this))}return Zd(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),t}(),vg=function(){function t(e,r){if(Jd(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new yg(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var n=1,i=e.length;n<i;n++){var o=new yg(e[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return Zd(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),mg=function(){function t(e,r){if(Jd(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=e.length;n<i;n++){var o=new vg(e[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return Zd(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),_g=function(){function t(e){Jd(this,t),this.events=e;for(var r=0,n=e.length;r<n;r++)e[r].segment.ringOut=this;this.poly=null}return Zd(t,null,[{key:"factory",value:function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,l=[a],h=a.point,c=[];s=a,a=u,l.push(a),a.point!==h;)for(;;){var f=a.getAvailableLinkedEvents();if(0===f.length){var p=l[0].point,d=l[l.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(p.x,",")+" ".concat(p.y,"]. Last matching segment found ends at")+" [".concat(d.x,", ").concat(d.y,"]."))}if(1===f.length){u=f[0].otherSE;break}for(var g=null,A=0,y=c.length;A<y;A++)if(c[A].point===a.point){g=A;break}if(null===g){c.push({index:l.length,point:a.point});var v=a.getLeftmostComparator(s);u=f.sort(v)[0].otherSE;break}var m=c.splice(g)[0],_=l.splice(m.index);_.unshift(_[0].otherSE),r.push(new t(_.reverse()))}r.push(new t(l))}}return r}}]),Zd(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==lg(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===lg(s,t,a)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,l=this.isExteriorRing()?0:e.length-1,h=this.isExteriorRing()?e.length:-1,c=[],f=l;f!=h;f+=u)c.push([e[f].x,e[f].y]);return c}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];dg.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),Ig=function(){function t(e){Jd(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Zd(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),t}(),Eg=function(){function t(e){Jd(this,t),this.rings=e,this.polys=this._composePolys(e)}return Zd(t,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new Ig(i));else{var o=i.enclosingRing();o.poly||e.push(new Ig(o)),o.poly.addInterior(i)}}return e}}]),t}(),xg=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ag.compare;Jd(this,t),this.queue=e,this.tree=new qd(r),this.segments=[]}return Zd(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var l=s.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l)))for(var h=this._splitSafely(s,l),c=0,f=h.length;c<f;c++)r.push(h[c])}var p=null;if(a){var d=a.getIntersection(e);if(null!==d&&(e.isAnEndpoint(d)||(p=d),!a.isAnEndpoint(d)))for(var g=this._splitSafely(a,d),A=0,y=g.length;A<y;A++)r.push(g[A])}if(null!==u||null!==p){var v=null;if(null===u)v=p;else if(null===p)v=u;else{v=dg.comparePoints(u,p)<=0?u:p}this.queue.remove(e.rightSE),r.push(e.rightSE);for(var m=e.split(v),_=0,I=m.length;_<I;_++)r.push(m[_])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var E=s.getIntersection(a);if(null!==E){if(!s.isAnEndpoint(E))for(var x=this._splitSafely(s,E),w=0,C=x.length;w<C;w++)r.push(x[w]);if(!a.isAnEndpoint(E))for(var b=this._splitSafely(a,E),S=0,B=b.length;S<B;S++)r.push(b[S])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),t}(),wg="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Cg="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,bg=function(){function t(){Jd(this,t)}return Zd(t,[{key:"run",value:function(t,e,r){Sg.type=t,sg.reset();for(var n=[new mg(e,!0)],i=0,o=r.length;i<o;i++)n.push(new mg(r[i],!1));if(Sg.numMultiPolys=n.length,"difference"===Sg.type)for(var s=n[0],a=1;a<n.length;)null!==tg(n[a].bbox,s.bbox)?a++:n.splice(a,1);if("intersection"===Sg.type)for(var u=0,l=n.length;u<l;u++)for(var h=n[u],c=u+1,f=n.length;c<f;c++)if(null===tg(h.bbox,n[c].bbox))return[];for(var p=new qd(dg.compare),d=0,g=n.length;d<g;d++)for(var A=n[d].getSweepEvents(),y=0,v=A.length;y<v;y++)if(p.insert(A[y]),p.size>wg)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var m=new xg(p),_=p.size,I=p.pop();I;){var E=I.key;if(p.size===_){var x=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(p.size>wg)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(m.segments.length>Cg)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var w=m.process(E),C=0,b=w.length;C<b;C++){var S=w[C];void 0===S.consumedBy&&p.insert(S)}_=p.size,I=p.pop()}sg.reset();var B=_g.factory(m.segments);return new Eg(B).getGeom()}}]),t}(),Sg=new bg,Bg={union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Sg.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Sg.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Sg.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Sg.run("difference",t,r)}};"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),r=Math.max(Math.min(e.length,9007199254740991),0)||0,n=1 in arguments&&parseInt(Number(arguments[1]),10)||0;n=n<0?Math.max(r+n,0):Math.min(n,r);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:r;for(i=i<0?Math.max(r+arguments[2],0):Math.min(i,r);n<i;)e[n]=t,++n;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var Mg=function(){};Mg.prototype.interfaces_=function(){return[]},Mg.prototype.getClass=function(){return Mg},Mg.prototype.equalsWithTolerance=function(t,e,r){return Math.abs(t-e)<=r};var Tg=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Lg=function(){},Rg={MAX_VALUE:{configurable:!0}};Lg.isNaN=function(t){return Number.isNaN(t)},Lg.doubleToLongBits=function(t){return t},Lg.longBitsToDouble=function(t){return t},Lg.isInfinite=function(t){return!Number.isFinite(t)},Rg.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(Lg,Rg);var Ng=function(){},Pg=function(){},Dg=function(){};function kg(){}var Fg=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},Qg={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};Fg.prototype.setOrdinate=function(t,e){switch(t){case Fg.X:this.x=e;break;case Fg.Y:this.y=e;break;case Fg.Z:this.z=e;break;default:throw new Tg("Invalid ordinate index: "+t)}},Fg.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!Mg.equalsWithTolerance(this.x,e.x,r)&&!!Mg.equalsWithTolerance(this.y,e.y,r)}},Fg.prototype.getOrdinate=function(t){switch(t){case Fg.X:return this.x;case Fg.Y:return this.y;case Fg.Z:return this.z}throw new Tg("Invalid ordinate index: "+t)},Fg.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||Lg.isNaN(this.z))&&Lg.isNaN(t.z)},Fg.prototype.equals=function(t){return t instanceof Fg&&this.equals2D(t)},Fg.prototype.equalInZ=function(t,e){return Mg.equalsWithTolerance(this.z,t.z,e)},Fg.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},Fg.prototype.clone=function(){},Fg.prototype.copy=function(){return new Fg(this)},Fg.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},Fg.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},Fg.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},Fg.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+Fg.hashCode(this.x))+Fg.hashCode(this.y)},Fg.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},Fg.prototype.interfaces_=function(){return[Ng,Pg,kg]},Fg.prototype.getClass=function(){return Fg},Fg.hashCode=function(){if(1===arguments.length){var t=Lg.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},Qg.DimensionalComparator.get=function(){return Og},Qg.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},Qg.NULL_ORDINATE.get=function(){return Lg.NaN},Qg.X.get=function(){return 0},Qg.Y.get=function(){return 1},Qg.Z.get=function(){return 2},Object.defineProperties(Fg,Qg);var Og=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new Tg("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};Og.prototype.compare=function(t,e){var r=t,n=e,i=Og.compare(r.x,n.x);if(0!==i)return i;var o=Og.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:Og.compare(r.z,n.z)},Og.prototype.interfaces_=function(){return[Dg]},Og.prototype.getClass=function(){return Og},Og.compare=function(t,e){return t<e?-1:t>e?1:Lg.isNaN(t)?Lg.isNaN(e)?0:-1:Lg.isNaN(e)?1:0};var Ug=function(){};Ug.prototype.create=function(){},Ug.prototype.interfaces_=function(){return[]},Ug.prototype.getClass=function(){return Ug};var Gg=function(){},zg={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Gg.prototype.interfaces_=function(){return[]},Gg.prototype.getClass=function(){return Gg},Gg.toLocationSymbol=function(t){switch(t){case Gg.EXTERIOR:return"e";case Gg.BOUNDARY:return"b";case Gg.INTERIOR:return"i";case Gg.NONE:return"-"}throw new Tg("Unknown location value: "+t)},zg.INTERIOR.get=function(){return 0},zg.BOUNDARY.get=function(){return 1},zg.EXTERIOR.get=function(){return 2},zg.NONE.get=function(){return-1},Object.defineProperties(Gg,zg);var jg=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Vg=function(){},Hg={LOG_10:{configurable:!0}};Vg.prototype.interfaces_=function(){return[]},Vg.prototype.getClass=function(){return Vg},Vg.log10=function(t){var e=Math.log(t);return Lg.isInfinite(e)||Lg.isNaN(e)?e:e/Vg.LOG_10},Vg.min=function(t,e,r,n){var i=t;return e<i&&(i=e),r<i&&(i=r),n<i&&(i=n),i},Vg.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],r=arguments[2];return t<e?e:t>r?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return n<i?i:n>o?o:n}},Vg.wrap=function(t,e){return t<0?e- -t%e:t%e},Vg.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return n>s&&(s=n),i>s&&(s=i),o>s&&(s=o),s}},Vg.average=function(t,e){return(t+e)/2},Hg.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(Vg,Hg);var qg=function(t){this.str=t};qg.prototype.append=function(t){this.str+=t},qg.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},qg.prototype.toString=function(t){return this.str};var Yg=function(t){this.value=t};Yg.prototype.intValue=function(){return this.value},Yg.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},Yg.isNaN=function(t){return Number.isNaN(t)};var Xg=function(){};Xg.isWhitespace=function(t){return t<=32&&t>=0||127===t},Xg.toUpperCase=function(t){return t.toUpperCase()};var Wg=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else if("string"==typeof arguments[0]){t.call(this,t.parse(arguments[0]))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},Jg={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};Wg.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},Wg.prototype.extractSignificantDigits=function(t,e){var r=this.abs(),n=Wg.magnitude(r._hi),i=Wg.TEN.pow(n);(r=r.divide(i)).gt(Wg.TEN)?(r=r.divide(Wg.TEN),n+=1):r.lt(Wg.ONE)&&(r=r.multiply(Wg.TEN),n-=1);for(var o=n+1,s=new qg,a=Wg.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(r._hi);if(l<0)break;var h=!1,c=0;l>9?(h=!0,c="9"):c="0"+l,s.append(c),r=r.subtract(Wg.valueOf(l)).multiply(Wg.TEN),h&&r.selfAdd(Wg.TEN);var f=!0,p=Wg.magnitude(r._hi);if(p<0&&Math.abs(p)>=a-u&&(f=!1),!f)break}return e[0]=n,s.toString()},Wg.prototype.sqr=function(){return this.multiply(this)},Wg.prototype.doubleValue=function(){return this._hi+this._lo},Wg.prototype.subtract=function(){if(arguments[0]instanceof Wg){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},Wg.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},Wg.prototype.isZero=function(){return 0===this._hi&&0===this._lo},Wg.prototype.selfSubtract=function(){if(arguments[0]instanceof Wg){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},Wg.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},Wg.prototype.min=function(t){return this.le(t)?this:t},Wg.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof Wg){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var r,n,i,o,s=arguments[0],a=arguments[1],u=null,l=null,h=null,c=null;return i=this._hi/s,c=(u=(h=Wg.SPLIT*i)-(u=h-i))*(l=(c=Wg.SPLIT*s)-(l=c-s))-(o=i*s)+u*(n=s-l)+(r=i-u)*l+r*n,c=i+(h=(this._hi-o-c+this._lo-i*a)/s),this._hi=c,this._lo=i-c+h,this}},Wg.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},Wg.prototype.divide=function(){if(arguments[0]instanceof Wg){var t,e,r,n,i=arguments[0],o=null,s=null,a=null,u=null;return t=(r=this._hi/i._hi)-(o=(a=Wg.SPLIT*r)-(o=a-r)),u=o*(s=(u=Wg.SPLIT*i._hi)-(s=u-i._hi))-(n=r*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-n-u+this._lo-r*i._lo)/i._hi,new Wg(u=r+a,r-u+a)}if("number"==typeof arguments[0]){var l=arguments[0];return Lg.isNaN(l)?Wg.createNaN():Wg.copy(this).selfDivide(l,0)}},Wg.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},Wg.prototype.pow=function(t){if(0===t)return Wg.valueOf(1);var e=new Wg(this),r=Wg.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},Wg.prototype.ceil=function(){if(this.isNaN())return Wg.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new Wg(t,e)},Wg.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},Wg.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},Wg.prototype.setValue=function(){if(arguments[0]instanceof Wg){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},Wg.prototype.max=function(t){return this.ge(t)?this:t},Wg.prototype.sqrt=function(){if(this.isZero())return Wg.valueOf(0);if(this.isNegative())return Wg.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=Wg.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},Wg.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof Wg){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,s=arguments[0],a=null;return a=(n=this._hi+s)-(i=n-this._hi),r=(o=(a=s-i+(this._hi-a))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var u,l,h,c,f=arguments[0],p=arguments[1],d=null,g=null,A=null;h=this._hi+f,l=this._lo+p,g=h-(A=h-this._hi),d=l-(c=l-this._lo);var y=(u=h+(A=(g=f-A+(this._hi-g))+l))+(A=(d=p-c+(this._lo-d))+(A+(h-u))),v=A+(u-y);return this._hi=y,this._lo=v,this}},Wg.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof Wg){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var r,n,i=arguments[0],o=arguments[1],s=null,a=null,u=null,l=null;s=(u=Wg.SPLIT*this._hi)-this._hi,l=Wg.SPLIT*i,s=u-s,r=this._hi-s,a=l-i;var h=(u=this._hi*i)+(l=s*(a=l-a)-u+s*(n=i-a)+r*a+r*n+(this._hi*o+this._lo*i)),c=l+(s=u-h);return this._hi=h,this._lo=c,this}},Wg.prototype.selfSqr=function(){return this.selfMultiply(this)},Wg.prototype.floor=function(){if(this.isNaN())return Wg.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new Wg(t,e)},Wg.prototype.negate=function(){return this.isNaN()?this:new Wg(-this._hi,-this._lo)},Wg.prototype.clone=function(){},Wg.prototype.multiply=function(){if(arguments[0]instanceof Wg){var t=arguments[0];return t.isNaN()?Wg.createNaN():Wg.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Lg.isNaN(e)?Wg.createNaN():Wg.copy(this).selfMultiply(e,0)}},Wg.prototype.isNaN=function(){return Lg.isNaN(this._hi)},Wg.prototype.intValue=function(){return Math.trunc(this._hi)},Wg.prototype.toString=function(){var t=Wg.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},Wg.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+Wg.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+Wg.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},Wg.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,s=null,a=null;t=(r=1/this._hi)-(i=(s=Wg.SPLIT*r)-(i=s-r)),o=(a=Wg.SPLIT*this._hi)-this._hi;var u=r+(s=(1-(n=r*this._hi)-(a=i*(o=a-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new Wg(u,r-u+s)},Wg.prototype.toSciNotation=function(){if(this.isZero())return Wg.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=Wg.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},Wg.prototype.abs=function(){return this.isNaN()?Wg.NaN:this.isNegative()?this.negate():new Wg(this)},Wg.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},Wg.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},Wg.prototype.add=function(){if(arguments[0]instanceof Wg){var t=arguments[0];return Wg.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Wg.copy(this).selfAdd(e)}},Wg.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof Wg){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._hi=r,this._lo=n}},Wg.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},Wg.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},Wg.prototype.trunc=function(){return this.isNaN()?Wg.NaN:this.isPositive()?this.floor():this.ceil()},Wg.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},Wg.prototype.interfaces_=function(){return[kg,Ng,Pg]},Wg.prototype.getClass=function(){return Wg},Wg.sqr=function(t){return Wg.valueOf(t).selfMultiply(t)},Wg.valueOf=function(){return"string"==typeof arguments[0]?Wg.parse(arguments[0]):"number"==typeof arguments[0]?new Wg(arguments[0]):void 0},Wg.sqrt=function(t){return Wg.valueOf(t).sqrt()},Wg.parse=function(t){for(var e=0,r=t.length;Xg.isWhitespace(t.charAt(e));)e++;var n=!1;if(e<r){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(n=!0))}for(var o=new Wg,s=0,a=0,u=0;!(e>=r);){var l=t.charAt(e);if(e++,Xg.isDigit(l)){var h=l-"0";o.selfMultiply(Wg.TEN),o.selfAdd(h),s++}else{if("."!==l){if("e"===l||"E"===l){var c=t.substring(e);try{u=Yg.parseInt(c)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+c+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var f=o,p=s-a-u;if(0===p)f=o;else if(p>0){var d=Wg.TEN.pow(p);f=o.divide(d)}else if(p<0){var g=Wg.TEN.pow(-p);f=o.multiply(g)}return n?f.negate():f},Wg.createNaN=function(){return new Wg(Lg.NaN,Lg.NaN)},Wg.copy=function(t){return new Wg(t)},Wg.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},Wg.stringOfChar=function(t,e){for(var r=new qg,n=0;n<e;n++)r.append(t);return r.toString()},Jg.PI.get=function(){return new Wg(3.141592653589793,12246467991473532e-32)},Jg.TWO_PI.get=function(){return new Wg(6.283185307179586,24492935982947064e-32)},Jg.PI_2.get=function(){return new Wg(1.5707963267948966,6123233995736766e-32)},Jg.E.get=function(){return new Wg(2.718281828459045,14456468917292502e-32)},Jg.NaN.get=function(){return new Wg(Lg.NaN,Lg.NaN)},Jg.EPS.get=function(){return 123259516440783e-46},Jg.SPLIT.get=function(){return 134217729},Jg.MAX_PRINT_DIGITS.get=function(){return 32},Jg.TEN.get=function(){return Wg.valueOf(10)},Jg.ONE.get=function(){return Wg.valueOf(1)},Jg.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Jg.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(Wg,Jg);var Kg=function(){},Zg={DP_SAFE_EPSILON:{configurable:!0}};Kg.prototype.interfaces_=function(){return[]},Kg.prototype.getClass=function(){return Kg},Kg.orientationIndex=function(t,e,r){var n=Kg.orientationIndexFilter(t,e,r);if(n<=1)return n;var i=Wg.valueOf(e.x).selfAdd(-t.x),o=Wg.valueOf(e.y).selfAdd(-t.y),s=Wg.valueOf(r.x).selfAdd(-e.x),a=Wg.valueOf(r.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},Kg.signOfDet2x2=function(t,e,r,n){return t.multiply(n).selfSubtract(e.multiply(r)).signum()},Kg.intersection=function(t,e,r,n){var i=Wg.valueOf(n.y).selfSubtract(r.y).selfMultiply(Wg.valueOf(e.x).selfSubtract(t.x)),o=Wg.valueOf(n.x).selfSubtract(r.x).selfMultiply(Wg.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=Wg.valueOf(n.x).selfSubtract(r.x).selfMultiply(Wg.valueOf(t.y).selfSubtract(r.y)),u=Wg.valueOf(n.y).selfSubtract(r.y).selfMultiply(Wg.valueOf(t.x).selfSubtract(r.x)),l=a.subtract(u).selfDivide(s).doubleValue(),h=Wg.valueOf(t.x).selfAdd(Wg.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),c=Wg.valueOf(e.x).selfSubtract(t.x).selfMultiply(Wg.valueOf(t.y).selfSubtract(r.y)),f=Wg.valueOf(e.y).selfSubtract(t.y).selfMultiply(Wg.valueOf(t.x).selfSubtract(r.x)),p=c.subtract(f).selfDivide(s).doubleValue(),d=Wg.valueOf(r.y).selfAdd(Wg.valueOf(n.y).selfSubtract(r.y).selfMultiply(p)).doubleValue();return new Fg(h,d)},Kg.orientationIndexFilter=function(t,e,r){var n=null,i=(t.x-r.x)*(e.y-r.y),o=(t.y-r.y)*(e.x-r.x),s=i-o;if(i>0){if(o<=0)return Kg.signum(s);n=i+o}else{if(!(i<0))return Kg.signum(s);if(o>=0)return Kg.signum(s);n=-i-o}var a=Kg.DP_SAFE_EPSILON*n;return s>=a||-s>=a?Kg.signum(s):2},Kg.signum=function(t){return t>0?1:t<0?-1:0},Zg.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Kg,Zg);var $g=function(){},tA={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};tA.X.get=function(){return 0},tA.Y.get=function(){return 1},tA.Z.get=function(){return 2},tA.M.get=function(){return 3},$g.prototype.setOrdinate=function(t,e,r){},$g.prototype.size=function(){},$g.prototype.getOrdinate=function(t,e){},$g.prototype.getCoordinate=function(){},$g.prototype.getCoordinateCopy=function(t){},$g.prototype.getDimension=function(){},$g.prototype.getX=function(t){},$g.prototype.clone=function(){},$g.prototype.expandEnvelope=function(t){},$g.prototype.copy=function(){},$g.prototype.getY=function(t){},$g.prototype.toCoordinateArray=function(){},$g.prototype.interfaces_=function(){return[Pg]},$g.prototype.getClass=function(){return $g},Object.defineProperties($g,tA);var eA=function(){},rA=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(eA),nA=function(){};nA.arraycopy=function(t,e,r,n,i){for(var o=0,s=e;s<e+i;s++)r[n+o]=t[s],o++},nA.getProperty=function(t){return{"line.separator":"\n"}[t]};var iA=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this.x=r,this.y=n,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof Fg&&arguments[1]instanceof Fg){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var u=arguments[0],l=arguments[1],h=arguments[2];this.x=u,this.y=l,this.w=h}else if(4===arguments.length){var c=arguments[0],f=arguments[1],p=arguments[2],d=arguments[3],g=c.y-f.y,A=f.x-c.x,y=c.x*f.y-f.x*c.y,v=p.y-d.y,m=d.x-p.x,_=p.x*d.y-d.x*p.y;this.x=A*_-m*y,this.y=v*y-g*_,this.w=g*m-v*A}};iA.prototype.getY=function(){var t=this.y/this.w;if(Lg.isNaN(t)||Lg.isInfinite(t))throw new rA;return t},iA.prototype.getX=function(){var t=this.x/this.w;if(Lg.isNaN(t)||Lg.isInfinite(t))throw new rA;return t},iA.prototype.getCoordinate=function(){var t=new Fg;return t.x=this.getX(),t.y=this.getY(),t},iA.prototype.interfaces_=function(){return[]},iA.prototype.getClass=function(){return iA},iA.intersection=function(t,e,r,n){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=r.y-n.y,u=n.x-r.x,l=r.x*n.y-n.x*r.y,h=i*u-a*o,c=(o*l-u*s)/h,f=(a*s-i*l)/h;if(Lg.isNaN(c)||Lg.isInfinite(c)||Lg.isNaN(f)||Lg.isInfinite(f))throw new rA;return new Fg(c,f)};var oA=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof Fg){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},sA={serialVersionUID:{configurable:!0}};oA.prototype.getArea=function(){return this.getWidth()*this.getHeight()},oA.prototype.equals=function(t){if(!(t instanceof oA))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},oA.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new oA;var e=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new oA(e,n,r,i)},oA.prototype.isNull=function(){return this._maxx<this._minx},oA.prototype.getMaxX=function(){return this._maxx},oA.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof Fg){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof oA){var e=arguments[0];return!this.isNull()&&!e.isNull()&&(e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&(r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy)}},oA.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof oA){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof Fg){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||n>this._maxy||n<this._miny)}},oA.prototype.getMinY=function(){return this._miny},oA.prototype.getMinX=function(){return this._minx},oA.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof Fg){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof oA){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(r<this._minx&&(this._minx=r),r>this._maxx&&(this._maxx=r),n<this._miny&&(this._miny=n),n>this._maxy&&(this._maxy=n))}},oA.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},oA.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},oA.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},oA.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},oA.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},oA.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},oA.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},oA.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},oA.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},oA.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof oA){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof Fg){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},oA.prototype.centre=function(){return this.isNull()?null:new Fg((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},oA.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof Fg){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof oA){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},oA.prototype.getMaxY=function(){return this._maxy},oA.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var r=0;return this._maxy<t._miny?r=t._miny-this._maxy:this._miny>t._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},oA.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+Fg.hashCode(this._minx))+Fg.hashCode(this._maxx))+Fg.hashCode(this._miny))+Fg.hashCode(this._maxy)},oA.prototype.interfaces_=function(){return[Ng,kg]},oA.prototype.getClass=function(){return oA},oA.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.x<e.x?t.x:e.x)&&r.x<=(t.x>e.x?t.x:e.x)&&r.y>=(t.y<e.y?t.y:e.y)&&r.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(n.x,i.x),h=Math.max(n.x,i.x);return!(l>u)&&(!(h<a)&&(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(n.y,i.y),h=Math.max(n.y,i.y),!(l>u)&&!(h<a)))}},sA.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(oA,sA);var aA={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},uA=function(t){this.geometryFactory=t||new Yy};uA.prototype.read=function(t){var e,r,n;t=t.replace(/[\n\r]/g," ");var i=aA.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=aA.emptyTypeStr.exec(t))[2]=void 0),i&&(r=i[1].toLowerCase(),n=i[2],hA[r]&&(e=hA[r].apply(this,[n]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},uA.prototype.write=function(t){return this.extractGeometry(t)},uA.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!lA[e])return null;var r=e.toUpperCase();return t.isEmpty()?r+" EMPTY":r+"("+lA[e].apply(this,[t])+")"};var lA={coordinate:function(t){return t.x+" "+t.y},point:function(t){return lA.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+lA.point.apply(this,[t._geometries[r]])+")");return e.join(",")},linestring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(lA.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},linearring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(lA.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},multilinestring:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+lA.linestring.apply(this,[t._geometries[r]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+lA.linestring.apply(this,[t._shell])+")");for(var r=0,n=t._holes.length;r<n;++r)e.push("("+lA.linestring.apply(this,[t._holes[r]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+lA.polygon.apply(this,[t._geometries[r]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push(this.extractGeometry(t._geometries[r]));return e.join(",")}},hA={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(aA.spaces);return this.geometryFactory.createPoint(new Fg(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(aA.trimParens,"$1"),n.push(hA.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(n)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(aA.spaces),n.push(new Fg(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(aA.spaces),n.push(new Fg(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var r=t.trim().split(aA.parenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(aA.trimParens,"$1"),n.push(hA.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(n)},polygon:function(t){var e,r,n;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(aA.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(aA.trimParens,"$1"),r=hA.linestring.apply(this,[e]),n=this.geometryFactory.createLinearRing(r._points),0===a?i=n:s.push(n);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var r=t.trim().split(aA.doubleParenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(aA.trimParens,"$1"),n.push(hA.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(n)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),r=[],n=0,i=e.length;n<i;++n)r.push(this.read(e[n]));return this.geometryFactory.createGeometryCollection(r)}},cA=function(t){this.parser=new uA(t)};cA.prototype.write=function(t){return this.parser.write(t)},cA.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var fA=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),pA=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){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.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fA),dA=function(){};dA.prototype.interfaces_=function(){return[]},dA.prototype.getClass=function(){return dA},dA.shouldNeverReachHere=function(){if(0===arguments.length)dA.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new pA("Should never reach here"+(null!==t?": "+t:""))}},dA.isTrue=function(){var t;if(1===arguments.length)dA.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new pA:new pA(t)},dA.equals=function(){var t,e,r;if(2===arguments.length)dA.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],r=arguments[2],!(e=arguments[1]).equals(t)))throw new pA("Expected "+t+" but encountered "+e+(null!==r?": "+r:""))};var gA=function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new Fg,this._intPt[1]=new Fg,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},AA={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};gA.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},gA.prototype.getTopologySummary=function(){var t=new qg;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},gA.prototype.computeIntersection=function(t,e,r,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=r,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,r,n)},gA.prototype.getIntersectionNum=function(){return this._result},gA.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},gA.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},gA.prototype.setPrecisionModel=function(t){this._precisionModel=t},gA.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;r<this._result;r++)if(!t._intPt[r].equals2D(t._inputLines[e][0])&&!t._intPt[r].equals2D(t._inputLines[e][1]))return!0;return!1}},gA.prototype.getIntersection=function(t){return this._intPt[t]},gA.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},gA.prototype.hasIntersection=function(){return this._result!==gA.NO_INTERSECTION},gA.prototype.getEdgeDistance=function(t,e){return gA.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},gA.prototype.isCollinear=function(){return this._result===gA.COLLINEAR_INTERSECTION},gA.prototype.toString=function(){return cA.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+cA.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},gA.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},gA.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},gA.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},gA.prototype.interfaces_=function(){return[]},gA.prototype.getClass=function(){return gA},gA.computeEdgeDistance=function(t,e,r){var n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(r))o=n>i?n:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=n>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return dA.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},gA.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return dA.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},AA.DONT_INTERSECT.get=function(){return 0},AA.DO_INTERSECT.get=function(){return 1},AA.COLLINEAR.get=function(){return 2},AA.NO_INTERSECTION.get=function(){return 0},AA.POINT_INTERSECTION.get=function(){return 1},AA.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(gA,AA);var yA=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.isInSegmentEnvelopes=function(t){var e=new oA(this._inputLines[0][0],this._inputLines[0][1]),r=new oA(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,oA.intersects(r,n,e)&&0===_A.orientationIndex(r,n,e)&&0===_A.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=iA.intersection(t,r,n,i)}catch(s){if(!(s instanceof rA))throw s;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new Fg(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(r)<o&&(i=r,o=Math.abs(r)),Math.abs(n)<o&&(i=n),i},e.prototype.checkDD=function(t,e,r,n,i){var o=Kg.intersection(t,e,r,n),s=this.isInSegmentEnvelopes(o);nA.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&nA.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new Fg(t),o=new Fg(e),s=new Fg(r),a=new Fg(n),u=new Fg;this.normalizeToEnvCentre(i,o,s,a,u);var l=this.safeHCoordinateIntersection(i,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=oA.intersects(e,r,n),s=oA.intersects(e,r,i),a=oA.intersects(n,i,e),u=oA.intersects(n,i,r);return o&&s?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=r.x<n.x?r.x:n.x,h=r.y<n.y?r.y:n.y,c=r.x>n.x?r.x:n.x,f=r.y>n.y?r.y:n.y,p=((o>l?o:l)+(a<c?a:c))/2,d=((s>h?s:h)+(u<f?u:f))/2;i.x=p,i.y=d,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.computeIntersect=function(e,r,n,i){if(this._isProper=!1,!oA.intersects(e,r,n,i))return t.NO_INTERSECTION;var o=_A.orientationIndex(e,r,n),s=_A.orientationIndex(e,r,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=_A.orientationIndex(n,i,e),u=_A.orientationIndex(n,i,r);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,r,n,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new Fg(n):0===s?this._intPt[0]=new Fg(i):0===a?this._intPt[0]=new Fg(e):0===u&&(this._intPt[0]=new Fg(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=_A.distancePointLine(t,r,n),s=_A.distancePointLine(e,r,n);return s<o&&(o=s,i=e),(s=_A.distancePointLine(r,t,e))<o&&(o=s,i=r),(s=_A.distancePointLine(n,t,e))<o&&(o=s,i=n),i},e}(gA),vA=function(){};vA.prototype.interfaces_=function(){return[]},vA.prototype.getClass=function(){return vA},vA.orientationIndex=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,s=r.y-e.y;return vA.signOfDet2x2(n,i,o,s)},vA.signOfDet2x2=function(t,e,r,n){var i=null,o=null,s=null;if(i=1,0===t||0===n)return 0===e||0===r?0:e>0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(s=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=s*t)+r){if(e<n+n)return i}else{if(e>n+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(s=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=s*r)+t){if(n<e+e)return-i}else{if(n>e+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var mA=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};mA.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var r=t.x,n=e.x;return r>n&&(r=e.x,n=t.x),this._p.x>=r&&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 i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=vA.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},mA.prototype.isPointInPolygon=function(){return this.getLocation()!==Gg.EXTERIOR},mA.prototype.getLocation=function(){return this._isPointOnSegment?Gg.BOUNDARY:this._crossingCount%2==1?Gg.INTERIOR:Gg.EXTERIOR},mA.prototype.isOnSegment=function(){return this._isPointOnSegment},mA.prototype.interfaces_=function(){return[]},mA.prototype.getClass=function(){return mA},mA.locatePointInRing=function(){if(arguments[0]instanceof Fg&&jg(arguments[1],$g)){for(var t=arguments[1],e=new mA(arguments[0]),r=new Fg,n=new Fg,i=1;i<t.size();i++)if(t.getCoordinate(i,r),t.getCoordinate(i-1,n),e.countSegment(r,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof Fg&&arguments[1]instanceof Array){for(var o=arguments[1],s=new mA(arguments[0]),a=1;a<o.length;a++){var u=o[a],l=o[a-1];if(s.countSegment(u,l),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var _A=function(){},IA={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};_A.prototype.interfaces_=function(){return[]},_A.prototype.getClass=function(){return _A},_A.orientationIndex=function(t,e,r){return Kg.orientationIndex(t,e,r)},_A.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,r=t[0].x,n=1;n<t.length-1;n++){var i=t[n].x-r,o=t[n+1].y;e+=i*(t[n-1].y-o)}return e/2}if(jg(arguments[0],$g)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new Fg,l=new Fg,h=new Fg;s.getCoordinate(0,l),s.getCoordinate(1,h);var c=l.x;h.x-=c;for(var f=0,p=1;p<a-1;p++)u.y=l.y,l.x=h.x,l.y=h.y,s.getCoordinate(p+1,h),h.x-=c,f+=l.x*(u.y-h.y);return f/2}},_A.distanceLineLine=function(t,e,r,n){if(t.equals(e))return _A.distancePointLine(t,r,n);if(r.equals(n))return _A.distancePointLine(n,t,e);var i=!1;if(oA.intersects(t,e,r,n)){var o=(e.x-t.x)*(n.y-r.y)-(e.y-t.y)*(n.x-r.x);if(0===o)i=!0;else{var s=(t.y-r.y)*(n.x-r.x)-(t.x-r.x)*(n.y-r.y),a=((t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?Vg.min(_A.distancePointLine(t,r,n),_A.distancePointLine(e,r,n),_A.distancePointLine(r,t,e),_A.distancePointLine(n,t,e)):0},_A.isPointInRing=function(t,e){return _A.locatePointInRing(t,e)!==Gg.EXTERIOR},_A.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new Fg;t.getCoordinate(0,n);for(var i=n.x,o=n.y,s=1;s<e;s++){t.getCoordinate(s,n);var a=n.x,u=n.y,l=a-i,h=u-o;r+=Math.sqrt(l*l+h*h),i=a,o=u}return r},_A.isCCW=function(t){var e=t.length-1;if(e<3)throw new Tg("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],n=0,i=1;i<=e;i++){var o=t[i];o.y>r.y&&(r=o,n=i)}var s=n;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(r)&&s!==n);var a=n;do{a=(a+1)%e}while(t[a].equals2D(r)&&a!==n);var u=t[s],l=t[a];if(u.equals2D(r)||l.equals2D(r)||u.equals2D(l))return!1;var h=_A.computeOrientation(u,r,l),c=!1;return c=0===h?u.x>l.x:h>0,c},_A.locatePointInRing=function(t,e){return mA.locatePointInRing(t,e)},_A.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},_A.computeOrientation=function(t,e,r){return _A.orientationIndex(t,e,r)},_A.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new Tg("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n<e.length-1;n++){var i=_A.distancePointLine(t,e[n],e[n+1]);i<r&&(r=i)}return r}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(l>=1)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(h)*Math.sqrt(u)}},_A.isOnLine=function(t,e){for(var r=new yA,n=1;n<e.length;n++){var i=e[n-1],o=e[n];if(r.computeIntersection(t,i,o),r.hasIntersection())return!0}return!1},IA.CLOCKWISE.get=function(){return-1},IA.RIGHT.get=function(){return _A.CLOCKWISE},IA.COUNTERCLOCKWISE.get=function(){return 1},IA.LEFT.get=function(){return _A.COUNTERCLOCKWISE},IA.COLLINEAR.get=function(){return 0},IA.STRAIGHT.get=function(){return _A.COLLINEAR},Object.defineProperties(_A,IA);var EA=function(){};EA.prototype.filter=function(t){},EA.prototype.interfaces_=function(){return[]},EA.prototype.getClass=function(){return EA};var xA=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},wA={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};xA.prototype.isGeometryCollection=function(){return this.getSortIndex()===xA.SORTINDEX_GEOMETRYCOLLECTION},xA.prototype.getFactory=function(){return this._factory},xA.prototype.getGeometryN=function(t){return this},xA.prototype.getArea=function(){return 0},xA.prototype.isRectangle=function(){return!1},xA.prototype.equals=function(){if(arguments[0]instanceof xA){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof xA))return!1;var r=e;return this.equalsExact(r)}},xA.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},xA.prototype.geometryChanged=function(){this.apply(xA.geometryChangedFilter)},xA.prototype.geometryChangedAction=function(){this._envelope=null},xA.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},xA.prototype.getLength=function(){return 0},xA.prototype.getNumGeometries=function(){return 1},xA.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.getSortIndex()!==r.getSortIndex()?this.getSortIndex()-r.getSortIndex():this.isEmpty()&&r.isEmpty()?0:this.isEmpty()?-1:r.isEmpty()?1:this.compareToSameClass(r,n)}},xA.prototype.getUserData=function(){return this._userData},xA.prototype.getSRID=function(){return this._SRID},xA.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},xA.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===xA.SORTINDEX_GEOMETRYCOLLECTION)throw new Tg("This method does not support GeometryCollection arguments")},xA.prototype.equal=function(t,e,r){return 0===r?t.equals(e):t.distance(e)<=r},xA.prototype.norm=function(){var t=this.copy();return t.normalize(),t},xA.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},xA.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new oA(this._envelope)},xA.prototype.setSRID=function(t){this._SRID=t},xA.prototype.setUserData=function(t){this._userData=t},xA.prototype.compare=function(t,e){for(var r=t.iterator(),n=e.iterator();r.hasNext()&&n.hasNext();){var i=r.next(),o=n.next(),s=i.compareTo(o);if(0!==s)return s}return r.hasNext()?1:n.hasNext()?-1:0},xA.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},xA.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===xA.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===xA.SORTINDEX_MULTIPOINT||this.getSortIndex()===xA.SORTINDEX_MULTILINESTRING||this.getSortIndex()===xA.SORTINDEX_MULTIPOLYGON},xA.prototype.interfaces_=function(){return[Pg,Ng,kg]},xA.prototype.getClass=function(){return xA},xA.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},xA.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},wA.serialVersionUID.get=function(){return 0x799ea46522854c00},wA.SORTINDEX_POINT.get=function(){return 0},wA.SORTINDEX_MULTIPOINT.get=function(){return 1},wA.SORTINDEX_LINESTRING.get=function(){return 2},wA.SORTINDEX_LINEARRING.get=function(){return 3},wA.SORTINDEX_MULTILINESTRING.get=function(){return 4},wA.SORTINDEX_POLYGON.get=function(){return 5},wA.SORTINDEX_MULTIPOLYGON.get=function(){return 6},wA.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},wA.geometryChangedFilter.get=function(){return CA},Object.defineProperties(xA,wA);var CA=function(){};CA.interfaces_=function(){return[EA]},CA.filter=function(t){t.geometryChangedAction()};var bA=function(){};bA.prototype.filter=function(t){},bA.prototype.interfaces_=function(){return[]},bA.prototype.getClass=function(){return bA};var SA=function(){},BA={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};SA.prototype.isInBoundary=function(t){},SA.prototype.interfaces_=function(){return[]},SA.prototype.getClass=function(){return SA},BA.Mod2BoundaryNodeRule.get=function(){return MA},BA.EndPointBoundaryNodeRule.get=function(){return TA},BA.MultiValentEndPointBoundaryNodeRule.get=function(){return LA},BA.MonoValentEndPointBoundaryNodeRule.get=function(){return RA},BA.MOD2_BOUNDARY_RULE.get=function(){return new MA},BA.ENDPOINT_BOUNDARY_RULE.get=function(){return new TA},BA.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new LA},BA.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new RA},BA.OGC_SFS_BOUNDARY_RULE.get=function(){return SA.MOD2_BOUNDARY_RULE},Object.defineProperties(SA,BA);var MA=function(){};MA.prototype.isInBoundary=function(t){return t%2==1},MA.prototype.interfaces_=function(){return[SA]},MA.prototype.getClass=function(){return MA};var TA=function(){};TA.prototype.isInBoundary=function(t){return t>0},TA.prototype.interfaces_=function(){return[SA]},TA.prototype.getClass=function(){return TA};var LA=function(){};LA.prototype.isInBoundary=function(t){return t>1},LA.prototype.interfaces_=function(){return[SA]},LA.prototype.getClass=function(){return LA};var RA=function(){};RA.prototype.isInBoundary=function(t){return 1===t},RA.prototype.interfaces_=function(){return[SA]},RA.prototype.getClass=function(){return RA};var NA=function(){};function PA(t){this.message=t||""}NA.prototype.add=function(){},NA.prototype.addAll=function(){},NA.prototype.isEmpty=function(){},NA.prototype.iterator=function(){},NA.prototype.size=function(){},NA.prototype.toArray=function(){},NA.prototype.remove=function(){},PA.prototype=new Error,PA.prototype.name="IndexOutOfBoundsException";var DA=function(){};DA.prototype.hasNext=function(){},DA.prototype.next=function(){},DA.prototype.remove=function(){};var kA=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}(NA);function FA(t){this.message=t||""}FA.prototype=new Error,FA.prototype.name="NoSuchElementException";var QA=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof NA&&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,NA]},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 r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new OA(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new PA;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,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,r=0,n=this.array_.length;r<n;r++)if(this.array_[r]===t){this.array_.splice(r,1),e=!0;break}return e},e}(kA),OA=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new FA;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(DA),UA=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.ensureCapacity(r.length),this.add(r,n)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={coordArrayType:{configurable:!0}};return r.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],r=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),e),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=0;r<this.size();r++)e.add(r,this.get(r).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var r=arguments[0];t.prototype.add.call(this,r)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof Fg&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1])if(this.size()>=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 u=arguments[0],l=arguments[1];if(arguments[2])for(var h=0;h<u.length;h++)e.add(u[h],l);else for(var c=u.length-1;c>=0;c--)e.add(u[c],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof Fg){var f=arguments[0],p=arguments[1];if(!arguments[2]){var d=this.size();if(d>0){if(f>0)if(this.get(f-1).equals2D(p))return null;if(f<d)if(this.get(f).equals2D(p))return null}}t.prototype.add.call(this,f,p)}}else if(4===arguments.length){var g=arguments[0],A=arguments[1],y=arguments[2],v=arguments[3],m=1;y>v&&(m=-1);for(var _=y;_!==v;_+=m)e.add(g[_],A);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Fg(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(QA),GA=function(){},zA={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};zA.ForwardComparator.get=function(){return jA},zA.BidirectionalComparator.get=function(){return VA},zA.coordArrayType.get=function(){return new Array(0).fill(null)},GA.prototype.interfaces_=function(){return[]},GA.prototype.getClass=function(){return GA},GA.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},GA.ptNotInList=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(GA.indexOf(n,e)<0)return n}return null},GA.scroll=function(t,e){var r=GA.indexOf(e,t);if(r<0)return null;var n=new Array(t.length).fill(null);nA.arraycopy(t,r,n,0,t.length-r),nA.arraycopy(t,0,n,t.length-r,r),nA.arraycopy(n,0,t,0,t.length)},GA.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!t[r].equals(e[r]))return!1;return!0}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];if(n===i)return!0;if(null===n||null===i)return!1;if(n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(0!==o.compare(n[s],i[s]))return!1;return!0}},GA.intersection=function(t,e){for(var r=new UA,n=0;n<t.length;n++)e.intersects(t[n])&&r.add(t[n],!0);return r.toCoordinateArray()},GA.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},GA.removeRepeatedPoints=function(t){return GA.hasRepeatedPoints(t)?new UA(t,!1).toCoordinateArray():t},GA.reverse=function(t){for(var e=t.length-1,r=Math.trunc(e/2),n=0;n<=r;n++){var i=t[n];t[n]=t[e-n],t[e-n]=i}},GA.removeNull=function(t){for(var e=0,r=0;r<t.length;r++)null!==t[r]&&e++;var n=new Array(e).fill(null);if(0===e)return n;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(n[i++]=t[o]);return n},GA.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),r=0;r<t.length;r++)e[r]=new Fg(t[r]);return e}if(5===arguments.length)for(var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new Fg(n[i+u])},GA.isEqualReversed=function(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=e[t.length-r-1];if(0!==n.compareTo(i))return!1}return!0},GA.envelope=function(t){for(var e=new oA,r=0;r<t.length;r++)e.expandToInclude(t[r]);return e},GA.toCoordinateArray=function(t){return t.toArray(GA.coordArrayType)},GA.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},GA.indexOf=function(t,e){for(var r=0;r<e.length;r++)if(t.equals(e[r]))return r;return-1},GA.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var r=t.length-1-e,n=t[e].compareTo(t[r]);if(0!==n)return n}return 1},GA.compare=function(t,e){for(var r=0;r<t.length&&r<e.length;){var n=t[r].compareTo(e[r]);if(0!==n)return n;r++}return r<e.length?-1:r<t.length?1:0},GA.minCoordinate=function(t){for(var e=null,r=0;r<t.length;r++)(null===e||e.compareTo(t[r])>0)&&(e=t[r]);return e},GA.extract=function(t,e,r){e=Vg.clamp(e,0,t.length);var n=(r=Vg.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),r<e&&(n=0);var i=new Array(n).fill(null);if(0===n)return i;for(var o=0,s=e;s<=r;s++)i[o++]=t[s];return i},Object.defineProperties(GA,zA);var jA=function(){};jA.prototype.compare=function(t,e){return GA.compare(t,e)},jA.prototype.interfaces_=function(){return[Dg]},jA.prototype.getClass=function(){return jA};var VA=function(){};VA.prototype.compare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;var i=GA.compare(r,n);return GA.isEqualReversed(r,n)?0:i},VA.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;for(var i=GA.increasingDirection(r),o=GA.increasingDirection(n),s=i>0?0:r.length-1,a=o>0?0:r.length-1,u=0;u<r.length;u++){var l=r[s].compareTo(n[a]);if(0!==l)return l;s+=i,a+=o}return 0},VA.prototype.interfaces_=function(){return[Dg]},VA.prototype.getClass=function(){return VA};var HA=function(){};HA.prototype.get=function(){},HA.prototype.put=function(){},HA.prototype.size=function(){},HA.prototype.values=function(){},HA.prototype.entrySet=function(){};var qA=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}(HA);function YA(t){this.message=t||""}function XA(){}YA.prototype=new Error,YA.prototype.name="OperationNotSupported",XA.prototype=new NA,XA.prototype.contains=function(){};var WA=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof NA&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++){if(this.array_[e]===t)return!0}return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new JA(this)},e}(XA),JA=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new FA;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new YA},e}(DA);function KA(t){return null===t?0:t.color}function ZA(t){return null===t?null:t.parent}function $A(t,e){null!==t&&(t.color=e)}function ty(t){return null===t?null:t.left}function ey(t){return null===t?null:t.right}function ry(){this.root_=null,this.size_=0}ry.prototype=new qA,ry.prototype.get=function(t){for(var e=this.root_;null!==e;){var r=t.compareTo(e.key);if(r<0)e=e.left;else{if(!(r>0))return e.value;e=e.right}}return null},ry.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 r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:r,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},ry.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(ZA(t)===ty(ZA(ZA(t)))){var r=ey(ZA(ZA(t)));1===KA(r)?($A(ZA(t),0),$A(r,0),$A(ZA(ZA(t)),1),t=ZA(ZA(t))):(t===ey(ZA(t))&&(t=ZA(t),e.rotateLeft(t)),$A(ZA(t),0),$A(ZA(ZA(t)),1),e.rotateRight(ZA(ZA(t))))}else{var n=ty(ZA(ZA(t)));1===KA(n)?($A(ZA(t),0),$A(n,0),$A(ZA(ZA(t)),1),t=ZA(ZA(t))):(t===ty(ZA(t))&&(t=ZA(t),e.rotateRight(t)),$A(ZA(t),0),$A(ZA(ZA(t)),1),e.rotateLeft(ZA(ZA(t))))}this.root_.color=0},ry.prototype.values=function(){var t=new QA,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=ry.successor(e));)t.add(e.value);return t},ry.prototype.entrySet=function(){var t=new WA,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=ry.successor(e));)t.add(e);return t},ry.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}},ry.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}},ry.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},ry.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 r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},ry.prototype.size=function(){return this.size_};var ny=function(){};function iy(){}function oy(){this.array_=[],arguments[0]instanceof NA&&this.addAll(arguments[0])}ny.prototype.interfaces_=function(){return[]},ny.prototype.getClass=function(){return ny},iy.prototype=new XA,oy.prototype=new iy,oy.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++){if(0===this.array_[e].compareTo(t))return!0}return!1},oy.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,r=this.array_.length;e<r;e++){if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0}return this.array_.push(t),!0},oy.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},oy.prototype.remove=function(t){throw new YA},oy.prototype.size=function(){return this.array_.length},oy.prototype.isEmpty=function(){return 0===this.array_.length},oy.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},oy.prototype.iterator=function(){return new sy(this)};var sy=function(t){this.treeSet_=t,this.position_=0};sy.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new FA;return this.treeSet_.array_[this.position_++]},sy.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},sy.prototype.remove=function(){throw new YA};var ay=function(){};ay.sort=function(){var t,e,r,n,i=arguments[0];if(1===arguments.length)n=function(t,e){return t.compareTo(e)},i.sort(n);else if(2===arguments.length)r=arguments[1],n=function(t,e){return r.compare(t,e)},i.sort(n);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),r=arguments[3],n=function(t,e){return r.compare(t,e)},e.sort(n),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},ay.asList=function(t){for(var e=new QA,r=0,n=t.length;r<n;r++)e.add(t[r]);return e};var uy=function(){},ly={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};ly.P.get=function(){return 0},ly.L.get=function(){return 1},ly.A.get=function(){return 2},ly.FALSE.get=function(){return-1},ly.TRUE.get=function(){return-2},ly.DONTCARE.get=function(){return-3},ly.SYM_FALSE.get=function(){return"F"},ly.SYM_TRUE.get=function(){return"T"},ly.SYM_DONTCARE.get=function(){return"*"},ly.SYM_P.get=function(){return"0"},ly.SYM_L.get=function(){return"1"},ly.SYM_A.get=function(){return"2"},uy.prototype.interfaces_=function(){return[]},uy.prototype.getClass=function(){return uy},uy.toDimensionSymbol=function(t){switch(t){case uy.FALSE:return uy.SYM_FALSE;case uy.TRUE:return uy.SYM_TRUE;case uy.DONTCARE:return uy.SYM_DONTCARE;case uy.P:return uy.SYM_P;case uy.L:return uy.SYM_L;case uy.A:return uy.SYM_A}throw new Tg("Unknown dimension value: "+t)},uy.toDimensionValue=function(t){switch(Xg.toUpperCase(t)){case uy.SYM_FALSE:return uy.FALSE;case uy.SYM_TRUE:return uy.TRUE;case uy.SYM_DONTCARE:return uy.DONTCARE;case uy.SYM_P:return uy.P;case uy.SYM_L:return uy.L;case uy.SYM_A:return uy.A}throw new Tg("Unknown dimension symbol: "+t)},Object.defineProperties(uy,ly);var hy=function(){};hy.prototype.filter=function(t){},hy.prototype.interfaces_=function(){return[]},hy.prototype.getClass=function(){return hy};var cy=function(){};cy.prototype.filter=function(t,e){},cy.prototype.isDone=function(){},cy.prototype.isGeometryChanged=function(){},cy.prototype.interfaces_=function(){return[]},cy.prototype.getClass=function(){return cy};var fy=function(t){function e(e,r){if(t.call(this,r),this._geometries=e||[],t.hasNullElements(this._geometries))throw new Tg("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new oA,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=0;r<this._geometries.length;r++)for(var n=this._geometries[r].getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();ay.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=uy.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=uy.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new oy(ay.asList(this._geometries)),r=new oy(ay.asList(t._geometries));return this.compare(e,r)}if(2===arguments.length){for(var n=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var u=this.getGeometryN(a),l=i.getGeometryN(a),h=u.compareToSameClass(l,n);if(0!==h)return h;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(jg(arguments[0],bA))for(var e=arguments[0],r=0;r<this._geometries.length;r++)t._geometries[r].apply(e);else if(jg(arguments[0],cy)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(jg(arguments[0],hy)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(jg(arguments[0],EA)){var a=arguments[0];a.filter(this);for(var u=0;u<this._geometries.length;u++)t._geometries[u].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),dA.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var r=0;r<this._geometries.length;r++)e._geometries[r]=this._geometries[r].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,r),e}(xA),py=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return xA.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?uy.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[t-1-r]=this._geometries[r].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new dy(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[ny]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,r),e}(fy),dy=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=SA.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._geom=r,this._geomFact=r.getFactory(),this._bnRule=n}};dy.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},dy.prototype.getBoundary=function(){return this._geom instanceof Cy?this.boundaryLineString(this._geom):this._geom instanceof py?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},dy.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},dy.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},dy.prototype.computeBoundaryCoordinates=function(t){var e=this,r=new QA;this._endpointMap=new ry;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&r.add(s.getKey())}return GA.toCoordinateArray(r)},dy.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new gy,this._endpointMap.put(t,e)),e.count++},dy.prototype.interfaces_=function(){return[]},dy.prototype.getClass=function(){return dy},dy.getBoundary=function(){return 1===arguments.length?new dy(arguments[0]).getBoundary():2===arguments.length?new dy(arguments[0],arguments[1]).getBoundary():void 0};var gy=function(){this.count=null};function Ay(){}function yy(){}gy.prototype.interfaces_=function(){return[]},gy.prototype.getClass=function(){return gy};var vy=function(){};function my(){}function _y(){}function Iy(){}var Ey=function(){},xy={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Ey.prototype.interfaces_=function(){return[]},Ey.prototype.getClass=function(){return Ey},Ey.chars=function(t,e){for(var r=new Array(e).fill(null),n=0;n<e;n++)r[n]=t;return String(r)},Ey.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new my,r=new Ay;return t.printStackTrace(r),e.toString()}if(2===arguments.length){var n=arguments[1],i="";new yy(Ey.getStackTrace(arguments[0]));for(var o=new Iy,s=0;s<n;s++)try{i+=o.readLine()+Ey.NEWLINE}catch(t){if(!(t instanceof _y))throw t;dA.shouldNeverReachHere()}return i}},Ey.split=function(t,e){for(var r=e.length,n=new QA,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);n.add(s),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var a=new Array(n.size()).fill(null),u=0;u<a.length;u++)a[u]=n.get(u);return a},Ey.toString=function(){if(1===arguments.length){var t=arguments[0];return Ey.SIMPLE_ORDINATE_FORMAT.format(t)}},Ey.spaces=function(t){return Ey.chars(" ",t)},xy.NEWLINE.get=function(){return nA.getProperty("line.separator")},xy.SIMPLE_ORDINATE_FORMAT.get=function(){return new vy},Object.defineProperties(Ey,xy);var wy=function(){};wy.prototype.interfaces_=function(){return[]},wy.prototype.getClass=function(){return wy},wy.copyCoord=function(t,e,r,n){for(var i=Math.min(t.getDimension(),r.getDimension()),o=0;o<i;o++)r.setOrdinate(n,o,t.getOrdinate(e,o))},wy.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,$g.X)===t.getOrdinate(e-1,$g.X)&&t.getOrdinate(0,$g.Y)===t.getOrdinate(e-1,$g.Y))},wy.isEqual=function(t,e){var r=t.size();if(r!==e.size())return!1;for(var n=Math.min(t.getDimension(),e.getDimension()),i=0;i<r;i++)for(var o=0;o<n;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(t.getOrdinate(i,o)!==e.getOrdinate(i,o)&&(!Lg.isNaN(s)||!Lg.isNaN(a)))return!1}return!0},wy.extend=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();if(wy.copy(e,0,n,0,i),i>0)for(var o=i;o<r;o++)wy.copy(e,i-1,n,o,1);return n},wy.reverse=function(t){for(var e=t.size()-1,r=Math.trunc(e/2),n=0;n<=r;n++)wy.swap(t,n,e-n)},wy.swap=function(t,e,r){if(e===r)return null;for(var n=0;n<t.getDimension();n++){var i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(r,n)),t.setOrdinate(r,n,i)}},wy.copy=function(t,e,r,n,i){for(var o=0;o<i;o++)wy.copyCoord(t,e+o,r,n+o)},wy.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var r=t.getDimension(),n=new qg;n.append("(");for(var i=0;i<e;i++){i>0&&n.append(" ");for(var o=0;o<r;o++)o>0&&n.append(","),n.append(Ey.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},wy.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?wy.createClosedRing(t,e,4):e.getOrdinate(0,$g.X)===e.getOrdinate(r-1,$g.X)&&e.getOrdinate(0,$g.Y)===e.getOrdinate(r-1,$g.Y)?e:wy.createClosedRing(t,e,r+1)},wy.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();wy.copy(e,0,n,0,i);for(var o=i;o<r;o++)wy.copy(e,0,n,o,1);return n};var Cy=function(t){function e(e,r){t.call(this,r),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new oA:this._points.expandEnvelope(new oA)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var r=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(r)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(r))>0&&wy.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?uy.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 _A.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return wy.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e<this._points.size()&&r<t._points.size();){var n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(r));if(0!==n)return n;e++,r++}return e<this._points.size()?1:r<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(jg(arguments[0],bA))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(jg(arguments[0],cy)){var r=arguments[0];if(0===this._points.size())return null;for(var n=0;n<this._points.size()&&(r.filter(this._points,n),!r.isDone());n++);r.isGeometryChanged()&&this.geometryChanged()}else if(jg(arguments[0],hy)){arguments[0].filter(this)}else if(jg(arguments[0],EA)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return new dy(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new Tg("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[ny]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,r),e}(xA),by=function(){};by.prototype.interfaces_=function(){return[]},by.prototype.getClass=function(){return by};var Sy=function(t){function e(e,r){t.call(this,r),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new oA;var t=new oA;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),r))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return uy.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(jg(arguments[0],bA)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(jg(arguments[0],cy)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(jg(arguments[0],hy)){arguments[0].filter(this)}else if(jg(arguments[0],EA)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),dA.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[by]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,r),e}(xA),By=function(){};By.prototype.interfaces_=function(){return[]},By.prototype.getClass=function(){return By};var My=function(t){function e(e,r,n){if(t.call(this,n),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===r&&(r=[]),t.hasNullElements(r))throw new Tg("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(r))throw new Tg("shell is empty but holes are not");this._shell=e,this._holes=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=this._shell.getCoordinates(),n=0;n<r.length;n++)t[++e]=r[n];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(_A.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(_A.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),r=0;r<5;r++){var n=t.getX(r);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;var i=t.getY(r);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),l=t.getY(a);if(u!==o===(l!==s))return!1;o=u,s=l}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e,i=this._shell,o=n._shell;if(!i.equalsExact(o,r))return!1;if(this._holes.length!==n._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(n._holes[s],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);ay.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(e.isEmpty())return null;var n=new Array(e.getCoordinates().length-1).fill(null);nA.arraycopy(e.getCoordinates(),0,n,0,n.length);var i=GA.minCoordinate(e.getCoordinates());GA.scroll(n,i),nA.arraycopy(n,0,e.getCoordinates(),0,n.length),e.getCoordinates()[n.length]=n[0],_A.isCCW(e.getCoordinates())===r&&GA.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,r=t._shell;return e.compareToSameClass(r)}if(2===arguments.length){var n=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,n);if(0!==a)return a;for(var u=this.getNumInteriorRing(),l=i.getNumInteriorRing(),h=0;h<u&&h<l;){var c=this.getInteriorRingN(h),f=i.getInteriorRingN(h),p=c.compareToSameClass(f,n);if(0!==p)return p;h++}return h<u?1:h<l?-1:0}},e.prototype.apply=function(t){var e=this;if(jg(t,bA)){this._shell.apply(t);for(var r=0;r<this._holes.length;r++)e._holes[r].apply(t)}else if(jg(t,cy)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(e._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(jg(t,hy))t.filter(this);else if(jg(t,EA)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var r=0;r<this._holes.length;r++)e._holes[r]=this._holes[r].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),r=new Array(this._holes.length).fill(null),n=0;n<r.length;n++)r[n]=this._holes[n].copy();return new e(t,r,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[By]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,r),e}(xA),Ty=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return xA.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return uy.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[by]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,r),e}(fy),Ly=function(t){function e(e,r){e instanceof Fg&&r instanceof Yy&&(e=r.getCoordinateSequenceFactory().create(e)),t.call(this,e,r),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return xA.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return uy.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return wy.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new Tg("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new Tg("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 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},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(Cy),Ry=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return xA.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}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),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new QA,e=0;e<this._geometries.length;e++)for(var r=this._geometries[e].getBoundary(),n=0;n<r.getNumGeometries();n++)t.add(r.getGeometryN(n));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[By]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,r),e}(fy),Ny=function(t){this._factory=t||null,this._isUserDataCopied=!1},Py={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Ny.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Ny.prototype.edit=function(t,e){if(null===t)return null;var r=this.editInternal(t,e);return this._isUserDataCopied&&r.setUserData(t.getUserData()),r},Ny.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof fy?this.editGeometryCollection(t,e):t instanceof My?this.editPolygon(t,e):t instanceof Sy||t instanceof Cy?e.edit(t,this._factory):(dA.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Ny.prototype.editGeometryCollection=function(t,e){for(var r=e.edit(t,this._factory),n=new QA,i=0;i<r.getNumGeometries();i++){var o=this.edit(r.getGeometryN(i),e);null===o||o.isEmpty()||n.add(o)}return r.getClass()===Ty?this._factory.createMultiPoint(n.toArray([])):r.getClass()===py?this._factory.createMultiLineString(n.toArray([])):r.getClass()===Ry?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))},Ny.prototype.editPolygon=function(t,e){var r=e.edit(t,this._factory);if(null===r&&(r=this._factory.createPolygon(null)),r.isEmpty())return r;var n=this.edit(r.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();for(var i=new QA,o=0;o<r.getNumInteriorRing();o++){var s=this.edit(r.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(n,i.toArray([]))},Ny.prototype.interfaces_=function(){return[]},Ny.prototype.getClass=function(){return Ny},Ny.GeometryEditorOperation=function(){},Py.NoOpGeometryOperation.get=function(){return Dy},Py.CoordinateOperation.get=function(){return ky},Py.CoordinateSequenceOperation.get=function(){return Fy},Object.defineProperties(Ny,Py);var Dy=function(){};Dy.prototype.edit=function(t,e){return t},Dy.prototype.interfaces_=function(){return[Ny.GeometryEditorOperation]},Dy.prototype.getClass=function(){return Dy};var ky=function(){};ky.prototype.edit=function(t,e){var r=this.editCoordinates(t.getCoordinates(),t);return null===r?t:t instanceof Ly?e.createLinearRing(r):t instanceof Cy?e.createLineString(r):t instanceof Sy?r.length>0?e.createPoint(r[0]):e.createPoint():t},ky.prototype.interfaces_=function(){return[Ny.GeometryEditorOperation]},ky.prototype.getClass=function(){return ky};var Fy=function(){};Fy.prototype.edit=function(t,e){return t instanceof Ly?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Cy?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Sy?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},Fy.prototype.interfaces_=function(){return[Ny.GeometryEditorOperation]},Fy.prototype.getClass=function(){return Fy};var Qy=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 r=0;r<e;r++)t._coordinates[r]=new Fg}else if(jg(arguments[0],$g)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],u=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=u;for(var l=0;l<a;l++)t._coordinates[l]=new Fg}},Oy={serialVersionUID:{configurable:!0}};Qy.prototype.setOrdinate=function(t,e,r){switch(e){case $g.X:this._coordinates[t].x=r;break;case $g.Y:this._coordinates[t].y=r;break;case $g.Z:this._coordinates[t].z=r;break;default:throw new Tg("invalid ordinateIndex")}},Qy.prototype.size=function(){return this._coordinates.length},Qy.prototype.getOrdinate=function(t,e){switch(e){case $g.X:return this._coordinates[t].x;case $g.Y:return this._coordinates[t].y;case $g.Z:return this._coordinates[t].z}return Lg.NaN},Qy.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],r=arguments[1];r.x=this._coordinates[e].x,r.y=this._coordinates[e].y,r.z=this._coordinates[e].z}},Qy.prototype.getCoordinateCopy=function(t){return new Fg(this._coordinates[t])},Qy.prototype.getDimension=function(){return this._dimension},Qy.prototype.getX=function(t){return this._coordinates[t].x},Qy.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new Qy(t,this._dimension)},Qy.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},Qy.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new Qy(t,this._dimension)},Qy.prototype.toString=function(){if(this._coordinates.length>0){var t=new qg(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},Qy.prototype.getY=function(t){return this._coordinates[t].y},Qy.prototype.toCoordinateArray=function(){return this._coordinates},Qy.prototype.interfaces_=function(){return[$g,kg]},Qy.prototype.getClass=function(){return Qy},Oy.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(Qy,Oy);var Uy=function(){},Gy={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Uy.prototype.readResolve=function(){return Uy.instance()},Uy.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new Qy(arguments[0]);if(jg(arguments[0],$g))return new Qy(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new Qy(t):new Qy(t,e)}},Uy.prototype.interfaces_=function(){return[Ug,kg]},Uy.prototype.getClass=function(){return Uy},Uy.instance=function(){return Uy.instanceObject},Gy.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Gy.instanceObject.get=function(){return new Uy},Object.defineProperties(Uy,Gy);var zy=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 QA,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new WA;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(HA),jy=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 Hy){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},Vy={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};jy.prototype.equals=function(t){if(!(t instanceof jy))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},jy.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new Yg(r).compareTo(new Yg(n))},jy.prototype.getScale=function(){return this._scale},jy.prototype.isFloating=function(){return this._modelType===jy.FLOATING||this._modelType===jy.FLOATING_SINGLE},jy.prototype.getType=function(){return this._modelType},jy.prototype.toString=function(){var t="UNKNOWN";return this._modelType===jy.FLOATING?t="Floating":this._modelType===jy.FLOATING_SINGLE?t="Floating-Single":this._modelType===jy.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},jy.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return Lg.isNaN(t)||this._modelType===jy.FLOATING_SINGLE?t:this._modelType===jy.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof Fg){var e=arguments[0];if(this._modelType===jy.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},jy.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===jy.FLOATING?t=16:this._modelType===jy.FLOATING_SINGLE?t=6:this._modelType===jy.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},jy.prototype.setScale=function(t){this._scale=Math.abs(t)},jy.prototype.interfaces_=function(){return[kg,Ng]},jy.prototype.getClass=function(){return jy},jy.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Vy.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},Vy.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(jy,Vy);var Hy=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},qy={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Hy.prototype.readResolve=function(){return Hy.nameToTypeMap.get(this._name)},Hy.prototype.toString=function(){return this._name},Hy.prototype.interfaces_=function(){return[kg]},Hy.prototype.getClass=function(){return Hy},qy.serialVersionUID.get=function(){return-552860263173159e4},qy.nameToTypeMap.get=function(){return new zy},Object.defineProperties(Hy,qy),jy.Type=Hy,jy.FIXED=new Hy("FIXED"),jy.FLOATING=new Hy("FLOATING"),jy.FLOATING_SINGLE=new Hy("FLOATING SINGLE");var Yy=function t(){this._precisionModel=new jy,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?jg(arguments[0],Ug)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof jy&&(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]))},Xy={serialVersionUID:{configurable:!0}};Yy.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Fg(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Fg(t.getMinX(),t.getMinY()),new Fg(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Fg(t.getMinX(),t.getMinY()),new Fg(t.getMinX(),t.getMaxY()),new Fg(t.getMaxX(),t.getMaxY()),new Fg(t.getMaxX(),t.getMinY()),new Fg(t.getMinX(),t.getMinY())]),null)},Yy.prototype.createLineString=function(t){return t?t instanceof Array?new Cy(this.getCoordinateSequenceFactory().create(t),this):jg(t,$g)?new Cy(t,this):void 0:new Cy(this.getCoordinateSequenceFactory().create([]),this)},Yy.prototype.createMultiLineString=function(){return 0===arguments.length?new py(null,this):1===arguments.length?new py(arguments[0],this):void 0},Yy.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(Yy.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof My)return this.createMultiPolygon(Yy.toPolygonArray(t));if(a instanceof Cy)return this.createMultiLineString(Yy.toLineStringArray(t));if(a instanceof Sy)return this.createMultiPoint(Yy.toPointArray(t));dA.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},Yy.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},Yy.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Fg){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(jg(arguments[0],$g))return new Sy(arguments[0],this)}},Yy.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Yy.prototype.createPolygon=function(){if(0===arguments.length)return new My(null,null,this);if(1===arguments.length){if(jg(arguments[0],$g)){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 Ly){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length){return new My(arguments[0],arguments[1],this)}},Yy.prototype.getSRID=function(){return this._SRID},Yy.prototype.createGeometryCollection=function(){return 0===arguments.length?new fy(null,this):1===arguments.length?new fy(arguments[0],this):void 0},Yy.prototype.createGeometry=function(t){return new Ny(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},Yy.prototype.getPrecisionModel=function(){return this._precisionModel},Yy.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(jg(arguments[0],$g))return new Ly(arguments[0],this)}},Yy.prototype.createMultiPolygon=function(){return 0===arguments.length?new Ry(null,this):1===arguments.length?new Ry(arguments[0],this):void 0},Yy.prototype.createMultiPoint=function(){if(0===arguments.length)return new Ty(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new Ty(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(jg(arguments[0],$g)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n<e.size();n++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());wy.copy(e,n,i,0,1),r[n]=this.createPoint(i)}return this.createMultiPoint(r)}}},Yy.prototype.interfaces_=function(){return[kg]},Yy.prototype.getClass=function(){return Yy},Yy.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.getDefaultCoordinateSequenceFactory=function(){return Uy.instance()},Yy.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Yy.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},Xy.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(Yy,Xy);var Wy=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Jy=function(t){this.geometryFactory=t||new Yy};Jy.prototype.read=function(t){var e,r=(e="string"==typeof t?JSON.parse(t):t).type;if(!Ky[r])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Wy.indexOf(r)?Ky[r].apply(this,[e.coordinates]):"GeometryCollection"===r?Ky[r].apply(this,[e.geometries]):Ky[r].apply(this,[e])},Jy.prototype.write=function(t){var e=t.getGeometryType();if(!Zy[e])throw new Error("Geometry is not supported");return Zy[e].apply(this,[t])};var Ky={Feature:function(t){var e={};for(var r in t)e[r]=t[r];if(t.geometry){var n=t.geometry.type;if(!Ky[n])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Ky.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var r=0;r<t.features.length;++r)e.features.push(this.read(t.features[r]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(new Fg(n[0],n[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new Fg(t[0],t[1]),new Fg(t[2],t[1]),new Fg(t[2],t[3]),new Fg(t[0],t[3]),new Fg(t[0],t[1])])},Point:function(t){var e=new Fg(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],r=0;r<t.length;++r)e.push(Ky.Point.apply(this,[t[r]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=Ky.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],r=0;r<t.length;++r)e.push(Ky.LineString.apply(this,[t[r]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=Ky.coordinates.apply(this,[t[0]]),r=this.geometryFactory.createLinearRing(e),n=[],i=1;i<t.length;++i){var o=t[i],s=Ky.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);n.push(a)}return this.geometryFactory.createPolygon(r,n)},MultiPolygon:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(Ky.Polygon.apply(this,[n]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},Zy={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:Zy.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=Zy.Point.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],r=t.getCoordinates(),n=0;n<r.length;++n){var i=r[n];e.push(Zy.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=Zy.LineString.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],r=Zy.LineString.apply(this,[t._shell]);e.push(r.coordinates);for(var n=0;n<t._holes.length;++n){var i=t._holes[n],o=Zy.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=Zy.Polygon.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=n.getGeometryType();e.push(Zy[i].apply(this,[n]))}return{type:"GeometryCollection",geometries:e}}},$y=function(t){this.geometryFactory=t||new Yy,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Jy(this.geometryFactory)};$y.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===jy.FIXED&&this.reducePrecision(e),e},$y.prototype.reducePrecision=function(t){var e,r;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,r=t.points.length;e<r;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,r=t.geometries.length;e<r;e++)this.reducePrecision(t.geometries[e])};var tv=function(){this.parser=new Jy(this.geometryFactory)};tv.prototype.write=function(t){return this.parser.write(t)};var ev=function(){},rv={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function nv(t){this.message=t||""}function iv(){this.array_=[]}ev.prototype.interfaces_=function(){return[]},ev.prototype.getClass=function(){return ev},ev.opposite=function(t){return t===ev.LEFT?ev.RIGHT:t===ev.RIGHT?ev.LEFT:t},rv.ON.get=function(){return 0},rv.LEFT.get=function(){return 1},rv.RIGHT.get=function(){return 2},Object.defineProperties(ev,rv),nv.prototype=new Error,nv.prototype.name="EmptyStackException",iv.prototype=new kA,iv.prototype.add=function(t){return this.array_.push(t),!0},iv.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},iv.prototype.push=function(t){return this.array_.push(t),t},iv.prototype.pop=function(t){if(0===this.array_.length)throw new nv;return this.array_.pop()},iv.prototype.peek=function(){if(0===this.array_.length)throw new nv;return this.array_[this.array_.length-1]},iv.prototype.empty=function(){return 0===this.array_.length},iv.prototype.isEmpty=function(){return this.empty()},iv.prototype.search=function(t){return this.array_.indexOf(t)},iv.prototype.size=function(){return this.array_.length},iv.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t};var ov=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};ov.prototype.getCoordinate=function(){return this._minCoord},ov.prototype.getRightmostSide=function(t,e){var r=this.getRightmostSideOfSegment(t,e);return r<0&&(r=this.getRightmostSideOfSegment(t,e-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),r},ov.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();dA.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],r=t[this._minIndex+1],n=_A.computeOrientation(this._minCoord,r,e),i=!1;(e.y<this._minCoord.y&&r.y<this._minCoord.y&&n===_A.COUNTERCLOCKWISE||e.y>this._minCoord.y&&r.y>this._minCoord.y&&n===_A.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},ov.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=ev.LEFT;return r[e].y<r[e+1].y&&(n=ev.RIGHT),n},ov.prototype.getEdge=function(){return this._orientedDe},ov.prototype.checkForRightmostCoordinate=function(t){for(var e=this,r=t.getEdge().getCoordinates(),n=0;n<r.length-1;n++)(null===e._minCoord||r[n].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},ov.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)},ov.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}dA.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)===ev.LEFT&&(this._orientedDe=this._minDe.getSym())},ov.prototype.interfaces_=function(){return[]},ov.prototype.getClass=function(){return ov};var sv=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new Fg(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}(fA),av=function(){this.array_=[]};av.prototype.addLast=function(t){this.array_.push(t)},av.prototype.removeFirst=function(){return this.array_.shift()},av.prototype.isEmpty=function(){return 0===this.array_.length};var uv=function(){this._finder=null,this._dirEdgeList=new QA,this._nodes=new QA,this._rightMostCoord=null,this._env=null,this._finder=new ov};uv.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},uv.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},uv.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new sv("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},uv.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(ev.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},uv.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},uv.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(ev.RIGHT)>=1&&e.getDepth(ev.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},uv.prototype.computeDepths=function(t){var e=new WA,r=new av,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(r.addLast(a),e.add(a))}}}},uv.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},uv.prototype.getEnvelope=function(){if(null===this._env){for(var t=new oA,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;n<r.length-1;n++)t.expandToInclude(r[n]);this._env=t}return this._env},uv.prototype.addReachable=function(t){var e=new iv;for(e.add(t);!e.empty();){var r=e.pop();this.add(r,e)}},uv.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(ev.LEFT,t.getDepth(ev.RIGHT)),e.setDepth(ev.RIGHT,t.getDepth(ev.LEFT))},uv.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var r=t.getEdges().iterator();r.hasNext();){var n=r.next();this._dirEdgeList.add(n);var i=n.getSym().getNode();i.isVisited()||e.push(i)}},uv.prototype.getNodes=function(){return this._nodes},uv.prototype.getDirectedEdges=function(){return this._dirEdgeList},uv.prototype.interfaces_=function(){return[Ng]},uv.prototype.getClass=function(){return uv};var lv=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[ev.ON]=r}else if(arguments[0]instanceof t){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[ev.ON]=o,this.location[ev.LEFT]=s,this.location[ev.RIGHT]=a}};lv.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},lv.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==Gg.NONE)return!1;return!0},lv.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===Gg.NONE&&(this.location[e]=t)},lv.prototype.isLine=function(){return 1===this.location.length},lv.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[ev.ON]=this.location[ev.ON],e[ev.LEFT]=Gg.NONE,e[ev.RIGHT]=Gg.NONE,this.location=e}for(var r=0;r<this.location.length;r++)this.location[r]===Gg.NONE&&r<t.location.length&&(this.location[r]=t.location[r])},lv.prototype.getLocations=function(){return this.location},lv.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[ev.LEFT];this.location[ev.LEFT]=this.location[ev.RIGHT],this.location[ev.RIGHT]=t},lv.prototype.toString=function(){var t=new qg;return this.location.length>1&&t.append(Gg.toLocationSymbol(this.location[ev.LEFT])),t.append(Gg.toLocationSymbol(this.location[ev.ON])),this.location.length>1&&t.append(Gg.toLocationSymbol(this.location[ev.RIGHT])),t.toString()},lv.prototype.setLocations=function(t,e,r){this.location[ev.ON]=t,this.location[ev.LEFT]=e,this.location[ev.RIGHT]=r},lv.prototype.get=function(t){return t<this.location.length?this.location[t]:Gg.NONE},lv.prototype.isArea=function(){return this.location.length>1},lv.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===Gg.NONE)return!0;return!1},lv.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(ev.ON,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.location[e]=r}},lv.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(Gg.NONE)},lv.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},lv.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},lv.prototype.interfaces_=function(){return[]},lv.prototype.getClass=function(){return lv};var hv=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new lv(e),this.elt[1]=new lv(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.elt[0]=new lv(r.elt[0]),this.elt[1]=new lv(r.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new lv(Gg.NONE),this.elt[1]=new lv(Gg.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new lv(o,s,a),this.elt[1]=new lv(o,s,a)}else if(4===arguments.length){var u=arguments[0],l=arguments[1],h=arguments[2],c=arguments[3];this.elt[0]=new lv(Gg.NONE,Gg.NONE,Gg.NONE),this.elt[1]=new lv(Gg.NONE,Gg.NONE,Gg.NONE),this.elt[u].setLocations(l,h,c)}};hv.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},hv.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},hv.prototype.isNull=function(t){return this.elt[t].isNull()},hv.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.elt[e].setAllLocationsIfNull(r)}},hv.prototype.isLine=function(t){return this.elt[t].isLine()},hv.prototype.merge=function(t){for(var e=this,r=0;r<2;r++)null===e.elt[r]&&null!==t.elt[r]?e.elt[r]=new lv(t.elt[r]):e.elt[r].merge(t.elt[r])},hv.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},hv.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(ev.ON)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return this.elt[e].get(r)}},hv.prototype.toString=function(){var t=new qg;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},hv.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},hv.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},hv.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(ev.ON,e)}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this.elt[r].setLocation(n,i)}},hv.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},hv.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},hv.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new lv(this.elt[t].location[0]))},hv.prototype.interfaces_=function(){return[]},hv.prototype.getClass=function(){return hv},hv.toLineLabel=function(t){for(var e=new hv(Gg.NONE),r=0;r<2;r++)e.setLocation(r,t.getLocation(r));return e};var cv=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new QA,this._pts=new QA,this._label=new hv(Gg.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new QA,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};cv.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=_A.isCCW(this._ring.getCoordinates())},cv.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},cv.prototype.computePoints=function(t){var e=this;this._startDe=t;var r=t,n=!0;do{if(null===r)throw new sv("Found null DirectedEdge");if(r.getEdgeRing()===e)throw new sv("Directed Edge visited twice during ring-building at "+r.getCoordinate());e._edges.add(r);var i=r.getLabel();dA.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(r.getEdge(),r.isForward(),n),n=!1,e.setEdgeRing(r,e),r=e.getNext(r)}while(r!==this._startDe)},cv.prototype.getLinearRing=function(){return this._ring},cv.prototype.getCoordinate=function(t){return this._pts.get(t)},cv.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var r=e.getNode().getEdges().getOutgoingDegree(t);r>t._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},cv.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o<n.length;o++)this._pts.add(n[o])}else{var s=n.length-2;r&&(s=n.length-1);for(var a=s;a>=0;a--)this._pts.add(n[a])}},cv.prototype.isHole=function(){return this._isHole},cv.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},cv.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!_A.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){if(r.next().containsPoint(t))return!1}return!0},cv.prototype.addHole=function(t){this._holes.add(t)},cv.prototype.isShell=function(){return null===this._shell},cv.prototype.getLabel=function(){return this._label},cv.prototype.getEdges=function(){return this._edges},cv.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},cv.prototype.getShell=function(){return this._shell},cv.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],r=arguments[0].getLocation(e,ev.RIGHT);if(r===Gg.NONE)return null;if(this._label.getLocation(e)===Gg.NONE)return this._label.setLocation(e,r),null}},cv.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},cv.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)e[r]=this._holes.get(r).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},cv.prototype.interfaces_=function(){return[]},cv.prototype.getClass=function(){return cv};var fv=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(cv),pv=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new QA,e=this._startDe;do{if(null===e.getMinEdgeRing()){var r=new fv(e,this._geometryFactory);t.add(r)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(cv),dv=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};dv.prototype.setVisited=function(t){this._isVisited=t},dv.prototype.setInResult=function(t){this._isInResult=t},dv.prototype.isCovered=function(){return this._isCovered},dv.prototype.isCoveredSet=function(){return this._isCoveredSet},dv.prototype.setLabel=function(t){this._label=t},dv.prototype.getLabel=function(){return this._label},dv.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},dv.prototype.updateIM=function(t){dA.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},dv.prototype.isInResult=function(){return this._isInResult},dv.prototype.isVisited=function(){return this._isVisited},dv.prototype.interfaces_=function(){return[]},dv.prototype.getClass=function(){return dv};var gv=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new hv(0,Gg.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 r=Gg.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==Gg.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new hv(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof hv)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===Gg.NONE&&t._label.setLocation(i,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=Gg.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;if(e===Gg.BOUNDARY)r=Gg.INTERIOR;else r=Gg.BOUNDARY;this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dv),Av=function(){this.nodeMap=new ry,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};Av.prototype.find=function(t){return this.nodeMap.get(t)},Av.prototype.addNode=function(){if(arguments[0]instanceof Fg){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 gv){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},Av.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Av.prototype.iterator=function(){return this.nodeMap.values().iterator()},Av.prototype.values=function(){return this.nodeMap.values()},Av.prototype.getBoundaryNodes=function(t){for(var e=new QA,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===Gg.BOUNDARY&&e.add(n)}return e},Av.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},Av.prototype.interfaces_=function(){return[]},Av.prototype.getClass=function(){return Av};var yv=function(){},vv={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};yv.prototype.interfaces_=function(){return[]},yv.prototype.getClass=function(){return yv},yv.isNorthern=function(t){return t===yv.NE||t===yv.NW},yv.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},yv.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var r=t<e?t:e;return 0===r&&3===(t>e?t:e)?3:r},yv.isInHalfPlane=function(t,e){return e===yv.SE?t===yv.SE||t===yv.SW:t===e||t===e+1},yv.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 Tg("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?yv.NE:yv.SE:e>=0?yv.NW:yv.SW}if(arguments[0]instanceof Fg&&arguments[1]instanceof Fg){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new Tg("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?yv.NE:yv.SE:n.y>=r.y?yv.NW:yv.SW}},vv.NE.get=function(){return 0},vv.NW.get=function(){return 1},vv.SW.get=function(){return 2},vv.SE.get=function(){return 3},Object.defineProperties(yv,vv);var mv=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],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};mv.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:_A.computeOrientation(t._p0,t._p1,this._p1)},mv.prototype.getDy=function(){return this._dy},mv.prototype.getCoordinate=function(){return this._p0},mv.prototype.setNode=function(t){this._node=t},mv.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),n=r.lastIndexOf("."),i=r.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},mv.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},mv.prototype.getDirectedCoordinate=function(){return this._p1},mv.prototype.getDx=function(){return this._dx},mv.prototype.getLabel=function(){return this._label},mv.prototype.getEdge=function(){return this._edge},mv.prototype.getQuadrant=function(){return this._quadrant},mv.prototype.getNode=function(){return this._node},mv.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),r=e.lastIndexOf(".");return" "+e.substring(r+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},mv.prototype.computeLabel=function(t){},mv.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=yv.quadrant(this._dx,this._dy),dA.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},mv.prototype.interfaces_=function(){return[Ng]},mv.prototype.getClass=function(){return mv};var _v=function(t){function e(){var e=arguments[0],r=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=r,r)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var n=e.getNumPoints()-1;this.init(e.getCoordinate(n),e.getCoordinate(n-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new hv(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new sv("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,r=0;r<2;r++)t._label.isArea(r)&&t._label.getLocation(r,ev.LEFT)===Gg.INTERIOR&&t._label.getLocation(r,ev.RIGHT)===Gg.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[ev.LEFT]+"/"+this._depth[ev.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,Gg.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,Gg.EXTERIOR);return t&&e&&r},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var n=1;t===ev.LEFT&&(n=-1);var i=ev.opposite(t),o=e+r*n;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===Gg.EXTERIOR&&e===Gg.INTERIOR?1:t===Gg.INTERIOR&&e===Gg.EXTERIOR?-1:0},e}(mv),Iv=function(){};Iv.prototype.createNode=function(t){return new gv(t,null)},Iv.prototype.interfaces_=function(){return[]},Iv.prototype.getClass=function(){return Iv};var Ev=function(){if(this._edges=new QA,this._nodes=null,this._edgeEndList=new QA,0===arguments.length)this._nodes=new Av(new Iv);else if(1===arguments.length){var t=arguments[0];this._nodes=new Av(t)}};Ev.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var r=this._edges.get(e);r.print(t),r.eiList.print(t)}},Ev.prototype.find=function(t){return this._nodes.find(t)},Ev.prototype.addNode=function(){if(arguments[0]instanceof gv){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof Fg){var e=arguments[0];return this._nodes.addNode(e)}},Ev.prototype.getNodeIterator=function(){return this._nodes.iterator()},Ev.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}},Ev.prototype.debugPrintln=function(t){nA.out.println(t)},Ev.prototype.isBoundaryNode=function(t,e){var r=this._nodes.find(e);if(null===r)return!1;var n=r.getLabel();return null!==n&&n.getLocation(t)===Gg.BOUNDARY},Ev.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}},Ev.prototype.matchInSameDirection=function(t,e,r,n){return!!t.equals(r)&&(_A.computeOrientation(t,e,n)===_A.COLLINEAR&&yv.quadrant(t,e)===yv.quadrant(r,n))},Ev.prototype.getEdgeEnds=function(){return this._edgeEndList},Ev.prototype.debugPrint=function(t){nA.out.print(t)},Ev.prototype.getEdgeIterator=function(){return this._edges.iterator()},Ev.prototype.findEdgeInSameDirection=function(t,e){for(var r=this,n=0;n<this._edges.size();n++){var i=r._edges.get(n),o=i.getCoordinates();if(r.matchInSameDirection(t,e,o[0],o[1]))return i;if(r.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},Ev.prototype.insertEdge=function(t){this._edges.add(t)},Ev.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var r=e.next();if(r.getEdge()===t)return r}return null},Ev.prototype.addEdges=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next();e._edges.add(n);var i=new _v(n,!0),o=new _v(n,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},Ev.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},Ev.prototype.getNodes=function(){return this._nodes.values()},Ev.prototype.findEdge=function(t,e){for(var r=0;r<this._edges.size();r++){var n=this._edges.get(r),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null},Ev.prototype.interfaces_=function(){return[]},Ev.prototype.getClass=function(){return Ev},Ev.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}};var xv=function(){this._geometryFactory=null,this._shellList=new QA;var t=arguments[0];this._geometryFactory=t};xv.prototype.sortShellsAndHoles=function(t,e,r){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()?r.add(i):e.add(i)}},xv.prototype.computePolygons=function(t){for(var e=new QA,r=t.iterator();r.hasNext();){var n=r.next().toPolygon(this._geometryFactory);e.add(n)}return e},xv.prototype.placeFreeHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(null===n.getShell()){var i=this.findEdgeRingContaining(n,t);if(null===i)throw new sv("unable to assign hole to a shell",n.getCoordinate(0));n.setShell(i)}}},xv.prototype.buildMinimalEdgeRings=function(t,e,r){for(var n=new QA,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):r.addAll(s)}else n.add(o)}return n},xv.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},xv.prototype.buildMaximalEdgeRings=function(t){for(var e=new QA,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new pv(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},xv.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},xv.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},xv.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),h=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(n)&&_A.isPointInRing(i,l.getCoordinates())&&(c=!0),c&&(null===o||s.contains(h))&&(o=u)}return o},xv.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return dA.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},xv.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];Ev.linkResultDirectedEdges(arguments[1]);var r=this.buildMaximalEdgeRings(e),n=new QA,i=this.buildMinimalEdgeRings(r,this._shellList,n);this.sortShellsAndHoles(i,this._shellList,n),this.placeFreeHoles(this._shellList,n)}},xv.prototype.interfaces_=function(){return[]},xv.prototype.getClass=function(){return xv};var wv=function(){};wv.prototype.getBounds=function(){},wv.prototype.interfaces_=function(){return[]},wv.prototype.getClass=function(){return wv};var Cv=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Cv.prototype.getItem=function(){return this._item},Cv.prototype.getBounds=function(){return this._bounds},Cv.prototype.interfaces_=function(){return[wv,kg]},Cv.prototype.getClass=function(){return Cv};var bv=function(){this._size=null,this._items=null,this._size=0,this._items=new QA,this._items.add(null)};bv.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},bv.prototype.size=function(){return this._size},bv.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},bv.prototype.clear=function(){this._size=0,this._items.clear()},bv.prototype.isEmpty=function(){return 0===this._size},bv.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)},bv.prototype.interfaces_=function(){return[]},bv.prototype.getClass=function(){return bv};var Sv=function(){};Sv.prototype.visitItem=function(t){},Sv.prototype.interfaces_=function(){return[]},Sv.prototype.getClass=function(){return Sv};var Bv=function(){};Bv.prototype.insert=function(t,e){},Bv.prototype.remove=function(t,e){},Bv.prototype.query=function(){},Bv.prototype.interfaces_=function(){return[]},Bv.prototype.getClass=function(){return Bv};var Mv=function(){if(this._childBoundables=new QA,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},Tv={serialVersionUID:{configurable:!0}};Mv.prototype.getLevel=function(){return this._level},Mv.prototype.size=function(){return this._childBoundables.size()},Mv.prototype.getChildBoundables=function(){return this._childBoundables},Mv.prototype.addChildBoundable=function(t){dA.isTrue(null===this._bounds),this._childBoundables.add(t)},Mv.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Mv.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Mv.prototype.interfaces_=function(){return[wv,kg]},Mv.prototype.getClass=function(){return Mv},Tv.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Mv,Tv);var Lv=function(){};Lv.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Lv.min=function(t){return Lv.sort(t),t.get(0)},Lv.sort=function(t,e){var r=t.toArray();e?ay.sort(r,e):ay.sort(r);for(var n=t.iterator(),i=0,o=r.length;i<o;i++)n.next(),n.set(r[i])},Lv.singletonList=function(t){var e=new QA;return e.add(t),e};var Rv=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],r=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=r,this._distance=this.distance()};Rv.prototype.expandToQueue=function(t,e){var r=Rv.isComposite(this._boundable1),n=Rv.isComposite(this._boundable2);if(r&&n)return Rv.area(this._boundable1)>Rv.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Tg("neither boundable is composite")},Rv.prototype.isLeaves=function(){return!(Rv.isComposite(this._boundable1)||Rv.isComposite(this._boundable2))},Rv.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},Rv.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new Rv(o,e,this._itemDistance);s.getDistance()<n&&r.add(s)}},Rv.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},Rv.prototype.getDistance=function(){return this._distance},Rv.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Rv.prototype.interfaces_=function(){return[Ng]},Rv.prototype.getClass=function(){return Rv},Rv.area=function(t){return t.getBounds().getArea()},Rv.isComposite=function(t){return t instanceof Mv};var Nv=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new QA,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var r=arguments[0];dA.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},Pv={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Nv.prototype.getNodeCapacity=function(){return this._nodeCapacity},Nv.prototype.lastNode=function(t){return t.get(t.size()-1)},Nv.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 r=e.next();r instanceof Mv?t+=this.size(r):r instanceof Cv&&(t+=1)}return t}},Nv.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof Cv&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},Nv.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new QA:t}if(1===arguments.length){for(var e=arguments[0],r=new QA,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof Mv){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof Cv?r.add(i.getItem()):dA.shouldNeverReachHere()}return r.size()<=0?null:r}},Nv.prototype.insert=function(t,e){dA.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Cv(t,e))},Nv.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new QA;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(dA.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof Mv?this.boundablesAtLevel(r,s,i):(dA.isTrue(s instanceof Cv),-1===r&&i.add(s))}return null}},Nv.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new QA;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(jg(arguments[2],Sv)&&arguments[0]instanceof Object&&arguments[1]instanceof Mv)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),u=0;u<a.size();u++){var l=a.get(u);t.getIntersectsOp().intersects(l.getBounds(),o)&&(l instanceof Mv?t.query(o,l,s):l instanceof Cv?s.visitItem(l.getItem()):dA.shouldNeverReachHere())}else if(jg(arguments[2],kA)&&arguments[0]instanceof Object&&arguments[1]instanceof Mv)for(var h=arguments[0],c=arguments[2],f=arguments[1].getChildBoundables(),p=0;p<f.size();p++){var d=f.get(p);t.getIntersectsOp().intersects(d.getBounds(),h)&&(d instanceof Mv?t.query(h,d,c):d instanceof Cv?c.add(d.getItem()):dA.shouldNeverReachHere())}},Nv.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},Nv.prototype.getRoot=function(){return this.build(),this._root},Nv.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=this.removeItem(n,i);if(o)return!0;for(var s=null,a=n.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),r)&&(u instanceof Mv&&(o=this.remove(r,u,i)))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(s),o}},Nv.prototype.createHigherLevels=function(t,e){dA.isTrue(!t.isEmpty());var r=this.createParentBoundables(t,e+1);return 1===r.size()?r.get(0):this.createHigherLevels(r,e+1)},Nv.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();if(r instanceof Mv){var n=this.depth(r);n>t&&(t=n)}}return t+1}},Nv.prototype.createParentBoundables=function(t,e){var r=this;dA.isTrue(!t.isEmpty());var n=new QA;n.add(this.createNode(e));var i=new QA(t);Lv.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(s)}return n},Nv.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Nv.prototype.interfaces_=function(){return[kg]},Nv.prototype.getClass=function(){return Nv},Nv.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},Pv.IntersectsOp.get=function(){return Dv},Pv.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},Pv.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Nv,Pv);var Dv=function(){},kv=function(){};kv.prototype.distance=function(t,e){},kv.prototype.interfaces_=function(){return[]},kv.prototype.getClass=function(){return kv};var Fv=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){dA.isTrue(t.length>0);for(var r=new QA,n=0;n<t.length;n++)r.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return r},e.prototype.createNode=function(t){return new Qv(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],r=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,r)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var r=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){n[o]=new QA;for(var s=0;i.hasNext()&&s<r;){var a=i.next();n[o].add(a),s++}}return n},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var r=arguments[0],n=arguments[1];t.prototype.query.call(this,r,n)}else if(3===arguments.length)if(jg(arguments[2],Sv)&&arguments[0]instanceof Object&&arguments[1]instanceof Mv){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(jg(arguments[2],kA)&&arguments[0]instanceof Object&&arguments[1]instanceof Mv){var a=arguments[0],u=arguments[1],l=arguments[2];t.prototype.query.call(this,a,u,l)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,r){return t.prototype.createParentBoundables.call(this,e,r)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return t.prototype.remove.call(this,e,r)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,r){dA.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new QA(t);Lv.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(o,r)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(jg(arguments[0],kv)){var t=arguments[0],r=new Rv(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(r)}if(arguments[0]instanceof Rv){var n=arguments[0];return this.nearestNeighbour(n,Lg.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&jg(arguments[1],kv)){var i=arguments[0],o=arguments[1],s=new Rv(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof Rv&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],l=null,h=new bv;for(h.add(a);!h.isEmpty()&&u>0;){var c=h.poll(),f=c.getDistance();if(f>=u)break;c.isLeaves()?(u=f,l=c):c.expandToQueue(h,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var p=arguments[2],d=new Cv(arguments[0],arguments[1]),g=new Rv(this.getRoot(),d,p);return this.nearestNeighbour(g)[0]}},e.prototype.interfaces_=function(){return[Bv,kg]},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())},r.STRtreeNode.get=function(){return Qv},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[Dg]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[Dg]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(Nv),Qv=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 r=e.next();null===t?t=new oA(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Mv),Ov=function(){};Ov.prototype.interfaces_=function(){return[]},Ov.prototype.getClass=function(){return Ov},Ov.relativeSign=function(t,e){return t<e?-1:t>e?1:0},Ov.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=Ov.relativeSign(e.x,r.x),i=Ov.relativeSign(e.y,r.y);switch(t){case 0:return Ov.compareValue(n,i);case 1:return Ov.compareValue(i,n);case 2:return Ov.compareValue(i,-n);case 3:return Ov.compareValue(-n,i);case 4:return Ov.compareValue(-n,-i);case 5:return Ov.compareValue(-i,-n);case 6:return Ov.compareValue(-i,n);case 7:return Ov.compareValue(n,-i)}return dA.shouldNeverReachHere("invalid octant value"),0},Ov.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Uv=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new Fg(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};Uv.prototype.getCoordinate=function(){return this.coord},Uv.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},Uv.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:Ov.compare(this._segmentOctant,this.coord,e.coord)},Uv.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},Uv.prototype.isInterior=function(){return this._isInterior},Uv.prototype.interfaces_=function(){return[Ng]},Uv.prototype.getClass=function(){return Uv};var Gv=function(){this._nodeMap=new ry,this._edge=null;var t=arguments[0];this._edge=t};Gv.prototype.getSplitCoordinates=function(){var t=new UA;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},Gv.prototype.addCollapsedNodes=function(){var t=new QA;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},Gv.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Gv.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var r=this._edge.getCoordinate(e),n=this._edge.getCoordinate(e+2);r.equals2D(n)&&t.add(new Yg(e+1))}},Gv.prototype.addEdgeCoordinates=function(t,e,r){var n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);r.add(new Fg(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)r.add(this._edge.getCoordinate(o));i&&r.add(new Fg(e.coord))},Gv.prototype.iterator=function(){return this._nodeMap.values().iterator()},Gv.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},Gv.prototype.findCollapseIndex=function(t,e,r){if(!t.coord.equals2D(e.coord))return!1;var n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(r[0]=t.segmentIndex+1,!0)},Gv.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),r=this.iterator(),n=r.next();r.hasNext();){var i=r.next();this.findCollapseIndex(n,i,e)&&t.add(new Yg(e[0])),n=i}},Gv.prototype.getEdge=function(){return this._edge},Gv.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},Gv.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new Fg(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new Fg(e.coord)),new Hv(o,this._edge.getData())},Gv.prototype.add=function(t,e){var r=new Uv(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(r);return null!==n?(dA.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(r,r),r)},Gv.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),r=t.get(0).getCoordinate(0);if(!r.equals2D(e[0]))throw new fA("bad split edge start point at "+r);var n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new fA("bad split edge end point at "+i)},Gv.prototype.interfaces_=function(){return[]},Gv.prototype.getClass=function(){return Gv};var zv=function(){};zv.prototype.interfaces_=function(){return[]},zv.prototype.getClass=function(){return zv},zv.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new Tg("Cannot compute the octant for point ( "+t+", "+e+" )");var r=Math.abs(t),n=Math.abs(e);return t>=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof Fg&&arguments[1]instanceof Fg){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new Tg("Cannot compute the octant for two identical points "+i);return zv.octant(s,a)}};var jv=function(){};jv.prototype.getCoordinates=function(){},jv.prototype.size=function(){},jv.prototype.getCoordinate=function(t){},jv.prototype.isClosed=function(){},jv.prototype.setData=function(t){},jv.prototype.getData=function(){},jv.prototype.interfaces_=function(){return[]},jv.prototype.getClass=function(){return jv};var Vv=function(){};Vv.prototype.addIntersection=function(t,e){},Vv.prototype.interfaces_=function(){return[jv]},Vv.prototype.getClass=function(){return Vv};var Hv=function(){this._nodeList=new Gv(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Hv.prototype.getCoordinates=function(){return this._pts},Hv.prototype.size=function(){return this._pts.length},Hv.prototype.getCoordinate=function(t){return this._pts[t]},Hv.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Hv.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Hv.prototype.setData=function(t){this._data=t},Hv.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:zv.octant(t,e)},Hv.prototype.getData=function(){return this._data},Hv.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new Fg(arguments[0].getIntersection(n));this.addIntersection(i,r)}},Hv.prototype.toString=function(){return cA.toLineString(new Qy(this._pts))},Hv.prototype.getNodeList=function(){return this._nodeList},Hv.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n<this._pts.length){var i=this._pts[n];t.equals2D(i)&&(r=n)}return this._nodeList.add(t,r)},Hv.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},Hv.prototype.interfaces_=function(){return[Vv]},Hv.prototype.getClass=function(){return Hv},Hv.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new QA;return Hv.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){n.next().getNodeList().addSplitEdges(r)}};var qv=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new Fg,this.p1=new Fg;else if(1===arguments.length){var t=arguments[0];this.p0=new Fg(t.p0),this.p1=new Fg(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=arguments[3];this.p0=new Fg(e,r),this.p1=new Fg(n,i)}},Yv={serialVersionUID:{configurable:!0}};qv.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},qv.prototype.orientationIndex=function(){if(arguments[0]instanceof qv){var t=arguments[0],e=_A.orientationIndex(this.p0,this.p1,t.p0),r=_A.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof Fg){var n=arguments[0];return _A.orientationIndex(this.p0,this.p1,n)}},qv.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},qv.prototype.isVertical=function(){return this.p0.x===this.p1.x},qv.prototype.equals=function(t){if(!(t instanceof qv))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},qv.prototype.intersection=function(t){var e=new yA;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},qv.prototype.project=function(){if(arguments[0]instanceof Fg){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Fg(t);var e=this.projectionFactor(t),r=new Fg;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof qv){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(n.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(n.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new qv(s,a)}},qv.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},qv.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},qv.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},qv.prototype.distancePerpendicular=function(t){return _A.distancePointLinePerpendicular(t,this.p0,this.p1)},qv.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},qv.prototype.midPoint=function(){return qv.midPoint(this.p0,this.p1)},qv.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,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?Lg.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},qv.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=Lg.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<n&&(n=i,r[0]=s,r[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<n&&(n=i,r[0]=this.p0,r[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<n&&(n=i,r[0]=this.p1,r[1]=u),r},qv.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},qv.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},qv.prototype.getLength=function(){return this.p0.distance(this.p1)},qv.prototype.compareTo=function(t){var e=t,r=this.p0.compareTo(e.p0);return 0!==r?r:this.p1.compareTo(e.p1)},qv.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},qv.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},qv.prototype.lineIntersection=function(t){try{return iA.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof rA))throw t}return null},qv.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},qv.prototype.pointAlongOffset=function(t,e){var r=this.p0.x+t*(this.p1.x-this.p0.x),n=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,u=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,u=e*o/s}return new Fg(r-u,n+a)},qv.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=r.x,this.p1.y=r.y}},qv.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||Lg.isNaN(e))&&(e=1),e},qv.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},qv.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},qv.prototype.distance=function(){if(arguments[0]instanceof qv){var t=arguments[0];return _A.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof Fg){var e=arguments[0];return _A.distancePointLine(e,this.p0,this.p1)}},qv.prototype.pointAlong=function(t){var e=new Fg;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},qv.prototype.hashCode=function(){var t=Lg.doubleToLongBits(this.p0.x);t^=31*Lg.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=Lg.doubleToLongBits(this.p1.x);return r^=31*Lg.doubleToLongBits(this.p1.y),e^(Math.trunc(r)^Math.trunc(r>>32))},qv.prototype.interfaces_=function(){return[Ng,kg]},qv.prototype.getClass=function(){return qv},qv.midPoint=function(t,e){return new Fg((t.x+e.x)/2,(t.y+e.y)/2)},Yv.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(qv,Yv);var Xv=function(){this.tempEnv1=new oA,this.tempEnv2=new oA,this._overlapSeg1=new qv,this._overlapSeg2=new qv};Xv.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},Xv.prototype.interfaces_=function(){return[]},Xv.prototype.getClass=function(){return Xv};var Wv=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],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};Wv.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},Wv.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var s=Math.trunc((e+r)/2);e<s&&this.computeSelect(t,e,s,n),s<r&&this.computeSelect(t,s,r,n)},Wv.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,r=this._start;r<=this._end;r++)t[e++]=this._pts[r];return t},Wv.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},Wv.prototype.setId=function(t){this._id=t},Wv.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},Wv.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new oA(t,e)}return this._env},Wv.prototype.getEndIndex=function(){return this._end},Wv.prototype.getStartIndex=function(){return this._start},Wv.prototype.getContext=function(){return this._context},Wv.prototype.getId=function(){return this._id},Wv.prototype.computeOverlapsInternal=function(t,e,r,n,i,o){var s=this._pts[t],a=this._pts[e],u=r._pts[n],l=r._pts[i];if(e-t==1&&i-n==1)return o.overlap(this,t,r,n),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),c=Math.trunc((n+i)/2);t<h&&(n<c&&this.computeOverlapsInternal(t,h,r,n,c,o),c<i&&this.computeOverlapsInternal(t,h,r,c,i,o)),h<e&&(n<c&&this.computeOverlapsInternal(h,e,r,n,c,o),c<i&&this.computeOverlapsInternal(h,e,r,c,i,o))},Wv.prototype.interfaces_=function(){return[]},Wv.prototype.getClass=function(){return Wv};var Jv=function(){};Jv.prototype.interfaces_=function(){return[]},Jv.prototype.getClass=function(){return Jv},Jv.getChainStartIndices=function(t){var e=0,r=new QA;r.add(new Yg(e));do{var n=Jv.findChainEnd(t,e);r.add(new Yg(n)),e=n}while(e<t.length-1);return Jv.toIntArray(r)},Jv.findChainEnd=function(t,e){for(var r=e;r<t.length-1&&t[r].equals2D(t[r+1]);)r++;if(r>=t.length-1)return t.length-1;for(var n=yv.quadrant(t[r],t[r+1]),i=e+1;i<t.length;){if(!t[i-1].equals2D(t[i]))if(yv.quadrant(t[i-1],t[i])!==n)break;i++}return i-1},Jv.getChains=function(){if(1===arguments.length)return Jv.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],r=new QA,n=Jv.getChainStartIndices(t),i=0;i<n.length-1;i++){var o=new Wv(t,n[i],n[i+1],e);r.add(o)}return r}},Jv.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var Kv=function(){};Kv.prototype.computeNodes=function(t){},Kv.prototype.getNodedSubstrings=function(){},Kv.prototype.interfaces_=function(){return[]},Kv.prototype.getClass=function(){return Kv};var Zv=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};Zv.prototype.setSegmentIntersector=function(t){this._segInt=t},Zv.prototype.interfaces_=function(){return[Kv]},Zv.prototype.getClass=function(){return Zv};var $v=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new QA,this._index=new Fv,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return Hv.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,r=Jv.getChains(t.getCoordinates(),t).iterator();r.hasNext();){var n=r.next();n.setId(e._idCounter++),e._index.insert(n.getEnvelope(),n),e._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=this,e=new tm(this._segInt),r=this._monoChains.iterator();r.hasNext();)for(var n=r.next(),i=t._index.query(n.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>n.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return tm},Object.defineProperties(e,r),e}(Zv),tm=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],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Xv),em=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 r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},rm={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}};em.prototype.getEndCapStyle=function(){return this._endCapStyle},em.prototype.isSingleSided=function(){return this._isSingleSided},em.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=em.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=em.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==em.JOIN_ROUND&&(this._quadrantSegments=em.DEFAULT_QUADRANT_SEGMENTS)},em.prototype.getJoinStyle=function(){return this._joinStyle},em.prototype.setJoinStyle=function(t){this._joinStyle=t},em.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},em.prototype.getSimplifyFactor=function(){return this._simplifyFactor},em.prototype.getQuadrantSegments=function(){return this._quadrantSegments},em.prototype.setEndCapStyle=function(t){this._endCapStyle=t},em.prototype.getMitreLimit=function(){return this._mitreLimit},em.prototype.setMitreLimit=function(t){this._mitreLimit=t},em.prototype.setSingleSided=function(t){this._isSingleSided=t},em.prototype.interfaces_=function(){return[]},em.prototype.getClass=function(){return em},em.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},rm.CAP_ROUND.get=function(){return 1},rm.CAP_FLAT.get=function(){return 2},rm.CAP_SQUARE.get=function(){return 3},rm.JOIN_ROUND.get=function(){return 1},rm.JOIN_MITRE.get=function(){return 2},rm.JOIN_BEVEL.get=function(){return 3},rm.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},rm.DEFAULT_MITRE_LIMIT.get=function(){return 5},rm.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(em,rm);var nm=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=_A.COUNTERCLOCKWISE,this._inputLine=t||null},im={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};nm.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[r];return!!this.isConcave(i,o,s)&&(!!this.isShallow(i,o,s,n)&&this.isShallowSampled(i,o,t,r,n))},nm.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n<this._inputLine.length;){var o=!1;t.isDeletable(e,r,n,t._distanceTol)&&(t._isDeleted[r]=nm.DELETE,o=!0,i=!0),e=o?n:r,r=t.findNextNonDeletedIndex(e),n=t.findNextNonDeletedIndex(r)}return i},nm.prototype.isShallowConcavity=function(t,e,r,n){return _A.computeOrientation(t,e,r)===this._angleOrientation&&_A.distancePointLine(e,t,r)<n},nm.prototype.isShallowSampled=function(t,e,r,n,i){var o=Math.trunc((n-r)/nm.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=r;s<n;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},nm.prototype.isConcave=function(t,e,r){var n=_A.computeOrientation(t,e,r)===this._angleOrientation;return n},nm.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=_A.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},nm.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===nm.DELETE;)e++;return e},nm.prototype.isShallow=function(t,e,r,n){return _A.distancePointLine(e,t,r)<n},nm.prototype.collapseLine=function(){for(var t=new UA,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==nm.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},nm.prototype.interfaces_=function(){return[]},nm.prototype.getClass=function(){return nm},nm.simplify=function(t,e){return new nm(t).simplify(e)},im.INIT.get=function(){return 0},im.DELETE.get=function(){return 1},im.KEEP.get=function(){return 1},im.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(nm,im);var om=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new QA},sm={COORDINATE_ARRAY_TYPE:{configurable:!0}};om.prototype.getCoordinates=function(){return this._ptList.toArray(om.COORDINATE_ARRAY_TYPE)},om.prototype.setPrecisionModel=function(t){this._precisionModel=t},om.prototype.addPt=function(t){var e=new Fg(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},om.prototype.revere=function(){},om.prototype.addPts=function(t,e){if(e)for(var r=0;r<t.length;r++)this.addPt(t[r]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},om.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},om.prototype.toString=function(){return(new Yy).createLineString(this.getCoordinates()).toString()},om.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new Fg(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},om.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},om.prototype.interfaces_=function(){return[]},om.prototype.getClass=function(){return om},sm.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(om,sm);var am=function(){},um={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};am.prototype.interfaces_=function(){return[]},am.prototype.getClass=function(){return am},am.toDegrees=function(t){return 180*t/Math.PI},am.normalize=function(t){for(;t>Math.PI;)t-=am.PI_TIMES_2;for(;t<=-Math.PI;)t+=am.PI_TIMES_2;return t},am.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],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},am.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},am.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},am.interiorAngle=function(t,e,r){var n=am.angle(e,t),i=am.angle(e,r);return Math.abs(i-n)},am.normalizePositive=function(t){if(t<0){for(;t<0;)t+=am.PI_TIMES_2;t>=am.PI_TIMES_2&&(t=0)}else{for(;t>=am.PI_TIMES_2;)t-=am.PI_TIMES_2;t<0&&(t=0)}return t},am.angleBetween=function(t,e,r){var n=am.angle(e,t),i=am.angle(e,r);return am.diff(n,i)},am.diff=function(t,e){var r=null;return(r=t<e?e-t:t-e)>Math.PI&&(r=2*Math.PI-r),r},am.toRadians=function(t){return t*Math.PI/180},am.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?am.COUNTERCLOCKWISE:r<0?am.CLOCKWISE:am.NONE},am.angleBetweenOriented=function(t,e,r){var n=am.angle(e,t),i=am.angle(e,r)-n;return i<=-Math.PI?i+am.PI_TIMES_2:i>Math.PI?i-am.PI_TIMES_2:i},um.PI_TIMES_2.get=function(){return 2*Math.PI},um.PI_OVER_2.get=function(){return Math.PI/2},um.PI_OVER_4.get=function(){return Math.PI/4},um.COUNTERCLOCKWISE.get=function(){return _A.COUNTERCLOCKWISE},um.CLOCKWISE.get=function(){return _A.CLOCKWISE},um.NONE.get=function(){return _A.COLLINEAR},Object.defineProperties(am,um);var lm=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 qv,this._seg1=new qv,this._offset0=new qv,this._offset1=new qv,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new yA,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===em.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},hm={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}};lm.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 r=_A.computeOrientation(this._s0,this._s1,this._s2),n=r===_A.CLOCKWISE&&this._side===ev.LEFT||r===_A.COUNTERCLOCKWISE&&this._side===ev.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},lm.prototype.addLineEndCap=function(t,e){var r=new qv(t,e),n=new qv;this.computeOffsetSegment(r,ev.LEFT,this._distance,n);var i=new qv;this.computeOffsetSegment(r,ev.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case em.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,_A.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case em.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case em.CAP_SQUARE:var u=new Fg;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new Fg(n.p1.x+u.x,n.p1.y+u.y),h=new Fg(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(h)}},lm.prototype.getCoordinates=function(){return this._segList.getCoordinates()},lm.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=iA.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof rA))throw t;o=new Fg(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},lm.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=r.x-t.x,l=r.y-t.y,h=Math.atan2(l,u);n===_A.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,n,i),this._segList.addPt(r)},lm.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*lm.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===em.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===em.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},lm.prototype.createSquare=function(t){this._segList.addPt(new Fg(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new Fg(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new Fg(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new Fg(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},lm.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},lm.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},lm.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},lm.prototype.initSideSegments=function(t,e,r){this._s1=t,this._s2=e,this._side=r,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,r,this._distance,this._offset1)},lm.prototype.addLimitedMitreJoin=function(t,e,r,n){var i=this._seg0.p1,o=am.angle(i,this._seg0.p0),s=am.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=am.normalize(o+s),u=am.normalize(a+Math.PI),l=n*r,h=r-l*Math.abs(Math.sin(s)),c=i.x+l*Math.cos(u),f=i.y+l*Math.sin(u),p=new Fg(c,f),d=new qv(i,p),g=d.pointAlongOffset(1,h),A=d.pointAlongOffset(1,-h);this._side===ev.LEFT?(this._segList.addPt(g),this._segList.addPt(A)):(this._segList.addPt(A),this._segList.addPt(g))},lm.prototype.computeOffsetSegment=function(t,e,r,n){var i=e===ev.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),u=i*r*o/a,l=i*r*s/a;n.p0.x=t.p0.x-l,n.p0.y=t.p0.y+u,n.p1.x=t.p1.x-l,n.p1.y=t.p1.y+u},lm.prototype.addFilletArc=function(t,e,r,n,i){var o=n===_A.CLOCKWISE?-1:1,s=Math.abs(e-r),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,h=new Fg;l<s;){var c=e+o*l;h.x=t.x+i*Math.cos(c),h.y=t.y+i*Math.sin(c),this._segList.addPt(h),l+=u}},lm.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*lm.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var r=new Fg((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(r);var n=new Fg((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)}},lm.prototype.createCircle=function(t){var e=new Fg(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},lm.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},lm.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new om,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*lm.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},lm.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===em.JOIN_BEVEL||this._bufParams.getJoinStyle()===em.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,_A.CLOCKWISE,this._distance))},lm.prototype.closeRing=function(){this._segList.closeRing()},lm.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},lm.prototype.interfaces_=function(){return[]},lm.prototype.getClass=function(){return lm},hm.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},hm.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},hm.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},hm.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(lm,hm);var cm=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};cm.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&GA.reverse(o),o},cm.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=nm.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],ev.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{r.addSegments(t,!1);var a=nm.simplify(t,n),u=a.length-1;r.initSideSegments(a[0],a[1],ev.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(a[l],!0)}r.addLastSegment(),r.closeRing()},cm.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===ev.RIGHT&&(n=-n);var i=nm.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;r.addNextSegment(i[s],a)}r.closeRing()},cm.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=nm.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],ev.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var s=nm.simplify(t,-r),a=s.length-1;e.initSideSegments(s[a],s[a-1],ev.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},cm.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case em.CAP_ROUND:e.createCircle(t);break;case em.CAP_SQUARE:e.createSquare(t)}},cm.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},cm.prototype.getBufferParameters=function(){return this._bufParams},cm.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},cm.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return cm.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},cm.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=nm.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],ev.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{var a=nm.simplify(t,n),u=a.length-1;r.initSideSegments(a[0],a[1],ev.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(a[l],!0)}r.addLastSegment()},cm.prototype.getSegGen=function(t){return new lm(this._precisionModel,this._bufParams,t)},cm.prototype.interfaces_=function(){return[]},cm.prototype.getClass=function(){return cm},cm.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;r<e.length;r++)e[r]=new Fg(t[r]);return e};var fm=function(){this._subgraphs=null,this._seg=new qv,this._cga=new _A;var t=arguments[0];this._subgraphs=t},pm={DepthSegment:{configurable:!0}};fm.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=new QA,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(jg(arguments[2],kA)&&arguments[0]instanceof Fg&&arguments[1]instanceof _v)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getEdge().getCoordinates(),h=0;h<l.length-1;h++){if(t._seg.p0=l[h],t._seg.p1=l[h+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse(),!(Math.max(t._seg.p0.x,t._seg.p1.x)<s.x||t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||_A.computeOrientation(t._seg.p0,t._seg.p1,s)===_A.RIGHT)){var c=a.getDepth(ev.LEFT);t._seg.p0.equals(l[h])||(c=a.getDepth(ev.RIGHT));var f=new dm(t._seg,c);u.add(f)}}else if(jg(arguments[2],kA)&&arguments[0]instanceof Fg&&jg(arguments[1],kA))for(var p=arguments[0],d=arguments[2],g=arguments[1].iterator();g.hasNext();){var A=g.next();A.isForward()&&t.findStabbedSegments(p,A,d)}},fm.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Lv.min(e)._leftDepth},fm.prototype.interfaces_=function(){return[]},fm.prototype.getClass=function(){return fm},pm.DepthSegment.get=function(){return dm},Object.defineProperties(fm,pm);var dm=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new qv(t),this._leftDepth=e};dm.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 r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!==(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},dm.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},dm.prototype.toString=function(){return this._upwardSeg.toString()},dm.prototype.interfaces_=function(){return[Ng]},dm.prototype.getClass=function(){return dm};var gm=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};gm.prototype.area=function(){return gm.area(this.p0,this.p1,this.p2)},gm.prototype.signedArea=function(){return gm.signedArea(this.p0,this.p1,this.p2)},gm.prototype.interpolateZ=function(t){if(null===t)throw new Tg("Supplied point is null.");return gm.interpolateZ(t,this.p0,this.p1,this.p2)},gm.prototype.longestSideLength=function(){return gm.longestSideLength(this.p0,this.p1,this.p2)},gm.prototype.isAcute=function(){return gm.isAcute(this.p0,this.p1,this.p2)},gm.prototype.circumcentre=function(){return gm.circumcentre(this.p0,this.p1,this.p2)},gm.prototype.area3D=function(){return gm.area3D(this.p0,this.p1,this.p2)},gm.prototype.centroid=function(){return gm.centroid(this.p0,this.p1,this.p2)},gm.prototype.inCentre=function(){return gm.inCentre(this.p0,this.p1,this.p2)},gm.prototype.interfaces_=function(){return[]},gm.prototype.getClass=function(){return gm},gm.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},gm.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},gm.det=function(t,e,r,n){return t*n-e*r},gm.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,s=r.x-i,a=n.x-i,u=r.y-o,l=n.y-o,h=s*l-a*u,c=t.x-i,f=t.y-o,p=(l*c-a*f)/h,d=(-u*c+s*f)/h;return e.z+p*(r.z-e.z)+d*(n.z-e.z)},gm.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),s=n;return i>s&&(s=i),o>s&&(s=o),s},gm.isAcute=function(t,e,r){return!!am.isAcute(t,e,r)&&(!!am.isAcute(e,r,t)&&!!am.isAcute(r,t,e))},gm.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,s=t.y-i,a=e.x-n,u=e.y-i,l=2*gm.det(o,s,a,u),h=gm.det(s,o*o+s*s,u,a*a+u*u),c=gm.det(o,o*o+s*s,a,a*a+u*u);return new Fg(n-h/l,i+c/l)},gm.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new iA(t.x+r/2,t.y+n/2,1),o=new iA(t.x-n+r/2,t.y+r+n/2,1);return new iA(i,o)},gm.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,s=r.y-t.y;return new Fg(t.x+i*o,t.y+i*s)},gm.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=r.x-t.x,a=r.y-t.y,u=r.z-t.z,l=i*u-o*a,h=o*s-n*u,c=n*a-i*s,f=l*l+h*h+c*c,p=Math.sqrt(f)/2;return p},gm.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new Fg(n,i)},gm.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),s=n+i+o,a=(n*t.x+i*e.x+o*r.x)/s,u=(n*t.y+i*e.y+o*r.y)/s;return new Fg(a,u)};var Am=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new QA;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};Am.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,Gg.EXTERIOR,Gg.INTERIOR)},Am.prototype.addPolygon=function(t){var e=this,r=this._distance,n=ev.LEFT;this._distance<0&&(r=-this._distance,n=ev.RIGHT);var i=t.getExteriorRing(),o=GA.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,Gg.EXTERIOR,Gg.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),u=GA.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,r,ev.opposite(n),Gg.INTERIOR,Gg.EXTERIOR)}},Am.prototype.isTriangleErodedCompletely=function(t,e){var r=new gm(t[0],t[1],t[2]),n=r.inCentre();return _A.distancePointLine(n,r.p0,r.p1)<Math.abs(e)},Am.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=GA.removeRepeatedPoints(t.getCoordinates()),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,Gg.EXTERIOR,Gg.INTERIOR)},Am.prototype.addCurve=function(t,e,r){if(null===t||t.length<2)return null;var n=new Hv(t,new hv(0,Gg.BOUNDARY,e,r));this._curveList.add(n)},Am.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Am.prototype.addPolygonRing=function(t,e,r,n,i){if(0===e&&t.length<Ly.MINIMUM_VALID_SIZE)return null;var o=n,s=i;t.length>=Ly.MINIMUM_VALID_SIZE&&_A.isCCW(t)&&(o=i,s=n,r=ev.opposite(r));var a=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(a,o,s)},Am.prototype.add=function(t){if(t.isEmpty())return null;t instanceof My?this.addPolygon(t):t instanceof Cy?this.addLineString(t):t instanceof Sy?this.addPoint(t):(t instanceof Ty||t instanceof py||t instanceof Ry||t instanceof fy)&&this.addCollection(t)},Am.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},Am.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},Am.prototype.interfaces_=function(){return[]},Am.prototype.getClass=function(){return Am};var ym=function(){};ym.prototype.locate=function(t){},ym.prototype.interfaces_=function(){return[]},ym.prototype.getClass=function(){return ym};var vm=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};vm.prototype.next=function(){if(this._atStart)return this._atStart=!1,vm.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new FA;var t=this._parent.getGeometryN(this._index++);return t instanceof fy?(this._subcollectionIterator=new vm(t),this._subcollectionIterator.next()):t},vm.prototype.remove=function(){throw new Error(this.getClass().getName())},vm.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)},vm.prototype.interfaces_=function(){return[DA]},vm.prototype.getClass=function(){return vm},vm.isAtomic=function(t){return!(t instanceof fy)};var mm=function(){this._geom=null;var t=arguments[0];this._geom=t};mm.prototype.locate=function(t){return mm.locate(t,this._geom)},mm.prototype.interfaces_=function(){return[ym]},mm.prototype.getClass=function(){return mm},mm.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&_A.isPointInRing(t,e.getCoordinates())},mm.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!mm.isPointInRing(t,r))return!1;for(var n=0;n<e.getNumInteriorRing();n++){var i=e.getInteriorRingN(n);if(mm.isPointInRing(t,i))return!1}return!0},mm.containsPoint=function(t,e){if(e instanceof My)return mm.containsPointInPolygon(t,e);if(e instanceof fy)for(var r=new vm(e);r.hasNext();){var n=r.next();if(n!==e&&mm.containsPoint(t,n))return!0}return!1},mm.locate=function(t,e){return e.isEmpty()?Gg.EXTERIOR:mm.containsPoint(t,e)?Gg.INTERIOR:Gg.EXTERIOR};var _m=function(){this._edgeMap=new ry,this._edgeList=null,this._ptInAreaLocation=[Gg.NONE,Gg.NONE]};_m.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),r=e-1;return 0===e&&(r=this._edgeList.size()-1),this._edgeList.get(r)},_m.prototype.propagateSideLabels=function(t){for(var e=Gg.NONE,r=this.iterator();r.hasNext();){var n=r.next().getLabel();n.isArea(t)&&n.getLocation(t,ev.LEFT)!==Gg.NONE&&(e=n.getLocation(t,ev.LEFT))}if(e===Gg.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,ev.ON)===Gg.NONE&&a.setLocation(t,ev.ON,i),a.isArea(t)){var u=a.getLocation(t,ev.LEFT),l=a.getLocation(t,ev.RIGHT);if(l!==Gg.NONE){if(l!==i)throw new sv("side location conflict",s.getCoordinate());u===Gg.NONE&&dA.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else dA.isTrue(a.getLocation(t,ev.LEFT)===Gg.NONE,"found single null side"),a.setLocation(t,ev.RIGHT,i),a.setLocation(t,ev.LEFT,i)}}},_m.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},_m.prototype.print=function(t){nA.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){e.next().print(t)}},_m.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},_m.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var r=e.size()-1,n=e.get(r).getLabel().getLocation(t,ev.LEFT);dA.isTrue(n!==Gg.NONE,"Found unlabelled area edge");for(var i=n,o=this.iterator();o.hasNext();){var s=o.next().getLabel();dA.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,ev.LEFT),u=s.getLocation(t,ev.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},_m.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++){if(this._edgeList.get(e)===t)return e}return-1},_m.prototype.iterator=function(){return this.getEdges().iterator()},_m.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new QA(this._edgeMap.values())),this._edgeList},_m.prototype.getLocation=function(t,e,r){return this._ptInAreaLocation[t]===Gg.NONE&&(this._ptInAreaLocation[t]=mm.locate(e,r[t].getGeometry())),this._ptInAreaLocation[t]},_m.prototype.toString=function(){var t=new qg;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var r=e.next();t.append(r),t.append("\n")}return t.toString()},_m.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){e.next().computeLabel(t)}},_m.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],r=this.iterator();r.hasNext();)for(var n=r.next().getLabel(),i=0;i<2;i++)n.isLine(i)&&n.getLocation(i)===Gg.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var l=Gg.NONE;if(e[u])l=Gg.EXTERIOR;else{var h=s.getCoordinate();l=this.getLocation(u,h,t)}a.setAllLocationsIfNull(u,l)}},_m.prototype.getDegree=function(){return this._edgeMap.size()},_m.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},_m.prototype.interfaces_=function(){return[]},_m.prototype.getClass=function(){return _m};var Im=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var t=this;this.getResultAreaEdges();for(var e=null,r=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),n){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;r=s,n=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;r.setNext(o),n=t._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===e)throw new sv("no outgoing dirEdge found",this.getCoordinate());dA.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),r.setNext(e)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var r=t.get(0);if(1===e)return r;var n=t.get(e-1),i=r.getQuadrant(),o=n.getQuadrant();return yv.isNorthern(i)&&yv.isNorthern(o)?r:yv.isNorthern(i)||yv.isNorthern(o)?0!==r.getDy()?r:0!==n.getDy()?n:(dA.shouldNeverReachHere("found two horizontal edges incident on node"),null):n},e.prototype.print=function(t){nA.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var r=e.next();t.print("out "),r.print(t),t.println(),t.print("in "),r.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new QA;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next().getLabel();r.setAllLocationsIfNull(0,t.getLocation(0)),r.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,r=this._edgeList.size()-1;r>=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(ev.LEFT),n=t.getDepth(ev.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new sv("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var u=this._edgeList.get(a);u.setEdgeDepths(ev.RIGHT,s),s=u.getDepth(ev.LEFT)}return s}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=this,r=null,n=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===r&&s.getEdgeRing()===t&&(r=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(dA.isTrue(null!==r,"found null for first outgoing dirEdge"),dA.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},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 r=arguments[0],n=0,i=this.iterator();i.hasNext();){i.next().getEdgeRing()===r&&n++}return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=Gg.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=Gg.INTERIOR;break}if(n.isInResult()){t=Gg.EXTERIOR;break}}}if(t===Gg.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===Gg.INTERIOR):(s.isInResult()&&(i=Gg.EXTERIOR),a.isInResult()&&(i=Gg.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new hv(Gg.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==Gg.INTERIOR&&o!==Gg.BOUNDARY||this._label.setLocation(i,Gg.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(_m),Em=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 gv(t,new Im)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Iv),xm=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};xm.prototype.compareTo=function(t){var e=t;return xm.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},xm.prototype.interfaces_=function(){return[Ng]},xm.prototype.getClass=function(){return xm},xm.orientation=function(t){return 1===GA.increasingDirection(t)},xm.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,s=e?t.length:-1,a=n?r.length:-1,u=e?0:t.length-1,l=n?0:r.length-1;;){var h=t[u].compareTo(r[l]);if(0!==h)return h;var c=(u+=i)===s,f=(l+=o)===a;if(c&&!f)return-1;if(!c&&f)return 1;if(c&&f)return 0}};var wm=function(){this._edges=new QA,this._ocaMap=new ry};wm.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var r=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i<n.length;i++)i>0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},wm.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},wm.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},wm.prototype.iterator=function(){return this._edges.iterator()},wm.prototype.getEdges=function(){return this._edges},wm.prototype.get=function(t){return this._edges.get(t)},wm.prototype.findEqualEdge=function(t){var e=new xm(t.getCoordinates());return this._ocaMap.get(e)},wm.prototype.add=function(t){this._edges.add(t);var e=new xm(t.getCoordinates());this._ocaMap.put(e,t)},wm.prototype.interfaces_=function(){return[]},wm.prototype.getClass=function(){return wm};var Cm=function(){};Cm.prototype.processIntersections=function(t,e,r,n){},Cm.prototype.isDone=function(){},Cm.prototype.interfaces_=function(){return[]},Cm.prototype.getClass=function(){return Cm};var bm=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};bm.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(bm.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},bm.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},bm.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},bm.prototype.getLineIntersector=function(){return this._li},bm.prototype.hasProperIntersection=function(){return this._hasProper},bm.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},bm.prototype.hasIntersection=function(){return this._hasIntersection},bm.prototype.isDone=function(){return!1},bm.prototype.hasInteriorIntersection=function(){return this._hasInterior},bm.prototype.interfaces_=function(){return[Cm]},bm.prototype.getClass=function(){return bm},bm.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Sm=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],r=arguments[2];this.coord=new Fg(t),this.segmentIndex=e,this.dist=r};Sm.prototype.getSegmentIndex=function(){return this.segmentIndex},Sm.prototype.getCoordinate=function(){return this.coord},Sm.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Sm.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Sm.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Sm.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Sm.prototype.getDistance=function(){return this.dist},Sm.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Sm.prototype.interfaces_=function(){return[Ng]},Sm.prototype.getClass=function(){return Sm};var Bm=function(){this._nodeMap=new ry,this.edge=null;var t=arguments[0];this.edge=t};Bm.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Bm.prototype.iterator=function(){return this._nodeMap.values().iterator()},Bm.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},Bm.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Bm.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new Fg(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new Nm(o,new hv(this.edge._label))},Bm.prototype.add=function(t,e,r){var n=new Sm(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},Bm.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},Bm.prototype.interfaces_=function(){return[]},Bm.prototype.getClass=function(){return Bm};var Mm=function(){};Mm.prototype.getChainStartIndices=function(t){var e=0,r=new QA;r.add(new Yg(e));do{var n=this.findChainEnd(t,e);r.add(new Yg(n)),e=n}while(e<t.length-1);return Mm.toIntArray(r)},Mm.prototype.findChainEnd=function(t,e){for(var r=yv.quadrant(t[e],t[e+1]),n=e+1;n<t.length;){if(yv.quadrant(t[n-1],t[n])!==r)break;n++}return n-1},Mm.prototype.interfaces_=function(){return[]},Mm.prototype.getClass=function(){return Mm},Mm.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var Tm=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new oA,this.env2=new oA;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Mm;this.startIndex=e.getChainStartIndices(this.pts)};Tm.prototype.getCoordinates=function(){return this.pts},Tm.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e>r?e:r},Tm.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e<r?e:r},Tm.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[r],e.startIndex[r+1],n)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],h=this.pts[i],c=this.pts[o],f=s.pts[a],p=s.pts[u];if(o-i==1&&u-a==1)return l.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(h,c),this.env2.init(f,p),!this.env1.intersects(this.env2))return null;var d=Math.trunc((i+o)/2),g=Math.trunc((a+u)/2);i<d&&(a<g&&this.computeIntersectsForChain(i,d,s,a,g,l),g<u&&this.computeIntersectsForChain(i,d,s,g,u,l)),d<o&&(a<g&&this.computeIntersectsForChain(d,o,s,a,g,l),g<u&&this.computeIntersectsForChain(d,o,s,g,u,l))}},Tm.prototype.getStartIndexes=function(){return this.startIndex},Tm.prototype.computeIntersects=function(t,e){for(var r=0;r<this.startIndex.length-1;r++)for(var n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(r,t,n,e)},Tm.prototype.interfaces_=function(){return[]},Tm.prototype.getClass=function(){return Tm};var Lm=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var r=0;r<3;r++)this._depth[e][r]=t.NULL_VALUE},Rm={NULL_VALUE:{configurable:!0}};Lm.prototype.getDepth=function(t,e){return this._depth[t][e]},Lm.prototype.setDepth=function(t,e,r){this._depth[t][e]=r},Lm.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==Lm.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===Lm.NULL_VALUE}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this._depth[n][i]===Lm.NULL_VALUE}},Lm.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var r=t._depth[e][1];t._depth[e][2]<r&&(r=t._depth[e][2]),r<0&&(r=0);for(var n=1;n<3;n++){var i=0;t._depth[e][n]>r&&(i=1),t._depth[e][n]=i}}},Lm.prototype.getDelta=function(t){return this._depth[t][ev.RIGHT]-this._depth[t][ev.LEFT]},Lm.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Gg.EXTERIOR:Gg.INTERIOR},Lm.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Lm.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==Gg.EXTERIOR&&i!==Gg.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=Lm.depthAtLocation(i):t._depth[r][n]+=Lm.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===Gg.INTERIOR&&this._depth[o][s]++}},Lm.prototype.interfaces_=function(){return[]},Lm.prototype.getClass=function(){return Lm},Lm.depthAtLocation=function(t){return t===Gg.EXTERIOR?0:t===Gg.INTERIOR?1:Lm.NULL_VALUE},Rm.NULL_VALUE.get=function(){return-1},Object.defineProperties(Lm,Rm);var Nm=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Bm(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Lm,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}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,hv.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 r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(r.pts[s])||(n=!1),this.pts[s].equals2D(r.pts[--o])||(i=!1),!n&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?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;e<this.pts.length;e++)e>0&&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 Tm(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new oA;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,r,n){var i=new Fg(t.getIntersection(n)),o=e,s=t.getEdgeDistance(r,n),a=o+1;if(a<this.pts.length){var u=this.pts[a];i.equals2D(u)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new qg;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&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;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],r=arguments[1];r.setAtLeastIfValid(e.getLocation(0,ev.ON),e.getLocation(1,ev.ON),1),e.isArea()&&(r.setAtLeastIfValid(e.getLocation(0,ev.LEFT),e.getLocation(1,ev.LEFT),2),r.setAtLeastIfValid(e.getLocation(0,ev.RIGHT),e.getLocation(1,ev.RIGHT),2))},e}(dv),Pm=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new wm,this._bufParams=t||null};Pm.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Pm.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new hv(t.getLabel())).flip(),r.merge(n);var i=Pm.depthDelta(n),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(Pm.depthDelta(t.getLabel()))},Pm.prototype.buildSubgraphs=function(t,e){for(var r=new QA,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getRightmostCoordinate(),s=new fm(r).getDepth(o);i.computeDepth(s),i.findResultEdges(),r.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},Pm.prototype.createSubgraphs=function(t){for(var e=new QA,r=t.getNodes().iterator();r.hasNext();){var n=r.next();if(!n.isVisited()){var i=new uv;i.create(n),e.add(i)}}return Lv.sort(e,Lv.reverseOrder()),e},Pm.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Pm.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new $v,r=new yA;return r.setPrecisionModel(t),e.setSegmentIntersector(new bm(r)),e},Pm.prototype.buffer=function(t,e){var r=this._workingPrecisionModel;null===r&&(r=t.getPrecisionModel()),this._geomFact=t.getFactory();var n=new cm(r,this._bufParams),i=new Am(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,r),this._graph=new Ev(new Em),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new xv(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},Pm.prototype.computeNodedEdges=function(t,e){var r=this.getNoder(e);r.computeNodes(t);for(var n=r.getNodedSubstrings().iterator();n.hasNext();){var i=n.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new Nm(i.getCoordinates(),new hv(s));this.insertUniqueEdge(a)}}},Pm.prototype.setNoder=function(t){this._workingNoder=t},Pm.prototype.interfaces_=function(){return[]},Pm.prototype.getClass=function(){return Pm},Pm.depthDelta=function(t){var e=t.getLocation(0,ev.LEFT),r=t.getLocation(0,ev.RIGHT);return e===Gg.INTERIOR&&r===Gg.EXTERIOR?1:e===Gg.EXTERIOR&&r===Gg.INTERIOR?-1:0},Pm.convertSegStrings=function(t){for(var e=new Yy,r=new QA;t.hasNext();){var n=t.next(),i=e.createLineString(n.getCoordinates());r.add(i)}return e.buildGeometry(r)};var Dm=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this._noder=r,this._scaleFactor=n,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};Dm.prototype.rescale=function(){var t=this;if(jg(arguments[0],NA))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/t._scaleFactor+t._offsetX,n[i].y=n[i].y/t._scaleFactor+t._offsetY;2===n.length&&n[0].equals2D(n[1])&&nA.out.println(n)}},Dm.prototype.scale=function(){var t=this;if(jg(arguments[0],NA)){for(var e=arguments[0],r=new QA,n=e.iterator();n.hasNext();){var i=n.next();r.add(new Hv(t.scale(i.getCoordinates()),i.getData()))}return r}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new Fg(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return GA.removeRepeatedPoints(s)}},Dm.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},Dm.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Dm.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},Dm.prototype.interfaces_=function(){return[Kv]},Dm.prototype.getClass=function(){return Dm};var km=function(){this._li=new yA,this._segStrings=null;var t=arguments[0];this._segStrings=t},Fm={fact:{configurable:!0}};km.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var r=e.next().getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(n))throw new fA("found endpt/interior pt intersection at index "+s+" :pt "+n)},km.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),r=this._segStrings.iterator();r.hasNext();){var n=r.next();this.checkInteriorIntersections(e,n)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var l=0;l<a.length-1;l++)this.checkInteriorIntersections(i,u,o,l);else if(4===arguments.length){var h=arguments[0],c=arguments[1],f=arguments[2],p=arguments[3];if(h===f&&c===p)return null;var d=h.getCoordinates()[c],g=h.getCoordinates()[c+1],A=f.getCoordinates()[p],y=f.getCoordinates()[p+1];if(this._li.computeIntersection(d,g,A,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,d,g)||this.hasInteriorIntersection(this._li,A,y)))throw new fA("found non-noded intersection at "+d+"-"+g+" and "+A+"-"+y)}},km.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},km.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var r=arguments[0].getCoordinates(),n=0;n<r.length-2;n++)this.checkCollapse(r[n],r[n+1],r[n+2])},km.prototype.hasInteriorIntersection=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++){var i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(r))return!0}return!1},km.prototype.checkCollapse=function(t,e,r){if(t.equals(r))throw new fA("found non-noded collapse at "+km.fact.createLineString([t,e,r]))},km.prototype.interfaces_=function(){return[]},km.prototype.getClass=function(){return km},Fm.fact.get=function(){return new Yy},Object.defineProperties(km,Fm);var Qm=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],r=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=r,e<=0)throw new Tg("Scale factor must be non-zero");1!==e&&(this._pt=new Fg(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new Fg,this._p1Scaled=new Fg),this.initCorners(this._pt)},Om={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Qm.prototype.intersectsScaled=function(t,e){var r=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<r||this._minx>n||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return dA.isTrue(!(s&&a),"Found bad envelope test"),a},Qm.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 Fg(this._maxx,this._maxy),this._corner[1]=new Fg(this._minx,this._maxy),this._corner[2]=new Fg(this._minx,this._miny),this._corner[3]=new Fg(this._maxx,this._miny)},Qm.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))},Qm.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Qm.prototype.getCoordinate=function(){return this._originalPt},Qm.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Qm.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=Qm.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new oA(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},Qm.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())))},Qm.prototype.intersectsToleranceSquare=function(t,e){var r=!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()&&(r=!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()||(!(!r||!n)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},Qm.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},Qm.prototype.interfaces_=function(){return[]},Qm.prototype.getClass=function(){return Qm},Om.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(Qm,Om);var Um=function(){this.tempEnv1=new oA,this.selectedSegment=new qv};Um.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)}},Um.prototype.interfaces_=function(){return[]},Um.prototype.getClass=function(){return Um};var Gm=function(){this._index=null;var t=arguments[0];this._index=t},zm={HotPixelSnapAction:{configurable:!0}};Gm.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],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new jm(e,r,n);return this._index.query(i,{interfaces_:function(){return[Sv]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},Gm.prototype.interfaces_=function(){return[]},Gm.prototype.getClass=function(){return Gm},zm.HotPixelSnapAction.get=function(){return jm},Object.defineProperties(Gm,zm);var jm=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,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],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Um),Vm=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new QA};Vm.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)}},Vm.prototype.isDone=function(){return!1},Vm.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Vm.prototype.interfaces_=function(){return[Cm]},Vm.prototype.getClass=function(){return Vm};var Hm=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new yA,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};Hm.prototype.checkCorrectness=function(t){var e=Hv.getNodedSubstrings(t),r=new km(e);try{r.checkValid()}catch(t){if(!(t instanceof eA))throw t;t.printStackTrace()}},Hm.prototype.getNodedSubstrings=function(){return Hv.getNodedSubstrings(this._nodedSegStrings)},Hm.prototype.snapRound=function(t,e){var r=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(r),this.computeVertexSnaps(t)},Hm.prototype.findInteriorIntersections=function(t,e){var r=new Vm(e);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(t),r.getInteriorIntersections()},Hm.prototype.computeVertexSnaps=function(){var t=this;if(jg(arguments[0],NA))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof Hv)for(var n=arguments[0],i=n.getCoordinates(),o=0;o<i.length;o++){var s=new Qm(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,n,o)&&n.addIntersection(i[o],o)}},Hm.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new $v,this._pointSnapper=new Gm(this._noder.getIndex()),this.snapRound(t,this._li)},Hm.prototype.computeIntersectionSnaps=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next(),i=new Qm(n,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},Hm.prototype.interfaces_=function(){return[Kv]},Hm.prototype.getClass=function(){return Hm};var qm=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new em,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._argGeom=e,this._bufParams=r}},Ym={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};qm.prototype.bufferFixedPrecision=function(t){var e=new Dm(new Hm(new jy(1)),t.getScale()),r=new Pm(this._bufParams);r.setWorkingPrecisionModel(t),r.setNoder(e),this._resultGeometry=r.buffer(this._argGeom,this._distance)},qm.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=qm.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof sv))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=qm.precisionScaleFactor(this._argGeom,this._distance,r),i=new jy(n);this.bufferFixedPrecision(i)}},qm.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===jy.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},qm.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},qm.prototype.bufferOriginalPrecision=function(){try{var t=new Pm(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof fA))throw t;this._saveException=t}},qm.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},qm.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},qm.prototype.interfaces_=function(){return[]},qm.prototype.getClass=function(){return qm},qm.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new qm(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof xA&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new qm(arguments[0]);return n.setQuadrantSegments(r),n.getResultGeometry(e)}if(arguments[2]instanceof em&&arguments[0]instanceof xA&&"number"==typeof arguments[1]){var i=arguments[1];return new qm(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],u=new qm(arguments[0]);return u.setQuadrantSegments(s),u.setEndCapStyle(a),u.getResultGeometry(o)}},qm.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=Vg.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},Ym.CAP_ROUND.get=function(){return em.CAP_ROUND},Ym.CAP_BUTT.get=function(){return em.CAP_FLAT},Ym.CAP_FLAT.get=function(){return em.CAP_FLAT},Ym.CAP_SQUARE.get=function(){return em.CAP_SQUARE},Ym.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(qm,Ym);var Xm=function(){this._pt=[new Fg,new Fg],this._distance=Lg.NaN,this._isNull=!0};Xm.prototype.getCoordinates=function(){return this._pt},Xm.prototype.getCoordinate=function(t){return this._pt[t]},Xm.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],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},Xm.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},Xm.prototype.getDistance=function(){return this._distance},Xm.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},Xm.prototype.interfaces_=function(){return[]},Xm.prototype.getClass=function(){return Xm};var Wm=function(){};Wm.prototype.interfaces_=function(){return[]},Wm.prototype.getClass=function(){return Wm},Wm.computeDistance=function(){if(arguments[2]instanceof Xm&&arguments[0]instanceof Cy&&arguments[1]instanceof Fg)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new qv,i=0;i<r.length-1;i++){n.setCoordinates(r[i],r[i+1]);var o=n.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof Xm&&arguments[0]instanceof My&&arguments[1]instanceof Fg){var s=arguments[0],a=arguments[1],u=arguments[2];Wm.computeDistance(s.getExteriorRing(),a,u);for(var l=0;l<s.getNumInteriorRing();l++)Wm.computeDistance(s.getInteriorRingN(l),a,u)}else if(arguments[2]instanceof Xm&&arguments[0]instanceof xA&&arguments[1]instanceof Fg){var h=arguments[0],c=arguments[1],f=arguments[2];if(h instanceof Cy)Wm.computeDistance(h,c,f);else if(h instanceof My)Wm.computeDistance(h,c,f);else if(h instanceof fy)for(var p=h,d=0;d<p.getNumGeometries();d++){var g=p.getGeometryN(d);Wm.computeDistance(g,c,f)}else f.setMinimum(h.getCoordinate(),c)}else if(arguments[2]instanceof Xm&&arguments[0]instanceof qv&&arguments[1]instanceof Fg){var A=arguments[1],y=arguments[2],v=arguments[0].closestPoint(A);y.setMinimum(v,A)}};var Jm=function(t){this._maxPtDist=new Xm,this._inputGeom=t||null},Km={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Jm.prototype.computeMaxMidpointDistance=function(t){var e=new $m(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Jm.prototype.computeMaxVertexDistance=function(t){var e=new Zm(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Jm.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Jm.prototype.getDistancePoints=function(){return this._maxPtDist},Jm.prototype.interfaces_=function(){return[]},Jm.prototype.getClass=function(){return Jm},Km.MaxPointDistanceFilter.get=function(){return Zm},Km.MaxMidpointDistanceFilter.get=function(){return $m},Object.defineProperties(Jm,Km);var Zm=function(t){this._maxPtDist=new Xm,this._minPtDist=new Xm,this._geom=t||null};Zm.prototype.filter=function(t){this._minPtDist.initialize(),Wm.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Zm.prototype.getMaxPointDistance=function(){return this._maxPtDist},Zm.prototype.interfaces_=function(){return[bA]},Zm.prototype.getClass=function(){return Zm};var $m=function(t){this._maxPtDist=new Xm,this._minPtDist=new Xm,this._geom=t||null};$m.prototype.filter=function(t,e){if(0===e)return null;var r=t.getCoordinate(e-1),n=t.getCoordinate(e),i=new Fg((r.x+n.x)/2,(r.y+n.y)/2);this._minPtDist.initialize(),Wm.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},$m.prototype.isDone=function(){return!1},$m.prototype.isGeometryChanged=function(){return!1},$m.prototype.getMaxPointDistance=function(){return this._maxPtDist},$m.prototype.interfaces_=function(){return[cy]},$m.prototype.getClass=function(){return $m};var t_=function(t){this._comps=t||null};t_.prototype.filter=function(t){t instanceof My&&this._comps.add(t)},t_.prototype.interfaces_=function(){return[hy]},t_.prototype.getClass=function(){return t_},t_.getPolygons=function(){if(1===arguments.length)return t_.getPolygons(arguments[0],new QA);if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof My?e.add(t):t instanceof fy&&t.apply(new t_(e)),e}};var e_=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._lines=e,this._isForcedToLineString=r}};e_.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Ly){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Cy&&this._lines.add(t)},e_.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},e_.prototype.interfaces_=function(){return[EA]},e_.prototype.getClass=function(){return e_},e_.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(e_.getLines(t))}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().buildGeometry(e_.getLines(e,r))}},e_.getLines=function(){if(1===arguments.length)return e_.getLines(arguments[0],!1);if(2===arguments.length){if(jg(arguments[0],NA)&&jg(arguments[1],NA)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var r=e.next();e_.getLines(r,t)}return t}if(arguments[0]instanceof xA&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1],o=new QA;return n.apply(new e_(o,i)),o}if(arguments[0]instanceof xA&&jg(arguments[1],NA)){var s=arguments[0],a=arguments[1];return s instanceof Cy?a.add(s):s.apply(new e_(a)),a}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&jg(arguments[0],NA)&&jg(arguments[1],NA)){for(var u=arguments[1],l=arguments[2],h=arguments[0].iterator();h.hasNext();){var c=h.next();e_.getLines(c,u,l)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof xA&&jg(arguments[1],NA)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new e_(f,p)),f}}};var r_=function(){if(this._boundaryRule=SA.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new Tg("Rule must be non-null");this._boundaryRule=t}};r_.prototype.locateInternal=function(){if(arguments[0]instanceof Fg&&arguments[1]instanceof My){var t=arguments[0],e=arguments[1];if(e.isEmpty())return Gg.EXTERIOR;var r=e.getExteriorRing(),n=this.locateInPolygonRing(t,r);if(n===Gg.EXTERIOR)return Gg.EXTERIOR;if(n===Gg.BOUNDARY)return Gg.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===Gg.INTERIOR)return Gg.EXTERIOR;if(s===Gg.BOUNDARY)return Gg.BOUNDARY}return Gg.INTERIOR}if(arguments[0]instanceof Fg&&arguments[1]instanceof Cy){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return Gg.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?_A.isOnLine(a,l)?Gg.INTERIOR:Gg.EXTERIOR:Gg.BOUNDARY}if(arguments[0]instanceof Fg&&arguments[1]instanceof Sy){var h=arguments[0];return arguments[1].getCoordinate().equals2D(h)?Gg.INTERIOR:Gg.EXTERIOR}},r_.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?_A.locatePointInRing(t,e.getCoordinates()):Gg.EXTERIOR},r_.prototype.intersects=function(t,e){return this.locate(t,e)!==Gg.EXTERIOR},r_.prototype.updateLocationInfo=function(t){t===Gg.INTERIOR&&(this._isIn=!0),t===Gg.BOUNDARY&&this._numBoundaries++},r_.prototype.computeLocation=function(t,e){var r=this;if(e instanceof Sy&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Cy)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof My)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof py)for(var n=e,i=0;i<n.getNumGeometries();i++){var o=n.getGeometryN(i);r.updateLocationInfo(r.locateInternal(t,o))}else if(e instanceof Ry)for(var s=e,a=0;a<s.getNumGeometries();a++){var u=s.getGeometryN(a);r.updateLocationInfo(r.locateInternal(t,u))}else if(e instanceof fy)for(var l=new vm(e);l.hasNext();){var h=l.next();h!==e&&r.computeLocation(t,h)}},r_.prototype.locate=function(t,e){return e.isEmpty()?Gg.EXTERIOR:e instanceof Cy||e instanceof My?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?Gg.BOUNDARY:this._numBoundaries>0||this._isIn?Gg.INTERIOR:Gg.EXTERIOR)},r_.prototype.interfaces_=function(){return[]},r_.prototype.getClass=function(){return r_};var n_=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],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},i_={INSIDE_AREA:{configurable:!0}};n_.prototype.isInsideArea=function(){return this._segIndex===n_.INSIDE_AREA},n_.prototype.getCoordinate=function(){return this._pt},n_.prototype.getGeometryComponent=function(){return this._component},n_.prototype.getSegmentIndex=function(){return this._segIndex},n_.prototype.interfaces_=function(){return[]},n_.prototype.getClass=function(){return n_},i_.INSIDE_AREA.get=function(){return-1},Object.defineProperties(n_,i_);var o_=function(t){this._pts=t||null};o_.prototype.filter=function(t){t instanceof Sy&&this._pts.add(t)},o_.prototype.interfaces_=function(){return[hy]},o_.prototype.getClass=function(){return o_},o_.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Sy?Lv.singletonList(t):o_.getPoints(t,new QA)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof Sy?r.add(e):e instanceof fy&&e.apply(new o_(r)),r}};var s_=function(){this._locations=null;var t=arguments[0];this._locations=t};s_.prototype.filter=function(t){(t instanceof Sy||t instanceof Cy||t instanceof My)&&this._locations.add(new n_(t,0,t.getCoordinate()))},s_.prototype.interfaces_=function(){return[hy]},s_.prototype.getClass=function(){return s_},s_.getLocations=function(t){var e=new QA;return t.apply(new s_(e)),e};var a_=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new r_,this._minDistanceLocation=null,this._minDistance=Lg.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 r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};a_.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 r=arguments[0],n=arguments[1],i=1-r,o=t_.getPolygons(this._geom[r]);if(o.size()>0){var s=s_.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&jg(arguments[0],kA)&&jg(arguments[1],kA)){for(var a=arguments[0],u=arguments[1],l=arguments[2],h=0;h<a.size();h++)for(var c=a.get(h),f=0;f<u.size();f++)if(t.computeContainmentDistance(c,u.get(f),l),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof n_&&arguments[1]instanceof My){var p=arguments[0],d=arguments[1],g=arguments[2],A=p.getCoordinate();if(Gg.EXTERIOR!==this._ptLocator.locate(A,d))return this._minDistance=0,g[0]=p,g[1]=new n_(d,A),null}},a_.prototype.computeMinDistanceLinesPoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},a_.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=e_.getLines(this._geom[0]),r=e_.getLines(this._geom[1]),n=o_.getPoints(this._geom[0]),i=o_.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(r,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))},a_.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},a_.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},a_.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},a_.prototype.computeMinDistance=function(){var t=this;if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof Cy&&arguments[1]instanceof Sy){var e=arguments[0],r=arguments[1],n=arguments[2];if(e.getEnvelopeInternal().distance(r.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),s=0;s<i.length-1;s++){var a=_A.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var u=new qv(i[s],i[s+1]).closestPoint(o);n[0]=new n_(e,s,u),n[1]=new n_(r,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Cy&&arguments[1]instanceof Cy){var l=arguments[0],h=arguments[1],c=arguments[2];if(l.getEnvelopeInternal().distance(h.getEnvelopeInternal())>this._minDistance)return null;for(var f=l.getCoordinates(),p=h.getCoordinates(),d=0;d<f.length-1;d++)for(var g=0;g<p.length-1;g++){var A=_A.distanceLineLine(f[d],f[d+1],p[g],p[g+1]);if(A<t._minDistance){t._minDistance=A;var y=new qv(f[d],f[d+1]),v=new qv(p[g],p[g+1]),m=y.closestPoints(v);c[0]=new n_(l,d,m[0]),c[1]=new n_(h,g,m[1])}if(t._minDistance<=t._terminateDistance)return null}}},a_.prototype.computeMinDistancePoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),u=o.getCoordinate().distance(a.getCoordinate());if(u<n._minDistance&&(n._minDistance=u,r[0]=new n_(o,0,o.getCoordinate()),r[1]=new n_(a,0,a.getCoordinate())),n._minDistance<=n._terminateDistance)return null}},a_.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new Tg("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},a_.prototype.computeMinDistanceLines=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},a_.prototype.interfaces_=function(){return[]},a_.prototype.getClass=function(){return a_},a_.distance=function(t,e){return new a_(t,e).distance()},a_.isWithinDistance=function(t,e,r){return new a_(t,e,r).distance()<=r},a_.nearestPoints=function(t,e){return new a_(t,e).nearestPoints()};var u_=function(){this._pt=[new Fg,new Fg],this._distance=Lg.NaN,this._isNull=!0};u_.prototype.getCoordinates=function(){return this._pt},u_.prototype.getCoordinate=function(t){return this._pt[t]},u_.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],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},u_.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},u_.prototype.toString=function(){return cA.toLineString(this._pt[0],this._pt[1])},u_.prototype.getDistance=function(){return this._distance},u_.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},u_.prototype.interfaces_=function(){return[]},u_.prototype.getClass=function(){return u_};var l_=function(){};l_.prototype.interfaces_=function(){return[]},l_.prototype.getClass=function(){return l_},l_.computeDistance=function(){if(arguments[2]instanceof u_&&arguments[0]instanceof Cy&&arguments[1]instanceof Fg)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new qv,i=t.getCoordinates(),o=0;o<i.length-1;o++){n.setCoordinates(i[o],i[o+1]);var s=n.closestPoint(e);r.setMinimum(s,e)}else if(arguments[2]instanceof u_&&arguments[0]instanceof My&&arguments[1]instanceof Fg){var a=arguments[0],u=arguments[1],l=arguments[2];l_.computeDistance(a.getExteriorRing(),u,l);for(var h=0;h<a.getNumInteriorRing();h++)l_.computeDistance(a.getInteriorRingN(h),u,l)}else if(arguments[2]instanceof u_&&arguments[0]instanceof xA&&arguments[1]instanceof Fg){var c=arguments[0],f=arguments[1],p=arguments[2];if(c instanceof Cy)l_.computeDistance(c,f,p);else if(c instanceof My)l_.computeDistance(c,f,p);else if(c instanceof fy)for(var d=c,g=0;g<d.getNumGeometries();g++){var A=d.getGeometryN(g);l_.computeDistance(A,f,p)}else p.setMinimum(c.getCoordinate(),f)}else if(arguments[2]instanceof u_&&arguments[0]instanceof qv&&arguments[1]instanceof Fg){var y=arguments[1],v=arguments[2],m=arguments[0].closestPoint(y);v.setMinimum(m,y)}};var h_=function(){this._g0=null,this._g1=null,this._ptDist=new u_,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},c_={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};h_.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},h_.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new Tg("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},h_.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},h_.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},h_.prototype.computeOrientedDistance=function(t,e,r){var n=new f_(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new p_(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},h_.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},h_.prototype.interfaces_=function(){return[]},h_.prototype.getClass=function(){return h_},h_.distance=function(){if(2===arguments.length)return new h_(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new h_(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},c_.MaxPointDistanceFilter.get=function(){return f_},c_.MaxDensifiedByFractionDistanceFilter.get=function(){return p_},Object.defineProperties(h_,c_);var f_=function(){this._maxPtDist=new u_,this._minPtDist=new u_,this._euclideanDist=new l_,this._geom=null;var t=arguments[0];this._geom=t};f_.prototype.filter=function(t){this._minPtDist.initialize(),l_.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},f_.prototype.getMaxPointDistance=function(){return this._maxPtDist},f_.prototype.interfaces_=function(){return[bA]},f_.prototype.getClass=function(){return f_};var p_=function(){this._maxPtDist=new u_,this._minPtDist=new u_,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};p_.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var u=n.x+a*o,l=n.y+a*s,h=new Fg(u,l);r._minPtDist.initialize(),l_.computeDistance(r._geom,h,r._minPtDist),r._maxPtDist.setMaximum(r._minPtDist)}},p_.prototype.isDone=function(){return!1},p_.prototype.isGeometryChanged=function(){return!1},p_.prototype.getMaxPointDistance=function(){return this._maxPtDist},p_.prototype.interfaces_=function(){return[cy]},p_.prototype.getClass=function(){return p_};var d_=function(t,e,r){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=r||null},g_={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};d_.prototype.checkMaximumDistance=function(t,e,r){var n=new h_(e,t);if(n.setDensifyFraction(.25),this._maxDistanceFound=n.orientedDistance(),this._maxDistanceFound>r){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+cA.toLineString(i[0],i[1])+")"}},d_.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=d_.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(),d_.VERBOSE&&nA.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},d_.prototype.checkNegativeValid=function(){if(!(this._input instanceof My||this._input instanceof Ry||this._input instanceof fy))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)},d_.prototype.getErrorIndicator=function(){return this._errorIndicator},d_.prototype.checkMinimumDistance=function(t,e,r){var n=new a_(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound<r){this._isValid=!1;var i=n.nearestPoints();this._errorLocation=n.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+cA.toLineString(i[0],i[1])+" )"}},d_.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},d_.prototype.getErrorLocation=function(){return this._errorLocation},d_.prototype.getPolygonLines=function(t){for(var e=new QA,r=new e_(e),n=t_.getPolygons(t).iterator();n.hasNext();){n.next().apply(r)}return t.getFactory().buildGeometry(e)},d_.prototype.getErrorMessage=function(){return this._errMsg},d_.prototype.interfaces_=function(){return[]},d_.prototype.getClass=function(){return d_},g_.VERBOSE.get=function(){return!1},g_.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(d_,g_);var A_=function(t,e,r){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=r||null},y_={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};A_.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},A_.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*A_.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new oA(this._input.getEnvelopeInternal());e.expandBy(this._distance);var r=new oA(this._result.getEnvelopeInternal());r.expandBy(t),r.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(r)),this.report("Envelope")},A_.prototype.checkDistance=function(){var t=new d_(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},A_.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},A_.prototype.checkPolygonal=function(){this._result instanceof My||this._result instanceof Ry||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},A_.prototype.getErrorIndicator=function(){return this._errorIndicator},A_.prototype.getErrorLocation=function(){return this._errorLocation},A_.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=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"))},A_.prototype.report=function(t){if(!A_.VERBOSE)return null;nA.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},A_.prototype.getErrorMessage=function(){return this._errorMsg},A_.prototype.interfaces_=function(){return[]},A_.prototype.getClass=function(){return A_},A_.isValidMsg=function(t,e,r){var n=new A_(t,e,r);return n.isValid()?null:n.getErrorMessage()},A_.isValid=function(t,e,r){return!!new A_(t,e,r).isValid()},y_.VERBOSE.get=function(){return!1},y_.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(A_,y_);var v_=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};v_.prototype.getCoordinates=function(){return this._pts},v_.prototype.size=function(){return this._pts.length},v_.prototype.getCoordinate=function(t){return this._pts[t]},v_.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},v_.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:zv.octant(this.getCoordinate(t),this.getCoordinate(t+1))},v_.prototype.setData=function(t){this._data=t},v_.prototype.getData=function(){return this._data},v_.prototype.toString=function(){return cA.toLineString(new Qy(this._pts))},v_.prototype.interfaces_=function(){return[jv]},v_.prototype.getClass=function(){return v_};var m_=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new QA,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};m_.prototype.getInteriorIntersection=function(){return this._interiorIntersection},m_.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},m_.prototype.getIntersectionSegments=function(){return this._intSegments},m_.prototype.count=function(){return this._intersectionCount},m_.prototype.getIntersections=function(){return this._intersections},m_.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},m_.prototype.setKeepIntersections=function(t){this._keepIntersections=t},m_.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(r,n)))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,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++)},m_.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},m_.prototype.hasIntersection=function(){return null!==this._interiorIntersection},m_.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},m_.prototype.interfaces_=function(){return[Cm]},m_.prototype.getClass=function(){return m_},m_.createAllIntersectionsFinder=function(t){var e=new m_(t);return e.setFindAllIntersections(!0),e},m_.createAnyIntersectionFinder=function(t){return new m_(t)},m_.createIntersectionCounter=function(t){var e=new m_(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var __=function(){this._li=new yA,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};__.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},__.prototype.getIntersections=function(){return this._segInt.getIntersections()},__.prototype.isValid=function(){return this.execute(),this._isValid},__.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},__.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new m_(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new $v;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},__.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new sv(this.getErrorMessage(),this._segInt.getInteriorIntersection())},__.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+cA.toLineString(t[0],t[1])+" and "+cA.toLineString(t[2],t[3])},__.prototype.interfaces_=function(){return[]},__.prototype.getClass=function(){return __},__.computeIntersections=function(t){var e=new __(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var I_=function t(){this._nv=null;var e=arguments[0];this._nv=new __(t.toSegmentStrings(e))};I_.prototype.checkValid=function(){this._nv.checkValid()},I_.prototype.interfaces_=function(){return[]},I_.prototype.getClass=function(){return I_},I_.toSegmentStrings=function(t){for(var e=new QA,r=t.iterator();r.hasNext();){var n=r.next();e.add(new v_(n.getCoordinates(),n))}return e},I_.checkValid=function(t){new I_(t).checkValid()};var E_=function(t){this._mapOp=t};E_.prototype.map=function(t){for(var e=new QA,r=0;r<t.getNumGeometries();r++){var n=this._mapOp.map(t.getGeometryN(r));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(Yy.toGeometryArray(e))},E_.prototype.interfaces_=function(){return[]},E_.prototype.getClass=function(){return E_},E_.map=function(t,e){return new E_(e).map(t)};var x_=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new QA,this._resultLineList=new QA;var t=arguments[0],e=arguments[1],r=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=r};x_.prototype.collectLines=function(t){for(var e=this,r=this._op.getGraph().getEdgeEnds().iterator();r.hasNext();){var n=r.next();e.collectLineEdge(n,t,e._lineEdgesList),e.collectBoundaryTouchEdge(n,t,e._lineEdgesList)}},x_.prototype.labelIsolatedLine=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,r)},x_.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},x_.prototype.collectLineEdge=function(t,e,r){var n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!nI.isResultOfOp(n,e)||i.isCovered()||(r.add(i),t.setVisitedEdge(!0)))},x_.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();){t.next().getEdges().findCoveredLineEdges()}for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var r=e.next(),n=r.getEdge();if(r.isLineEdge()&&!n.isCoveredSet()){var i=this._op.isCoveredByA(r.getCoordinate());n.setCovered(i)}}},x_.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next(),n=r.getLabel();r.isIsolated()&&(n.isNull(0)?this.labelIsolatedLine(r,0):this.labelIsolatedLine(r,1))}},x_.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var r=e.next(),n=this._geometryFactory.createLineString(r.getCoordinates());this._resultLineList.add(n),r.setInResult(!0)}},x_.prototype.collectBoundaryTouchEdge=function(t,e,r){var n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(dA.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(nI.isResultOfOp(n,e)&&e===nI.INTERSECTION&&(r.add(t.getEdge()),t.setVisitedEdge(!0))))},x_.prototype.interfaces_=function(){return[]},x_.prototype.getClass=function(){return x_};var w_=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new QA;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};w_.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var r=this._geometryFactory.createPoint(e);this._resultPointList.add(r)}},w_.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var r=e.next();if(!r.isInResult()&&(!r.isIncidentEdgeInResult()&&(0===r.getEdges().getDegree()||t===nI.INTERSECTION))){var n=r.getLabel();nI.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r)}}},w_.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},w_.prototype.interfaces_=function(){return[]},w_.prototype.getClass=function(){return w_};var C_=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};C_.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},C_.prototype.transformPolygon=function(t,e){var r=!0,n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof Ly&&!n.isEmpty()||(r=!1);for(var i=new QA,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof Ly||(r=!1),i.add(s))}if(r)return this._factory.createPolygon(n,i.toArray([]));var a=new QA;return null!==n&&a.add(n),a.addAll(i),this._factory.buildGeometry(a)},C_.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},C_.prototype.getInputGeometry=function(){return this._inputGeom},C_.prototype.transformMultiLineString=function(t,e){for(var r=new QA,n=0;n<t.getNumGeometries();n++){var i=this.transformLineString(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},C_.prototype.transformCoordinates=function(t,e){return this.copy(t)},C_.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},C_.prototype.transformMultiPoint=function(t,e){for(var r=new QA,n=0;n<t.getNumGeometries();n++){var i=this.transformPoint(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},C_.prototype.transformMultiPolygon=function(t,e){for(var r=new QA,n=0;n<t.getNumGeometries();n++){var i=this.transformPolygon(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},C_.prototype.copy=function(t){return t.copy()},C_.prototype.transformGeometryCollection=function(t,e){for(var r=new QA,n=0;n<t.getNumGeometries();n++){var i=this.transform(t.getGeometryN(n));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||r.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Yy.toGeometryArray(r)):this._factory.buildGeometry(r)},C_.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Sy)return this.transformPoint(t,null);if(t instanceof Ty)return this.transformMultiPoint(t,null);if(t instanceof Ly)return this.transformLinearRing(t,null);if(t instanceof Cy)return this.transformLineString(t,null);if(t instanceof py)return this.transformMultiLineString(t,null);if(t instanceof My)return this.transformPolygon(t,null);if(t instanceof Ry)return this.transformMultiPolygon(t,null);if(t instanceof fy)return this.transformGeometryCollection(t,null);throw new Tg("Unknown Geometry subtype: "+t.getClass().getName())},C_.prototype.transformLinearRing=function(t,e){var r=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===r)return this._factory.createLinearRing(null);var n=r.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},C_.prototype.interfaces_=function(){return[]},C_.prototype.getClass=function(){return C_};var b_=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new qv,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Cy&&"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 r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};b_.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n<r;n++){var i=t.get(n),o=this.findSnapForVertex(i,e);null!==o&&(t.set(n,new Fg(o)),0===n&&this._isClosed&&t.set(t.size()-1,new Fg(o)))}},b_.prototype.findSnapForVertex=function(t,e){for(var r=0;r<e.length;r++){if(t.equals2D(e[r]))return null;if(t.distance(e[r])<this._snapTolerance)return e[r]}return null},b_.prototype.snapTo=function(t){var e=new UA(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},b_.prototype.snapSegments=function(t,e){if(0===e.length)return null;var r=e.length;e[0].equals2D(e[e.length-1])&&(r=e.length-1);for(var n=0;n<r;n++){var i=e[n],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new Fg(i),!1)}},b_.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=Lg.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(r._seg.p0=e.get(o),r._seg.p1=e.get(o+1),r._seg.p0.equals2D(t)||r._seg.p1.equals2D(t)){if(r._allowSnappingToSourceVertices)continue;return-1}var s=r._seg.distance(t);s<r._snapTolerance&&s<n&&(n=s,i=o)}return i},b_.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},b_.prototype.interfaces_=function(){return[]},b_.prototype.getClass=function(){return b_},b_.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var S_=function(t){this._srcGeom=t||null},B_={SNAP_PRECISION_FACTOR:{configurable:!0}};S_.prototype.snapTo=function(t,e){var r=this.extractTargetCoordinates(t);return new M_(e,r).transform(this._srcGeom)},S_.prototype.snapToSelf=function(t,e){var r=this.extractTargetCoordinates(this._srcGeom),n=new M_(t,r,!0).transform(this._srcGeom),i=n;return e&&jg(i,By)&&(i=n.buffer(0)),i},S_.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},S_.prototype.extractTargetCoordinates=function(t){for(var e=new oy,r=t.getCoordinates(),n=0;n<r.length;n++)e.add(r[n]);return e.toArray(new Array(0).fill(null))},S_.prototype.computeMinimumSegmentLength=function(t){for(var e=Lg.MAX_VALUE,r=0;r<t.length-1;r++){var n=t[r].distance(t[r+1]);n<e&&(e=n)}return e},S_.prototype.interfaces_=function(){return[]},S_.prototype.getClass=function(){return S_},S_.snap=function(t,e,r){var n=new Array(2).fill(null),i=new S_(t);n[0]=i.snapTo(e,r);var o=new S_(e);return n[1]=o.snapTo(n[0],r),n},S_.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=S_.computeSizeBasedSnapTolerance(t),r=t.getPrecisionModel();if(r.getType()===jy.FIXED){var n=1/r.getScale()*2/1.415;n>e&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(S_.computeOverlaySnapTolerance(i),S_.computeOverlaySnapTolerance(o))}},S_.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*S_.SNAP_PRECISION_FACTOR},S_.snapToSelf=function(t,e,r){return new S_(t).snapToSelf(e,r)},B_.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(S_,B_);var M_=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||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 r=new b_(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(C_),T_=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};T_.prototype.getCommon=function(){return Lg.longBitsToDouble(this._commonBits)},T_.prototype.add=function(t){var e=Lg.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=T_.signExpBits(this._commonBits),this._isFirst=!1,null):T_.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=T_.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=T_.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},T_.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=Lg.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+Lg.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},T_.prototype.interfaces_=function(){return[]},T_.prototype.getClass=function(){return T_},T_.getBit=function(t,e){return 0!=(t&1<<e)?1:0},T_.signExpBits=function(t){return t>>52},T_.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},T_.numCommonMostSigMantissaBits=function(t,e){for(var r=0,n=52;n>=0;n--){if(T_.getBit(t,n)!==T_.getBit(e,n))return r;r++}return 52};var L_=function(){this._commonCoord=null,this._ccFilter=new N_},R_={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};L_.prototype.addCommonBits=function(t){var e=new P_(this._commonCoord);t.apply(e),t.geometryChanged()},L_.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new Fg(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new P_(e);return t.apply(r),t.geometryChanged(),t},L_.prototype.getCommonCoordinate=function(){return this._commonCoord},L_.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},L_.prototype.interfaces_=function(){return[]},L_.prototype.getClass=function(){return L_},R_.CommonCoordinateFilter.get=function(){return N_},R_.Translater.get=function(){return P_},Object.defineProperties(L_,R_);var N_=function(){this._commonBitsX=new T_,this._commonBitsY=new T_};N_.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},N_.prototype.getCommonCoordinate=function(){return new Fg(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},N_.prototype.interfaces_=function(){return[bA]},N_.prototype.getClass=function(){return N_};var P_=function(){this.trans=null;var t=arguments[0];this.trans=t};P_.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},P_.prototype.isDone=function(){return!1},P_.prototype.isGeometryChanged=function(){return!0},P_.prototype.interfaces_=function(){return[cy]},P_.prototype.getClass=function(){return P_};var D_=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()};D_.prototype.selfSnap=function(t){return new S_(t).snapTo(t,this._snapTolerance)},D_.prototype.removeCommonBits=function(t){this._cbr=new L_,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},D_.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},D_.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=nI.overlayOp(e[0],e[1],t);return this.prepareResult(r)},D_.prototype.checkValid=function(t){t.isValid()||nA.out.println("Snapped geometry is invalid")},D_.prototype.computeSnapTolerance=function(){this._snapTolerance=S_.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},D_.prototype.snap=function(t){var e=this.removeCommonBits(t);return S_.snap(e[0],e[1],this._snapTolerance)},D_.prototype.interfaces_=function(){return[]},D_.prototype.getClass=function(){return D_},D_.overlayOp=function(t,e,r){return new D_(t,e).getResultGeometry(r)},D_.union=function(t,e){return D_.overlayOp(t,e,nI.UNION)},D_.intersection=function(t,e){return D_.overlayOp(t,e,nI.INTERSECTION)},D_.symDifference=function(t,e){return D_.overlayOp(t,e,nI.SYMDIFFERENCE)},D_.difference=function(t,e){return D_.overlayOp(t,e,nI.DIFFERENCE)};var k_=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};k_.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=nI.overlayOp(this._geom[0],this._geom[1],t);r=!0}catch(t){if(!(t instanceof fA))throw t;n=t}if(!r)try{e=D_.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof fA?n:t}return e},k_.prototype.interfaces_=function(){return[]},k_.prototype.getClass=function(){return k_},k_.overlayOp=function(t,e,r){return new k_(t,e).getResultGeometry(r)},k_.union=function(t,e){return k_.overlayOp(t,e,nI.UNION)},k_.intersection=function(t,e){return k_.overlayOp(t,e,nI.INTERSECTION)},k_.symDifference=function(t,e){return k_.overlayOp(t,e,nI.SYMDIFFERENCE)},k_.difference=function(t,e){return k_.overlayOp(t,e,nI.DIFFERENCE)};var F_=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};F_.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},F_.prototype.interfaces_=function(){return[]},F_.prototype.getClass=function(){return F_};var Q_=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],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},O_={INSERT:{configurable:!0},DELETE:{configurable:!0}};Q_.prototype.isDelete=function(){return this._eventType===Q_.DELETE},Q_.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},Q_.prototype.getObject=function(){return this._obj},Q_.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},Q_.prototype.getInsertEvent=function(){return this._insertEvent},Q_.prototype.isInsert=function(){return this._eventType===Q_.INSERT},Q_.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},Q_.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Q_.prototype.interfaces_=function(){return[Ng]},Q_.prototype.getClass=function(){return Q_},O_.INSERT.get=function(){return 1},O_.DELETE.get=function(){return 2},Object.defineProperties(Q_,O_);var U_=function(){};U_.prototype.interfaces_=function(){return[]},U_.prototype.getClass=function(){return U_};var G_=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],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};G_.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(G_.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},G_.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},G_.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},G_.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},G_.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},G_.prototype.hasProperIntersection=function(){return this._hasProper},G_.prototype.hasIntersection=function(){return this._hasIntersection},G_.prototype.isDone=function(){return this._isDone},G_.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},G_.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},G_.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.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))))},G_.prototype.interfaces_=function(){return[]},G_.prototype.getClass=function(){return G_},G_.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var z_=function(t){function e(){t.call(this),this.events=new QA,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Lv.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var r=this.events.get(e);if(r.isInsert()&&this.processOverlaps(e,r.getDeleteEventIndex(),r,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof G_&&jg(arguments[0],kA)&&jg(arguments[1],kA)){var n=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(n,n),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&jg(arguments[0],kA)&&arguments[1]instanceof G_){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var r=t.getMonotoneChainEdge(),n=r.getStartIndexes(),i=0;i<n.length-1;i++){var o=new F_(r,i),s=new Q_(e,r.getMinX(i),o);this.events.add(s),this.events.add(new Q_(r.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,r,n){for(var i=r.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();r.isSameLabel(s)||(i.computeIntersections(a,n),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){var i=n.next();this.addEdge(i,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(U_),j_=function(){this._min=Lg.POSITIVE_INFINITY,this._max=Lg.NEGATIVE_INFINITY},V_={NodeComparator:{configurable:!0}};j_.prototype.getMin=function(){return this._min},j_.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},j_.prototype.getMax=function(){return this._max},j_.prototype.toString=function(){return cA.toLineString(new Fg(this._min,0),new Fg(this._max,0))},j_.prototype.interfaces_=function(){return[]},j_.prototype.getClass=function(){return j_},V_.NodeComparator.get=function(){return H_},Object.defineProperties(j_,V_);var H_=function(){};H_.prototype.compare=function(t,e){var r=t,n=e,i=(r._min+r._max)/2,o=(n._min+n._max)/2;return i<o?-1:i>o?1:0},H_.prototype.interfaces_=function(){return[Dg]},H_.prototype.getClass=function(){return H_};var q_=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,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,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(j_),Y_=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,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,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(j_),X_=function(){this._leaves=new QA,this._root=null,this._level=0};X_.prototype.buildTree=function(){Lv.sort(this._leaves,new j_.NodeComparator);for(var t=this._leaves,e=null,r=new QA;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},X_.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new q_(t,e,r))},X_.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},X_.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},X_.prototype.printNode=function(t){nA.out.println(cA.toLineString(new Fg(t._min,this._level),new Fg(t._max,this._level)))},X_.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},X_.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r<t.size();r+=2){var n=t.get(r);if(null===(r+1<t.size()?t.get(r):null))e.add(n);else{var i=new Y_(t.get(r),t.get(r+1));e.add(i)}}},X_.prototype.interfaces_=function(){return[]},X_.prototype.getClass=function(){return X_};var W_=function(){this._items=new QA};W_.prototype.visitItem=function(t){this._items.add(t)},W_.prototype.getItems=function(){return this._items},W_.prototype.interfaces_=function(){return[Sv]},W_.prototype.getClass=function(){return W_};var J_=function(){this._index=null;var t=arguments[0];if(!jg(t,By))throw new Tg("Argument must be Polygonal");this._index=new $_(t)},K_={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};J_.prototype.locate=function(t){var e=new mA(t),r=new Z_(e);return this._index.query(t.y,t.y,r),e.getLocation()},J_.prototype.interfaces_=function(){return[ym]},J_.prototype.getClass=function(){return J_},K_.SegmentVisitor.get=function(){return Z_},K_.IntervalIndexedGeometry.get=function(){return $_},Object.defineProperties(J_,K_);var Z_=function(){this._counter=null;var t=arguments[0];this._counter=t};Z_.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},Z_.prototype.interfaces_=function(){return[Sv]},Z_.prototype.getClass=function(){return Z_};var $_=function(){this._index=new X_;var t=arguments[0];this.init(t)};$_.prototype.init=function(t){for(var e=e_.getLines(t).iterator();e.hasNext();){var r=e.next().getCoordinates();this.addLine(r)}},$_.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var r=new qv(t[e-1],t[e]),n=Math.min(r.p0.y,r.p1.y),i=Math.max(r.p0.y,r.p1.y);this._index.insert(n,i,r)}},$_.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new W_;return this._index.query(t,e,r),r.getItems()}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._index.query(n,i,o)}},$_.prototype.interfaces_=function(){return[]},$_.prototype.getClass=function(){return $_};var tI=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new zy,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new r_,2===arguments.length){var e=arguments[0],r=arguments[1],n=SA.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=r,this._boundaryNodeRule=n,null!==r&&this.add(r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,r){var n=this._nodes.addNode(r).getLabel(),i=1;n.getLocation(t,ev.ON)===Gg.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var r=arguments[1],n=arguments[2],i=new G_(arguments[0],!0,!1);i.setIsDoneIfProperInt(n);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof Ly||this._parentGeom instanceof My||this._parentGeom instanceof Ry,a=r||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();){e.next().eiList.addSplitEdges(t)}},e.prototype.computeEdgeIntersections=function(t,e,r){var n=new G_(e,r,!0);return n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof Sy){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,Gg.INTERIOR)}else if(arguments[0]instanceof Fg){var e=arguments[0];this.insertPoint(this._argIndex,e,Gg.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),Gg.EXTERIOR,Gg.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var r=t.getInteriorRingN(e);this.addPolygonRing(r,Gg.INTERIOR,Gg.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],Gg.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],Gg.BOUNDARY)},e.prototype.addLineString=function(t){var e=GA.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var r=new Nm(e,new hv(this._argIndex,Gg.INTERIOR));this._lineEdgeMap.put(t,r),this.insertEdge(r),dA.isTrue(e.length>=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),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=i.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,r){if(this.isBoundaryNode(t,e))return null;r===Gg.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=GA.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;_A.isCCW(n)&&(i=r,o=e);var s=new Nm(n,new hv(this._argIndex,Gg.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,n[0],Gg.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new hv(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new z_},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.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 Ry&&(this._useBoundaryDeterminationRule=!1),e instanceof My)this.addPolygon(e);else if(e instanceof Cy)this.addLineString(e);else if(e instanceof Sy)this.addPoint(e);else if(e instanceof Ty)this.addCollection(e);else if(e instanceof py)this.addCollection(e);else if(e instanceof Ry)this.addCollection(e);else{if(!(e instanceof fy))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},e.prototype.locate=function(t){return jg(this._parentGeom,By)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new J_(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)?Gg.BOUNDARY:Gg.INTERIOR},e}(Ev),eI=function(){if(this._li=new yA,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 tI(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=SA.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new tI(0,e,n),this._arg[1]=new tI(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new tI(0,i,s),this._arg[1]=new tI(1,o,s)}};eI.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},eI.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},eI.prototype.interfaces_=function(){return[]},eI.prototype.getClass=function(){return eI};var rI=function(){};rI.prototype.interfaces_=function(){return[]},rI.prototype.getClass=function(){return rI},rI.map=function(){if(arguments[0]instanceof xA&&jg(arguments[1],rI.MapOp)){for(var t=arguments[0],e=arguments[1],r=new QA,n=0;n<t.getNumGeometries();n++){var i=e.map(t.getGeometryN(n));null!==i&&r.add(i)}return t.getFactory().buildGeometry(r)}if(jg(arguments[0],NA)&&jg(arguments[1],rI.MapOp)){for(var o=arguments[0],s=arguments[1],a=new QA,u=o.iterator();u.hasNext();){var l=u.next(),h=s.map(l);null!==h&&a.add(h)}return a}},rI.MapOp=function(){};var nI=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r),this._ptLocator=new r_,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new wm,this._resultPolyList=new QA,this._resultLineList=new QA,this._resultPointList=new QA,this._graph=new Ev(new Em),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new hv(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(r),i.add(n),r.merge(n)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),r=e.getSym();e.isInResult()&&r.isInResult()&&(e.setInResult(!1),r.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,r,n,i){var o=new QA;return o.addAll(t),o.addAll(r),o.addAll(n),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().mergeSymLabels()}},e.prototype.isCovered=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(this._ptLocator.locate(t,n)!==Gg.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new QA,e=this._edgeList.iterator();e.hasNext();){var r=e.next();r.isCollapsed()&&(e.remove(),t.add(r.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getEdges().getLabel();e.getLabel().merge(r)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();this.insertUniqueEdge(r)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new QA;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),I_.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var r=new xv(this._geomFact);r.add(this._graph),this._resultPolyList=r.getPolygons();var n=new x_(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);var i=new w_(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,r)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var r=e.next();this._graph.addNode(r.getCoordinate()).setLabel(t,r.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var n=r.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,ev.RIGHT),i.getLocation(1,ev.RIGHT),t)&&n.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),r=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(var i=0;i<2;i++)r.isNull(i)||!r.isArea()||n.isNull(i)||(0===n.getDelta(i)?r.toLine(i):(dA.isTrue(!n.isNull(i,ev.LEFT),"depth of LEFT side has not been initialized"),r.setLocation(i,ev.LEFT,n.getLocation(i,ev.LEFT)),dA.isTrue(!n.isNull(i,ev.RIGHT),"depth of RIGHT side has not been initialized"),r.setLocation(i,ev.RIGHT,n.getLocation(i,ev.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().computeLabelling(this._arg)}this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getLabel();e.isIsolated()&&(r.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(r)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(eI);nI.overlayOp=function(t,e,r){return new nI(t,e).getResultGeometry(r)},nI.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return nI.createEmptyResult(nI.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var r=e;return E_.map(t,{interfaces_:function(){return[rI.MapOp]},map:function(t){return t.intersection(r)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),k_.overlayOp(t,e,nI.INTERSECTION)},nI.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return nI.createEmptyResult(nI.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),k_.overlayOp(t,e,nI.SYMDIFFERENCE)},nI.resultDimension=function(t,e,r){var n=e.getDimension(),i=r.getDimension(),o=-1;switch(t){case nI.INTERSECTION:o=Math.min(n,i);break;case nI.UNION:o=Math.max(n,i);break;case nI.DIFFERENCE:o=n;break;case nI.SYMDIFFERENCE:o=Math.max(n,i)}return o},nI.createEmptyResult=function(t,e,r,n){var i=null;switch(nI.resultDimension(t,e,r)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon()}return i},nI.difference=function(t,e){return t.isEmpty()?nI.createEmptyResult(nI.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),k_.overlayOp(t,e,nI.DIFFERENCE))},nI.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=t.getLocation(0),n=t.getLocation(1);return nI.isResultOfOp(r,n,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===Gg.BOUNDARY&&(i=Gg.INTERIOR),o===Gg.BOUNDARY&&(o=Gg.INTERIOR),arguments[2]){case nI.INTERSECTION:return i===Gg.INTERIOR&&o===Gg.INTERIOR;case nI.UNION:return i===Gg.INTERIOR||o===Gg.INTERIOR;case nI.DIFFERENCE:return i===Gg.INTERIOR&&o!==Gg.INTERIOR;case nI.SYMDIFFERENCE:return i===Gg.INTERIOR&&o!==Gg.INTERIOR||i!==Gg.INTERIOR&&o===Gg.INTERIOR}return!1}},nI.INTERSECTION=1,nI.UNION=2,nI.DIFFERENCE=3,nI.SYMDIFFERENCE=4;var iI=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new r_,this._seg=new qv;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};iI.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,r=0;r<this._linework.getNumGeometries();r++)for(var n=e._linework.getGeometryN(r).getCoordinateSequence(),i=0;i<n.size()-1;i++){if(n.getCoordinate(i,e._seg.p0),n.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0}return!1},iI.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?Gg.BOUNDARY:this._ptLocator.locate(t,this._g)},iI.prototype.extractLinework=function(t){var e=new oI;t.apply(e);var r=e.getLinework(),n=Yy.toLineStringArray(r);return t.getFactory().createMultiLineString(n)},iI.prototype.interfaces_=function(){return[]},iI.prototype.getClass=function(){return iI};var oI=function(){this._linework=null,this._linework=new QA};oI.prototype.getLinework=function(){return this._linework},oI.prototype.filter=function(t){if(t instanceof My){var e=t;this._linework.add(e.getExteriorRing());for(var r=0;r<e.getNumInteriorRing();r++)this._linework.add(e.getInteriorRingN(r))}},oI.prototype.interfaces_=function(){return[hy]},oI.prototype.getClass=function(){return oI};var sI=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};sI.prototype.extractPoints=function(t,e,r){for(var n=t.getCoordinates(),i=0;i<n.length-1;i++)this.computeOffsetPoints(n[i],n[i+1],e,r)},sI.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},sI.prototype.getPoints=function(t){for(var e=new QA,r=e_.getLines(this._g).iterator();r.hasNext();){var n=r.next();this.extractPoints(n,t,e)}return e},sI.prototype.computeOffsetPoints=function(t,e,r,n){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=r*i/s,u=r*o/s,l=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var c=new Fg(l-u,h+a);n.add(c)}if(this._doRight){var f=new Fg(l+u,h-a);n.add(f)}},sI.prototype.interfaces_=function(){return[]},sI.prototype.getClass=function(){return sI};var aI=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new QA;var e=arguments[0],r=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,r),this._geom=[e,r,n],this._locFinder=[new iI(this._geom[0],this._boundaryDistanceTolerance),new iI(this._geom[1],this._boundaryDistanceTolerance),new iI(this._geom[2],this._boundaryDistanceTolerance)]},uI={TOLERANCE:{configurable:!0}};aI.prototype.reportResult=function(t,e,r){nA.out.println("Overlay result invalid - A:"+Gg.toLocationSymbol(e[0])+" B:"+Gg.toLocationSymbol(e[1])+" expected:"+(r?"i":"e")+" actual:"+Gg.toLocationSymbol(e[2]))},aI.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},aI.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=0;r<this._testCoords.size();r++){var n=t._testCoords.get(r);if(!t.checkValid(e,n))return t._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!aI.hasLocation(this._location,Gg.BOUNDARY)||this.isValidResult(i,this._location)}},aI.prototype.addTestPts=function(t){var e=new sI(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},aI.prototype.isValidResult=function(t,e){var r=nI.isResultOfOp(e[0],e[1],t),n=!(r^e[2]===Gg.INTERIOR);return n||this.reportResult(t,e,r),n},aI.prototype.getInvalidLocation=function(){return this._invalidLocation},aI.prototype.interfaces_=function(){return[]},aI.prototype.getClass=function(){return aI},aI.hasLocation=function(t,e){for(var r=0;r<3;r++)if(t[r]===e)return!0;return!1},aI.computeBoundaryDistanceTolerance=function(t,e){return Math.min(S_.computeSizeBasedSnapTolerance(t),S_.computeSizeBasedSnapTolerance(e))},aI.isValid=function(t,e,r,n){return new aI(t,e,n).isValid(r)},uI.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(aI,uI);var lI=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};lI.prototype.extractElements=function(t,e){if(null===t)return null;for(var r=0;r<t.getNumGeometries();r++){var n=t.getGeometryN(r);this._skipEmpty&&n.isEmpty()||e.add(n)}},lI.prototype.combine=function(){for(var t=new QA,e=this._inputGeoms.iterator();e.hasNext();){var r=e.next();this.extractElements(r,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},lI.prototype.interfaces_=function(){return[]},lI.prototype.getClass=function(){return lI},lI.combine=function(){return 1===arguments.length?new lI(arguments[0]).combine():2===arguments.length?new lI(lI.createList(arguments[0],arguments[1])).combine():3===arguments.length?new lI(lI.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},lI.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},lI.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new QA;return r.add(t),r.add(e),r}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=new QA;return s.add(n),s.add(i),s.add(o),s}};var hI=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new QA)},cI={STRTREE_NODE_CAPACITY:{configurable:!0}};hI.prototype.reduceToGeometries=function(t){for(var e=new QA,r=t.iterator();r.hasNext();){var n=r.next(),i=null;jg(n,kA)?i=this.unionTree(n):n instanceof xA&&(i=n),e.add(i)}return e},hI.prototype.extractByEnvelope=function(t,e,r){for(var n=new QA,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?n.add(o):r.add(o)}return this._geomFactory.buildGeometry(n)},hI.prototype.unionOptimized=function(t,e){var r=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();if(!r.intersects(n))return lI.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=r.intersection(n);return this.unionUsingEnvelopeIntersection(t,e,i)},hI.prototype.union=function(){if(null===this._inputPolys)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new Fv(hI.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var r=e.next();t.insert(r.getEnvelopeInternal(),r)}this._inputPolys=null;var n=t.itemsTree();return this.unionTree(n)},hI.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];if(n-r<=1){var i=hI.getGeometry(e,r);return this.unionSafe(i,null)}if(n-r==2)return this.unionSafe(hI.getGeometry(e,r),hI.getGeometry(e,r+1));var o=Math.trunc((n+r)/2),s=this.binaryUnion(e,r,o),a=this.binaryUnion(e,o,n);return this.unionSafe(s,a)}},hI.prototype.repeatedUnion=function(t){for(var e=null,r=t.iterator();r.hasNext();){var n=r.next();e=null===e?n.copy():e.union(n)}return e},hI.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},hI.prototype.unionActual=function(t,e){return hI.restrictToPolygons(t.union(e))},hI.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},hI.prototype.unionUsingEnvelopeIntersection=function(t,e,r){var n=new QA,i=this.extractByEnvelope(r,t,n),o=this.extractByEnvelope(r,e,n),s=this.unionActual(i,o);return n.add(s),lI.combine(n)},hI.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().createGeometryCollection([e,r]).buffer(0)}},hI.prototype.interfaces_=function(){return[]},hI.prototype.getClass=function(){return hI},hI.restrictToPolygons=function(t){if(jg(t,By))return t;var e=t_.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(Yy.toPolygonArray(e))},hI.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},hI.union=function(t){return new hI(t).union()},cI.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(hI,cI);var fI=function(){};function pI(){return new dI}function dI(){this.reset()}fI.prototype.interfaces_=function(){return[]},fI.prototype.getClass=function(){return fI},fI.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return nI.createEmptyResult(nI.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),k_.overlayOp(t,e,nI.UNION)},dI.prototype={constructor:dI,reset:function(){this.s=this.t=0},add:function(t){AI(gI,t,this.t),AI(this,gI.s,this.s),this.s?this.t+=gI.t:this.s=gI.t},valueOf:function(){return this.s}};var gI=new dI;function AI(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var yI=1e-6,vI=Math.PI,mI=vI/2,_I=vI/4,II=2*vI,EI=180/vI,xI=vI/180,wI=Math.abs,CI=Math.atan,bI=Math.atan2,SI=Math.cos,BI=Math.sin,MI=Math.sqrt;function TI(t){return t>1?0:t<-1?vI:Math.acos(t)}function LI(t){return t>1?mI:t<-1?-mI:Math.asin(t)}function RI(){}function NI(t,e){t&&FI.hasOwnProperty(t.type)&&FI[t.type](t,e)}var PI,DI,kI={Feature:function(t,e){NI(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)NI(r[n].geometry,e)}},FI={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){QI(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)QI(r[n],e,0)},Polygon:function(t,e){OI(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)OI(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)NI(r[n],e)}};function QI(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function OI(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)QI(t[r],e,1);e.polygonEnd()}function UI(t){return[bI(t[1],t[0]),LI(t[2])]}function GI(t){var e=t[0],r=t[1],n=SI(r);return[n*SI(e),n*BI(e),BI(r)]}function zI(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function jI(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function VI(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function HI(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function qI(t){var e=MI(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function YI(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function XI(t,e){return[t>vI?t-II:t<-vI?t+II:t,e]}function WI(t){return function(e,r){return[(e+=t)>vI?e-II:e<-vI?e+II:e,r]}}function JI(t){var e=WI(t);return e.invert=WI(-t),e}function KI(t,e){var r=SI(t),n=BI(t),i=SI(e),o=BI(e);function s(t,e){var s=SI(e),a=SI(t)*s,u=BI(t)*s,l=BI(e),h=l*r+a*n;return[bI(u*i-h*o,a*r-l*n),LI(h*i+u*o)]}return s.invert=function(t,e){var s=SI(e),a=SI(t)*s,u=BI(t)*s,l=BI(e),h=l*i-u*o;return[bI(u*i+l*o,a*r+h*n),LI(h*r-a*n)]},s}function ZI(t,e){(e=GI(e))[0]-=t,qI(e);var r=TI(-e[1]);return((-e[2]<0?-r:r)+II-yI)%II}function $I(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:RI,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function tE(t,e){return wI(t[0]-e[0])<yI&&wI(t[1]-e[1])<yI}function eE(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function rE(t,e,r,n,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],s=t[e];if(tE(n,s)){for(i.lineStart(),o=0;o<e;++o)i.point((n=t[o])[0],n[1]);i.lineEnd()}else a.push(r=new eE(n,t,null,!0)),u.push(r.o=new eE(n,null,r,!1)),a.push(r=new eE(s,t,null,!1)),u.push(r.o=new eE(s,null,r,!0))}})),a.length){for(u.sort(e),nE(a),nE(u),o=0,s=u.length;o<s;++o)u[o].e=r=!r;for(var l,h,c=a[0];;){for(var f=c,p=!0;f.v;)if((f=f.n)===c)return;l=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(o=0,s=l.length;o<s;++o)i.point((h=l[o])[0],h[1]);else n(f.x,f.n.x,1,i);f=f.n}else{if(p)for(l=f.p.z,o=l.length-1;o>=0;--o)i.point((h=l[o])[0],h[1]);else n(f.x,f.p.x,-1,i);f=f.p}l=(f=f.o).z,p=!p}while(!f.v);i.lineEnd()}}}function nE(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function iE(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function oE(t){for(var e,r,n,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(r=new Array(s);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--s]=n[e];return r}pI(),pI(),pI(),XI.invert=XI,1===(PI=iE).length&&(DI=PI,PI=function(t,e){return iE(DI(t),e)});var sE=1e9,aE=-sE;function uE(t,e,r,n){function i(i,o){return t<=i&&i<=r&&e<=o&&o<=n}function o(i,o,a,l){var h=0,c=0;if(null==i||(h=s(i,a))!==(c=s(o,a))||u(i,o)<0^a>0)do{l.point(0===h||3===h?t:r,h>1?n:e)}while((h=(h+a+4)%4)!==c);else l.point(o[0],o[1])}function s(n,i){return wI(n[0]-t)<yI?i>0?0:3:wI(n[0]-r)<yI?i>0?2:1:wI(n[1]-e)<yI?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){var u,l,h,c,f,p,d,g,A,y,v,m=s,_=$I(),I={point:E,lineStart:function(){I.point=x,l&&l.push(h=[]);y=!0,A=!1,d=g=NaN},lineEnd:function(){u&&(x(c,f),p&&A&&_.rejoin(),u.push(_.result()));I.point=E,A&&m.lineEnd()},polygonStart:function(){m=_,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=l.length;r<i;++r)for(var o,s,a=l[r],u=1,h=a.length,c=a[0],f=c[0],p=c[1];u<h;++u)o=f,s=p,f=(c=a[u])[0],p=c[1],s<=n?p>n&&(f-o)*(n-s)>(p-s)*(t-o)&&++e:p<=n&&(f-o)*(n-s)<(p-s)*(t-o)&&--e;return e}(),r=v&&e,i=(u=oE(u)).length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&rE(u,a,e,o,s),s.polygonEnd());m=s,u=l=h=null}};function E(t,e){i(t,e)&&m.point(t,e)}function x(o,s){var a=i(o,s);if(l&&h.push([o,s]),y)c=o,f=s,p=a,y=!1,a&&(m.lineStart(),m.point(o,s));else if(a&&A)m.point(o,s);else{var u=[d=Math.max(aE,Math.min(sE,d)),g=Math.max(aE,Math.min(sE,g))],_=[o=Math.max(aE,Math.min(sE,o)),s=Math.max(aE,Math.min(sE,s))];!function(t,e,r,n,i,o){var s,a=t[0],u=t[1],l=0,h=1,c=e[0]-a,f=e[1]-u;if(s=r-a,c||!(s>0)){if(s/=c,c<0){if(s<l)return;s<h&&(h=s)}else if(c>0){if(s>h)return;s>l&&(l=s)}if(s=i-a,c||!(s<0)){if(s/=c,c<0){if(s>h)return;s>l&&(l=s)}else if(c>0){if(s<l)return;s<h&&(h=s)}if(s=n-u,f||!(s>0)){if(s/=f,f<0){if(s<l)return;s<h&&(h=s)}else if(f>0){if(s>h)return;s>l&&(l=s)}if(s=o-u,f||!(s<0)){if(s/=f,f<0){if(s>h)return;s>l&&(l=s)}else if(f>0){if(s<l)return;s<h&&(h=s)}return l>0&&(t[0]=a+l*c,t[1]=u+l*f),h<1&&(e[0]=a+h*c,e[1]=u+h*f),!0}}}}}(u,_,t,e,r,n)?a&&(m.lineStart(),m.point(o,s),v=!1):(A||(m.lineStart(),m.point(u[0],u[1])),m.point(_[0],_[1]),a||m.lineEnd(),v=!1)}d=o,g=s,A=a}return I}}var lE=pI();function hE(t){return t}pI(),pI(),pI();var cE=1/0,fE=cE,pE=-cE,dE=pE,gE={point:function(t,e){t<cE&&(cE=t);t>pE&&(pE=t);e<fE&&(fE=e);e>dE&&(dE=e)},lineStart:RI,lineEnd:RI,polygonStart:RI,polygonEnd:RI,result:function(){var t=[[cE,fE],[pE,dE]];return pE=dE=-(fE=cE=1/0),t}};function AE(t,e,r,n){return function(i,o){var s,a,u,l=e(o),h=i.invert(n[0],n[1]),c=$I(),f=e(c),p=!1,d={point:g,lineStart:y,lineEnd:v,polygonStart:function(){d.point=m,d.lineStart=_,d.lineEnd=I,a=[],s=[]},polygonEnd:function(){d.point=g,d.lineStart=y,d.lineEnd=v,a=oE(a);var t=function(t,e){var r=e[0],n=e[1],i=[BI(r),-SI(r),0],o=0,s=0;lE.reset();for(var a=0,u=t.length;a<u;++a)if(h=(l=t[a]).length)for(var l,h,c=l[h-1],f=c[0],p=c[1]/2+_I,d=BI(p),g=SI(p),A=0;A<h;++A,f=v,d=_,g=I,c=y){var y=l[A],v=y[0],m=y[1]/2+_I,_=BI(m),I=SI(m),E=v-f,x=E>=0?1:-1,w=x*E,C=w>vI,b=d*_;if(lE.add(bI(b*x*BI(w),g*I+b*SI(w))),o+=C?E+x*II:E,C^f>=r^v>=r){var S=jI(GI(c),GI(y));qI(S);var B=jI(i,S);qI(B);var M=(C^E>=0?-1:1)*LI(B[2]);(n>M||n===M&&(S[0]||S[1]))&&(s+=C^E>=0?1:-1)}}return(o<-yI||o<yI&&lE<-yI)^1&s}(s,h);a.length?(p||(o.polygonStart(),p=!0),rE(a,vE,t,r,o)):t&&(p||(o.polygonStart(),p=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),p&&(o.polygonEnd(),p=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function g(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function A(t,e){var r=i(t,e);l.point(r[0],r[1])}function y(){d.point=A,l.lineStart()}function v(){d.point=g,l.lineEnd()}function m(t,e){u.push([t,e]);var r=i(t,e);f.point(r[0],r[1])}function _(){f.lineStart(),u=[]}function I(){m(u[0][0],u[0][1]),f.lineEnd();var t,e,r,n,i=f.clean(),l=c.result(),h=l.length;if(u.pop(),s.push(u),u=null,h)if(1&i){if((e=(r=l[0]).length-1)>0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t<e;++t)o.point((n=r[t])[0],n[1]);o.lineEnd()}}else h>1&&2&i&&l.push(l.pop().concat(l.shift())),a.push(l.filter(yE))}return d}}function yE(t){return t.length>1}function vE(t,e){return((t=t.x)[0]<0?t[1]-mI-yI:mI-t[1])-((e=e.x)[0]<0?e[1]-mI-yI:mI-e[1])}pI();var mE=AE((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?vI:-vI,u=wI(o-r);wI(u-vI)<yI?(t.point(r,n=(n+s)/2>0?mI:-mI),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):i!==a&&u>=vI&&(wI(r-i)<yI&&(r-=i*yI),wI(o-a)<yI&&(o-=a*yI),n=function(t,e,r,n){var i,o,s=BI(t-r);return wI(s)>yI?CI((BI(e)*(o=SI(n))*BI(r)-BI(n)*(i=SI(e))*BI(t))/(i*o*s)):(e+n)/2}(r,n,o,s),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(r=o,n=s),i=a},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*mI,n.point(-vI,i),n.point(0,i),n.point(vI,i),n.point(vI,0),n.point(vI,-i),n.point(0,-i),n.point(-vI,-i),n.point(-vI,0),n.point(-vI,i);else if(wI(t[0]-e[0])>yI){var o=t[0]<e[0]?vI:-vI;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}),[-vI,-mI]);function _E(t,e){var r=SI(t),n=r>0,i=wI(r)>yI;function o(t,e){return SI(t)*SI(e)>r}function s(t,e,n){var i=[1,0,0],o=jI(GI(t),GI(e)),s=zI(o,o),a=o[0],u=s-a*a;if(!u)return!n&&t;var l=r*s/u,h=-r*a/u,c=jI(i,o),f=HI(i,l);VI(f,HI(o,h));var p=c,d=zI(f,p),g=zI(p,p),A=d*d-g*(zI(f,f)-1);if(!(A<0)){var y=MI(A),v=HI(p,(-d-y)/g);if(VI(v,f),v=UI(v),!n)return v;var m,_=t[0],I=e[0],E=t[1],x=e[1];I<_&&(m=_,_=I,I=m);var w=I-_,C=wI(w-vI)<yI;if(!C&&x<E&&(m=E,E=x,x=m),C||w<yI?C?E+x>0^v[1]<(wI(v[0]-_)<yI?E:x):E<=v[1]&&v[1]<=x:w>vI^(_<=v[0]&&v[0]<=I)){var b=HI(p,(-d+y)/g);return VI(b,f),[v,UI(b)]}}}function a(e,r){var i=n?t:vI-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return AE(o,(function(t){var e,r,u,l,h;return{lineStart:function(){l=u=!1,h=1},point:function(c,f){var p,d=[c,f],g=o(c,f),A=n?g?0:a(c,f):g?a(c+(c<0?vI:-vI),f):0;if(!e&&(l=u=g)&&t.lineStart(),g!==u&&(!(p=s(e,d))||tE(e,p)||tE(d,p))&&(d[0]+=yI,d[1]+=yI,g=o(d[0],d[1])),g!==u)h=0,g?(t.lineStart(),p=s(d,e),t.point(p[0],p[1])):(p=s(e,d),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(i&&e&&n^g){var y;A&r||!(y=s(d,e,!0))||(h=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])))}!g||e&&tE(e,d)||t.point(d[0],d[1]),e=d,u=g,r=A},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return h|(l&&u)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var s=SI(e),a=BI(e),u=n*r;null==i?(i=e+n*II,o=e-u/2):(i=ZI(s,i),o=ZI(s,o),(n>0?i<o:i>o)&&(i+=n*II));for(var l,h=i;n>0?h>o:h<o;h-=u)l=UI([s,-a*SI(h),-a*BI(h)]),t.point(l[0],l[1])}}(o,t,e,i,r,n)}),n?[0,-t]:[-vI,t-vI])}function IE(t){return function(e){var r=new EE;for(var n in t)r[n]=t[n];return r.stream=e,r}}function EE(){}function xE(t,e,r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&kI.hasOwnProperty(t.type)?kI[t.type](t,e):NI(t,e)}(r,t.stream(gE));var s=gE.result(),a=Math.min(n/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(n-a*(s[1][0]+s[0][0]))/2,l=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,l])}EE.prototype={constructor:EE,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var wE=16,CE=SI(30*xI);function bE(t,e){return+e?function(t,e){function r(n,i,o,s,a,u,l,h,c,f,p,d,g,A){var y=l-n,v=h-i,m=y*y+v*v;if(m>4*e&&g--){var _=s+f,I=a+p,E=u+d,x=MI(_*_+I*I+E*E),w=LI(E/=x),C=wI(wI(E)-1)<yI||wI(o-c)<yI?(o+c)/2:bI(I,_),b=t(C,w),S=b[0],B=b[1],M=S-n,T=B-i,L=v*M-y*T;(L*L/m>e||wI((y*M+v*T)/m-.5)>.3||s*f+a*p+u*d<CE)&&(r(n,i,o,s,a,u,S,B,C,_/=x,I/=x,E,g,A),A.point(S,B),r(S,B,C,_,I,E,l,h,c,f,p,d,g,A))}}return function(e){var n,i,o,s,a,u,l,h,c,f,p,d,g={point:A,lineStart:y,lineEnd:m,polygonStart:function(){e.polygonStart(),g.lineStart=_},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function A(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){h=NaN,g.point=v,e.lineStart()}function v(n,i){var o=GI([n,i]),s=t(n,i);r(h,c,l,f,p,d,h=s[0],c=s[1],l=n,f=o[0],p=o[1],d=o[2],wE,e),e.point(h,c)}function m(){g.point=A,e.lineEnd()}function _(){y(),g.point=I,g.lineEnd=E}function I(t,e){v(n=t,e),i=h,o=c,s=f,a=p,u=d,g.point=v}function E(){r(h,c,l,f,p,d,i,o,n,s,a,u,wE,e),g.lineEnd=m,m()}return g}}(t,e):function(t){return IE({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}(t)}var SE=IE({point:function(t,e){this.stream.point(t*xI,e*xI)}});function BE(t){return function(t){var e,r,n,i,o,s,a,u,l,h,c=150,f=480,p=250,d=0,g=0,A=0,y=0,v=0,m=null,_=mE,I=null,E=hE,x=.5,w=bE(S,x);function C(t){return[(t=o(t[0]*xI,t[1]*xI))[0]*c+r,n-t[1]*c]}function b(t){return(t=o.invert((t[0]-r)/c,(n-t[1])/c))&&[t[0]*EI,t[1]*EI]}function S(t,i){return[(t=e(t,i))[0]*c+r,n-t[1]*c]}function B(){o=YI(i=function(t,e,r){return(t%=II)?e||r?YI(JI(t),KI(e,r)):JI(t):e||r?KI(e,r):XI}(A,y,v),e);var t=e(d,g);return r=f-t[0]*c,n=p+t[1]*c,M()}function M(){return l=h=null,C}return C.stream=function(t){return l&&h===t?l:l=SE(_(i,w(E(h=t))))},C.clipAngle=function(t){return arguments.length?(_=+t?_E(m=t*xI,6*xI):(m=null,mE),M()):m*EI},C.clipExtent=function(t){return arguments.length?(E=null==t?(I=s=a=u=null,hE):uE(I=+t[0][0],s=+t[0][1],a=+t[1][0],u=+t[1][1]),M()):null==I?null:[[I,s],[a,u]]},C.scale=function(t){return arguments.length?(c=+t,B()):c},C.translate=function(t){return arguments.length?(f=+t[0],p=+t[1],B()):[f,p]},C.center=function(t){return arguments.length?(d=t[0]%360*xI,g=t[1]%360*xI,B()):[d*EI,g*EI]},C.rotate=function(t){return arguments.length?(A=t[0]%360*xI,y=t[1]%360*xI,v=t.length>2?t[2]%360*xI:0,B()):[A*EI,y*EI,v*EI]},C.precision=function(t){return arguments.length?(w=bE(S,x=t*t),M()):MI(x)},C.fitExtent=function(t,e){return xE(C,t,e)},C.fitSize=function(t,e){return function(t,e,r){return xE(t,[[0,0],e],r)}(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&b,B()}}((function(){return t}))()}function ME(t){return function(e,r){var n=SI(e),i=SI(r),o=t(n*i);return[o*i*BI(e),o*BI(r)]}}function TE(t){return function(e,r){var n=MI(e*e+r*r),i=t(n),o=BI(i),s=SI(i);return[bI(e*o,n*s),LI(n&&r*o/n)]}}ME((function(t){return MI(2/(1+t))})).invert=TE((function(t){return 2*LI(t/2)}));var LE=ME((function(t){return(t=TI(t))&&t/BI(t)}));function RE(){return BE(LE).scale(79.4188).clipAngle(179.999)}function NE(t,e){return[t,e]}function PE(t,e,r,n){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return nn(t,(function(t){var i=PE(t,e,r,n);i&&s.push(i)})),Lr(s)}var a=function(t){var e=$o(t).geometry.coordinates,r=[-e[0],-e[1]];return RE().rotate(r).scale(mr)}(o),u={type:o.type,coordinates:kE(o.coordinates,a)},l=(new $y).read(u),h=Fr(Qr(e,r),"meters"),c=qm.bufferOp(l,h,n);if(!DE((c=(new tv).write(c)).coordinates))return xr({type:c.type,coordinates:FE(c.coordinates,a)},i)}function DE(t){return Array.isArray(t[0])?DE(t[0]):isNaN(t[0])}function kE(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return kE(t,e)}))}function FE(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return FE(t,e)}))}function QE(t,e,r){void 0===r&&(r={});var n=En(t),i=En(e),o=Bg.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?Sr(o[0],r.properties):Pr(o,r.properties)}function OE(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,h=2*e/Pi([i,u],[s,u],r)*(s-i),c=2*e/Pi([l,o],[l,a],r)*(a-o),f=h/2,p=2*f,d=Math.sqrt(3)/2*c,g=s-i,A=a-o,y=3/4*p,v=d,m=(g-p)/(p-f/2),_=Math.floor(m),I=(_*y-f/2-g)/2-f/2+y/2,E=Math.floor((A-d)/d),x=(A-E*d)/2,w=E*d-A>d/2;w&&(x-=d/4);for(var C=[],b=[],S=0;S<6;S++){var B=2*Math.PI/6*S;C.push(Math.cos(B)),b.push(Math.sin(B))}for(var M=[],T=0;T<=_;T++)for(var L=0;L<=E;L++){var R=T%2==1;if((0!==L||!R)&&(0!==L||!w)){var N=T*y+i-I,P=L*v+o+x;if(R&&(P-=d/2),!0===r.triangles)GE([N,P],h/2,c/2,JSON.parse(n),C,b).forEach((function(t){r.mask?QE(r.mask,t)&&M.push(t):M.push(t)}));else{var D=UE([N,P],h/2,c/2,JSON.parse(n),C,b);r.mask?QE(r.mask,D)&&M.push(D):M.push(D)}}}return Lr(M)}function UE(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+r*o[a];s.push([u,l])}return s.push(s[0].slice()),Sr([s],n)}function GE(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+r*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+r*o[(a+1)%6]]),u.push(t),s.push(Sr([u],n))}return s}function zE(t){return Pr(t)}function jE(t){return Sr(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}function VE(t,e,r){return void 0===r&&(r={}),function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],l=e/Pi([o,s],[a,s],n)*(a-o),h=r/Pi([o,s],[o,u],n)*(u-s),c=a-o,f=u-s,p=Math.floor(c/l),d=Math.floor(f/h),g=(f-d*h)/2,A=o+(c-p*l)/2,y=0;y<p;y++){for(var v=s+g,m=0;m<d;m++){var _=Sr([[[A,v],[A,v+h],[A+l,v+h],[A+l,v],[A,v]]],n.properties);n.mask?$f(n.mask,_)&&i.push(_):i.push(_),v+=h}A+=l}return Lr(i)}(t,e,e,r)}function HE(t,e,r){void 0===r&&(r={});for(var n=[],i=e/Pi([t[0],t[1]],[t[2],t[1]],r)*(t[2]-t[0]),o=e/Pi([t[0],t[1]],[t[0],t[3]],r)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var u=0,l=t[1];l<=t[3];){var h=null,c=null;s%2==0&&u%2==0?(h=Sr([[[a,l],[a,l+o],[a+i,l],[a,l]]],r.properties),c=Sr([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],r.properties)):s%2==0&&u%2==1?(h=Sr([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],r.properties),c=Sr([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],r.properties)):u%2==0&&s%2==1?(h=Sr([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],r.properties),c=Sr([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],r.properties)):u%2==1&&s%2==1&&(h=Sr([[[a,l],[a,l+o],[a+i,l],[a,l]]],r.properties),c=Sr([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],r.properties)),r.mask?(QE(r.mask,h)&&n.push(h),QE(r.mask,c)&&n.push(c)):(n.push(h),n.push(c)),l+=o,u++}s++,a+=i}return Lr(n)}LE.invert=TE((function(t){return t})),NE.invert=NE;var qE=Object.freeze({__proto__:null,projection:Ed,random:Td,clusters:Qd,helpers:Wr,invariant:wn,meta:dn,isolines:function(t,e,r){if(!qr(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(In(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks must be an Array");if(!qr(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s=Qn(t,{zProperty:n,flip:!0}),a=function(t,e,r,n,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=Tn({},n,i[s]);u[r]=a;var l=Rr(Nn(t,a),u);o.push(l)}return o}(s,e,n,i,o),u=function(t,e,r){var n=gn(r),i=n[2]-n[0],o=n[3]-n[1],s=n[0],a=n[1],u=e[0].length-1,l=e.length-1,h=i/u,c=o/l,f=function(t){t[0]=t[0]*h+s,t[1]=t[1]*c+a};return t.forEach((function(t){Jr(t,f)})),t}(a,s,t);return Lr(u)},convex:Ti,pointsWithinPolygon:Ni,within:Ni,concave:function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=function(t){var e=[],r={};return tn(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),Lr(e)}(t),i=Di(n);if(i.features=i.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=Pi(n,i,e),a=Pi(i,o,e),u=Pi(n,o,e);return s<=r&&a<=r&&u<=r})),i.features.length<1)return null;var o=go(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),xr(o)},collect:function(t,e,r,n){var i=Ro(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[r]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=gn(t),r=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];r.forEach((function(e){Li([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[n]=o})),t},flip:function(t,e){if(!qr(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if(!t)throw new Error("geojson is required");return!1!==r&&void 0!==r||(t=Oi(t)),Jr(t,(function(t){var e=t[0],r=t[1];t[0]=r,t[1]=e})),t},simplify:Go,bezier:qo,bezierSpline:qo,tag:function(t,e,r,n){return t=Oi(t),e=Oi(e),tn(t,(function(t){t.properties||(t.properties={}),tn(e,(function(e){void 0===t.properties[n]&&Li(t,e)&&(t.properties[n]=e.properties[r])}))})),t},sample:function(t,e){if(!t)throw new Error("featurecollection is required");if(null==e)throw new Error("num is required");if("number"!=typeof e)throw new Error("num must be a number");var r=Lr(function(t,e){var r,n,i=t.slice(0),o=t.length,s=o-e;for(;o-- >s;)r=i[n=Math.floor((o+1)*Math.random())],i[n]=i[o],i[o]=r;return i.slice(s)}(t.features,e));return r},envelope:Xo,square:Wo,circle:Ko,midpoint:function(t,e){return Jo(t,Pi(t,e)/2,Zo(t,e))},center:$o,centerOfMass:function t(e,r){switch(void 0===r&&(r={}),xn(e)){case"Point":return Cr(An(e),r.properties);case"Polygon":var n=[];Jr(e,(function(t){n.push(t)}));var i,o,s,a,u,l,h,c,f=ts(e,{properties:r.properties}),p=f.geometry.coordinates,d=0,g=0,A=0,y=n.map((function(t){return[t[0]-p[0],t[1]-p[1]]}));for(i=0;i<n.length-1;i++)a=(o=y[i])[0],l=o[1],u=(s=y[i+1])[0],A+=c=a*(h=s[1])-u*l,d+=(a+u)*c,g+=(l+h)*c;if(0===A)return f;var v=1/(6*(.5*A));return Cr([p[0]+v*d,p[1]+v*g],r.properties);default:var m=Ti(e);return m?t(m,{properties:r.properties}):ts(e,{properties:r.properties})}},centroid:ts,combine:function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return tn(t,(function(t){var r,n,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(r=e.MultiPoint.coordinates).push.apply(r,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(n=e.MultiLineString.coordinates).push.apply(n,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),Lr(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return xr({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},distance:Pi,explode:es,bbox:gn,tesselate:function(t){if(!t.geometry||"Polygon"!==t.geometry.type&&"MultiPolygon"!==t.geometry.type)throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return"Polygon"===t.geometry.type?e.features=Ts(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(Ts(t))})),e},bboxPolygon:Yo,booleanPointInPolygon:Li,inside:Li,nearest:Ls,nearestPoint:Ls,nearestPointOnLine:Ea,pointOnLine:Ea,nearestPointToLine:function(t,e,r){void 0===r&&(r={});var n=r.units,i=r.properties||{},o=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return nn(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}(t);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==xn(e))throw new Error("line must be a LineString");var s=1/0,a=null;return tn(o,(function(t){var r=wa(t,e,{units:n});r<s&&(s=r,a=t)})),a&&(a.properties=Tn({dist:s},a.properties,i)),a},planepoint:function(t,e){var r=An(t),n=En(e).coordinates[0];if(n.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var i=e.properties||{},o=i.a,s=i.b,a=i.c,u=r[0],l=r[1],h=n[0][0],c=n[0][1],f=void 0!==o?o:n[0][2],p=n[1][0],d=n[1][1],g=void 0!==s?s:n[1][2],A=n[2][0],y=n[2][1],v=void 0!==a?a:n[2][2];return(v*(u-h)*(l-d)+f*(u-p)*(l-y)+g*(u-A)*(l-c)-g*(u-h)*(l-y)-v*(u-p)*(l-c)-f*(u-A)*(l-d))/((u-h)*(l-d)+(u-p)*(l-y)+(u-A)*(l-c)-(u-h)*(l-y)-(u-p)*(l-c)-(u-A)*(l-d))},tin:Di,bearing:Zo,destination:Jo,kinks:function(t){var e,r,n={type:"FeatureCollection",features:[]};if("LineString"===(r="Feature"===t.type?t.geometry:t).type)e=[r.coordinates];else if("MultiLineString"===r.type)e=r.coordinates;else if("MultiPolygon"===r.type)e=[].concat.apply([],r.coordinates);else{if("Polygon"!==r.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=r.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var r=0;r<t.length-1;r++)for(var i=r;i<e.length-1;i++){if(t===e){if(1===Math.abs(r-i))continue;if(0===r&&i===t.length-2&&t[r][0]===t[t.length-1][0]&&t[r][1]===t[t.length-1][1])continue}var o=Sa(t[r][0],t[r][1],t[r+1][0],t[r+1][1],e[i][0],e[i][1],e[i+1][0],e[i+1][1]);o&&n.features.push(Cr([o[0],o[1]]))}}))})),n},pointOnFeature:Ba,pointOnSurface:Ba,area:La,along:function(t,e,r){void 0===r&&(r={});for(var n=En(t).coordinates,i=0,o=0;o<n.length&&!(e>=i&&o===n.length-1);o++){if(i>=e){var s=e-i;if(s){var a=Zo(n[o],n[o-1])-180;return Jo(n[o],s,a,r)}return Cr(n[o])}i+=Pi(n[o],n[o+1],r)}return Cr(n[n.length-1])},length:Da,lineDistance:Da,lineSlice:function(t,e,r){var n=yn(r);if("LineString"!==xn(r))throw new Error("line must be a LineString");for(var i,o=Ea(r,t),s=Ea(r,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)a.push(n[u]);return a.push(i[1].geometry.coordinates),Mr(a,r.properties)},lineSliceAlong:ka,pointGrid:ja,truncate:Va,flatten:Ha,lineIntersect:_a,lineChunk:function(t,e,r){if(!qr(r=r||{}))throw new Error("options is invalid");var n=r.units,i=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return sn(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,n){var i=Da(t,{units:r});if(i<=e)return n(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++){n(ka(t,e*s,e*(s+1),{units:r}),s)}}(t,e,n,(function(t){o.push(t)}))})),Lr(o)},unkinkPolygon:function(t){var e=[];return sn(t,(function(t){"Polygon"===t.geometry.type&&tn(Xa(t),(function(r){e.push(Sr(r.geometry.coordinates,t.properties))}))})),Lr(e)},greatCircle:function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.properties,i=r.npoints,o=r.offset;return t=An(t),e=An(e),n=n||{},i=i||100,o=o||10,new su({x:t[0],y:t[1]},{x:e[0],y:e[1]},n).Arc(i,{offset:o}).json()},lineSegment:Rs,lineSplit:function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var r=xn(t),n=xn(e);if("LineString"!==r)throw new Error("line must be LineString");if("FeatureCollection"===n)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===n)throw new Error("splitter cannot be a GeometryCollection");var i=Va(e,{precision:7});switch(n){case"Point":return uu(t,i);case"MultiPoint":return au(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return au(t,_a(t,i))}},lineArc:cu,polygonToLine:pu,polygonToLineString:pu,lineStringToPolygon:Au,lineToPolygon:Au,bboxClip:function(t,e){var r=En(t),n=r.type,i="Feature"===t.type?t.properties:{},o=r.coordinates;switch(n){case"LineString":case"MultiLineString":var s=[];return"LineString"===n&&(o=[o]),o.forEach((function(t){!function(t,e,r){var n,i,o,s,a,u=t.length,l=Iu(t[0],e),h=[];for(r||(r=[]),n=1;n<u;n++){for(s=t[n-1],i=o=Iu(a=t[n],e);;){if(!(l|i)){h.push(s),i!==o?(h.push(a),n<u-1&&(r.push(h),h=[])):n===u-1&&h.push(a);break}if(l&i)break;l?l=Iu(s=_u(s,a,l,e),e):i=Iu(a=_u(s,a,i,e),e)}l=o}h.length&&r.push(h)}(t,e,s)})),1===s.length?Mr(s[0],i):Rr(s,i);case"Polygon":return Sr(Eu(o,e),i);case"MultiPolygon":return Pr(o.map((function(t){return Eu(t,e)})),i);default:throw new Error("geometry "+n+" not supported")}},lineOverlap:nc,sector:function(t,e,r,n,i){if(!qr(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(oc(r)===oc(n))return Ko(t,e,i);var s=yn(t),a=cu(t,e,r,n,i),u=[[s]];return Jr(a,(function(t){u[0].push(t)})),u[0].push(s),Sr(u,o)},rhumbBearing:sc,rhumbDistance:xa,rhumbDestination:uc,polygonTangents:function(t,e){var r,n,i,o,s=yn(t),a=yn(e),u=gn(e),l=0,h=null;switch(s[0]>u[0]&&s[0]<u[2]&&s[1]>u[1]&&s[1]<u[3]&&(l=(h=Ls(t,es(e))).properties.featureIndex),xn(e)){case"Polygon":r=a[0][l],n=a[0][0],null!==h&&h.geometry.coordinates[1]<s[1]&&(n=a[0][l]),o=cc(a[0][0],a[0][a[0].length-1],s);var c=lc(a[0],s,o,i,r,n);r=c[0],n=c[1];break;case"MultiPolygon":for(var f=0,p=0,d=0,g=0;g<a[0].length;g++){f=g;for(var A=!1,y=0;y<a[0][g].length;y++){if(p=y,d===l){A=!0;break}d++}if(A)break}r=a[0][f][p],n=a[0][f][p],o=cc(a[0][0][0],a[0][0][a[0][0].length-1],s),a.forEach((function(t){var e=lc(t[0],s,o,i,r,n);r=e[0],n=e[1]}))}return Lr([Cr(r),Cr(n)])},rewind:function(t,e){if(!qr(e=e||{}))throw new Error("options is invalid");var r=e.reverse||!1,n=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof r)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof n)throw new Error("<mutate> must be a boolean");!1===n&&(t=Oi(t));var i=[];switch(t.type){case"GeometryCollection":return nn(t,(function(t){pc(t,r)})),t;case"FeatureCollection":return tn(t,(function(t){tn(pc(t,r),(function(t){i.push(t)}))})),Lr(i)}return pc(t,r)},isobands:function(t,e,r){if(!qr(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(In(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!qr(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=Ac(t,{zProperty:n,flip:!0}),a=function(t,e,r){for(var n=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=vf(yf(mc(t,o,s-o))),u={};u.groupedRings=a,u[r]=o+"-"+s,n.push(u)}return n}(s,e,n);a=function(t,e,r){var n=gn(r),i=n[2]-n[0],o=n[3]-n[1],s=n[0],a=n[1],u=e[0].length-1,l=e.length-1,h=i/u,c=o/l,f=function(t){t[0]=t[0]*h+s,t[1]=t[1]*c+a};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(f)}))}))})),t}(a,s,t);var u=a.map((function(t,e){if(o[e]&&!qr(o[e]))throw new Error("Each mappedProperty is required to be an Object");var r=Tn({},i,o[e]);return r[n]=t[n],Pr(t.groupedRings,r)}));return Lr(u)},transformRotate:If,transformScale:Ef,transformTranslate:function(t,e,r,n){if(!qr(n=n||{}))throw new Error("options is invalid");var i=n.units,o=n.zTranslation,s=n.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");if(o&&"number"!=typeof o&&isNaN(o))throw new Error("zTranslation is not a number");if(o=void 0!==o?o:0,0===e&&0===o)return t;if(null==r||isNaN(r))throw new Error("direction is required");return e<0&&(e=-e,r+=180),!1!==s&&void 0!==s||(t=Oi(t)),Jr(t,(function(t){var n=yn(uc(t,e,r,{units:i}));t[0]=n[0],t[1]=n[1],o&&3===t.length&&(t[2]+=o)})),t},lineOffset:function(t,e,r){if(!qr(r=r||{}))throw new Error("options is invalid");var n=r.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=xn(t),o=t.properties;switch(i){case"LineString":return Sf(t,e,n);case"MultiLineString":var s=[];return sn(t,(function(t){s.push(Sf(t,e,n).geometry.coordinates)})),Rr(s,o);default:throw new Error("geometry "+i+" is not supported")}},polygonize:function(t){var e=Df.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var r=[],n=[];return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?r.push(t):n.push(t)})),r.forEach((function(t){Nf.findEdgeRingContaining(t,n)&&n.push(t)})),Lr(n.map((function(t){return t.toPolygon()})))},booleanDisjoint:kf,booleanContains:function(t,e){var r=En(t),n=En(e),i=r.type,o=n.type,s=r.coordinates,a=n.coordinates;switch(i){case"Point":if("Point"===o)return Gf(s,a);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return function(t,e){var r,n=!1;for(r=0;r<t.coordinates.length;r++)if(Gf(t.coordinates[r],e.coordinates)){n=!0;break}return n}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){for(var i=n[r],o=!1,s=0,a=t.coordinates;s<a.length;s++){if(Gf(i,a[s])){o=!0;break}}if(!o)return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return Fa(n,r,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(Fa({type:"Point",coordinates:o},t,{ignoreEndVertices:!0})&&(r=!0),!Fa({type:"Point",coordinates:o},t,{ignoreEndVertices:!1}))return!1}return r}(r,n);case"MultiPoint":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(Fa(o,t,{ignoreEndVertices:!0})&&(r=!0),!Fa(o,t))return!1}if(r)return!0;return!1}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return Li(n,r,{ignoreBoundary:!0});case"LineString":return function(t,e){var r=!1,n=0,i=gn(t),o=gn(e);if(!Uf(i,o))return!1;for(;n<e.coordinates.length-1;n++){if(Li({type:"Point",coordinates:zf(e.coordinates[n],e.coordinates[n+1])},t,{ignoreBoundary:!0})){r=!0;break}}return r}(r,n);case"Polygon":return function(t,e){if("Feature"===t.type&&null===t.geometry)return!1;if("Feature"===e.type&&null===e.geometry)return!1;var r=gn(t),n=gn(e);if(!Uf(r,n))return!1;for(var i=En(e).coordinates,o=0,s=i;o<s.length;o++)for(var a=0,u=s[o];a<u.length;a++){if(!Li(u[a],t))return!1}return!0}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){if(!Li(n[r],t,{ignoreBoundary:!0}))return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanCrosses:function(t,e){var r=En(t),n=En(e),i=r.type,o=n.type;switch(i){case"MultiPoint":switch(o){case"LineString":return jf(r,n);case"Polygon":return Hf(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return jf(n,r);case"LineString":return function(t,e){if(_a(t,e).features.length>0)for(var r=0;r<t.coordinates.length-1;r++)for(var n=0;n<e.coordinates.length-1;n++){var i=!0;if(0!==n&&n!==e.coordinates.length-2||(i=!1),qf(t.coordinates[r],t.coordinates[r+1],e.coordinates[n],i))return!0}return!1}(r,n);case"Polygon":return Vf(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return Hf(n,r);case"LineString":return Vf(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanClockwise:fc,booleanOverlap:function(t,e){var r=En(t),n=En(e),i=r.type,o=n.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new Zf({precision:6}).compare(t,e))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<r.coordinates.length;a++)for(var u=0;u<n.coordinates.length;u++){var l=r.coordinates[a],h=n.coordinates[u];if(l[0]===h[0]&&l[1]===h[1])return!0}return!1;case"LineString":case"MultiLineString":un(t,(function(t){un(e,(function(e){nc(t,e).features.length&&s++}))}));break;case"Polygon":case"MultiPolygon":un(t,(function(t){un(e,(function(e){_a(t,e).features.length&&s++}))}))}return s>0},booleanPointOnLine:Fa,booleanEqual:function(t,e){return En(t).type===En(e).type&&new Zf({precision:6}).compare(No(t),No(e))},booleanWithin:Oa,booleanIntersects:$f,clone:Oi,cleanCoords:No,clustersDbscan:function(t,e,r){void 0===r&&(r={}),!0!==r.mutate&&(t=Oi(t)),r.minPoints=r.minPoints||3;var n=new op.DBSCAN,i=n.run(rn(t),jr(e,r.units),r.minPoints,Pi),o=-1;return i.forEach((function(e){o++,e.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster=o,r.properties.dbscan="core"}))})),n.noise.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster?r.properties.dbscan="edge":r.properties.dbscan="noise"})),t},clustersKmeans:function(t,e){void 0===e&&(e={});var r=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(r/2)),e.numberOfClusters>r&&(e.numberOfClusters=r),!0!==e.mutate&&(t=Oi(t));var n=rn(t),i=n.slice(0,e.numberOfClusters),o=dp(n,e.numberOfClusters,i),s={};return o.centroids.forEach((function(t,e){s[e]=t})),tn(t,(function(t,e){var r=o.idxs[e];t.properties.cluster=r,t.properties.centroid=s[r]})),t},pointToLineDistance:wa,booleanParallel:function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Ap(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Ap(e,"line2"))throw new Error("line2 must be a LineString");for(var r=Rs(No(t)).features,n=Rs(No(e)).features,i=0;i<r.length;i++){var o=r[i].geometry.coordinates;if(!n[i])break;if(!gp(o,n[i].geometry.coordinates))return!1}return!0},shortestPath:function(t,e,r){if(!qr(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,o=r.obstacles||Lr([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!Hr(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=An(t),a=An(e);switch(t=Cr(s),e=Cr(a),xn(o)){case"FeatureCollection":if(0===o.features.length)return Mr([s,a]);break;case"Polygon":o=Lr([xr(En(o))]);break;default:throw new Error("invalid obstacles")}var u=o;u.features.push(t),u.features.push(e);var l=gn(Ef(Yo(gn(u)),1.15));n||(n=Pi([l[0],l[1]],[l[2],l[1]],r)/100),u.features.pop(),u.features.pop();for(var h=l[0],c=l[1],f=l[2],p=l[3],d=n/Pi([h,c],[f,c],r)*(f-h),g=n/Pi([h,c],[h,p],r)*(p-c),A=f-h,y=p-c,v=Math.floor(A/d),m=Math.floor(y/g),_=(A-v*d)/2,I=[],E=[],x=[],w=[],C=1/0,b=1/0,S=p-(y-m*g)/2,B=0;S>=c;){for(var M=[],T=[],L=h+_,R=0;L<=f;){var N=Cr([L,S]),P=Ep(N,o);M.push(P?0:1),T.push(L+"|"+S);var D=Pi(N,t);!P&&D<C&&(C=D,x={x:R,y:B});var k=Pi(N,e);!P&&k<b&&(b=k,w={x:R,y:B}),L+=d,R++}E.push(M),I.push(T),S-=g,B++}var F=new mp(E,{diagonal:!0}),Q=F.grid[x.y][x.x],O=F.grid[w.y][w.x],U=vp.search(F,Q,O),G=[s];return U.forEach((function(t){var e=I[t.x][t.y].split("|");G.push([+e[0],+e[1]])})),G.push(a),No(Mr(G))},voronoi:function(t,e){if(!qr(e=e||{}))throw new Error("options is invalid");var r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return In(t,"Point","points"),Lr(function(){var t=wp,e=Cp,r=null;function n(n){return new od(n.map((function(r,i){var o=[Math.round(t(r,i,n)/rd)*rd,Math.round(e(r,i,n)/rd)*rd];return o.index=i,o.data=r,o})),r)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(e){return arguments.length?(t="function"==typeof e?e:xp(+e),n):t},n.y=function(t){return arguments.length?(e="function"==typeof t?t:xp(+t),n):e},n.extent=function(t){return arguments.length?(r=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},n.size=function(t){return arguments.length?(r=null==t?null:[[0,0],[+t[0],+t[1]]],n):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},n}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(sd))},ellipse:ad,centerMean:ld,centerMedian:function(t,e){if(void 0===e&&(e={}),!qr(e=e||{}))throw new Error("options is invalid");var r=e.counter||10;if(!Hr(r))throw new Error("counter must be a number");var n=e.weight,i=ld(t,{weight:e.weight}),o=Lr([]);tn(t,(function(t){var e;o.features.push(ts(t,{properties:{weight:null===(e=t.properties)||void 0===e?void 0:e[n]}}))}));var s={tolerance:e.tolerance,medianCandidates:[]};return hd(i.geometry.coordinates,[0,0],o,s,r)},standardDeviationalEllipse:function(t,e){if(!qr(e=e||{}))throw new Error("options is invalid");var r=e.steps||64,n=e.weight,i=e.properties||{};if(!Hr(r))throw new Error("steps must be a number");if(!qr(i))throw new Error("properties must be a number");var o=rn(t).length,s=ld(t,{weight:n}),a=0,u=0,l=0;tn(t,(function(t){var e=t.properties[n]||1,r=cd(yn(t),yn(s));a+=Math.pow(r.x,2)*e,u+=Math.pow(r.y,2)*e,l+=r.x*r.y*e}));var h=a-u,c=Math.sqrt(Math.pow(h,2)+4*Math.pow(l,2)),f=2*l,p=Math.atan((h+c)/f),d=180*p/Math.PI,g=0,A=0,y=0;tn(t,(function(t){var e=t.properties[n]||1,r=cd(yn(t),yn(s));g+=Math.pow(r.x*Math.cos(p)-r.y*Math.sin(p),2)*e,A+=Math.pow(r.x*Math.sin(p)+r.y*Math.cos(p),2)*e,y+=e}));var v=Math.sqrt(2*g/y),m=Math.sqrt(2*A/y),_=ad(s,v,m,{units:"degrees",angle:d,steps:r,properties:i}),I=Ni(t,Lr([_])),E={meanCenterCoordinates:yn(s),semiMajorAxis:v,semiMinorAxis:m,numberOfFeatures:o,angle:d,percentageWithinEllipse:100*rn(I).length/o};return _.properties.standardDeviationalEllipse=E,_},angle:function(t,e,r,n){if(void 0===n&&(n={}),!qr(n))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!r)throw new Error("endPoint is required");var i=t,o=e,s=r,a=Ur(!0!==n.mercator?Zo(i,o):sc(i,o)),u=Ur(!0!==n.mercator?Zo(s,o):sc(s,o)),l=Math.abs(a-u);return!0===n.explementary?360-l:l},polygonSmooth:function(t,e){var r=[],n=e.iterations||1;if(!t)throw new Error("inputPolys is required");return nn(t,(function(t,e,i){var o,s,a;switch(t.type){case"Polygon":o=[[]];for(var u=0;u<n;u++)a=[[]],s=t,u>0&&(s=Sr(o).geometry),fd(s,a),o=a.slice(0);r.push(Sr(o,i));break;case"MultiPolygon":o=[[[]]];for(var l=0;l<n;l++)a=[[[]]],s=t,l>0&&(s=Pr(o).geometry),pd(s,a),o=a.slice(0);r.push(Pr(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),Lr(r)},moranIndex:function(t,e){var r=e.inputField,n=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=gd(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:n}),a=[];tn(t,(function(t){var e=t.properties||{};a.push(e[r])}));for(var u=Ad(a),l=function(t){for(var e=Ad(t),r=0,n=0,i=t;n<i.length;n++){var o=i[n];r+=Math.pow(o-e,2)}return r/t.length}(a),h=0,c=0,f=0,p=0,d=s.length,g=0;g<d;g++){for(var A=0,y=0;y<d;y++)h+=s[g][y]*(a[g]-u)*(a[y]-u),c+=s[g][y],f+=Math.pow(s[g][y]+s[y][g],2),A+=s[g][y]+s[y][g];p+=Math.pow(A,2)}var v=h/c/l,m=-1/(d-1),_=(d*d*(f*=.5)-d*p+c*c*3)/((d-1)*(d+1)*(c*c))-m*m,I=Math.sqrt(_);return{expectedMoranIndex:m,moranIndex:v,stdNorm:I,zNorm:(v-m)/I}},distanceWeight:gd,bearingToAngle:Ur,convertDistance:jr,degrees2radians:zr,distanceToDegrees:Or,distanceToRadians:Qr,radians2degrees:Gr,radiansToDistance:Fr,difference:function(t,e){var r=En(t),n=En(e),i=t.properties||{},o=Bg.difference(r.coordinates,n.coordinates);return 0===o.length?null:1===o.length?Sr(o[0],i):Pr(o,i)},buffer:function(t,e,r){var n=(r=r||{}).units||"kilometers",i=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof r)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return nn(t,(function(t){var r=PE(t,e,n,i);r&&o.push(r)})),Lr(o);case"FeatureCollection":return tn(t,(function(t){var r=PE(t,e,n,i);r&&tn(r,(function(t){t&&o.push(t)}))})),Lr(o)}return PE(t,e,n,i)},union:function(t,e,r){void 0===r&&(r={});var n=En(t),i=En(e),o=Bg.union(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?Sr(o[0],r.properties):Pr(o,r.properties)},intersect:QE,dissolve:function(t,e){if(!qr(e=e||{}))throw new Error("options is invalid");var r=e.propertyName;In(t,"Polygon","dissolve");var n=[];if(!e.propertyName)return Ha(Pr(Bg.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};tn(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[r])||(i[t.properties[r]]=[]),i[t.properties[r]].push(t)}));for(var o=Object.keys(i),s=0;s<o.length;s++){var a=Pr(Bg.union.apply(null,i[o[s]].map((function(t){return t.geometry.coordinates}))));a.properties[r]=o[s],n.push(a)}return Ha(Lr(n))},hexGrid:OE,mask:function(t,e){var r,n,i=jE(e),o=null;return"FeatureCollection"===t.type?(n=2===(r=t).features.length?Bg.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):Bg.union.apply(Bg,r.features.map((function(t){return t.geometry.coordinates}))),o=zE(n)):o=zE(Bg.union(t.geometry.coordinates)),o.geometry.coordinates.forEach((function(t){i.geometry.coordinates.push(t[0])})),i},squareGrid:VE,triangleGrid:HE,interpolate:function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.gridType,i=r.property,o=r.weight;if(!t)throw new Error("points is required");if(In(t,"Point","input must contain Points"),!e)throw new Error("cellSize is required");if(void 0!==o&&"number"!=typeof o)throw new Error("weight must be a number");i=i||"elevation",n=n||"square",o=o||1;var s,a=gn(t);switch(n){case"point":case"points":s=ja(a,e,r);break;case"square":case"squares":s=VE(a,e,r);break;case"hex":case"hexes":s=OE(a,e,r);break;case"triangle":case"triangles":s=HE(a,e,r);break;default:throw new Error("invalid gridType")}var u=[];return tn(s,(function(e){var s=0,a=0;tn(t,(function(t){var u,l=Pi("point"===n?e:ts(e),t,r);if(void 0!==i&&(u=t.properties[i]),void 0===u&&(u=t.geometry.coordinates[2]),void 0===u)throw new Error("zValue is missing");0===l&&(s=u);var h=1/Math.pow(l,o);a+=h,s+=h*u}));var l=Oi(e);l.properties[i]=s/a,u.push(l)})),Lr(u)},toMercator:yd,toWgs84:vd,randomPosition:wd,randomPoint:Cd,randomPolygon:bd,randomLineString:Sd,getCluster:Ld,clusterEach:Rd,clusterReduce:Nd,createBins:Pd,applyFilter:Dd,propertiesContainsFilter:kd,filterProperties:Fd,earthRadius:mr,factors:_r,unitsFactors:Ir,areaFactors:Er,feature:xr,geometry:wr,point:Cr,points:br,polygon:Sr,polygons:Br,lineString:Mr,lineStrings:Tr,featureCollection:Lr,multiLineString:Rr,multiPoint:Nr,multiPolygon:Pr,geometryCollection:Dr,round:kr,radiansToLength:Fr,lengthToRadians:Qr,lengthToDegrees:Or,bearingToAzimuth:Ur,radiansToDegrees:Gr,degreesToRadians:zr,convertLength:jr,convertArea:Vr,isNumber:Hr,isObject:qr,validateBBox:Yr,validateId:Xr,getCoord:An,getCoords:yn,containsNumber:vn,geojsonType:mn,featureOf:_n,collectionOf:In,getGeom:En,getType:xn,coordAll:rn,coordEach:Jr,coordReduce:Kr,featureEach:tn,featureReduce:en,findPoint:pn,findSegment:fn,flattenEach:sn,flattenReduce:an,geomEach:nn,geomReduce:on,lineEach:hn,lineReduce:cn,propEach:Zr,propReduce:$r,segmentEach:un,segmentReduce:ln});function YE(t){for(var e,r,n,i=-1,o=0,s=0;s<t.length;++s){var a=t[s];if(a.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===e&&(e=a.array.constructor),e!==a.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===r&&(r=a.itemSize),r!==a.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===n&&(n=a.normalized),n!==a.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===i&&(i=a.gpuType),i!==a.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;o+=a.array.length}for(var u=new e(o),l=0,c=0;c<t.length;++c)u.set(t[c].array,l),l+=t[c].array.length;var f=new h(u,r,n);return void 0!==i&&(f.gpuType=i),f}function XE(t,e){if(e===c)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===f||e===p){var r=t.getIndex();if(null===r){var n=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var o=0;o<i.count;o++)n.push(o);t.setIndex(n),r=t.getIndex()}var s=r.count-2,a=[];if(e===f)for(var u=1;u<=s;u++)a.push(r.getX(0)),a.push(r.getX(u)),a.push(r.getX(u+1));else for(var l=0;l<s;l++)l%2==0?(a.push(r.getX(l)),a.push(r.getX(l+1)),a.push(r.getX(l+2))):(a.push(r.getX(l+2)),a.push(r.getX(l+1)),a.push(r.getX(l)));a.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var h=t.clone();return h.setIndex(a),h.clearGroups(),h}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}function WE(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return console.warn("THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries()."),function(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=null!==t[0].index,n=new Set(Object.keys(t[0].attributes)),i=new Set(Object.keys(t[0].morphAttributes)),o={},s={},a=t[0].morphTargetsRelative,u=new l,h=0,c=0;c<t.length;++c){var f=t[c],p=0;if(r!==(null!==f.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(var d in f.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;void 0===o[d]&&(o[d]=[]),o[d].push(f.attributes[d]),p++}if(p!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(var g in f.morphAttributes){if(!i.has(g))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+". .morphAttributes must be consistent throughout all geometries."),null;void 0===s[g]&&(s[g]=[]),s[g].push(f.morphAttributes[g])}if(e){var A=void 0;if(r)A=f.index.count;else{if(void 0===f.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+c+". The geometry must have either an index or a position attribute"),null;A=f.attributes.position.count}u.addGroup(h,A,c),h+=A}}if(r){for(var y=0,v=[],m=0;m<t.length;++m){for(var _=t[m].index,I=0;I<_.count;++I)v.push(_.getX(I)+y);y+=t[m].attributes.position.count}u.setIndex(v)}for(var E in o){var x=YE(o[E]);if(!x)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+E+" attribute."),null;u.setAttribute(E,x)}for(var w in s){var C=s[w][0].length;if(0===C)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[w]=[];for(var b=0;b<C;++b){for(var S=[],B=0;B<s[w].length;++B)S.push(s[w][B][b]);var M=YE(S);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+w+" morphAttribute."),null;u.morphAttributes[w].push(M)}}return u}(t,e)}var JE=Math.PI/180,KE=6378137;function ZE(){var t="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}));return"iep".concat(t,"layer")}function $E(t){return new Promise((function(e){return setTimeout(e,t)}))}function tx(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function ex(t,e){return 256*(t=u.MathUtils.clamp(Math.floor(t),0,255))+(e=u.MathUtils.clamp(Math.floor(e),0,255))}function rx(e){for(var r=1/0,n=1/0,i=-1/0,o=-1/0,s=0,a=e.length;s<a;s++){var u=e[s],l=u.coordinate,h=u.lnglat,c=u.lnglats,f=u.xy,p=u.xys,d=l||h||c||f||p||e[s],g=void 0,A=void 0;Array.isArray(d)?(g=d[0],A=d[1]):d instanceof t.Coordinate&&(g=d.x,A=d.y),r=Math.min(r,g),n=Math.min(n,A),i=Math.max(i,g),o=Math.max(o,A)}return new t.Coordinate((r+i)/2,(n+o)/2)}function nx(t,e,r,n){var i=t,o=e.getShell(),s=[];o.forEach((function(t){var e=r.coordinateToVector3(t).sub(i);s.push(e)}));for(var a=[],l=0,h=s.length;l<h;l++)if(l!==s.length-1){var c=new Float32Array(12),f=s[l],p=s[l+1];c[0]=f.x,c[1]=f.y,c[2]=n,c[6]=f.x,c[7]=f.y,c[8]=0,c[3]=p.x,c[4]=p.y,c[5]=n,c[9]=p.x,c[10]=p.y,c[11]=0;var d=new u.BufferGeometry;d.setAttribute("position",new u.BufferAttribute(c,3)),d.setIndex([0,2,1,2,3,1]),a.push(d)}var g=new Float32Array(12),A=s[s.length-1],y=s[0];g[0]=A.x,g[1]=A.y,g[2]=n,g[6]=A.x,g[7]=A.y,g[8]=0,g[3]=y.x,g[4]=y.y,g[5]=n,g[9]=y.x,g[10]=y.y,g[11]=0;var v=new u.BufferGeometry;v.setAttribute("position",new u.BufferAttribute(g,3)),v.setIndex([0,2,1,2,3,1]),a.push(v);var m=WE(a);return m.computeVertexNormals(),m}function ix(t){for(var e=t.length,r=0,n=0;n<e;n++){r+=t[n].position.count}return new Float32Array(3*r)}function ox(t){return t*JE}function sx(t,e){if(!t||!e)return 0;Array.isArray(t)||(t=t.toArray()),Array.isArray(e)||(e=e.toArray());var r=ox(t[1]),n=ox(e[1]),i=r-n,o=ox(t[0])-ox(e[0]);return r=2*Math.asin(Math.sqrt(Math.pow(Math.sin(i/2),2)+Math.cos(r)*Math.cos(n)*Math.pow(Math.sin(o/2),2))),r*=KE,Math.round(1e5*r)/1e5}function ax(t){for(var e=function(t){return t.getCoordinates().map((function(t){return t.toArray()}))}(t),r=0,n=0,i=e.length;n<i-1;n++)r+=sx(e[n],e[n+1]);return r}function ux(t,e,r){var n=t*(Math.PI/180),i=new u.Vector3(Math.sin(n)*e,Math.cos(n)*e,0);return i=i.applyMatrix4(r)}function lx(t,e,r,n,i){for(var o,s,a=[],l=i.map,h=i.coordinateToVector3([t,e],0),c=(new u.Matrix4).makeTranslation(h.x,h.y,0),f=i.distanceToVector3(r,r).x,p=0;p<=360;){var d=(s=void 0,s=0,(o=p)<=90?s=-o:o>90&&o<=180||o>180&&o<=270?s=180-o:o>270&&o<360&&(s=360-o),{rotation:s}),g=ux(p,f,c),A=l.pointAtResToCoord(g,l.getGLRes());a.push({coord:[A.x,A.y],rotation:d.rotation}),p+=n}return a}function hx(t,e,r,n,i){for(var o=i.map,s=i.coordinateToVector3([t,e],0),a=(new u.Matrix4).makeTranslation(s.x,s.y,0),l=i.distanceToVector3(r,r).x,h=[],c=0;c<=360;c++){var f=new u.Vector3(Math.sin(c*(Math.PI/180))*l,Math.cos(c*(Math.PI/180))*l,0);f=f.applyMatrix4(a);var p=o.pointAtResToCoord(f,o.getGLRes());h.push([p.x,p.y])}return{type:"FeatureCollection",name:"net",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:[{type:"Feature",properties:{Id:0,color:n.color||"#fff"},geometry:{type:"MultiPolygon",coordinates:[[h]]}}]}}function cx(t,e,r,n,i){var o=t.x*Math.cos(r)*n-t.y*Math.sin(r)*n,s=t.x*Math.sin(r)*n+t.y*Math.cos(r)*n,a=new u.Vector3(o,s,0);return a=a.applyMatrix4(e),i.pointAtResToCoord(a,i.getGLRes())}function fx(t,e,r,n,i,o,s){var a=Math.PI/180*90,l=Math.PI/180*-90,h=s.distanceToVector3(i,i).x,c=s.coordinateToVector3([t,e],0),f=(new u.Matrix4).makeTranslation(c.x,c.y,0),p=s.coordinateToVector3([r,n],0).sub(c).normalize(),d=cx(p,f,a,h,s.map),g=cx(p,f,l,h,s.map);return{type:"FeatureCollection",name:"net",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:[{type:"Feature",properties:{Id:0},geometry:{type:"MultiPolygon",coordinates:[[[[d.x,d.y],[g.x,g.y]]]]}}]}}function px(e,r){var n,i,o=[],s=[];return e instanceof t.Geometry?(e.getCoordinates().forEach((function(t){t[0].forEach((function(t){o.push([t.x,t.y])}))})),n=Sr([o])):n=e,r instanceof t.Geometry?(r.getCoordinates().forEach((function(t){t[0].forEach((function(t){s.push([t.x,t.y])}))})),i=Sr([s])):i=r,QE(n,i)}function dx(t,e){for(var r=0;r<t.geometry.coordinates[0].length;r++){var n=t.geometry.coordinates[0][r];if(n[0]===e[0]&&n[1]===e[1])return!0}return!1}function gx(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(n[0].toFixed(6)===e[0].toFixed(6)&&n[1].toFixed(6)===e[1].toFixed(6))return!0}return!1}function Ax(t,e,r,n){for(var i=0;i<t.geometry.coordinates[0].length;i++){var o=t.geometry.coordinates[0][i],s=gx(e,o),a=gx(r,o),u=gx(n,o);if(!1===s&&!1===a&&!1===u)return o}}function yx(e,r){for(var n=[],i=[],o=0;o<e.length-1;o++){var s=[],a=o+1,u=fx(e[o][0],e[o][1],e[a][0],e[a][1],50,0,r);s.push(u.features[0].geometry.coordinates[0][0][0]),s.push(u.features[0].geometry.coordinates[0][0][1]);var l=fx(e[a][0],e[a][1],e[o][0],e[o][1],50,0,r);s.push(l.features[0].geometry.coordinates[0][0][0]),s.push(l.features[0].geometry.coordinates[0][0][1]),s.push(u.features[0].geometry.coordinates[0][0][0]);var h={type:"FeatureCollection",features:[{type:"Feature",properties:{_draw_type:"line"},geometry:{type:"MultiPolygon",coordinates:[[s]]}}]};n.push(s);var c=new t.MultiPolygon(h.features[0].geometry.coordinates);i.push(c)}var f=[];f.push(n[0][0]),f.push(n[0][1]);for(var p=0;p<n.length-1;p++){var d=i[p],g=i[p+1],A=n[p],y=n[p+1],v=px(d,g);if(dx(v,0===p?A[2]:y[1])){var m=Ax(v,A,y,e);f.push(m)}else f.push(A[2]),f.push(y[1])}f.push(n[n.length-1][2]),f.push(n[n.length-1][3]);for(var _=n.length-1;_>0;_--){var I=i[_],E=i[_-1],x=n[_],w=n[_-1],C=px(I,E);if(dx(C,x[4])){var b=Ax(C,x,w,e);f.push(b)}else f.push(x[4]),f.push(w[3])}return f.push(n[0][0]),f}function vx(t,e,r,n){for(var i=Mr(t),o=[],s=[],a=0;a<e.length;a++)if(0!==a&&a!==e.length-1){var l=Ea(i,Cr(e[a]),{units:"miles"});o.push(l),s.push(n[l.properties.index].z)}for(var h=1,c=[],f=0;f<o.length;f++){var p=o[f].properties.index;c.push([h,p]),h=p+1}c.push([h,t.length-2]);var d=[],g=new u.Color(r[0].color);d.push(g.r,g.g,g.b);for(var A=0;A<c.length;A++)for(var y=r[A],v=r[A+1],m=c[A],_=parseInt((m[1]-m[0]+1)/2),I=0,E=m[0];E<=m[1];E++){var x=void 0;x=I<_?new u.Color(y.color):new u.Color(v.color),d.push(x.r,x.g,x.b),I+=1}var w=new u.Color(r[r.length-1].color);return d.push(w.r,w.g,w.b),{allColors:d,snapPoints:o,snapPointsH:s}}var mx={altitude:0,imageWidth:512,imageHeight:512,texture:null},_x=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n);var l=i=t.Util.extend({},mx,i),h=l.altitude;l.imageHeight,l.imageWidth,e instanceof t.Extent||(e=new t.Extent(e));var c=e,f=c.xmin,p=c.ymin,d=c.xmax,g=c.ymax,A=1/0,y=1/0,v=-1/0,m=-1/0;[[f,p],[f,g],[d,g],[d,p]].forEach((function(t){var e=s.coordinateToVector3(t),r=e.x,n=e.y;A=Math.min(r,A),y=Math.min(n,y),v=Math.max(r,v),m=Math.max(n,m)}));var _=Math.abs(v-A),I=Math.abs(m-y),E=new u.PlaneGeometry(_,I);(a=r.call(this))._initOptions(i),a._createMesh(E,o);var x=s.distanceToVector3(h,h).x,w=s.coordinateToVector3(e.getCenter(),x);return a.getObject3d().position.copy(w),a.parent=null,a.type="Image",a}return tr(n)}(),Ix=function(){function e(r,n,i,o,s,a){var l=this;Ze(this,e),this.threelayer=s,this.map=s.map,this.groupId=a,this.textureLoader=new u.TextureLoader;var h=r.split(","),c=n.split(","),f=parseFloat(h[0]),p=parseFloat(h[1]),d=parseFloat(c[0]),g=parseFloat(c[1]),A=o.maxZoom||11,y=o.renderOrder||0,v=o.opacity||1,m=o.minZoom||3,_=new t.Extent(f,p,d,g);this.xmin_g=f,this.ymin_g=p,this.xmax_g=d,this.ymax_g=g,this.cacheTextureFlag=o.cacheTextureFlag,this.cacheTexture={},this.textureLoader.load(i,(function(t){var e=new u.MeshBasicMaterial({map:t,transparent:!0,opacity:v}),r=new _x(_,{imageWidth:512,imageHeight:512,maxZoom:A,minZoom:m,interactive:void 0!==o.interactive&&o.interactive},e,l.threelayer);r.object3d.renderOrder=y,l.imgMesh=r,l.imgMesh.parent=l,l.m=e,l.texture=t,l.groupId?l.threelayer.addMesh1(l.imgMesh,l.groupId):l.threelayer.addMesh(l.imgMesh),o.opacityItems&&o.opacityItems.length>0&&!isNaN(o.opacityItems[0])&&!isNaN(o.opacityItems[1])&&o.opacityItems[0]>3&&o.opacityItems[0]<=18&&o.opacityItems[1]>=0&&o.opacityItems[1]<=1&&(l.opacityItems=o.opacityItems,l._bindMapEvents(),l._viewChange()),l.cacheTextureFlag&&void 0===l.cacheTexture[i]&&(l.cacheTexture[i]=t)}))}return tr(e,[{key:"_bindMapEvents",value:function(){this.map.on("viewchange",this._viewChange,this)}},{key:"_viewChange",value:function(){this.opacityItems[0]<=this.map.getZoom()?this.imgMesh.object3d.material.opacity=this.opacityItems[1]:this.imgMesh.object3d.material.opacity=1}},{key:"_closeEvent",value:function(){this.map.off("viewchange",this._viewChange,this)}},{key:"updateImage",value:function(e,r){var n=this;if(r&&r.leftbottom&&r.righttop){var i=parseFloat(r.leftbottom[0]),o=parseFloat(r.leftbottom[1]),s=parseFloat(r.righttop[0]),a=parseFloat(r.righttop[1]);if(i!==this.xmin_g||o!==this.ymin_g||s!==this.xmax_g||a!==this.ymax_g){var l=new t.Extent(i,o,s,a),h=1/0,c=1/0,f=-1/0,p=-1/0;[[i,o],[i,a],[s,a],[s,o]].forEach((function(t){var e=n.threelayer.coordinateToVector3(t),r=e.x,i=e.y;h=Math.min(r,h),c=Math.min(i,c),f=Math.max(r,f),p=Math.max(i,p)}));for(var d=Math.abs(f-h),g=Math.abs(p-c),A=new u.PlaneBufferGeometry(d,g),y=A.attributes.position.array,v=this.imgMesh.object3d.geometry.attributes.position.array,m=0;m<v.length;m++)v[m]=y[m];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var _=this.threelayer.coordinateToVector3(l.getCenter(),0);this.imgMesh.getObject3d().position.copy(_),A.dispose(),this.xmin_g=i,this.ymin_g=o,this.xmax_g=s,this.ymax_g=a}}this.cacheTextureFlag?void 0===this.cacheTexture[e]?this.textureLoader.load(e,(function(t){n.imgMesh.object3d.material.map=t,n.imgMesh.object3d.material.map.needsUpdate=!0,n.cacheTexture[e]=t})):(this.imgMesh.object3d.material.map=this.cacheTexture[e],this.imgMesh.object3d.material.map.needsUpdate=!0):this.textureLoader.load(e,(function(t){n.texture&&n.texture.dispose(),delete n.texture,n.imgMesh.object3d.material.map=t,n.imgMesh.object3d.material.map.needsUpdate=!0,n.texture=t})),!1===this.imgMesh.isAdd&&(this.threelayer?(this.groupId?this.threelayer.addMesh1(this.imgMesh,this.groupId):this.threelayer.addMesh(this.imgMesh),this.opacityItems&&this._bindMapEvents()):this.dispose())}},{key:"clearImage",value:function(){this.imgMesh&&(this.groupId?this.threelayer.removeMesh1(this.imgMesh,this.groupId):this.threelayer.removeMesh(this.imgMesh),this.opacityItems&&this._closeEvent())}},{key:"show",value:function(){this.imgMesh&&(this.threelayer.addMesh(this.imgMesh),this.opacityItems&&this._bindMapEvents())}},{key:"dispose",value:function(){var t;for(var e in this.imgMesh&&(!0===this.imgMesh.isAdd&&(this.groupId?this.threelayer.removeMesh1(this.imgMesh,this.groupId):this.threelayer.removeMesh(this.imgMesh)),this.imgMesh.object3d.geometry&&this.imgMesh.object3d.geometry.dispose(),this.imgMesh.object3d.material&&(this.imgMesh.object3d.material.dispose(),delete this.m)),this.cacheTexture)this.cacheTexture[e].dispose(),delete this.cacheTexture[e];null===(t=this.texture)||void 0===t||t.dispose(),this.texture=null,this.opacityItems&&(this._closeEvent(),delete this.opacityItems),this.threelayer=null,this.textureLoader&&delete this.textureLoader}}]),e}(),Ex={interactive:!1,altitude:0,imageWidth:512,imageHeight:512,texture:null},xx=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s,a){var l;Ze(this,n);var h=(o=t.Util.extend({},Ex,o)).altitude,c=a.distanceToVector3(i,i).x,f=new u.CircleGeometry(c,32);(l=r.call(this))._initOptions(o),l._createMesh(f,s);var p=a.distanceToVector3(h,h).x,d=a.coordinateToVector3(e,p);return l.getObject3d().position.copy(d),l.parent=null,l.type="radarObject",l}return tr(n)}(),wx=function(){function t(e,r,n,i,o,s){Ze(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s,this.imgUrl=n.imgUrl,this.loader=new u.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var a=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n const float PI = 3.14159265359;\n const float TWO_PI = 6.28318530718;\n const int N = 3;\n const float r0 = 0.01;\n const float r_blue = 0.025;\n const float r_red = 0.015;\n const float edge = 0.95;\n const float offset = 0.05;\n\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n float plot(const vec2 st, const float pct, const float width)\n {\n return smoothstep(pct - width, pct, st.y) -\n smoothstep(pct, pct + width, st.y);\n }\n float drawPolygon(const vec2 polygonCenter, const int N, const float radius, vec2 pos)\n {\n pos = pos - polygonCenter;\n float d = 0.0;\n float a = atan(pos.x, pos.y);\n float r = TWO_PI / float(N);\n d = cos(floor(0.5 + a / r)*r - a)*length(pos);\n return (1.0 - smoothstep(radius, radius + radius/10.0, d));\n }\n float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n {\n float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n }\n void main() {\n // Normalized pixel coordinates (from 0 to 1)\n vec2 uv = vUv;\n vec2 pos = uv.xy - vec2(0.5, 0.5) ; // center what being drawn\n vec4 grndSpd = vec4(0.0, time/5.0, 0.0, 0.0);\n vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.85, 0.0, 1.0);\n //vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.58, 1.0, 1.0);\n //vec3 color = vec3(0.0, 0.0, 0.0);\n vec3 color = vec3(0.0, 147. / 255., 1.0);\n float r = length(pos) * 2.0;\n float a = atan(pos.y, pos.x); // angle of pixel\n float an = PI - mod(time/ 1.0, TWO_PI); // angle of radar sweep\n float blipSpd = 3.0; // Blip / Trace speed\n vec2 translate1 = vec2(cos(time/ blipSpd), sin(time/ blipSpd));\n vec2 translate2 = vec2(sin(time/ blipSpd), cos(time/ blipSpd));\n vec2 left1 = translate1 * 0.35;\n vec2 right1 = -translate1 * 0.30;\n vec2 left2 = translate2 * 0.15;\n vec2 right2 = -translate2 * 0.25;\n // Radar Sweep\n float sn = step(PI/2.0, an) * step(-PI/2.0, (a + an)) * step(r, edge) * (1.0 - 0.55 * (a + (TWO_PI) - an));\n float sw = step(an, a) * step(r, edge);\n float s_blade = sw * (1.0 - (a - an) * 20.0);\n float s = sw * (1.0 - 0.55 * (a - an));\n s = max(sn,s);\n float se = step(r, edge - 0.05);\n // Center point\n float s1 = smoothstep(edge - 0.00, edge + 0.01, r)* smoothstep(edge + 0.02, edge + 0.01, r);\n // Circular concentric rings\n float s0 = 1.0 - smoothstep(r0 / 2.0, r0, length(pos));\n float smb = (1.0 - smoothstep(0.2, 0.2 + 0.01, length(pos))) * (1.0 - smoothstep(0.2 +0.01, 0.2, length(pos)));\n float smr = (1.0 - smoothstep(0.3, 0.3 + 0.01, length(pos))) * (1.0 - smoothstep(0.3 +0.01, 0.3, length(pos)));\n // Circular concentric gradations\n float gradNum = 120.0;\n float tickWidth = 0.9;\n const float tickLen = 0.04;\n float outRad = edge;\n float move = 0.0;\n float sm = 0.75*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n gradNum = 36.0;\n tickWidth = 0.95;\n outRad = 0.6;\n move = sin(time/10.0);\n smr += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n outRad = 0.4;\n move = cos(time/10.0);\n smb += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n // Radial spoke gradations\n float sr = plot(pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.x, 0.002) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.y, 0.003) * step(r, edge - 0.06);\n sr += plot(-pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr *= 0.75;\n // Blue circular radar blip traces\n vec2 st_trace1 = left2;\n float s_trace1 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1)));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+offset, +offset))));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+2.0 *offset, +2.0 *offset))));\n\n vec2 st_trace2 = right1;\n float s_trace2 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace2)));\n // Red Trianglular radar flight blip trace\n vec2 st_trace3 = left1;\n float st1 = s * (drawPolygon(st_trace3, N, r_red , pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(-offset, -offset), N, r_red, pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(+offset, -offset), N, r_red, pos));\n\n vec2 st_trace4 = right2;\n float st2 = s * (drawPolygon(st_trace4, N, r_red, pos)); \n // Lets add all the bits together and send them to screen\n float s_grn = max(s * mapcol.y, s_blade);\n s_grn = max(s_grn, (s0 + sr + sm));\n s_grn += s1 / 1.5 + smb + smr;\n\n float s_red = st1*2.0 + st2*2.0 + smr;\n \n float s_blue = max(s_trace1 + s_trace2, s_blade) + smb;\n\n if (s_trace1 > 0.0 || s_trace2 > 0.0) { s_blue = max(s, s_blue); s_grn = max(s_grn, s_blue); }\n\n color += vec3(s_red , s_grn, s_blue); \n vec4 texColor = mapcol * s;\n // Output to screen \n gl_FragColor = vec4(color, 0.5);//Set the screen pixel to that color\n }",side:u.DoubleSide,transparent:!0});this.radar=new xx(e,r,{},a,i),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return tr(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.radar,this.groupId):this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),Cx=function(){function t(e,r,n,i,o,s){Ze(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s,this.imgUrl=n.imgUrl,this.loader=new u.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var a=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n const float PI = 3.14159265359;\n const float TWO_PI = 6.28318530718;\n const int N = 3;\n const float r0 = 0.01;\n const float r_blue = 0.025;\n const float r_red = 0.015;\n const float edge = 0.95;\n const float offset = 0.05;\n\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n float plot(const vec2 st, const float pct, const float width)\n {\n return smoothstep(pct - width, pct, st.y) -\n smoothstep(pct, pct + width, st.y);\n }\n float drawPolygon(const vec2 polygonCenter, const int N, const float radius, vec2 pos)\n {\n pos = pos - polygonCenter;\n float d = 0.0;\n float a = atan(pos.x, pos.y);\n float r = TWO_PI / float(N);\n d = cos(floor(0.5 + a / r)*r - a)*length(pos);\n return (1.0 - smoothstep(radius, radius + radius/10.0, d));\n }\n float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n {\n float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n }\n void main() {\n // Normalized pixel coordinates (from 0 to 1)\n vec2 uv = vUv;\n vec2 pos = uv.xy - vec2(0.5, 0.5) ; // center what being drawn\n vec4 grndSpd = vec4(0.0, time/5.0, 0.0, 0.0);\n vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.85, 0.0, 1.0);\n //vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.58, 1.0, 1.0);\n vec3 color = vec3(0.0, 0.0, 0.0); //背景色 黑色\n float r = length(pos) * 2.0;\n float a = atan(pos.y, pos.x); // angle of pixel\n float an = PI - mod(time/ 1.0, TWO_PI); // angle of radar sweep\n float blipSpd = 3.0; // Blip / Trace speed\n vec2 translate1 = vec2(cos(time/ blipSpd), sin(time/ blipSpd));\n vec2 translate2 = vec2(sin(time/ blipSpd), cos(time/ blipSpd));\n vec2 left1 = translate1 * 0.35;\n vec2 right1 = -translate1 * 0.30;\n vec2 left2 = translate2 * 0.15;\n vec2 right2 = -translate2 * 0.25;\n // Radar Sweep 雷达扫描\n float sn = step(PI/2.0, an) * step(-PI/2.0, (a + an)) * step(r, edge) * (1.0 - 0.55 * (a + (TWO_PI) - an));\n float sw = step(an, a) * step(r, edge);\n float s_blade = sw * (1.0 - (a - an) * 20.0);\n float s = sw * (1.0 - 0.55 * (a - an));\n s = max(sn,s);\n float se = step(r, edge - 0.05);\n // Center point\n float s1 = smoothstep(edge - 0.00, edge + 0.01, r) * smoothstep(edge + 0.02, edge + 0.01, r);\n // Circular concentric rings 圆形同心环\n float s0 = 1.0 - smoothstep(r0 / 2.0, r0, length(pos));\n //float smb = (1.0 - smoothstep(0.2, 0.2 + 0.01, length(pos))) * (1.0 - smoothstep(0.2 +0.01, 0.2, length(pos)));\n //float smb = s1;\n //float smr = (1.0 - smoothstep(0.3, 0.3 + 0.01, length(pos))) * (1.0 - smoothstep(0.3 +0.01, 0.3, length(pos)));\n // Circular concentric gradations 圆形同心渐变\n float gradNum = 120.0;\n float tickWidth = 0.9;\n const float tickLen = 0.04;\n float outRad = edge;\n float move = 0.0;\n float sm = 0.75*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n gradNum = 36.0;\n tickWidth = 0.95;\n //move = sin(time/10.0);\n //smr += gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n move = cos(time/10.0);\n //smb += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n //smb += gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n float smb = gradations(a, 1., 0.75, 0.08, 0.75, r, time); //圆环\n float smr = gradations(a, gradNum, outRad, tickLen, tickWidth, r, time * 0.3);\n\n\n // Lets add all the bits together and send them to screen\n //float s_grn = max(s * mapcol.y, s_blade);\n //s_grn = max(s_grn, (s0 + sr + sm));\n //s_grn = max(s_grn, (s0 + sr + sm));\n //s_grn += s1 / 1.5 + smb + smr;\n //s_grn += s1 / 1.5 + smb;\n //s_grn += s1 + smb;\n float s_grn = s1 + smb + smr;\n \n\n \n //float s_blue = max(s_trace1 + s_trace2, s_blade) + smb;\n float s_blue = s1 + smb + smr;\n\n //color += vec3(s_red , s_grn, s_blue); \n //color += vec3(0., s_grn, s_blue); //去掉红色三角\n color += vec3(0., s_grn, s_blue); //去掉红色三角\n //vec4 texColor = mapcol * s;\n // Output to screen \n gl_FragColor = vec4(color, 0.5);//Set the screen pixel to that color\n }",side:u.DoubleSide,transparent:!0});this.radar=new xx(e,r,{},a,i),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return tr(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.radar,this.groupId):this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),bx=function(){function t(e,r,n,i,o,s){Ze(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s,this.imgUrl=n.imgUrl,this.loader=new u.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var a=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n #define\tPI 3.141592\n #define\tTAU 6.283185\n\n uniform float time;\n varying vec2 vUv;\n float remap(float s, float a1, float a2, float b1, float b2)\n {\n return b1 + (s-a1)*(b2-b1)/(a2-a1);\n }\n // out: 0->val->0\n float SmoothTri2(float t, float val)\n {\n return val * (1.0-(0.5+cos(t*TAU)*0.5));\n }\n // Ring\n float ring(vec2 uv, float rad, float thickness)\n {\n return abs(rad - length(uv)) - thickness;\n }\n // Ring Segment (start 0-1, len 0-1)\n float ringseg(vec2 uv, float rad, float thickness,float segstart, float seglen)\n {\n float d = ring(uv,rad,thickness);\n float rr = fract((atan(uv.x, uv.y)/TAU)+segstart);\n return seglen > rr ? d : 1.0;\n }\n // Ring Segment pattern\n float ringsegpat(vec2 uv, float rad, float thickness,float segstart, float seglen,float pat)\n {\n float rr = fract((atan(uv.x, uv.y)/TAU)+segstart);\n float v1 = remap(rr, 0.0, seglen, 0.0, pat);\n thickness *= sin(v1*PI);\t\t\t// example pattern 1\n //thickness *= SmoothTri2(v1,1.0);\t// example pattern 2\n thickness *= fract(v1);\t\t\t\t// example pattern 3\n float d = abs(rad - length(uv)) - thickness;\n return seglen > rr ? d : 1.0;\n }\n float ringsegpat1(vec2 uv, float rad, float thickness,float segstart, float seglen,float pat)\n {\n float rr = fract((atan(uv.x, uv.y)/TAU)+segstart);\n float v1 = remap(rr, 0.0, seglen, 0.0, pat);\n thickness *= sin(v1*PI);\t\t\t// example pattern 1\n //thickness *= SmoothTri2(v1,1.0);\t// example pattern 2\n thickness *= fract(v1);\t\t\t\t// example pattern 3\n float d = abs(rad - length(uv)) - thickness;\n return seglen > rr ? d : 1.0;\n }\n float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n {\n float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n }\n void main() {\n vec2 uv = 2.0 * vUv - vec2(1., 1.);\n // ring segments\n float s = fract(time*0.3);\n //float r1 = ringseg(uv,0.5,0.025,s,0.2);\n float r1 = ringseg(uv,0.75,0.025,-s,0.2);\n float r2 = ringseg(uv,0.4,0.025,-s,0.2);\n\n // whole ring\n //float r3 = ring(uv,0.6,0.025);\n float r3 = ring(uv, 0.95, 0.005);\n // pattern ring 花纹环\n float r4 = ringsegpat(uv,0.8,0.1,fract(time*0.1),1.0,16.0);\n // 刻度\n float a = atan(uv.y, uv.x); // angle of pixel\n float r = length(uv) * 2.0;\n float move = cos(time/10.0);\n //float r5 = gradations(a, 120., 0.98, 0.04, 0.95, r, move);\n float r5 = ringsegpat1(uv,0.8,0.1,fract(time*0.1), 1.0, 32.0);\n \n // combine\n //float d = min(r4,min(r3,min(r1,r2)));//这里是全部图形\n //float d = min(r1,r2); //这里是两条弧段\n //float d = min(r1, r3);\n float d = r5;\n float c = smoothstep(0.0,0.01,d);\n \n vec4 backgroundcol = vec4(0, 0, 0, 1.0); //把1.0调成0.0背景就透明了\n vec4 imagecol = vec4(1.0, 1.0, 1.0, 1.0); //这里是所有图形的颜色\n\n gl_FragColor = mix(imagecol,backgroundcol,c);\n }",side:u.DoubleSide,transparent:!0});this.radar=new xx(e,r,{},a,i),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return tr(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.radar,this.groupId):this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),Sx=function(){function t(e,r,n,i,o,s){Ze(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s,this.imgUrl=n.imgUrl,this.loader=new u.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var a=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform float time;\n varying vec2 vUv;\n \n //#define PI 3.14159265358979323846\n #define roundnes 0.035\n\n #define PI 3.14159265\n #define DEG2RAD ((PI * 2.0) / 360.0)\n\n /*vec2 rotate2D(vec2 _st, float _angle){\n _st -= 0.5;\n _st = mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n _st += 0.5;\n return _st;\n }\n\n vec2 tile(vec2 _st, float _zoom){\n _st *= _zoom;\n return fract(_st);\n }\n\n float _box(vec2 _st, vec2 _size, float _smoothEdges){\n _size = vec2(0.5)-_size*0.5;\n vec2 aa = vec2(_smoothEdges*0.5);\n vec2 uv = smoothstep(_size,_size+aa,_st);\n uv *= smoothstep(_size,_size+aa,vec2(1.0)-_st);\n return uv.x*uv.y;\n }*/\n float subtract(float a, float b)\n {\n return min(max(a, -b), -roundnes) + length(max(vec2(roundnes) + vec2(a, -b), vec2(0.0)));\n }\n float merge(float a, float b)\n {\n return max(min(a, b), roundnes) - length(max(vec2(roundnes) - vec2(a, b), vec2(0.0)));\n }\n mat2 rotate(float a)\n {\n float sa = sin(a), ca = cos(a);\n return mat2(ca, -sa, sa, ca);\n }\n float box(vec2 p, vec2 size)\n {\n vec2 d = abs(p) - size + roundnes;\n return min(max(d.x, d.y), 0.0) + length(max(d, 0.0)) - roundnes;\n }\n float pModPolar(inout vec2 p, float repetitions)\n {\n float angle = 2.*PI/repetitions;\n float a = atan(p.y, p.x) + angle/2.;\n float r = length(p);\n float c = floor(a/angle);\n a = mod(a,angle) - angle/2.;\n p = vec2(cos(a), sin(a))*r;\n // For an odd number of repetitions, fix cell index of the cell in -x direction\n // (cell index would be e.g. -5 and 5 in the two halves of the cell):\n if (abs(c) >= (repetitions/2.)) c = abs(c);\n return c;\n }\n float shapeDist(vec2 p)\n {\n float d1 = box(p+vec2(0.0,0.0), vec2(1.0, 1.0));\t\t// main box to subtract\n //vec2 p2 = p * rotate(time*0.25*PI);\n vec2 p2 = p * rotate(0.25*PI);\n float offset = pModPolar(p2,16.0);\n //vec2 p3 = (p2-vec2(0.45,0.0)) * rotate(time*0.8);\n vec2 p3 = (p2-vec2(0.45,0.0)) * rotate(0.8);\n pModPolar(p3,9.0); \n float d2 = box(p3-vec2(0.05,0.0), vec2(0.04, 0.02));\n \n //float d4 = box(p,vec2(0.1,0.1));\n //d2 = merge(d2,d4);\n\n float dist = subtract(d1,d2);\n return dist;\n }\n\n float maskSharp(vec2 p)\n {\n return clamp(shapeDist(p) * 100.0, 0.0, 1.0);\n }\n\n float maskBlurry(vec2 p)\n {\n return clamp((shapeDist(p ) + 0.003) * 75.0, 0.0, 1.0);\n }\n\n vec3 normalAt(vec2 p)\n {\n float ps = 1.0 / p.x;\n float x = maskBlurry(p - vec2( ps, 0.0)) - maskBlurry(p + vec2( ps, 0.0));\n float y = maskBlurry(p - vec2(0.0, ps)) - maskBlurry(p + vec2(0.0, ps));\n return normalize(vec3(x, y, 1.0));\n }\n \n void main() {\n \n vec2 uv = vUv;\n /*uv *= 1.1;\n float px = 0.9;\n \n float width = 0.015;\n float dist = 1.0;\n float centerdist = length(uv);\n \n float isRed = 1.0;\n // static background to emulate the effect of the shaders alpha output channel\n vec4 color = vec4(uv,mix(1.0-uv.x,0.0,uv.y),1.0);\n for (float i = 0.0; i <= 15.0; i += 1.0) {\n if (mod(i, 5.0) == 0.0) {\n dist = min(dist, rln(abs(uv), 1.0 - 10.0 * width, 1.0 - 2.0 * width, i / 60.0));\n // draw first bar red\n if (i == 0.0 && uv.y > 0.0) {\n isRed = dist;\n dist = smoothstep(width, max(width - 3.0 * px, 0.0), dist);\n color = mixer(color, vec4(1.0, 0.0, 0.0, dist));\n dist = 1.0;\n } else {\n dist = min(dist, rln(abs(uv), 1.0 - 10.0 * width, 1.0 - 7.0 * width, i / 60.0));\n }\n }\n dist = min(dist, abs(1.0-width-length(uv)));\n // draw clock shadow\n if (centerdist > 1.0)\n color = mixer(color, vec4(0.0,0.0,0.0, 0.3*smoothstep(1.0 + width*2.0, 1.0, centerdist)));\n\n // draw outline + minute bars in white\n color = mixer(color, vec4(0.0, 0.0, 0.0,\n (1.0 - pow(smoothstep(width, width + 0.02, min(isRed, dist)), 0.4))*0.2));\n color = mixer(color, vec4(vec3(1.0), smoothstep(width, max(width - 3.0 * px, 0.0), dist)));\n }\n\n\n gl_FragColor = color;*/\n\n /*\n vec3 color = vec3(0.0, 0.0, 0.0);\n uv *= 3.0; // Scale up the space by 3\n uv = fract(uv); // Wrap around 1.0\n color = vec3(uv, 0.0);\n gl_FragColor = vec4(color, 1.0);\n */\n \n /*\n vec3 color = vec3(0.0, 0.0, 0.0);\n // Divide the space in 4\n uv = tile(uv, 4.);\n // Use a matrix to rotate the space 45 degrees\n uv = rotate2D(uv, PI*0.25);\n // Draw a square\n color = vec3(box(uv, vec2(0.7),0.01));\n */\n \n /*vec3 color = vec3(0.0, 0.0, 0.0);\n // bottom-left\n vec2 bl = step(vec2(0.2),uv);//0.1变成0.2矩形会变小\n float pct = bl.x * bl.y;\n // top-right\n vec2 tr = step(vec2(0.2),1.0-uv);\n pct *= tr.x * tr.y;\n\n color = vec3(pct);\n\n gl_FragColor = vec4(color, 1.0);\n */\n vec2 p = uv - vec2(0.5, 0.5);\n //vec3 color = vec3(0.1,0.3,0.1);\n vec3 color = vec3(0.0, 0.0, 0.0);\n //float val = maskSharp(p);\n float shade = 0.0;\n //if (val>0.0)\n //{\n //float z = (0.5+sin(time*3.5))*0.1;\n //vec3 lightPos = vec3(0.0, 0.0, 0.2+z);\n //vec3 toLight = lightPos - vec3(p, 0.0);\n //vec3 normal = normalAt(p);\n //shade = 0.3 + maskSharp(p) * 0.7;\n shade = maskSharp(p);\n //float col = clamp(dot(normalize(toLight), normal), 0.0, 1.0) / length(toLight) * shade;\n float col = shade;\n //color = vec3(0.6,0.2,0.9)*col;\n color = vec3(1.0, 1.0, 1.0)*col;\n //}\n gl_FragColor = vec4(color, 1.0);\n }",side:u.DoubleSide,transparent:!0});this.radar=new xx(e,r,{},a,i),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return tr(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.radar,this.groupId):this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),Bx={radius:100,altitude:0,interactive:!1},Mx=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({},Bx,i,{layer:s,coordinate:e}),(a=r.call(this))._initOptions(i);var l=i,h=l.altitude,c=l.radius,f=s.distanceToVector3(c,c).x,p=i.thetaStart||0,d=i.thetaLength||90,g=new u.CircleGeometry(f,128,p*Math.PI/180,d*Math.PI/180);a._createMesh(g,o);var A=s.distanceToVector3(h,h).x,y=s.coordinateToVector3(e,A);return a.getObject3d().position.copy(y),a}return tr(n)}(),Tx=function(){function t(e,r,n,i,o){Ze(this,t),this.threeLayer=i,this.map=i.map,this.groupId=o;var s=n.thetaLength||90,a=n.rotation||0,l=s/2,h=void 0!==n.gradientFlag&&n.gradientFlag,c=n.color||"#FF0000",f=n.opacity||1,p=a-l;p=p<0?p+360:p,this._uniforms={color:{value:new u.Color(c)}},this.material=null,this.material=h?new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec2 vUv;\n uniform vec3 color;\n void main() {\n vec2 uv = vUv;\n //vec2 pos = uv.xy - vec2(0.5, 0.5);\n float distance1 = clamp(length(uv - vec2(0.5, 0.5)) * 2., 0., 0.9);\n //vec2 pos = uv.xy - vec2(0.5, 0.5) * 2.;\n //float distance = clamp(length(pos), 0., 0.9);\n float opacity = 1. - distance1 / 1.;\n //gl_FragColor = vec4(1.0, 0.0, 0.0, opacity);\n gl_FragColor = vec4(color, opacity);\n\n }",side:u.DoubleSide,transparent:!0}):new u.MeshBasicMaterial({color:c,side:u.DoubleSide,transparent:!0,opacity:f}),console.log(this.material),this.sector=new Mx(e,{thetaStart:p,thetaLength:n.thetaLength,radius:r},this.material,i),this.groupId?this.threeLayer.addMesh1(this.sector,this.groupId):this.threeLayer.addMesh(this.sector)}return tr(t,[{key:"hide",value:function(){this.sector.hide()}},{key:"show",value:function(){this.sector.show()}},{key:"dispose",value:function(){this.groupId?this.threeLayer.removeMesh1(this.sector,this.groupId):this.threeLayer.removeMesh(this.sector),this.sector.object3d.geometry&&this.sector.object3d.geometry.dispose(),this.sector.object3d.material&&this.sector.object3d.material.dispose()}}]),t}(),Lx={altitude:0,height:0},Rx=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),o=t.Util.extend({},Lx,o,{layer:s}),a=r.call(this);var l=o,h=l.width,c=l.height,f=l.altitude;a._initOptions(o);var p=new u.PlaneGeometry(h,c);p.computeBoundingBox();var d=new u.Mesh(p,i);a._createGroup(),a.getObject3d().add(d);var g=s.distanceToVector3(f,f).x,A=s.coordinateToVector3(e,g);return d.position.set(0,p.boundingBox.max.y,0),a.getObject3d().position.copy(A),a}return tr(n)}();function Nx(t,e,r,n,i,o){this.tilesHorizontal=e,this.tilesVertical=r,this.numberOfTiles=n,t.wrapS=t.wrapT=u.RepeatWrapping,t.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=i,this.currentDisplayTime=0,this.currentTile=0,this.flag=o,this.update=function(e){for(this.currentDisplayTime+=e;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var r=this.currentTile%this.tilesHorizontal;t.offset.x=r/this.tilesHorizontal;var n=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?t.offset.y=this.tilesVertical-n/this.tilesVertical:t.offset.y=1-n/this.tilesVertical-1/this.tilesVertical}}}var Px=function(){function t(e,r,n,i,o){var s=this;Ze(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o;var a=n.thetaLength||45;this.millsec=n.millsec||1e3,this.duration=n.duration||75,this.tilesHoriz=n.tilesHoriz||12,this.tilesVert=n.tilesVert||5,this.numTiles=n.numTiles||49;var l=n.rotation||0,h=a/2,c=i.distanceToVector3(r,r).x,f=Math.sin(h*Math.PI/180)*c*2,p=void 0===n.flag;this.imgUrl=n.imgUrl,this.textureLoader=new u.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){s.texture=t,s.annie=new Nx(t,s.tilesHoriz,s.tilesVert,s.numTiles,s.duration,p);var r=new u.MeshBasicMaterial({transparent:!0,map:t,side:u.DoubleSide,depthTest:!1});s.imgObj=new Rx(e,r,{width:f,height:c},i),s.imgObj.object3d.renderOrder=1,s.imgObj.object3d.rotation.z=l*Math.PI/180,s.threelayer.addMesh(s.imgObj),s.layerClass.updatables.push(s)}))}return tr(t,[{key:"tick",value:function(t){var e;null===(e=this.annie)||void 0===e||e.update(this.millsec*t)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.threelayer.removeMesh(this.imgObj),this.imgObj.object3d.geometry&&this.imgObj.object3d.geometry.dispose(),this.imgObj.object3d.material&&this.imgObj.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),Dx={radius:100,altitude:0},kx=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({},Dx,i,{layer:s}),a=r.call(this);var l=i,h=l.width;l.height;var c=l.altitude;a._initOptions(i);var f=new u.CircleGeometry(h,32);a._createMesh(f,o);var p=s.distanceToVector3(c,c).x,d=s.coordinateToVector3(e,p);return a.getObject3d().position.copy(d),a}return tr(n)}(),Fx=function(){function t(e,r,n,i){var o=this;Ze(this,t),this.threelayer=n,this.map=n.map,this.layerClass=i,this.time=0,n.coordinateToVector3(e,0),this.imgUrl=r.imgUrl,this.textureLoader=new u.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){o.texture=t,o._uniforms={impactPosition:{value:new u.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:o.texture}};var r=new u.ShaderMaterial({uniforms:o._uniforms,vertexShader:"\n varying vec3 vPosition;\n varying vec2 vUv;\n void main(){\n vUv = uv;\n vPosition = position;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n uniform vec3 impactPosition;\n uniform float impactMaxRadius;\n uniform float impactRatio;\n varying vec3 vPosition;\n varying vec2 vUv;\n void main() {\n float dist = distance(vPosition, impactPosition);\n float curRadius = impactMaxRadius * impactRatio;\n float sstep = smoothstep(0., curRadius, dist) - smoothstep(curRadius - ( 0.25 * impactRatio ), curRadius, dist);\n sstep = 1. - sstep * (1. - impactRatio);\n vec3 col = mix(vec3(1., 0.5, 0.0625), vec3(1., 0.25, 0.125), impactRatio);\n gl_FragColor = texture2D(map, vUv);\n gl_FragColor = vec4( mix( col, gl_FragColor.rgb, sstep), 1.0 );\n }",side:u.DoubleSide,transparent:!0,depthTest:!1}),i=new kx(e,{width:2,height:2},r,n);o.threelayer.addMesh(i),o.layerClass.updatables.push(o)}))}return tr(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),Qx=document.createElement("canvas"),Ox=function(){function e(){Ze(this,e),this.type="gisCommon"}var r;return tr(e,null,[{key:"getTexture",value:function(t,e,r,n){var i=t.getContext("2d");i.drawImage(e,r,n);var o=new u.Texture(i.getImageData(0,0,t.width,t.height));return o.minFilter=u.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"getTexture1",value:function(t,e,r,n,i){Qx.width=Qx.height=128;var o=Qx.getContext("2d");o.drawImage(t,e,r,n,i);var s=new u.Texture(o.getImageData(0,0,Qx.width,Qx.height));return s.minFilter=u.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s}},{key:"addImageProcessImage",value:function(t){return new Promise((function(e,r){var n=document.createElement("img");n&&!n.crossOrigin&&(n.crossOrigin="Anonymous"),n.onload=function(){return e(n)},n.onerror=r,n.setAttribute("src",t)}))}},{key:"addImageProcess",value:function(t){return new Promise((function(e,r){var n=document.createElement("img");n.onload=function(){return e(n)},n.onerror=r,n.setAttribute("src","data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(t))))}))}},{key:"containsCoordinate3",value:function(t,e,r){if(1e3*Pi({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.x,e.y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.radius){var n=r.coordinateToVector3([e.x,e.y],0),i=r.coordinateToVector3(t,0).sub(n).normalize(),o=r.distanceToVector3(e.radius,e.radius).x,s=new u.Vector3(n.x,n.y+o,0).sub(n).normalize(),a=((i.clone().cross(s).z<0?-1:1)*Math.acos(i.dot(s))*180/Math.PI).toFixed(2);(a=parseFloat(a))<0&&(a=a+180+180);var l=parseFloat(e.begin),h=parseFloat(e.end);if(l>h){if(a>=l||a<=h)return!0}else if(a>=l&&a<=h)return!0;return!1}return!1}},{key:"containsCoordinate1",value:function(t,e){return 1e3*Pi({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.getCenter().x,e.getCenter().y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.getRadius()}},{key:"containsCoordinate2",value:function(t,e){return Li({type:"Feature",geometry:{type:"Point",coordinates:t}},{type:"Feature",geometry:{type:"Polygon",coordinates:e.geometry.coordinates[0]}})}},{key:"containsCoordinate",value:function(e,r){var n,i;Array.isArray(e)?(n=e[0],i=e[1]):e instanceof t.Coordinate&&(n=e.x,i=e.y);var o=r.xmin,s=r.ymin,a=r.xmax,u=r.ymax;return o<=n&&n<=a&&s<=i&&i<=u}},{key:"isInLevels",value:function(t,e){for(var r=!1,n=0;n<t.rangeArr.length;n+=2){var i=1*t.rangeArr[n],o=1*t.rangeArr[n+1];if(e>i&&e<=o){r=!0;break}}return r}},{key:"getExtent",value:function(t){if(0!==t.length){var e=1/0,r=1/0,n=-1/0,i=-1/0;return 1===t.length?(e=1*t[0].longitude-.5,r=1*t[0].latitude-.5,n=1*t[0].longitude+.5,i=1*t[0].latitude+.5):t.length>1&&t.slice(0,1/0).map((function(t){var o=1*t.longitude,s=1*t.latitude;e=Math.min(e,o),r=Math.min(r,s),n=Math.max(n,o),i=Math.max(i,s)})),{minX:e,minY:r,maxX:n,maxY:i}}}},{key:"vector2Pixel",value:function(t,e,r){var n=t.project(r),i=e.width/2,o=e.height/2;return{x:Math.round(n.x*i+i),y:Math.round(-n.y*o+o)}}},{key:"generateTextureOne",value:function(t,e,r){Qx.width=e,Qx.height=r;var n=Qx.getContext("2d");n.drawImage(t,0,0,e,r);var i=new u.Texture(n.getImageData(0,0,Qx.width,Qx.height));return i.magFilter=u.LinearFilter,i.minFilter=u.LinearFilter,i.generateMipmaps=!1,i.needsUpdate=!0,i}},{key:"generateTexture",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Qx.width=Qx.height=s;for(var l=Qx.getContext("2d"),h=0,c=0,f=[],p=0;p<n;p++){for(var d=5*(p+1)+p*h,g=0;g<n;g++){var A=5*(g+1)+g*t[c].w;if("img"===t[c].type){var y=(t[c].w-t[c].iw)/2,v=(t[c].h-t[c].ih)/2;l.drawImage(t[c].src,A+y,d+v,t[c].iw,t[c].ih)}else if("txt"===t[c].type)l.fillStyle=t[c].color,"#fff"===t[c].color?(l.font="lighter "+t[c].size+"px Microsoft YaHei",l.fillText(t[c].src,A+t[c].offx,d+t[c].offy),l.strokeStyle=t[c].color,l.strokeText(t[c].src,A+t[c].offx,d+t[c].offy)):(l.font="normal "+t[c].size+"px Microsoft YaHei",l.fillText(t[c].src,A+t[c].offx,d+t[c].offy));else{var m=(t[c].w-t[c].iw)/2,_=(t[c].h-t[c].ih)/2,I=t[c].offx||0,E=t[c].offy||0;l.drawImage(t[c].src,A+m+I,d+_+E,t[c].iw,t[c].ih)}if(f.push({w:t[c].w,h:t[c].h,u:A/s,v:d/s}),h=Math.max(h,t[c].h),(c+=1)>=t.length)break}if(c>=t.length)break}var x=new u.Texture(l.getImageData(0,0,Qx.width,Qx.height));return x.minFilter=u.LinearFilter,x.generateMipmaps=!1,x.needsUpdate=!0,{xys:f,texture:x,textureSize:s}}},{key:"generateTextureNew",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Qx.width=Qx.height=s;for(var l=Qx.getContext("2d"),h=0,c=0,f=0,p=[],d=0;d<n;d++){for(var g=5*(d+1)+d*h,A=0;A<n;A++){var y=5*(A+1)+f;if("img"===t[c].type){var v=(t[c].w-t[c].iw)/2,m=(t[c].h-t[c].ih)/2;l.drawImage(t[c].src,y+v,g+m,t[c].iw,t[c].ih)}else if("txt"===t[c].type)l.fillStyle=t[c].color,"#fff"===t[c].color?(l.font="lighter "+t[c].size+"px Microsoft YaHei",l.fillText(t[c].src,y+t[c].offx,g+t[c].offy),l.strokeStyle=t[c].color,l.strokeText(t[c].src,y+t[c].offx,g+t[c].offy)):(l.font="normal "+t[c].size+"px Microsoft YaHei",l.fillText(t[c].src,y+t[c].offx,g+t[c].offy));else{var _=(t[c].w-t[c].iw)/2,I=(t[c].h-t[c].ih)/2,E=t[c].offx||0,x=t[c].offy||0;l.drawImage(t[c].src,y+_+E,g+I+x,t[c].iw,t[c].ih)}if(p.push({w:t[c].w,h:t[c].h,u:y/s,v:g/s}),h=Math.max(h,t[c].h),f+=t[c].w,(c+=1)>=t.length)break}if(c>=t.length)break}var w=new u.Texture(l.getImageData(0,0,Qx.width,Qx.height));return w.minFilter=u.LinearFilter,w.generateMipmaps=!1,w.needsUpdate=!0,{xys:p,texture:w,textureSize:s}}},{key:"generateGifTexture",value:(r=Ke(Xe().mark((function t(r,n,i){var o,s,a,l,h,c,f,p,d,g,A,y,v;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=Math.sqrt(r.length),s=parseInt(o),a=s,o>s&&(a+=1),(l=document.createElement("canvas")).width=s*n,l.height=a*i,h=l.getContext("2d"),c=0,f=0;case 10:if(!(f<o)){t.next=32;break}p=f*i,d=0,g=0;case 14:if(!(g<o)){t.next=27;break}return A=d,t.next=18,e.addImageProcessImage(r[c]);case 18:if(y=t.sent,h.drawImage(y,A,p,n,i),d+=n,!((c+=1)>=r.length)){t.next=24;break}return t.abrupt("break",27);case 24:g++,t.next=14;break;case 27:if(!(c>=r.length)){t.next=29;break}return t.abrupt("break",32);case 29:f++,t.next=10;break;case 32:return(v=new u.Texture(h.getImageData(0,0,l.width,l.height))).generateMipmaps=!1,v.needsUpdate=!0,t.abrupt("return",{texture:v,colNum:s,rowNum:a});case 36:case"end":return t.stop()}}),t)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"generateTextureOptimize",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Qx.width=Qx.height=s;for(var l=Qx.getContext("2d"),h=0,c=0,f={},p=0;p<n;p++){for(var d=5*(p+1)+p*h,g=0,A=0;A<n;A++){var y=5*(A+1)+g,v=(t[c].w-t[c].iw)/2,m=(t[c].h-t[c].ih)/2;if(l.drawImage(t[c].src,y+v,d+m,t[c].iw,t[c].ih),f[t[c].key]={w:t[c].w,h:t[c].h,u:y/s,v:d/s},h=Math.max(h,t[c].h),g+=t[c].w,(c+=1)>=t.length)break}if(c>=t.length)break}var _=new u.Texture(l.getImageData(0,0,Qx.width,Qx.height));return _.magFilter=u.LinearFilter,_.minFilter=u.LinearFilter,_.generateMipmaps=!1,_.premultiplyAlpha=!0,_.needsUpdate=!0,{xys:f,texture:_,textureSize:s}}},{key:"setPointEventStatus",value:function(t,e){t&&t.getMeshes().forEach((function(t){"Points"===t.type&&(t.options.interactive=e)}))}},{key:"createTextTexture",value:function(t,e){Qx.width=Qx.height=t;var r=Qx.width/2,n=Qx.height/2;if(e){var i=0;e.forEach((function(t){var e=Qx.getContext("2d");e.fillStyle=t.fontcolor,e.font="".concat(t.fontsize,"px Arial"),e.textAlign="center",e.textBaseline="middle",e.fillText(t.txt,r,n+i),i+=t.fontsize}))}var o=new u.Texture(Qx);return o.minFilter=u.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"createTextAndBgTexture",value:function(t,e,r,n){var i=document.createElement("canvas");i.width=t,i.height=e;var o=i.getContext("2d");o.drawImage(r,0,0,t,e);var s=i.width/2,a=i.height/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle="#FFF",o.font="".concat(n.fontsize,"px Arial"),o.fillText(n.txt,s,a);var l=new u.Texture(i);return l.magFilter=u.NearestFilter,l.minFilter=u.NearestFilter,l.needsUpdate=!0,l}},{key:"getIntColor",value:function(t){var e=parseInt(255*t.r);return e=((e=(e<<8)+parseInt(255*t.g))<<8)+parseInt(255*t.b)}},{key:"colorIntToRGB",value:function(t){var e=t>>16&255,r=t>>8&255,n=255&t;return new u.Color("rgb(".concat(e,",").concat(r,",").concat(n,")"))}},{key:"createSimpleShader",value:function(t,e,r){return t.uniforms.texture1={value:e},t.uniforms.size1={value:r},t.uniforms.flag={value:1},t.vertexShader="uniform float size1;\n attribute float imgflag;\n varying float vimgflag;\n attribute float visibility;\n varying float vVisible;\n "+t.vertexShader,t.vertexShader=t.vertexShader.replace("#include <project_vertex>","\n #include <project_vertex>\n vimgflag = imgflag;\n vVisible = visibility;\n ").replace("gl_PointSize = size;","\n gl_PointSize = size1;\n "),t.fragmentShader="\n uniform sampler2D texture1;\n varying float vimgflag;\n varying float vVisible;\n "+t.fragmentShader,t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( outgoingLight, diffuseColor.a );","\n\n vec2 pUv = gl_PointCoord;\n pUv.y = 1. - pUv.y;\n\n if(vimgflag < 1.0){\n vec4 texColor = texture2D( texture1, pUv );\n outgoingLight *= texColor.xyz;\n gl_FragColor = vec4( outgoingLight, texColor.a * diffuseColor.a );\n }\n\n if (vVisible < 0.5) discard;\n "),t}},{key:"calTextWidth",value:function(t,e){var r=(t.match(/[\u4e00-\u9fa5]/g)||"").length;return r*e+.5*(t.length-r)*e}}]),e}();function Ux(t,e,r,n,i,o,s,a,u,l){var h=t.split("\n"),c=[],f={positionedGlyphs:c,text:t,top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:l,lineCount:h.length};return function(t,e,r,n,i,o,s,a,u){var l=0,h=-17,c=0,f=t.positionedGlyphs,p="right"===o?1:"left"===o?0:.5,d=f.length;r.forEach((function(t){if(t.split("").forEach((function(t){var r=e[u],n=t.charCodeAt(0),i=r&&r[n];i&&(f.push({glyph:n,x:l,y:h+0,vertical:!1,scale:1,fontStack:u}),l+=i.metrics.advance+a)})),f.length!==d){var r=l-a;c=Math.max(r,c),function(t,e,r,n,i){if(i){var o=t[n],s=e[o.fontStack],a=s&&s[o.glyph];if(a)for(var u=a.metrics.advance*o.scale,l=(t[n].x+u)*i,h=r;h<=n;h++)t[h].x-=l}}(f,e,d,f.length-1,p)}l=0,h+=n}));var g=function(t){var e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}(i),A=g.horizontalAlign,y=g.verticalAlign;!function(t,e,r,n,i,o,s){for(var a=(e-r)*i,u=(-n*s+.5)*o,l=0;l<t.length;l++)t[l].x+=a,t[l].y+=u}(f,p,A,y,c,n,r.length);var v=h- -17;t.top+=-y*v,t.bottom=t.top+v,t.left+=-A*c,t.right=t.left+c}(f,e,h,i,o,s,0,a,r),!!c.length&&f}var Gx=zx;function zx(t,e){this.x=t,this.y=e}zx.prototype={clone:function(){return new zx(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},zx.convert=function(t){return t instanceof zx?t:Array.isArray(t)?new zx(t[0],t[1]):t};var jx={radius:40,altitude:0},Vx=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s,a,l,h,c){var f;Ze(this,n);var p=rx(e);f=r.call(this),i=t.Util.extend({center:p,layer:c},jx,i),f._initOptions(i);var d=f.getLayer().getPick();f._colorMap={},f._datas=e,f._childCount=h,f.hidePosition=i.hidePosition;var g=c.coordinateToVector3(p);f.glyphMap=a,f.glyphAtlas=l;for(var A=new u.InstancedBufferGeometry,y=new Uint16Array([0,1,2,2,3,0]),v=new Float32Array([0,1,-.5,-.5,1,1,.5,-.5,1,0,.5,.5,0,0,-.5,.5]),m=new u.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),_=new u.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),I=new u.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),E=new u.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),x=new u.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),w=new u.InstancedBufferAttribute(new Float32Array(3*f._childCount),3,!0),C=0,b=function(t){var r=e[t],n=r.texts,i=r.markers,o=d.getColor(),s=o.getHex();f._colorMap[s]=t,f._datas[t].colorIndex=s,i&&i.forEach((function(r){if(m.setXYZW(C,r.markerWidth,r.markerHeight,r.markerDx,r.markerDy),_.setXYZW(C,r.u,r.v,-16,16),r.markerColor){var n=ex(0,255);x.setXYZW(C,n,0,r.markerRotation,0);var i=new u.Color(r.markerColor);I.setXYZW(C,i.r,i.g,i.b,r.markerOpacity),E.setXYZW(C,r.w,r.h,0,0)}else{var s=ex(0,0);x.setXYZW(C,s,0,r.markerRotation,0);var a=new u.Color("#fff");I.setXYZW(C,a.r,a.g,a.b,r.markerOpacity),E.setXYZW(C,r.w,r.h,0,0)}w.setXYZ(C,o.r,o.g,o.b),r.markerIndex=C,C+=1,e[t].childNum+=1})),n&&n.forEach((function(r){var n=new u.Color(r.textColor),i=ex(255,0);f.buildTextBuffers("".concat(r.text),r.textAnchor,"center",r.textSpacing).forEach((function(s){if(m.setXYZW(C,r.textSize,0,r.textDx,r.textDy),_.setXYZW(C,s[0],s[1],s[2],s[3]),r.textHaloColor){I.setXYZW(C,n.r,n.g,n.b,r.textOpacity);var a=new u.Color(r.textHaloColor);E.setXYZW(C,a.r,a.g,a.b,r.textHaloOpacity);var l=r.textHaloRadius;x.setXYZW(C,i,l,r.textRotation,0)}else I.setXYZW(C,n.r,n.g,n.b,r.textOpacity),E.setXYZW(C,0,0,0,0),x.setXYZW(C,i,-1.9,r.textRotation,0);w.setXYZ(C,o.r,o.g,o.b),r.textIndex.push(C),C+=1,e[t].childNum+=1}))}))},S=0;S<e.length;S++)b(S);A.setIndex(new u.Uint16BufferAttribute(y,1)),A.setAttribute("uv_offset",new u.Float32BufferAttribute(v,4,!0)),A.setAttribute("size",m),A.setAttribute("uv_image",_),A.setAttribute("color",I),A.setAttribute("util",x),A.setAttribute("haloAndWH",E),A.setAttribute("pickingColor",w),f._createInstancedMesh(A,o,f._childCount),f.getObject3d().instanceMatrix.setUsage(u.DynamicDrawUsage),f.getObject3d().frustumCulled=!1;var B=new u.InstancedMesh(A,s,f._childCount);B.frustumCulled=!1,B.instanceMatrix.setUsage(u.DynamicDrawUsage);var M=d.getColor().getHex();B._colorIndex=M,f.setPickObject3d(B);var T=new u.Object3D;C=0,e.forEach((function(t,r){var n,i,o=c.coordinateToVector3(t.coordinate);o.sub(g),t.height?o.z=c.altitudeToVector3(t.height).x:o.z=0,null===(n=e[r].markers)||void 0===n||n.forEach((function(e){!1===t.visible||!1===e.markerVisible?T.position.set(f.hidePosition[0],f.hidePosition[1],f.hidePosition[2]):T.position.set(o.x,o.y,o.z),T.rotation.z=-t.rotation,T.updateMatrix(),f.getObject3d().setMatrixAt(C,T.matrix),B.setMatrixAt(C,T.matrix),C+=1})),null===(i=e[r].texts)||void 0===i||i.forEach((function(e){e.textIndex.forEach((function(){!1===t.visible||!1===e.textVisible?T.position.set(f.hidePosition[0],f.hidePosition[1],f.hidePosition[2]):T.position.set(o.x,o.y,o.z),T.rotation.z=-t.rotation,T.updateMatrix(),f.getObject3d().setMatrixAt(C,T.matrix),B.setMatrixAt(C,T.matrix),C+=1}))}))}));var L=c.altitudeToVector3(i.altitude,i.altitude).x;return g.z=L,f.getObject3d().position.copy(g),B.position.copy(f.getObject3d().position),f.parent=null,f.pickMesh=B,f.threeLayer=c,f.center=g,f._init(),f}return tr(n,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}},{key:"getColorVector2",value:function(t,e){var r,n=new u.Color(t).getHexString(),i=(r="#".concat(n),{r:parseInt(r.slice(1,3),16),g:parseInt(r.slice(3,5),16),b:parseInt(r.slice(5,7),16)}),o=i.b;return[ex(i.r,i.g),ex(o,void 0!==e?e:255)]}},{key:"buildTextBuffers",value:function(t,e,r,n){var i=[],o=[0,0],s=Ux(t,this.glyphMap,"sans-serif",0,24,e,r,n,o,1);if(s){var a=function(t,e,r,n){for(var i=t.positionedGlyphs,o=[],s=0;s<i.length;s++){var a=i[s],u=n[a.fontStack],l=u&&u[a.glyph];if(l){var h=l.rect;if(h){var c=l.metrics.advance*a.scale/2,f=r?[a.x+c,a.y]:[0,0],p=r?[0,0]:[a.x+c+e[0],a.y+e[1]],d=(l.metrics.left-4)*a.scale-c+p[0],g=(-l.metrics.top-4)*a.scale+p[1],A=d+h.w*a.scale,y=g+h.h*a.scale,v=new Gx(d,g),m=new Gx(A,g),_=new Gx(d,y),I=new Gx(A,y);o.push({tl:v,tr:m,bl:_,br:I,tex:h,writingMode:t.writingMode,glyphOffset:f})}}}return o}(s,o,!1,this.glyphAtlas.positions);a.forEach((function(t){i.push([t.tex.x,t.tex.y+t.tex.h,t.bl.x,t.bl.y])}))}return i}},{key:"changeVisible",value:function(){var t=this,e=new u.Object3D;this._datas.forEach((function(r,n){var i=t.threeLayer.coordinateToVector3(r.coordinate);i.sub(t.center),r.height?i.z=t.threeLayer.altitudeToVector3(r.height).x:i.z=0,r.markers&&r.markers.forEach((function(n){!1===r.visible||!1===n.markerVisible?e.position.set(t.hidePosition[0],t.hidePosition[1],t.hidePosition[2]):e.position.set(i.x,i.y,i.z),e.rotation.z=-r.rotation,e.updateMatrix(),t.getObject3d().setMatrixAt(n.markerIndex,e.matrix),t.pickMesh.setMatrixAt(n.markerIndex,e.matrix)})),r.texts&&r.texts.forEach((function(n){n.textIndex.forEach((function(o){!1===r.visible||!1===n.textVisible?e.position.set(t.hidePosition[0],t.hidePosition[1],t.hidePosition[2]):e.position.set(i.x,i.y,i.z),e.rotation.z=-r.rotation,e.updateMatrix(),t.getObject3d().setMatrixAt(o,e.matrix),t.pickMesh.setMatrixAt(o,e.matrix)}))}))})),this.getObject3d().instanceMatrix.needsUpdate=!0,this.pickMesh.instanceMatrix.needsUpdate=!0}},{key:"changePickVisible",value:function(t){var e=this,r=new u.Object3D;this._datas.forEach((function(n,i){var o=e.threeLayer.coordinateToVector3(n.coordinate);o.sub(e.center),n.height?o.z=e.threeLayer.altitudeToVector3(n.height).x:o.z=0,n.markers&&n.markers.forEach((function(i){!1===t?r.position.set(e.hidePosition[0],e.hidePosition[1],e.hidePosition[2]):r.position.set(o.x,o.y,o.z),r.rotation.z=-n.rotation,r.updateMatrix(),e.pickMesh.setMatrixAt(i.markerIndex,r.matrix)})),n.texts&&n.texts.forEach((function(i){i.textIndex.forEach((function(i){!1===t?r.position.set(e.hidePosition[0],e.hidePosition[1],e.hidePosition[2]):r.position.set(o.x,o.y,o.z),r.rotation.z=-n.rotation,r.updateMatrix(),e.pickMesh.setMatrixAt(i,r.matrix)}))}))})),this.pickMesh.instanceMatrix.needsUpdate=!0}}]),n}(),Hx=function(){function t(e,r){Ze(this,t),this.createImage(e,1,r)}return tr(t,[{key:"createImage",value:function(t,e,r){var n=t.width,i=t.height;if(r){if(r.length!==n*i*e)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*i*e);this.width=n,this.height=i,this.data=r}},{key:"resize",value:function(){}}],[{key:"copy",value:function(t,e,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var s=t.data,a=e.data,u=0;u<i.height;u++)for(var l=((r.y+u)*t.width+r.x)*o,h=((n.y+u)*e.width+n.x)*o,c=0;c<i.width*o;c++)a[h+c]=s[l+c];return e}}]),t}();var qx=tr((function t(e){Ze(this,t);var r={},n=[];for(var i in e){var o=e[i],s=r[i]={};for(var a in o){var u=o[+a];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var l={x:0,y:0,w:u.bitmap.width+2,h:u.bitmap.height+2};n.push(l),s[a]={rect:l,metrics:u.metrics}}}}var h=function(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,o=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,o=Math.max(o,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:o,fill:e/(i*o)||0}}(n),c=h.w,f=h.h,p=new Hx({width:c||1,height:f||1});for(var d in e){var g=e[d];for(var A in g){var y=g[+A];if(y&&0!==y.bitmap.width&&0!==y.bitmap.height){var v=r[d][A].rect;Hx.copy(y.bitmap,p,{x:0,y:0},{x:v.x+1,y:v.y+1},y.bitmap)}}}this.image=p,this.positions=r})),Yx={exports:{}};Yx.exports=Wx,Yx.exports.default=Wx;var Xx=1e20;function Wx(t,e,r,n,i,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var s=this.size=this.fontSize+2*this.buffer,a=s+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=s,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a),this.useMetrics=void 0!==this.ctx.measureText("A").actualBoundingBoxLeft,this.middle=Math.round(s/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function Jx(t,e,r,n,i,o){for(var s=0;s<e;s++)Kx(t,s,e,r,n,i,o);for(var a=0;a<r;a++)Kx(t,a*e,1,e,n,i,o)}function Kx(t,e,r,n,i,o,s){var a,u,l,h;for(o[0]=0,s[0]=-Xx,s[1]=Xx,a=0;a<n;a++)i[a]=t[e+a*r];for(a=1,u=0,l=0;a<n;a++){do{h=o[u],l=(i[a]-i[h]+a*a-h*h)/(a-h)/2}while(l<=s[u]&&--u>-1);o[++u]=a,s[u]=l,s[u+1]=Xx}for(a=0,u=0;a<n;a++){for(;s[u+1]<a;)u++;h=o[u],t[e+a*r]=i[h]+(a-h)*(a-h)}}Wx.prototype._draw=function(t,e){var r,n,i,o,s,a,u,l,h,c=this.ctx.measureText(t),f=c.width,p=2*this.buffer;e&&this.useMetrics?(s=Math.floor(c.actualBoundingBoxAscent),l=this.buffer+Math.ceil(c.actualBoundingBoxAscent),a=this.buffer,u=this.buffer,r=(n=Math.min(this.size,Math.ceil(c.actualBoundingBoxRight-c.actualBoundingBoxLeft)))+p,i=(o=Math.min(this.size-a,Math.ceil(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent)))+p,this.ctx.textBaseline="alphabetic"):(r=n=this.size,i=o=this.size,s=19*this.fontSize/24,a=u=0,l=this.middle,this.ctx.textBaseline="middle"),n&&o&&(this.ctx.clearRect(u,a,n,o),this.ctx.fillText(t,this.buffer,l),h=this.ctx.getImageData(u,a,n,o));var d=new Uint8ClampedArray(r*i);return function(t,e,r,n,i,o,s){o.fill(Xx,0,e*r),s.fill(0,0,e*r);for(var a=(e-n)/2,u=0;u<i;u++)for(var l=0;l<n;l++){var h=(u+a)*e+l+a,c=t.data[4*(u*n+l)+3]/255;if(1===c)o[h]=0,s[h]=Xx;else if(0===c)o[h]=Xx,s[h]=0;else{var f=Math.max(0,.5-c),p=Math.max(0,c-.5);o[h]=f*f,s[h]=p*p}}}(h,r,i,n,o,this.gridOuter,this.gridInner),Jx(this.gridOuter,r,i,this.f,this.v,this.z),Jx(this.gridInner,r,i,this.f,this.v,this.z),function(t,e,r,n,i,o,s){for(var a=0;a<e*r;a++){var u=Math.sqrt(n[a])-Math.sqrt(i[a]);t[a]=Math.round(255-255*(u/o+s))}}(d,r,i,this.gridOuter,this.gridInner,this.radius,this.cutoff),{data:d,metrics:{width:n,height:o,sdfWidth:r,sdfHeight:i,top:s,left:0,advance:f}}},Wx.prototype.draw=function(t){return this._draw(t,!1).data},Wx.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var Zx=Yx.exports,$x={},tw={};var ew=function(){function e(t,r,n,i){var o=this;Ze(this,e);var s=r.pointMinZoom,a=r.pointOrder;if(0!=t.length){var u=[];this.charArray="",this.imgDict={},this.threeLayer=n,this.map=n.map,this.interactive=void 0===r.interactive||r.interactive,this.beginSizeZoom=r.beginSizeZoom||3,this.endSizeZoom=r.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.altitude=r.altitude||0,this.groupId=i,"EPSG:4326"===this.map.getSpatialReference().getProjection().code?this.tileResolution=.0006866455078125:this.tileResolution=76.43702828517625,this.textMinZoom=r.textMinZoom||0,this.textMaxZoom=r.textMaxZoom||30,this.textMinMaxZooms=r.textMinMaxZooms,this.hasAlign=r.hasAlign||!1,this.childCount=0,t.slice(0,1/0).map((function(t){1*t.longitude>70&&1*t.longitude<138&&1*t.latitude>0&&1*t.latitude<56&&o._bindDataItem(u,t)})),this.textures=null,this.glyphMap=null,this.glyphAtlas=null,this.dataItems=u,this.point=null,this.shader=null,this.minZoom=s||8,this.maxZoom=r.pointMaxZoom||20,this.order=a||0,this.isToolTip=r.isToolTip||!1,this.clickFunc=r.clickFunc||null,this.cFunc=r.cFunc||null,this.mouseMoveFunc=r.mouseMoveFunc||null,this.mouseOutFunc=r.mouseOutFunc||null,this.mMoveFunc=r.mMoveFunc||null,this.hasAlign=r.hasAlign||!1,this.zoomChangeCallback=r.zoomChangeCallback,this.hidePosition=r.hidePosition||[-999,-999,0]}else console.error("需要绘制的点位数量为0")}var r,n,i,o,s,a,l;return tr(e,[{key:"_putImgToDict",value:function(t,e,r){void 0===this.imgDict[t]?this.imgDict[t]={imgSrc:t,width:e,height:r}:(this.imgDict[t].width=(this.imgDict[t].width+e)/2,this.imgDict[t].height=(this.imgDict[t].height+r)/2)}},{key:"_bindDataItem",value:function(t,e){var r=(parseFloat(e.rotation)||0)+.01,n=parseFloat(r*(Math.PI/180)),i={coordinate:[parseFloat(e.longitude),parseFloat(e.latitude)],height:void 0!==e.height?parseFloat(e.height):0,visible:void 0===e.visible||e.visible,code:e.code,status:void 0!==e.status?e.status:1,name:e.name,rotation:n,childNum:0,data:e.data},o=e.texts;if(o){i.texts=[];for(var s=0,a=0;a<o.length;a++){var u=o[a];if(u.text&&u.text.length>0){s+=u.text.length,this.charArray=tx(this.charArray,u.text);var l=(parseFloat(u.textRotation)||0)+.01,h=parseFloat(l*(Math.PI/180)),c={text:u.text,textSize:u.textSize||14,textDx:u.textDx||0,textDy:u.textDy||0,textColor:u.textColor||"#fff",textAnchor:u.textAnchor||"center",textSpacing:u.textSpacing||2,textOpacity:u.textOpacity||1,textVisible:void 0===u.textVisible||u.textVisible,textRotation:h,textIndex:[]};u.textHaloColor&&(c=Object.assign(c,{textHaloColor:u.textHaloColor,textHaloRadius:u.textHaloRadius||1,textHaloOpacity:void 0!==u.textHaloOpacity?u.textHaloOpacity:1})),i.texts.push(c)}}this.childCount+=s}var f=e.markers;if(f){i.markers=[];for(var p=0,d=0;d<f.length;d++){var g=f[d];if(g.imgSrc){p+=1,this._putImgToDict(g.imgSrc,g.markerWidth||40,g.markerHeight||40);var A=(parseFloat(g.markerRotation)||0)+.01,y=parseFloat(A*(Math.PI/180));i.markers.push({markerWidth:1*g.markerWidth||40,markerHeight:1*g.markerHeight||40,markerDx:1*g.markerDx||0,markerDy:1*g.markerDy||0,markerColor:g.markerColor,markerOpacity:1*g.markerOpacity||1,key:g.imgSrc,markerIndex:-1,markerVisible:void 0===g.markerVisible||g.markerVisible,markerRotation:y})}}this.childCount+=p}t.push(i)}},{key:"_loadTexture",value:(l=Ke(Xe().mark((function t(){var e,r,n,i,o;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],t.t0=Xe().keys(this.imgDict);case 2:if((t.t1=t.t0()).done){t.next=18;break}if(r=t.t1.value,n=r,!r.includes(".svg")){t.next=12;break}return t.next=8,fetch(r);case 8:return i=t.sent,t.next=11,i.text();case 11:n=t.sent;case 12:return t.next=14,Ox.addImageProcess(n);case 14:o=t.sent,e.push({key:r,src:o,w:this.imgDict[r].width,h:this.imgDict[r].height,iw:this.imgDict[r].width,ih:this.imgDict[r].height}),t.next=2;break;case 18:return t.abrupt("return",Ox.generateTextureOptimize(e));case 19:case"end":return t.stop()}}),t,this)}))),function(){return l.apply(this,arguments)})},{key:"initGlyphAtlas",value:function(){var t=this.charArray.split("").map((function(t){return function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,n=function(t){var e=t.trim().substring(0,t.lastIndexOf(" ")),r="400";return/bold/i.test(t)?r="900":/medium/i.test(t)?r="500":/light/i.test(t)&&(r="200"),{fontFamily:e,fontWeight:r}}(e),i=n.fontFamily,o=n.fontWeight,s=r.charCodeAt(0),a=$x[e];return a||(a=$x[e]=new Zx(24,3,8,.25,i,o)),tw[e]||(tw[e]={}),tw[e][r]||(tw[e][r]=a.ctx.measureText(r).width),{id:s,bitmap:new Hx({width:30,height:30},a.draw(r)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=s,t>=19968&&t<=40959?24:tw[e][r])}}}("",t)})).reduce((function(t,e){return t[e.id]=e,t}),{});this.glyphMap||(this.glyphMap={}),this.glyphMap["sans-serif"]=t,this.glyphAtlas=new qx(this.glyphMap)}},{key:"addPoint",value:(a=Ke(Xe().mark((function t(){var e,r,n,i,o,s,a,l=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.dataItems){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this._loadTexture();case 4:return e=t.sent,this.textures||(this.textures=[]),this.textures.push(e.texture),this.initGlyphAtlas(),r=this.glyphAtlas.image,n=r.width,i=r.height,o=r.data,(s=new u.DataTexture(o,n,i)).needsUpdate=!0,s.magFilter=u.LinearFilter,s.minFilter=u.LinearFilter,s.format=u.RedFormat,this.textures.push(s),this.m=this._getRawShaderMaterial(e,s,n,i),this.m.depthTest=!1,this.hasAlign&&(this.m.vertexShader="#define HAS_ALIGN\n"+this.m.vertexShader),this.m_pick=this._getRawShaderMaterial(e,s,n,i),this.hasAlign&&(this.m_pick.vertexShader="#define HAS_ALIGN\n"+this.m_pick.vertexShader),this.m_pick.vertexShader="#define PICKING\n"+this.m_pick.vertexShader,this.m_pick.fragmentShader="#define PICKING\n"+this.m_pick.fragmentShader,this.dataItems.forEach((function(t){t.markers&&t.markers.forEach((function(t){t=Object.assign(t,e.xys[t.key])}))})),(a=new Vx(this.dataItems,{minZoom:this.minZoom,maxZoom:this.maxZoom,interactive:this.interactive,altitude:this.altitude,hidePosition:this.hidePosition},this.m,this.m_pick,this.glyphMap,this.glyphAtlas,this.childCount,this.threeLayer)).zoomChange=function(){l.m.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m.uniforms.zoomScale.value=l.tileResolution/l.map.getResolution(),l.m_pick.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m_pick.uniforms.zoomScale.value=l.tileResolution/l.map.getResolution();for(var t=l._getRate(),e=l.point.object3d.geometry.attributes.size.array,r=0,n=0;n<l.dataItems.length;n++){var i=l.dataItems[n];if(i.markers)for(var o=0;o<i.markers.length;o++)e[4*r+0]=i.markers[o].markerWidth*t,e[4*r+1]=i.markers[o].markerHeight*t,e[4*r+2]=i.markers[o].markerDx*t,e[4*r+3]=i.markers[o].markerDy*t,r+=1;if(i.texts)for(var s=function(){var n=i.texts[a].textSize,o=i.texts[a].textDx,s=i.texts[a].textDy;i.texts[a].textIndex.forEach((function(){e[4*r+0]=n*t,e[4*r+1]=0,e[4*r+2]=o*t,e[4*r+3]=s*t,r+=1}))},a=0;a<i.texts.length;a++)s()}l.point.object3d.geometry.attributes.size.needsUpdate=!0,l.zoomChangeCallback&&l.zoomChangeCallback()},a.object3d.renderOrder=this.order,a.pickMesh.renderOrder=this.order,this.point=a,this.point.parent=this,this.groupId?this.threeLayer.addMesh1(this.point,this.groupId):this.threeLayer.addMesh(this.point),this._bindMapEvents(),t.abrupt("return",this);case 32:case"end":return t.stop()}}),t,this)}))),function(){return a.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(t,e,r,n){return new u.RawShaderMaterial({uniforms:{imgTexture:{type:"t",value:t.texture},imgTextureSize:{type:"f",value:t.textureSize},sdfTexture:{type:"t",value:e},sdfTextureSize:{value:[r,n]},canvasSize:{value:[this.map.width,this.map.height]},cameraToCenterDistance:{type:"f",value:this.map.cameraToCenterDistance},zoomScale:{type:"f",value:this.tileResolution/this.map.getResolution()},mapPitch:{value:this.map.getPitch()*Math.PI/180},mapRotation:{value:this.map.getBearing()*Math.PI/180},gammaScale:{value:1}},vertexShader:"\n precision mediump float;\n\n uniform mat4 modelViewMatrix;\n uniform mat4 projectionMatrix;\n\n uniform vec2 canvasSize;\n uniform float cameraToCenterDistance;\n uniform float zoomScale;\n uniform float mapPitch;\n uniform float mapRotation;\n uniform vec2 sdfTextureSize;\n uniform float imgTextureSize;\n\n attribute mat4 instanceMatrix;\n attribute vec4 size;\n attribute vec4 uv_offset;\n attribute vec4 uv_image;\n attribute vec4 util;\n varying vec4 vColor;\n\n #ifdef PICKING\n attribute vec3 pickingColor;\n #else\n varying vec2 vUv;\n varying float vGammaScale;\n varying float vSize;\n varying vec4 vUtil;\n varying vec4 vHaloAndWH;\n attribute vec4 color;\n attribute vec4 haloAndWH;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n void main()\n {\n #ifdef PICKING\n vColor = vec4(pickingColor, 1.);\n #else\n vColor = color;\n vHaloAndWH = haloAndWH;\n vUtil = util;\n #endif\n vec2 utils1 = unpack_float(util.x) / 255.0;\n vec2 wh1 = uv_offset.zw * 32.;\n vec2 offset = vec2(uv_image.z + wh1.x, uv_image.w - wh1.y);\n \n vec2 j = vec2(offset.x + 16., offset.y - 16.);\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(0, 0, 0, 1.);\n float camera_to_anchor_distance = gl_Position.w;\n float distance_ratio = camera_to_anchor_distance / cameraToCenterDistance;\n float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, \n 1.5);\n float m = (1. - cameraToCenterDistance / camera_to_anchor_distance) * perspective_ratio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n vec3 c = vec3(0.0, 0.0, 0.0);\n\n float n1 = util.z + mapRotation;\n float o = sin(n1);\n float u = cos(n1);\n mat2 v1 = mat2(u, -1. * o, o, u);\n\n if (utils1.x > 0.) {\n float glyphSize = 24.;\n #ifndef PICKING\n vec2 wh = uv_offset.xy / sdfTextureSize * 32.;\n vec2 xy = uv_image.xy / sdfTextureSize;\n vUv = vec2(xy.x + wh.x, xy.y - wh.y);\n #endif\n \n j = j / glyphSize * size.x;\n float B = camera_to_anchor_distance / cameraToCenterDistance;\n j = v1 * j;\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n vec2 C = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(C, .0) / zoomScale * B * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n\n #ifndef PICKING\n #ifndef HAS_ALIGN\n vGammaScale = mix(1., B, perspective_ratio);\n #else\n vGammaScale = B + mapPitch / 4.;\n #endif\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = size.x;\n #endif\n } else {\n #ifndef PICKING\n //float width = uv_offset.x / imgTextureSize * color.z;\n //float height = uv_offset.y / imgTextureSize * color.w;\n float width = uv_offset.x / imgTextureSize * haloAndWH.x;\n float height = uv_offset.y / imgTextureSize * haloAndWH.y;\n float x = uv_image.x;\n float y = 1.0 - uv_image.y;\n vUv = vec2(x + width, y - height);\n #endif\n\n j = j * vec2(1., -1.);\n j = j / 32. * size.xy;\n // j = v1 * j;\n j += vec2(size.z, size.w);\n j = v1 * j;\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n float C = camera_to_anchor_distance / cameraToCenterDistance;\n vec2 B = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(B, .0) / zoomScale * C * n, 1.);\n #endif\n // gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n gl_Position.xy += 2. / canvasSize * camera_to_anchor_distance;\n }\n }\n ",fragmentShader:"\n precision mediump float;\n #define SDF_PX 8.0\n #define DEVICE_PIXEL_RATIO 1.0\n #define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\n uniform sampler2D sdfTexture;\n uniform sampler2D imgTexture;\n uniform highp float gammaScale;\n varying vec4 vColor;\n #ifndef PICKING\n varying vec2 vUv;\n varying float vSize;\n varying float vGammaScale;\n varying vec4 vUtil;\n varying vec4 vHaloAndWH;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n \n vec4 decode_color(const vec2 encodedColor) {\n return vec4(\n unpack_float(encodedColor[0]) / 255.0,\n unpack_float(encodedColor[1]) / 255.0\n );\n }\n void main()\n {\n #ifdef PICKING\n gl_FragColor = vColor;\n #else\n //vec4 color = decode_color(vColor.xy);\n vec4 color = vColor;\n vec2 utils1 = unpack_float(vUtil.x) / 255.0;\n if (utils1.x > 0.) {\n /*float vOpacity = 1.0;\n float d = vSize / 24.;\n lowp vec4 e = color;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n float l = texture2D(texture1, vUv).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * 1.0 * vOpacity);*/\n\n //float dist = texture2D(sdfTexture, vUv).a;\n float dist = texture2D(sdfTexture, vUv).r;\n float fontScale = vSize / 24.0;\n\n highp float gamma = EDGE_GAMMA / (fontScale * gammaScale);\n //lowp float buff = (192. + floor(fontScale)) / 256.0;\n lowp float buff = 185. / 256.;\n highp float gamma_scaled = gamma * vGammaScale * 0.7;\n highp float alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n\n if (vUtil.y < 0.) {\n // 使用自定义混合有效\n gl_FragColor = color * alpha;\n // 使用默认混合可以消除黑边\n // gl_FragColor = vec4(color.rgb, alpha * color.a);\n } else {\n float u_halo_width = vUtil.y;\n float u_halo_blur = 0.;\n //vec4 u_halo_color = decode_color(vColor.zw);\n vec4 u_halo_color = vHaloAndWH;\n float radius = u_halo_width / fontScale / 10.;\n //float halo_width = ceil(u_halo_width - u_halo_width / 10.);\n float halo_width = u_halo_width;\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * gammaScale);\n gamma_scaled = gamma * vGammaScale * 0.7;\n alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n // 使用自定义混合有效\n gl_FragColor = mix(u_halo_color, color, \n smoothstep(buff + radius - gamma_scaled, buff + radius + gamma_scaled, dist)) * alpha;\n // 使用默认混合可以消除黑边\n // vec4 mix_color = mix(u_halo_color, color, smoothstep(buff + radius - gamma_scaled, buff + radius + gamma_scaled, dist));\n // gl_FragColor = vec4(mix_color.rgb, alpha * mix_color.a);\n }\n } else {\n if (utils1.y > 0.) {\n gl_FragColor = color * texture2D(imgTexture, vUv);\n /*vec4 dist = color * texture2D(imgTexture, vUv);\n highp float alpha = smoothstep(0.5, 1.0, dist.a);\n gl_FragColor = vec4(dist.rgb, alpha * dist.a);*/\n } else {\n gl_FragColor = texture2D(imgTexture, vUv);\n /*vec4 dist = texture2D(imgTexture, vUv);\n highp float alpha = smoothstep(0.5, 1.0, dist.a);\n gl_FragColor = vec4(dist.rgb, alpha * dist.a);*/\n }\n }\n #endif\n }\n ",transparent:!0,side:u.DoubleSide,blending:u.CustomBlending,blendEquation:u.AddEquation,blendSrc:u.OneFactor,blendDst:u.OneMinusSrcAlphaFactor,blendSrcAlpha:u.OneFactor,blendDstAlpha:u.OneMinusSrcAlphaFactor})}},{key:"_bindMapEvents",value:function(){this.map.on("pitch",this._setSizeOn,this),this.point&&this.point.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.map.off("pitch",this._setSizeOn,this),this.point&&this.point.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setSizeOn",value:function(){this.m.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m_pick.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m.uniforms.mapPitch.value=this.map.getPitch()*Math.PI/180}},{key:"addContent",value:(s=Ke(Xe().mark((function t(e){return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(e);case 2:this.iconFile&&this._addIcon(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_setPointEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var r=e.name;if(this.isToolTip){var n=this.point.getToolTip();n?n._content="".concat(r):this.point.setToolTip("".concat(r),{showTimeout:0,eventsPropagation:!0,dx:10})}}"click"===t.type&&e&&this.clickFunc&&!this.cFunc&&this.addContent(e)}},{key:"findItemByCode",value:function(t){for(var e=0;e<this.dataItems.length;e++)if(this.dataItems[e].code===t)return e}},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom,e=(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize;return e=e>=.1?e:.1}},{key:"show",value:function(){var t,e;null===(t=this.point)||void 0===t||t.show();for(var r=0;r<this.dataItems.length;r++){this.dataItems[r].visible=!0}null===(e=this.point)||void 0===e||e.changeVisible()}},{key:"hide",value:function(){this.pointShowHideByCode([])}},{key:"disableEvent",value:function(){var t;null===(t=this.point)||void 0===t||t.changePickVisible(!1)}},{key:"enableEvent",value:function(){var t;null===(t=this.point)||void 0===t||t.changePickVisible(!0)}},{key:"setInteractiveState",value:function(t){this.point&&(this.point.options.interactive=t)}},{key:"changePartVisible",value:(o=Ke(Xe().mark((function t(e){var r,n=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.point){t.next=2;break}return t.abrupt("return");case 2:e.slice(0,1/0).map((function(t){var e,r,i=n.findItemByCode(t.code);void 0!==i&&(t.imgVisible&&(null===(e=n.dataItems[i].markers)||void 0===e||e.forEach((function(e,r){e.markerVisible=t.imgVisible[r]}))),t.textVisible&&(null===(r=n.dataItems[i].texts)||void 0===r||r.forEach((function(e,r){e.textVisible=t.textVisible[r]}))))})),null===(r=this.point)||void 0===r||r.changeVisible();case 4:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"changeText",value:(i=Ke(Xe().mark((function t(e){var r,n,i,o,s,a,l,h,c,f,p,d,g,A=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.point){t.next=2;break}return t.abrupt("return");case 2:for(e.slice(0,1/0).map((function(t){var e,r=A.findItemByCode(t.code);void 0!==r&&t.text&&(null===(e=A.dataItems[r].texts)||void 0===e||e.forEach((function(e,r){e.text=t.text[r]})))})),this.charArray="",n=0;n<this.dataItems.length;n++)null===(i=this.dataItems[n].texts)||void 0===i||i.forEach((function(t){A.charArray=tx(A.charArray,t.text)}));for(this.glyphMap={},delete this.glyphAtlas,this.initGlyphAtlas(),o=this.glyphAtlas.image,s=o.width,a=o.height,l=o.data,(h=new u.DataTexture(l,s,a)).needsUpdate=!0,h.magFilter=u.LinearFilter,h.minFilter=u.LinearFilter,h.format=u.RedFormat,null===(r=this.textures[this.textures.length-1])||void 0===r||r.dispose(),this.textures[this.textures.length-1]=null,this.textures[this.textures.length-1]=h,this.point.glyphMap=this.glyphMap,this.point.glyphAtlas=this.glyphAtlas,c=this.point.object3d.geometry.attributes.uv_image.array,f=0,p=0;p<this.dataItems.length;p++)null===(d=this.dataItems[p].markers)||void 0===d||d.forEach((function(t){f+=1})),null===(g=this.dataItems[p].texts)||void 0===g||g.forEach((function(t){A.point.buildTextBuffers("".concat(t.text),t.textAnchor,"center",t.textSpacing).forEach((function(t){c[4*f+0]=t[0],c[4*f+1]=t[1],c[4*f+2]=t[2],c[4*f+3]=t[3],f+=1}))}));this.point.object3d.material.uniforms.sdfTexture.value=h,this.point.object3d.material.uniforms.sdfTextureSize.value=[s,a],this.point.object3d.geometry.attributes.uv_image.needsUpdate=!0;case 25:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"changeColor",value:(n=Ke(Xe().mark((function t(e){var r,n,i,o,s,a=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.point){t.next=2;break}return t.abrupt("return");case 2:for(e.slice(0,1/0).map((function(t){var e,r,n=a.findItemByCode(t.code);void 0!==n&&(t.imgColor&&(null===(e=a.dataItems[n].markers)||void 0===e||e.forEach((function(e,r){e.markerColor=t.imgColor[r]}))),t.textColor&&(null===(r=a.dataItems[n].texts)||void 0===r||r.forEach((function(e,r){e.textColor=t.textColor[r]}))))})),r=this.point.object3d.geometry.attributes.color.array,n=0,i=0;i<this.dataItems.length;i++)null===(o=this.dataItems[i].markers)||void 0===o||o.forEach((function(t){var e=new u.Color(t.markerColor);r[4*n+0]=e.r,r[4*n+1]=e.g,r[4*n+2]=e.b,r[4*n+3]=t.markerOpacity,n+=1})),null===(s=this.dataItems[i].texts)||void 0===s||s.forEach((function(t){var e=new u.Color(t.textColor);t.textIndex.forEach((function(){r[4*n+0]=e.r,r[4*n+1]=e.g,r[4*n+2]=e.b,r[4*n+3]=t.textOpacity,n+=1}))}));this.point.object3d.geometry.attributes.color.needsUpdate=!0;case 7:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"changeHaloPara",value:(r=Ke(Xe().mark((function t(e){var r,n,i,o,s,a,l=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.point){t.next=2;break}return t.abrupt("return");case 2:for(e.slice(0,1/0).map((function(t){var e,r,n=l.findItemByCode(t.code);void 0!==n&&(t.textHaloColor&&(null===(e=l.dataItems[n].texts)||void 0===e||e.forEach((function(e,r){e.textHaloColor=t.textHaloColor[r]}))),t.textHaloRadius&&(null===(r=l.dataItems[n].texts)||void 0===r||r.forEach((function(e,r){e.textHaloRadius=t.textHaloRadius[r]}))))})),r=this.point.object3d.geometry.attributes.haloAndWH.array,n=this.point.object3d.geometry.attributes.util.array,i=0,o=0;o<this.dataItems.length;o++)null===(s=this.dataItems[o].markers)||void 0===s||s.forEach((function(t){i+=1})),null===(a=this.dataItems[o].texts)||void 0===a||a.forEach((function(t){var e=new u.Color(t.textHaloColor);t.textIndex.forEach((function(){r[4*i+0]=e.r,r[4*i+1]=e.g,r[4*i+2]=e.b,r[4*i+3]=t.textHaloOpacity,n[4*i+1]=t.textHaloRadius,i+=1}))}));this.point.object3d.geometry.attributes.haloAndWH.needsUpdate=!0,this.point.object3d.geometry.attributes.util.needsUpdate=!0,console.log(this.point.object3d.geometry.attributes,"5555555555");case 10:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"pointShowHideByCode",value:function(e,r,n){for(var i,o=1/0,s=1/0,a=-1/0,u=-1/0,l=0;l<this.dataItems.length;l++){var h=this.dataItems[l];e.includes(h.code)?(o=Math.min(o,this.dataItems[l].coordinate[0]),s=Math.min(s,this.dataItems[l].coordinate[1]),a=Math.max(a,this.dataItems[l].coordinate[0]),u=Math.max(u,this.dataItems[l].coordinate[1]),h.visible=!0):h.visible=!1}null===(i=this.point)||void 0===i||i.changeVisible(),r&&this.map.fitExtent(new t.Extent(o,s,a,u),n||0)}},{key:"updateByZoom",value:function(){var t=this,e=this.map.getZoom(),r=new u.Object3D,n=0;this.dataItems.forEach((function(i){var o=t.threeLayer.coordinateToVector3(i.coordinate);if(o.sub(t.point.center),i.height&&(o.z=t.threeLayer.altitudeToVector3(i.height).x),i.markers&&(n+=i.markers.length),i.value&&t.showValueFlag)for(var s=0;s<i.value.length;s++)e<t.valueMinZoom||e>t.valueMaxZoom?r.position.set(-999,-999,0):r.position.set(o.x,o.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(n,r.matrix),t.point.pickMesh.setMatrixAt(n,r.matrix),n+=1;if(i.name&&t.showNameFlag)for(var a=0;a<i.name.length;a++)e<t.nameMinZoom||e>t.nameMaxZoom?r.position.set(-999,-999,0):r.position.set(o.x,o.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(n,r.matrix),t.point.pickMesh.setMatrixAt(n,r.matrix),n+=1})),this.point.getObject3d().instanceMatrix.needsUpdate=!0,this.point.pickMesh.instanceMatrix.needsUpdate=!0}},{key:"dispose",value:function(){this.isToolTip&&this.point&&this.point.removeToolTip(),this._closeEvent(),this.point&&(this.groupId?this.threeLayer.removeMesh1(this.point,this.groupId):this.threeLayer.removeMesh(this.point),this.point.object3d.geometry&&this.point.object3d.geometry.dispose(),this.point.object3d.material&&this.point.object3d.material.dispose(),this.point.pickObject3d.geometry&&this.point.pickObject3d.geometry.dispose(),this.point.pickObject3d.material&&this.point.pickObject3d.material.dispose(),this.point._datas=[],this.point._colorMap={},delete this.point.object3d,delete this.point.pickObject3d,this.point.toolTip&&delete this.point.toolTip,delete this.point),this.textures&&this.textures.length>0&&(this.textures.forEach((function(t){t.dispose()})),delete this.textures),this.m&&(this.m.dispose(),delete this.m),this.m_pick&&(this.m_pick.dispose(),delete this.m_pick),this.glyphMap={},this.glyphAtlas&&delete this.glyphAtlas}}]),e}(),rw={};function nw(t){if(!rw[t]){var e=Math.random(),r=.5+.5*Math.random(),n=.375+.25*Math.random();rw[t]=(new d).setHSL(e,r,n)}return rw[t]}function iw(t){var e;try{e=new URL(t,"http://fakehost.com/")}catch(t){return null}var r=e.pathname.split("/").pop(),n=r.lastIndexOf(".");return-1===n||n===r.length-1?null:r.substring(n+1)}var ow=function(){function t(){Ze(this,t),this.maxSize=800,this.minSize=600,this.unloadPercent=.05,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.unloadPriorityCallback=null;var e=this.itemSet;this.defaultPriorityCallback=function(t){return e.get(t)}}return tr(t,[{key:"isFull",value:function(){return this.itemSet.size>=this.maxSize}},{key:"add",value:function(t,e){var r=this.itemSet;if(r.has(t))return!1;if(this.isFull())return!1;var n=this.usedSet,i=this.itemList,o=this.callbacks;return i.push(t),n.add(t),r.set(t,Date.now()),o.set(t,e),!0}},{key:"remove",value:function(t){var e=this.usedSet,r=this.itemSet,n=this.itemList,i=this.callbacks;if(r.has(t)){i.get(t)(t);var o=n.indexOf(t);return n.splice(o,1),e.delete(t),r.delete(t),i.delete(t),!0}return!1}},{key:"markUsed",value:function(t){var e=this.itemSet,r=this.usedSet;e.has(t)&&!r.has(t)&&(e.set(t,Date.now()),r.add(t))}},{key:"markAllUnused",value:function(){this.usedSet.clear()}},{key:"unloadUnusedContent",value:function(){var t=this.unloadPercent,e=this.minSize,r=this.itemList,n=this.itemSet,i=this.usedSet,o=this.callbacks,s=r.length-i.size,a=r.length-e,u=this.unloadPriorityCallback||this.defaultPriorityCallback;if(a>0&&s>0){r.sort((function(t,e){var r=i.has(t),n=i.has(e);return r&&n?0:r||n?r?1:-1:u(e)-u(t)}));var l=Math.min(a,s),h=Math.max(e*t,l*t),c=Math.min(h,s);c=Math.ceil(c);for(var f=r.splice(0,c),p=0,d=f.length;p<d;p++){var g=f[p];o.get(g)(g),n.delete(g),o.delete(g)}}}},{key:"scheduleUnload",value:function(){var t,e=this,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scheduled||(this.scheduled=!0,t=function(){e.scheduled=!1,e.unloadUnusedContent(),r&&e.markAllUnused()},Promise.resolve().then(t))}}]),t}(),sw=function(){function t(){var e=this;Ze(this,t),this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=function(){throw new Error("PriorityQueue: PriorityCallback function not defined.")},this.schedulingCallback=function(t){requestAnimationFrame(t)},this._runjobs=function(){e.tryRunJobs(),e.scheduled=!1}}return tr(t,[{key:"sort",value:function(){var t=this.priorityCallback;this.items.sort(t)}},{key:"add",value:function(t,e){var r=this;return new Promise((function(n,i){var o=r.items,s=r.callbacks;o.push(t),s.set(t,(function(){return e.apply(void 0,arguments).then(n).catch(i)})),r.autoUpdate&&r.scheduleJobRun()}))}},{key:"remove",value:function(t){var e=this.items,r=this.callbacks,n=e.indexOf(t);-1!==n&&(e.splice(n,1),r.delete(t))}},{key:"tryRunJobs",value:function(){var t=this;this.sort();for(var e=this.items,r=this.callbacks,n=this.maxJobs,i=this.currJobs;n>i&&e.length>0;){i++;var o=e.pop(),s=r.get(o);r.delete(o),s(o).then((function(){t.currJobs--,t.autoUpdate&&t.scheduleJobRun()})).catch((function(){t.currJobs--,t.autoUpdate&&t.scheduleJobRun()}))}this.currJobs=i}},{key:"scheduleJobRun",value:function(){this.scheduled||(this.schedulingCallback(this._runjobs),this.scheduled=!0)}}]),t}(),aw=0,uw=1,lw=2,hw=3,cw=4,fw=6378137,pw=1/298.257223563,dw=6356752.314245179;function gw(t){return t===hw||t===cw}function Aw(t,e){return t.__lastFrameVisited===e&&t.__used}function yw(t,e){t.__lastFrameVisited!==e&&(t.__lastFrameVisited=e,t.__used=!1,t.__inFrustum=!1,t.__isLeaf=!1,t.__visible=!1,t.__active=!1,t.__error=1/0,t.__distanceFromCamera=1/0,t.__childrenWereVisible=!1,t.__allChildrenLoaded=!1)}function vw(t,e,r,n){if(n.ensureChildrenArePreprocessed(t),yw(t,e),t.__used=!0,r.markUsed(t),t.__contentEmpty)for(var i=t.children,o=0,s=i.length;o<s;o++)vw(i[o],e,r,n)}function mw(t,e,r){if(r.ensureChildrenArePreprocessed(t),t.__contentEmpty&&(!t.__externalTileSet||gw(t.__loadingState)))for(var n=t.children,i=0,o=n.length;i<o;i++){var s=n[i];s.__depthFromRenderedParent=e,mw(s,e,r)}else r.requestTileContents(t)}function _w(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(e&&e(t,n,i))r&&r(t,n,i);else{for(var o=t.children,s=0,a=o.length;s<a;s++)_w(o[s],e,r,t,i+1);r&&r(t,n,i)}}function Iw(t,e){e.ensureChildrenArePreprocessed(t);var r=e.stats,n=e.frameCount,i=e.errorTarget,o=e.maxDepth,s=e.loadSiblings,a=e.lruCache,u=e.stopAtEmptyTiles;if(yw(t,n),!1===e.tileInView(t))return!1;if(t.__used=!0,a.markUsed(t),t.__inFrustum=!0,r.inFrustum++,(u||!t.__contentEmpty)&&!t.__externalTileSet){if(e.calculateError(t),t.__error<=i)return!0;if(e.maxDepth>0&&t.__depth+1>=o)return!0}for(var l=!1,h=t.children,c=0,f=h.length;c<f;c++){var p=Iw(h[c],e);l=l||p}if(l&&s)for(var d=0,g=h.length;d<g;d++){vw(h[d],n,a,e)}return!0}function Ew(t,e){var r=e.stats,n=e.frameCount;if(Aw(t,n)){r.used++;for(var i=t.children,o=!1,s=0,a=i.length;s<a;s++){var u=i[s];o=o||Aw(u,n)}if(o){for(var l=!1,h=!0,c=0,f=i.length;c<f;c++){var p=i[c];if(Ew(p,e),l=l||p.__wasSetVisible||p.__childrenWereVisible,Aw(p,n)){var d=p.__allChildrenLoaded||!p.__contentEmpty&&gw(p.__loadingState)||p.__externalTileSet&&p.__loadingState===cw;h=h&&d}}t.__childrenWereVisible=l,t.__allChildrenLoaded=h}else t.__isLeaf=!0}}function xw(t,e){var r=e.stats,n=e.frameCount;if(Aw(t,n)){var i=t.parent,o=i?i.__depthFromRenderedParent:-1;t.__depthFromRenderedParent=o;var s=e.lruCache;if(t.__isLeaf)return t.__depthFromRenderedParent++,void(t.__loadingState===hw?(t.__inFrustum&&(t.__visible=!0,r.visible++),t.__active=!0,r.active++):s.isFull()||t.__contentEmpty&&!t.__externalTileSet||e.requestTileContents(t));var a=(e.errorTarget+1)*e.errorThreshold,u=t.__error<=a,l=u||"ADD"===t.refine,h=!t.__contentEmpty,c=h||t.__externalTileSet,f=gw(t.__loadingState)&&c,p=t.__childrenWereVisible,d=t.children,g=t.__allChildrenLoaded;if(l&&h&&t.__depthFromRenderedParent++,l&&!f&&!s.isFull()&&c&&e.requestTileContents(t),(u&&!g&&!p&&f||"ADD"===t.refine&&f)&&(t.__inFrustum&&(t.__visible=!0,r.visible++),t.__active=!0,r.active++),"ADD"!==t.refine&&u&&!g&&f)for(var A=0,y=d.length;A<y;A++){var v=d[A];Aw(v,n)&&!s.isFull()&&(v.__depthFromRenderedParent=t.__depthFromRenderedParent+1,mw(v,v.__depthFromRenderedParent,e))}else for(var m=0,_=d.length;m<_;m++){var I=d[m];Aw(I,n)&&xw(I,e)}}}function ww(t,e){var r=Aw(t,e.frameCount);if(r||t.__usedLastFrame){var n=!1,i=!1;r&&(n=t.__active,i=e.displayActiveTiles&&t.__active||t.__visible),t.__contentEmpty||t.__loadingState!==hw||(t.__wasSetActive!==n&&e.setTileActive(t,n),t.__wasSetVisible!==i&&e.setTileVisible(t,i)),t.__wasSetActive=n,t.__wasSetVisible=i,t.__usedLastFrame=r;for(var o=t.children,s=0,a=o.length;s<a;s++){ww(o[s],e)}}}var Cw=function(t,e){return t.__depth!==e.__depth?t.__depth>e.__depth?-1:1:t.__inFrustum!==e.__inFrustum?t.__inFrustum?1:-1:t.__used!==e.__used?t.__used?1:-1:t.__error!==e.__error?t.__error>e.__error?1:-1:t.__distanceFromCamera!==e.__distanceFromCamera?t.__distanceFromCamera>e.__distanceFromCamera?-1:1:0},bw=function(t){return 1/(t.__depthFromRenderedParent+1)},Sw=function(){function t(e,r){Ze(this,t),this.tileSets={},this.rootURL=e,this.fetchOptions={},this.preprocessURL=null;var n=new ow;n.unloadPriorityCallback=bw;var i=new sw;i.maxJobs=4,i.priorityCallback=Cw;var o=new sw;o.maxJobs=1,o.priorityCallback=Cw,this.lruCache=n,this.downloadQueue=i,this.parseQueue=o,this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0,this.errorTarget=6,this.errorThreshold=1/0,this.loadSiblings=!0,this.displayActiveTiles=!1,this.maxDepth=1/0,this.stopAtEmptyTiles=!0,this.threeLayer=r,this.heightOffset=0,this.xOffset=0,this.yOffset=0,this.yScale=1}return tr(t,[{key:"rootTileSet",get:function(){var t=this.tileSets[this.rootURL];return!t||t instanceof Promise?null:t}},{key:"root",get:function(){var t=this.rootTileSet;return t?t.root:null}},{key:"traverse",value:function(t,e){var r=this,n=this.tileSets[this.rootURL];n&&n.root&&_w(n.root,(function(e){r.ensureChildrenArePreprocessed(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return!!t&&t.apply(void 0,[e].concat(i))}),e)}},{key:"update",value:function(){var t=this.stats,e=this.lruCache,r=this.tileSets,n=r[this.rootURL];if(this.rootURL in r){if(n&&n.root){var i=n.root;t.inFrustum=0,t.used=0,t.active=0,t.visible=0,this.frameCount++,Iw(i,this),Ew(i,this),xw(i,this),ww(i,this),e.scheduleUnload()}}else this.loadRootTileSet(this.rootURL)}},{key:"parseTile",value:function(t,e,r){return null}},{key:"disposeTile",value:function(t){}},{key:"preprocessNode",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.content&&(!("uri"in t.content)&&"url"in t.content&&(t.content.uri=t.content.url,delete t.content.url),t.content.uri&&(t.content.uri=new URL(t.content.uri,e+"/").toString()),t.content.boundingVolume&&!("box"in t.content.boundingVolume||"sphere"in t.content.boundingVolume||"region"in t.content.boundingVolume)&&delete t.content.boundingVolume),t.parent=r,t.children=t.children||[],t.content&&t.content.uri){var n=iw(t.content.uri),i=Boolean(n&&"json"===n.toLowerCase());t.__externalTileSet=i,t.__contentEmpty=i}else t.__externalTileSet=!1,t.__contentEmpty=!0;t.__distanceFromCamera=1/0,t.__error=1/0,t.__inFrustum=!1,t.__isLeaf=!1,t.__usedLastFrame=!1,t.__used=!1,t.__wasSetVisible=!1,t.__visible=!1,t.__childrenWereVisible=!1,t.__allChildrenLoaded=!1,t.__wasSetActive=!1,t.__active=!1,t.__loadingState=0,t.__loadIndex=0,t.__loadAbort=null,t.__depthFromRenderedParent=-1,null===r?(t.__depth=0,t.refine=t.refine||"REPLACE"):(t.__depth=r.__depth+1,t.refine=t.refine||r.refine),t.__basePath=e}},{key:"setTileActive",value:function(t,e){}},{key:"setTileVisible",value:function(t,e){}},{key:"calculateError",value:function(t){return 0}},{key:"tileInView",value:function(t){return!0}},{key:"ensureChildrenArePreprocessed",value:function(t){for(var e=t.children,r=0,n=e.length;r<n;r++){var i=e[r];if("__depth"in i)break;this.preprocessNode(i,t.__basePath,t)}}},{key:"resetFailedTiles",value:function(){var t=this.stats;0!==t.failed&&(this.traverse((function(t){t.__loadingState===cw&&(t.__loadingState=0)})),t.failed=0)}},{key:"fetchTileSet",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return fetch(t,e).then((function(e){if(e.ok)return e.json();throw new Error('TilesRenderer: Failed to load tileset "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText))})).then((function(e){var i=pr(e.asset.version.split(".").map((function(t){return parseInt(t)})),2),o=i[0],s=i[1];console.assert(o<=1,"TilesRenderer: asset.version is expected to be a 1.x or a compatible version."),1===o&&s>0&&console.warn("TilesRenderer: tiles versions at 1.1 or higher have limited support. Some new extensions and features may not be supported.");var a=t.replace(/\/[^\/]*\/?$/,"");return a=new URL(a,window.location.href).toString(),r.preprocessNode(e.root,a,n),e}))}},{key:"loadRootTileSet",value:function(t){var e=this.tileSets;if(t in e)return e[t]instanceof Error?Promise.reject(e[t]):Promise.resolve(e[t]);var r=this.fetchTileSet(this.preprocessURL?this.preprocessURL(t):t,this.fetchOptions).then((function(r){e[t]=r}));return r.catch((function(r){console.error(r),e[t]=r})),e[t]=r,r}},{key:"requestTileContents",value:function(t){var e=this;if(0===t.__loadingState){var r=this.stats,n=this.lruCache,i=this.downloadQueue,o=this.parseQueue,s=t.__externalTileSet;n.add(t,(function(t){1===t.__loadingState?(t.__loadAbort.abort(),t.__loadAbort=null):s?t.children.length=0:e.disposeTile(t),1===t.__loadingState?r.downloading--:2===t.__loadingState&&r.parsing--,t.__loadingState=0,t.__loadIndex++,o.remove(t),i.remove(t)})),t.__loadIndex++;var a=t.__loadIndex,u=new AbortController,l=u.signal;r.downloading++,t.__loadAbort=u,t.__loadingState=1;var h=function(e){t.__loadIndex===a&&("AbortError"!==e.name?(o.remove(t),i.remove(t),2===t.__loadingState?r.parsing--:1===t.__loadingState&&r.downloading--,r.failed++,console.error('TilesRenderer : Failed to load tile at url "'.concat(t.content.uri,'".')),console.error(e),t.__loadingState=cw):n.remove(t))};s?i.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=e.preprocessURL?e.preprocessURL(t.content.uri):t.content.uri;return e.fetchTileSet(r,Object.assign({signal:l},e.fetchOptions),t)})).then((function(e){t.__loadIndex===a&&(r.downloading--,t.__loadAbort=null,t.__loadingState=hw,t.children.push(e.root))})).catch(h):i.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=e.preprocessURL?e.preprocessURL(t.content.uri):t.content.uri;return fetch(r,Object.assign({signal:l},e.fetchOptions))})).then((function(e){if(t.__loadIndex===a){if(e.ok)return e.arrayBuffer();throw new Error("Failed to load model with error code ".concat(e.status))}})).then((function(n){if(t.__loadIndex===a)return r.downloading--,r.parsing++,t.__loadAbort=null,t.__loadingState=2,o.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=iw(t.content.uri);return e.parseTile(n,t,r)}))})).then((function(){t.__loadIndex===a&&(r.parsing--,t.__loadingState=hw,t.__wasSetVisible&&e.setTileVisible(t,!0),t.__wasSetActive&&e.setTileActive(t,!0))})).catch(h)}}},{key:"dispose",value:function(){var t=this.lruCache,e=[];this.traverse((function(t){return e.push(t),!1}));for(var r=0,n=e.length;r<n;r++)t.remove(e[r]);this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0}}]),t}();function Bw(t){return(new TextDecoder).decode(t)}var Mw=function(){function t(e,r,n,i){Ze(this,t),this.buffer=e,this.binOffset=r+n,this.binLength=i;var o=null;if(0!==n){var s=new Uint8Array(e,r,n);o=JSON.parse(Bw(s))}else o={};this.header=o}return tr(t,[{key:"getKeys",value:function(){return Object.keys(this.header)}},{key:"getData",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=this.header;if(!(t in i))return null;var o=i[t];if(o instanceof Object){if(Array.isArray(o))return o;var s,a,u=this.buffer,l=this.binOffset,h=this.binLength,c=o.byteOffset||0,f=o.type||n,p=o.componentType||r;if("type"in o&&n&&o.type!==n)throw new Error("FeatureTable: Specified type does not match expected type.");switch(f){case"SCALAR":s=1;break;case"VEC2":s=2;break;case"VEC3":s=3;break;case"VEC4":s=4;break;default:throw new Error('FeatureTable : Feature type not provided for "'.concat(t,'".'))}var d=l+c,g=e*s;switch(p){case"BYTE":a=new Int8Array(u,d,g);break;case"UNSIGNED_BYTE":a=new Uint8Array(u,d,g);break;case"SHORT":a=new Int16Array(u,d,g);break;case"UNSIGNED_SHORT":a=new Uint16Array(u,d,g);break;case"INT":a=new Int32Array(u,d,g);break;case"UNSIGNED_INT":a=new Uint32Array(u,d,g);break;case"FLOAT":a=new Float32Array(u,d,g);break;case"DOUBLE":a=new Float64Array(u,d,g);break;default:throw new Error('FeatureTable : Feature component type not provided for "'.concat(t,'".'))}if(d+g*a.BYTES_PER_ELEMENT>l+h)throw new Error("FeatureTable: Feature data read outside binary body length.");return a}return o}},{key:"getBuffer",value:function(t,e){var r=this.buffer,n=this.binOffset;return r.slice(n+t,n+t+e)}}]),t}(),Tw=function(t){rr(r,Mw);var e=ur(r);function r(t,n,i,o,s){var a;return Ze(this,r),(a=e.call(this,t,i,o,s)).batchSize=n,a}return tr(r,[{key:"getData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return hr(nr(r.prototype),"getData",this).call(this,t,this.batchSize,e,n)}}]),r}(),Lw=function(){function t(){Ze(this,t),this.fetchOptions={},this.workingPath=""}return tr(t,[{key:"load",value:function(t){var e=this;return fetch(t,this.fetchOptions).then((function(e){if(!e.ok)throw new Error('Failed to load file "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText));return e.arrayBuffer()})).then((function(r){return""===e.workingPath&&(e.workingPath=e.workingPathForURL(t)),e.parse(r)}))}},{key:"resolveExternalURL",value:function(t){return/^[^\\/]/.test(t)?this.workingPath+"/"+t:t}},{key:"workingPathForURL",value:function(t){var e=t.split(/[\\/]/g);return e.pop(),e.join("/")+"/"}},{key:"parse",value:function(t){throw new Error("LoaderBase: Parse not implemented.")}}]),t}();function Rw(t){var e;if(e=t instanceof DataView?t:new DataView(t),"{"===String.fromCharCode(e.getUint8(0)))return null;for(var r="",n=0;n<4;n++)r+=String.fromCharCode(e.getUint8(n));return r}var Nw=function(t){rr(r,Lw);var e=ur(r);function r(){return Ze(this,r),e.apply(this,arguments)}return tr(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Rw(e);console.assert("b3dm"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=t.slice(28,28+o+s),h=new Mw(l,0,o,s),c=28+o+s,f=t.slice(c,c+a+u),p=new Tw(f,h.getData("BATCH_LENGTH"),0,a,u),d=c+a+u;return{version:n,featureTable:h,batchTable:p,glbBytes:new Uint8Array(t,d,i-d)}}}]),r}(),Pw=function(t){rr(r,m);var e=ur(r);function r(t){var n;return Ze(this,r),(n=e.call(this,t)).dracoLoader=null,n.ktx2Loader=null,n.meshoptDecoder=null,n.pluginCallbacks=[],n.register((function(t){return new Uw(t)})),n.register((function(t){return new Ww(t)})),n.register((function(t){return new Jw(t)})),n.register((function(t){return new Kw(t)})),n.register((function(t){return new zw(t)})),n.register((function(t){return new jw(t)})),n.register((function(t){return new Vw(t)})),n.register((function(t){return new Hw(t)})),n.register((function(t){return new Ow(t)})),n.register((function(t){return new qw(t)})),n.register((function(t){return new Gw(t)})),n.register((function(t){return new Xw(t)})),n.register((function(t){return new Yw(t)})),n.register((function(t){return new Fw(t)})),n.register((function(t){return new Zw(t)})),n.register((function(t){return new $w(t)})),n}return tr(r,[{key:"load",value:function(t,e,r,n){var i,o=this;if(""!==this.resourcePath)i=this.resourcePath;else if(""!==this.path){var s=y.extractUrlBase(t);i=y.resolveURL(s,this.path)}else i=y.extractUrlBase(t);this.manager.itemStart(t);var a=function(e){n?n(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},u=new v(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(t,(function(r){try{o.parse(r,i,(function(r){e(r),o.manager.itemEnd(t)}),a)}catch(t){a(t)}}),r,a)}},{key:"setDRACOLoader",value:function(t){return this.dracoLoader=t,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(t){return this.ktx2Loader=t,this}},{key:"setMeshoptDecoder",value:function(t){return this.meshoptDecoder=t,this}},{key:"register",value:function(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}},{key:"unregister",value:function(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}},{key:"parse",value:function(t,e,r,n){var i,o={},s={},a=new TextDecoder;if("string"==typeof t)i=JSON.parse(t);else if(t instanceof ArrayBuffer){if(a.decode(new Uint8Array(t,0,4))===tC){try{o[kw.KHR_BINARY_GLTF]=new nC(t)}catch(t){return void(n&&n(t))}i=JSON.parse(o[kw.KHR_BINARY_GLTF].content)}else i=JSON.parse(a.decode(t))}else i=t;if(void 0===i.asset||i.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new BC(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var l=0;l<this.pluginCallbacks.length;l++){var h=this.pluginCallbacks[l](u);h.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),s[h.name]=h,o[h.name]=!0}if(i.extensionsUsed)for(var c=0;c<i.extensionsUsed.length;++c){var f=i.extensionsUsed[c],p=i.extensionsRequired||[];switch(f){case kw.KHR_MATERIALS_UNLIT:o[f]=new Qw;break;case kw.KHR_DRACO_MESH_COMPRESSION:o[f]=new iC(i,this.dracoLoader);break;case kw.KHR_TEXTURE_TRANSFORM:o[f]=new oC;break;case kw.KHR_MESH_QUANTIZATION:o[f]=new sC;break;default:p.indexOf(f)>=0&&void 0===s[f]&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(o),u.setPlugins(s),u.parse(r,n)}}},{key:"parseAsync",value:function(t,e){var r=this;return new Promise((function(n,i){r.parse(t,e,n,i)}))}}]),r}();function Dw(){var t={};return{get:function(e){return t[e]},add:function(e,r){t[e]=r},remove:function(e){delete t[e]},removeAll:function(){t={}}}}var kw={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},Fw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return tr(t,[{key:"_markDefs",value:function(){for(var t=this.parser,e=this.parser.json.nodes||[],r=0,n=e.length;r<n;r++){var i=e[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(t){var e=this.parser,r="light:"+t,n=e.cache.get(r);if(n)return n;var i,o=e.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[t],a=new d(16777215);void 0!==s.color&&a.setRGB(s.color[0],s.color[1],s.color[2],_);var u=void 0!==s.range?s.range:0;switch(s.type){case"directional":(i=new x(a)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new E(a)).distance=u;break;case"spot":(i=new I(a)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,i.angle=s.spot.outerConeAngle,i.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return i.position.set(0,0,0),i.decay=2,EC(i,s),void 0!==s.intensity&&(i.intensity=s.intensity),i.name=e.createUniqueName(s.name||"light_"+t),n=Promise.resolve(i),e.cache.add(r,n),n}},{key:"getDependency",value:function(t,e){if("light"===t)return this._loadLight(e)}},{key:"createNodeAttachment",value:function(t){var e=this,r=this.parser,n=r.json.nodes[t],i=(n.extensions&&n.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(t){return r._getNodeRef(e.cache,i,t)}))}}]),t}(),Qw=function(){function t(){Ze(this,t),this.name=kw.KHR_MATERIALS_UNLIT}return tr(t,[{key:"getMaterialType",value:function(){return w}},{key:"extendParams",value:function(t,e,r){var n=[];t.color=new d(1,1,1),t.opacity=1;var i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var o=i.baseColorFactor;t.color.setRGB(o[0],o[1],o[2],_),t.opacity=o[3]}void 0!==i.baseColorTexture&&n.push(r.assignTexture(t,"map",i.baseColorTexture,C))}return Promise.all(n)}}]),t}(),Ow=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_EMISSIVE_STRENGTH}return tr(t,[{key:"extendMaterialParams",value:function(t,e){var r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var n=r.extensions[this.name].emissiveStrength;return void 0!==n&&(e.emissiveIntensity=n),Promise.resolve()}}]),t}(),Uw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_CLEARCOAT}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];if(void 0!==o.clearcoatFactor&&(e.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(r.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(r.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(r.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new S(s,s)}return Promise.all(i)}}]),t}(),Gw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_IRIDESCENCE}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return void 0!==o.iridescenceFactor&&(e.iridescence=o.iridescenceFactor),void 0!==o.iridescenceTexture&&i.push(r.assignTexture(e,"iridescenceMap",o.iridescenceTexture)),void 0!==o.iridescenceIor&&(e.iridescenceIOR=o.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==o.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),void 0!==o.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),void 0!==o.iridescenceThicknessTexture&&i.push(r.assignTexture(e,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}]),t}(),zw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_SHEEN}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[];e.sheenColor=new d(0,0,0),e.sheenRoughness=0,e.sheen=1;var o=n.extensions[this.name];if(void 0!==o.sheenColorFactor){var s=o.sheenColorFactor;e.sheenColor.setRGB(s[0],s[1],s[2],_)}return void 0!==o.sheenRoughnessFactor&&(e.sheenRoughness=o.sheenRoughnessFactor),void 0!==o.sheenColorTexture&&i.push(r.assignTexture(e,"sheenColorMap",o.sheenColorTexture,C)),void 0!==o.sheenRoughnessTexture&&i.push(r.assignTexture(e,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}]),t}(),jw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_TRANSMISSION}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return void 0!==o.transmissionFactor&&(e.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(r.assignTexture(e,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}]),t}(),Vw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_VOLUME}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];e.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&i.push(r.assignTexture(e,"thicknessMap",o.thicknessTexture)),e.attenuationDistance=o.attenuationDistance||1/0;var s=o.attenuationColor||[1,1,1];return e.attenuationColor=(new d).setRGB(s[0],s[1],s[2],_),Promise.all(i)}}]),t}(),Hw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_IOR}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var n=r.extensions[this.name];return e.ior=void 0!==n.ior?n.ior:1.5,Promise.resolve()}}]),t}(),qw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_SPECULAR}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];e.specularIntensity=void 0!==o.specularFactor?o.specularFactor:1,void 0!==o.specularTexture&&i.push(r.assignTexture(e,"specularIntensityMap",o.specularTexture));var s=o.specularColorFactor||[1,1,1];return e.specularColor=(new d).setRGB(s[0],s[1],s[2],_),void 0!==o.specularColorTexture&&i.push(r.assignTexture(e,"specularColorMap",o.specularColorTexture,C)),Promise.all(i)}}]),t}(),Yw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.EXT_MATERIALS_BUMP}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return e.bumpScale=void 0!==o.bumpFactor?o.bumpFactor:1,void 0!==o.bumpTexture&&i.push(r.assignTexture(e,"bumpMap",o.bumpTexture)),Promise.all(i)}}]),t}(),Xw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_MATERIALS_ANISOTROPY}return tr(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?b:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return void 0!==o.anisotropyStrength&&(e.anisotropy=o.anisotropyStrength),void 0!==o.anisotropyRotation&&(e.anisotropyRotation=o.anisotropyRotation),void 0!==o.anisotropyTexture&&i.push(r.assignTexture(e,"anisotropyMap",o.anisotropyTexture)),Promise.all(i)}}]),t}(),Ww=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.KHR_TEXTURE_BASISU}return tr(t,[{key:"loadTexture",value:function(t){var e=this.parser,r=e.json,n=r.textures[t];if(!n.extensions||!n.extensions[this.name])return null;var i=n.extensions[this.name],o=e.options.ktx2Loader;if(!o){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,i.source,o)}}]),t}(),Jw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.EXT_TEXTURE_WEBP,this.isSupported=null}return tr(t,[{key:"loadTexture",value:function(t){var e=this.name,r=this.parser,n=r.json,i=n.textures[t];if(!i.extensions||!i.extensions[e])return null;var o=i.extensions[e],s=n.images[o.source],a=r.textureLoader;if(s.uri){var u=r.options.manager.getHandler(s.uri);null!==u&&(a=u)}return this.detectSupport().then((function(i){if(i)return r.loadTextureImage(t,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(t)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(t){var e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}]),t}(),Kw=function(){function t(e){Ze(this,t),this.parser=e,this.name=kw.EXT_TEXTURE_AVIF,this.isSupported=null}return tr(t,[{key:"loadTexture",value:function(t){var e=this.name,r=this.parser,n=r.json,i=n.textures[t];if(!i.extensions||!i.extensions[e])return null;var o=i.extensions[e],s=n.images[o.source],a=r.textureLoader;if(s.uri){var u=r.options.manager.getHandler(s.uri);null!==u&&(a=u)}return this.detectSupport().then((function(i){if(i)return r.loadTextureImage(t,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(t)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(t){var e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}]),t}(),Zw=function(){function t(e){Ze(this,t),this.name=kw.EXT_MESHOPT_COMPRESSION,this.parser=e}return tr(t,[{key:"loadBufferView",value:function(t){var e=this.parser.json,r=e.bufferViews[t];if(r.extensions&&r.extensions[this.name]){var n=r.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){var e=n.byteOffset||0,r=n.byteLength||0,i=n.count,s=n.byteStride,a=new Uint8Array(t,e,r);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(i,s,a,n.mode,n.filter).then((function(t){return t.buffer})):o.ready.then((function(){var t=new ArrayBuffer(i*s);return o.decodeGltfBuffer(new Uint8Array(t),i,s,a,n.mode,n.filter),t}))}))}return null}}]),t}(),$w=function(){function t(e){Ze(this,t),this.name=kw.EXT_MESH_GPU_INSTANCING,this.parser=e}return tr(t,[{key:"createNodeMesh",value:function(t){var e=this,r=this.parser.json,n=r.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;var i,o=yr(r.meshes[n.mesh].primitives);try{for(o.s();!(i=o.n()).done;){var s=i.value;if(s.mode!==hC.TRIANGLES&&s.mode!==hC.TRIANGLE_STRIP&&s.mode!==hC.TRIANGLE_FAN&&void 0!==s.mode)return null}}catch(t){o.e(t)}finally{o.f()}var a=n.extensions[this.name].attributes,u=[],l={},h=function(t){u.push(e.parser.getDependency("accessor",a[t]).then((function(e){return l[t]=e,l[t]})))};for(var c in a)h(c);return u.length<1?null:(u.push(this.parser.createNodeMesh(t)),Promise.all(u).then((function(t){var r,n=t.pop(),i=n.isGroup?n.children:[n],o=t[0].count,s=[],a=yr(i);try{for(a.s();!(r=a.n()).done;){for(var u=r.value,h=new A,c=new B,f=new g,p=new B(1,1,1),d=new M(u.geometry,u.material,o),y=0;y<o;y++)l.TRANSLATION&&c.fromBufferAttribute(l.TRANSLATION,y),l.ROTATION&&f.fromBufferAttribute(l.ROTATION,y),l.SCALE&&p.fromBufferAttribute(l.SCALE,y),d.setMatrixAt(y,h.compose(c,f,p));for(var v in l)if("_COLOR_0"===v){var m=l[v];d.instanceColor=new T(m.array,m.itemSize,m.normalized)}else"TRANSLATION"!==v&&"ROTATION"!==v&&"SCALE"!==v&&u.geometry.setAttribute(v,l[v]);L.prototype.copy.call(d,u),e.parser.assignFinalMaterial(d),s.push(d)}}catch(t){a.e(t)}finally{a.f()}return n.isGroup?(n.clear(),n.add.apply(n,s),n):s[0]})))}}]),t}(),tC="glTF",eC=1313821514,rC=5130562,nC=tr((function t(e){Ze(this,t),this.name=kw.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==tC)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=this.header.length-12,o=new DataView(e,12),s=0;s<i;){var a=o.getUint32(s,!0);s+=4;var u=o.getUint32(s,!0);if(s+=4,u===eC){var l=new Uint8Array(e,12+s,a);this.content=n.decode(l)}else if(u===rC){var h=12+s;this.body=e.slice(h,h+a)}s+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),iC=function(){function t(e,r){if(Ze(this,t),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=kw.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=r,this.dracoLoader.preload()}return tr(t,[{key:"decodePrimitive",value:function(t,e){var r=this.json,n=this.dracoLoader,i=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,s={},a={},u={};for(var l in o){var h=gC[l]||l.toLowerCase();s[h]=o[l]}for(var c in t.attributes){var f=gC[c]||c.toLowerCase();if(void 0!==o[c]){var p=r.accessors[t.attributes[c]],d=cC[p.componentType];u[f]=d.name,a[f]=!0===p.normalized}}return e.getDependency("bufferView",i).then((function(t){return new Promise((function(e,r){n.decodeDracoFile(t,(function(t){for(var r in t.attributes){var n=t.attributes[r],i=a[r];void 0!==i&&(n.normalized=i)}e(t)}),s,u,_,r)}))}))}}]),t}(),oC=function(){function t(){Ze(this,t),this.name=kw.KHR_TEXTURE_TRANSFORM}return tr(t,[{key:"extendTexture",value:function(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}]),t}(),sC=tr((function t(){Ze(this,t),this.name=kw.KHR_MESH_QUANTIZATION})),aC=function(t){rr(r,_t);var e=ur(r);function r(t,n,i,o){return Ze(this,r),e.call(this,t,n,i,o)}return tr(r,[{key:"copySampleValue_",value:function(t){for(var e=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=t*n*3+n,o=0;o!==n;o++)e[o]=r[i+o];return e}},{key:"interpolate_",value:function(t,e,r,n){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,u=3*s,l=n-e,h=(r-e)/l,c=h*h,f=c*h,p=t*u,d=p-u,g=-2*f+3*c,A=f-c,y=1-g,v=A-c+h,m=0;m!==s;m++){var _=o[d+m+s],I=o[d+m+a]*l,E=o[p+m+s],x=o[p+m]*l;i[m]=y*_+v*I+g*E+A*x}return i}}]),r}(),uC=new g,lC=function(t){rr(r,aC);var e=ur(r);function r(){return Ze(this,r),e.apply(this,arguments)}return tr(r,[{key:"interpolate_",value:function(t,e,n,i){var o=hr(nr(r.prototype),"interpolate_",this).call(this,t,e,n,i);return uC.fromArray(o).normalize().toArray(o),o}}]),r}(),hC={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},cC={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},fC={9728:it,9729:P,9984:ot,9985:st,9986:at,9987:D},pC={33071:ut,33648:lt,10497:k},dC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},gC={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},AC={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},yC={CUBICSPLINE:void 0,LINEAR:rt,STEP:ht},vC="OPAQUE",mC="MASK",_C="BLEND";function IC(t,e,r){for(var n in r.extensions)void 0===t[n]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=r.extensions[n])}function EC(t,e){void 0!==e.extras&&("object"===We(e.extras)?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function xC(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var r=0,n=e.weights.length;r<n;r++)t.morphTargetInfluences[r]=e.weights[r];if(e.extras&&Array.isArray(e.extras.targetNames)){var i=e.extras.targetNames;if(t.morphTargetInfluences.length===i.length){t.morphTargetDictionary={};for(var o=0,s=i.length;o<s;o++)t.morphTargetDictionary[i[o]]=o}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function wC(t){var e,r=t.extensions&&t.extensions[kw.KHR_DRACO_MESH_COMPRESSION];if(e=r?"draco:"+r.bufferView+":"+r.indices+":"+CC(r.attributes):t.indices+":"+CC(t.attributes)+":"+t.mode,void 0!==t.targets)for(var n=0,i=t.targets.length;n<i;n++)e+=":"+CC(t.targets[n]);return e}function CC(t){for(var e="",r=Object.keys(t).sort(),n=0,i=r.length;n<i;n++)e+=r[n]+":"+t[r[n]]+";";return e}function bC(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var SC=new A,BC=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ze(this,t),this.json=e,this.extensions={},this.plugins={},this.options=r,this.cache=new Dw,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};var n=!1,i=!1,o=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),o=(i=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||i&&o<98?this.textureLoader=new ft(this.options.manager):this.textureLoader=new pt(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new v(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return tr(t,[{key:"setExtensions",value:function(t){this.extensions=t}},{key:"setPlugins",value:function(t){this.plugins=t}},{key:"parse",value:function(t,e){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(e){var o={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:r,userData:{}};return IC(i,o,n),EC(o,n),Promise.all(r._invokeAll((function(t){return t.afterRoot&&t.afterRoot(o)}))).then((function(){t(o)}))})).catch(e)}},{key:"_markDefs",value:function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],n=0,i=e.length;n<i;n++)for(var o=e[n].joints,s=0,a=o.length;s<a;s++)t[o[s]].isBone=!0;for(var u=0,l=t.length;u<l;u++){var h=t[u];void 0!==h.mesh&&(this._addNodeRef(this.meshCache,h.mesh),void 0!==h.skin&&(r[h.mesh].isSkinnedMesh=!0)),void 0!==h.camera&&this._addNodeRef(this.cameraCache,h.camera)}}},{key:"_addNodeRef",value:function(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}},{key:"_getNodeRef",value:function(t,e,r){var n=this;if(t.refs[e]<=1)return r;var i=r.clone();return function t(e,r){var i=n.associations.get(e);null!=i&&n.associations.set(r,i);var o,s=yr(e.children.entries());try{for(s.s();!(o=s.n()).done;){var a=pr(o.value,2),u=a[0];t(a[1],r.children[u])}}catch(t){s.e(t)}finally{s.f()}}(r,i),i.name+="_instance_"+t.uses[e]++,i}},{key:"_invokeOne",value:function(t){var e=Object.values(this.plugins);e.push(this);for(var r=0;r<e.length;r++){var n=t(e[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(t){var e=Object.values(this.plugins);e.unshift(this);for(var r=[],n=0;n<e.length;n++){var i=t(e[n]);i&&r.push(i)}return r}},{key:"getDependency",value:function(t,e){var r=t+":"+e,n=this.cache.get(r);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":n=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":n=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":n=this.loadCamera(e);break;default:if(!(n=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(t,e)}))))throw new Error("Unknown type: "+t)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(t){var e=this.cache.get(t);if(!e){var r=this,n=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(n.map((function(e,n){return r.getDependency(t,n)}))),this.cache.add(t,e)}return e}},{key:"loadBuffer",value:function(t){var e=this.json.buffers[t],r=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[kw.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(t,i){r.load(y.resolveURL(e.uri,n.path),t,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}},{key:"loadBufferView",value:function(t){var e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){var r=e.byteLength||0,n=e.byteOffset||0;return t.slice(n,n+r)}))}},{key:"loadAccessor",value:function(t){var e=this,r=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse){var i=dC[n.type],o=cC[n.componentType],s=!0===n.normalized,a=new o(n.count*i);return Promise.resolve(new h(a,i,s))}var u=[];return void 0!==n.bufferView?u.push(this.getDependency("bufferView",n.bufferView)):u.push(null),void 0!==n.sparse&&(u.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),u.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(u).then((function(t){var i,o,s=t[0],a=dC[n.type],u=cC[n.componentType],l=u.BYTES_PER_ELEMENT,c=l*a,f=n.byteOffset||0,p=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,d=!0===n.normalized;if(p&&p!==c){var g=Math.floor(f/p),A="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+g+":"+n.count,y=e.cache.get(A);y||(i=new u(s,g*p,n.count*p/l),y=new R(i,p/l),e.cache.add(A,y)),o=new N(y,a,f%p/l,d)}else i=null===s?new u(n.count*a):new u(s,f,n.count*a),o=new h(i,a,d);if(void 0!==n.sparse){var v=dC.SCALAR,m=cC[n.sparse.indices.componentType],_=n.sparse.indices.byteOffset||0,I=n.sparse.values.byteOffset||0,E=new m(t[1],_,n.sparse.count*v),x=new u(t[2],I,n.sparse.count*a);null!==s&&(o=new h(o.array.slice(),o.itemSize,o.normalized));for(var w=0,C=E.length;w<C;w++){var b=E[w];if(o.setX(b,x[w*a]),a>=2&&o.setY(b,x[w*a+1]),a>=3&&o.setZ(b,x[w*a+2]),a>=4&&o.setW(b,x[w*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))}},{key:"loadTexture",value:function(t){var e=this.json,r=this.options,n=e.textures[t].source,i=e.images[n],o=this.textureLoader;if(i.uri){var s=r.manager.getHandler(i.uri);null!==s&&(o=s)}return this.loadTextureImage(t,n,o)}},{key:"loadTextureImage",value:function(t,e,r){var n=this,i=this.json,o=i.textures[t],s=i.images[e],a=(s.uri||s.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];var u=this.loadImageSource(e,r).then((function(e){e.flipY=!1,e.name=o.name||s.name||"",""===e.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(e.name=s.uri);var r=(i.samplers||{})[o.sampler]||{};return e.magFilter=fC[r.magFilter]||P,e.minFilter=fC[r.minFilter]||D,e.wrapS=pC[r.wrapS]||k,e.wrapT=pC[r.wrapT]||k,n.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[a]=u,u}},{key:"loadImageSource",value:function(t,e){var r=this.json,n=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((function(t){return t.clone()}));var i=r.images[t],o=self.URL||self.webkitURL,s=i.uri||"",a=!1;if(void 0!==i.bufferView)s=this.getDependency("bufferView",i.bufferView).then((function(t){a=!0;var e=new Blob([t],{type:i.mimeType});return s=o.createObjectURL(e)}));else if(void 0===i.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");var u=Promise.resolve(s).then((function(t){return new Promise((function(r,i){var o=r;!0===e.isImageBitmapLoader&&(o=function(t){var e=new dt(t);e.needsUpdate=!0,r(e)}),e.load(y.resolveURL(t,n.path),o,void 0,i)}))})).then((function(t){var e;return!0===a&&o.revokeObjectURL(s),t.userData.mimeType=i.mimeType||((e=i.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),t}));return this.sourceCache[t]=u,u}},{key:"assignTexture",value:function(t,e,r,n){var i=this;return this.getDependency("texture",r.index).then((function(o){if(!o)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((o=o.clone()).channel=r.texCoord),i.extensions[kw.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[kw.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var a=i.associations.get(o);o=i.extensions[kw.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),i.associations.set(o,a)}}return void 0!==n&&(o.colorSpace=n),t[e]=o,o}))}},{key:"assignFinalMaterial",value:function(t){var e=t.geometry,r=t.material,n=void 0===e.attributes.tangent,i=void 0!==e.attributes.color,o=void 0===e.attributes.normal;if(t.isPoints){var s="PointsMaterial:"+r.uuid,a=this.cache.get(s);a||(a=new F,Q.prototype.copy.call(a,r),a.color.copy(r.color),a.map=r.map,a.sizeAttenuation=!1,this.cache.add(s,a)),r=a}else if(t.isLine){var u="LineBasicMaterial:"+r.uuid,l=this.cache.get(u);l||(l=new O,Q.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(u,l)),r=l}if(n||i||o){var h="ClonedMaterial:"+r.uuid+":";n&&(h+="derivative-tangents:"),i&&(h+="vertex-colors:"),o&&(h+="flat-shading:");var c=this.cache.get(h);c||(c=r.clone(),i&&(c.vertexColors=!0),o&&(c.flatShading=!0),n&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(h,c),this.associations.set(c,this.associations.get(r))),r=c}t.material=r}},{key:"getMaterialType",value:function(){return U}},{key:"loadMaterial",value:function(t){var e,r=this,n=this.json,i=this.extensions,o=n.materials[t],s={},a=[];if((o.extensions||{})[kw.KHR_MATERIALS_UNLIT]){var u=i[kw.KHR_MATERIALS_UNLIT];e=u.getMaterialType(),a.push(u.extendParams(s,o,r))}else{var l=o.pbrMetallicRoughness||{};if(s.color=new d(1,1,1),s.opacity=1,Array.isArray(l.baseColorFactor)){var h=l.baseColorFactor;s.color.setRGB(h[0],h[1],h[2],_),s.opacity=h[3]}void 0!==l.baseColorTexture&&a.push(r.assignTexture(s,"map",l.baseColorTexture,C)),s.metalness=void 0!==l.metallicFactor?l.metallicFactor:1,s.roughness=void 0!==l.roughnessFactor?l.roughnessFactor:1,void 0!==l.metallicRoughnessTexture&&(a.push(r.assignTexture(s,"metalnessMap",l.metallicRoughnessTexture)),a.push(r.assignTexture(s,"roughnessMap",l.metallicRoughnessTexture))),e=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),a.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,s)}))))}!0===o.doubleSided&&(s.side=G);var c=o.alphaMode||vC;if(c===_C?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,c===mC&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&e!==w&&(a.push(r.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new S(1,1),void 0!==o.normalTexture.scale)){var f=o.normalTexture.scale;s.normalScale.set(f,f)}if(void 0!==o.occlusionTexture&&e!==w&&(a.push(r.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&e!==w){var p=o.emissiveFactor;s.emissive=(new d).setRGB(p[0],p[1],p[2],_)}return void 0!==o.emissiveTexture&&e!==w&&a.push(r.assignTexture(s,"emissiveMap",o.emissiveTexture,C)),Promise.all(a).then((function(){var n=new e(s);return o.name&&(n.name=o.name),EC(n,o),r.associations.set(n,{materials:t}),o.extensions&&IC(i,n,o),n}))}},{key:"createUniqueName",value:function(t){var e=z.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}},{key:"loadGeometries",value:function(t){var e=this,r=this.extensions,n=this.primitiveCache;function i(t){return r[kw.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(r){return MC(r,t,e)}))}for(var o=[],s=0,a=t.length;s<a;s++){var u=t[s],h=wC(u),c=n[h];if(c)o.push(c.promise);else{var f=void 0;f=u.extensions&&u.extensions[kw.KHR_DRACO_MESH_COMPRESSION]?i(u):MC(new l,u,e),n[h]={primitive:u,promise:f},o.push(f)}}return Promise.all(o)}},{key:"loadMesh",value:function(t){for(var e,r=this,n=this.json,i=this.extensions,o=n.meshes[t],s=o.primitives,a=[],u=0,l=s.length;u<l;u++){var h=void 0===s[u].material?(void 0===(e=this.cache).DefaultMaterial&&(e.DefaultMaterial=new U({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ct})),e.DefaultMaterial):this.getDependency("material",s[u].material);a.push(h)}return a.push(r.loadGeometries(s)),Promise.all(a).then((function(e){for(var n=e.slice(0,e.length-1),a=e[e.length-1],u=[],l=0,h=a.length;l<h;l++){var c=a[l],d=s[l],g=void 0,A=n[l];if(d.mode===hC.TRIANGLES||d.mode===hC.TRIANGLE_STRIP||d.mode===hC.TRIANGLE_FAN||void 0===d.mode)!0===(g=!0===o.isSkinnedMesh?new j(c,A):new V(c,A)).isSkinnedMesh&&g.normalizeSkinWeights(),d.mode===hC.TRIANGLE_STRIP?g.geometry=XE(g.geometry,p):d.mode===hC.TRIANGLE_FAN&&(g.geometry=XE(g.geometry,f));else if(d.mode===hC.LINES)g=new H(c,A);else if(d.mode===hC.LINE_STRIP)g=new q(c,A);else if(d.mode===hC.LINE_LOOP)g=new Y(c,A);else{if(d.mode!==hC.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);g=new X(c,A)}Object.keys(g.geometry.morphAttributes).length>0&&xC(g,o),g.name=r.createUniqueName(o.name||"mesh_"+t),EC(g,o),d.extensions&&IC(i,g,d),r.assignFinalMaterial(g),u.push(g)}for(var y=0,v=u.length;y<v;y++)r.associations.set(u[y],{meshes:t,primitives:y});if(1===u.length)return o.extensions&&IC(i,u[0],o),u[0];var m=new W;o.extensions&&IC(i,m,o),r.associations.set(m,{meshes:t});for(var _=0,I=u.length;_<I;_++)m.add(u[_]);return m}))}},{key:"loadCamera",value:function(t){var e,r=this.json.cameras[t],n=r[r.type];if(n)return"perspective"===r.type?e=new J(K.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(e=new Z(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(e.name=this.createUniqueName(r.name)),EC(e,r),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(t){for(var e=this.json.skins[t],r=[],n=0,i=e.joints.length;n<i;n++)r.push(this._loadNodeShallow(e.joints[n]));return void 0!==e.inverseBindMatrices?r.push(this.getDependency("accessor",e.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(t){for(var r=t.pop(),n=t,i=[],o=[],s=0,a=n.length;s<a;s++){var u=n[s];if(u){i.push(u);var l=new A;null!==r&&l.fromArray(r.array,16*s),o.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[s])}return new $(i,o)}))}},{key:"loadAnimation",value:function(t){for(var e=this.json,r=this,n=e.animations[t],i=n.name?n.name:"animation_"+t,o=[],s=[],a=[],u=[],l=[],h=0,c=n.channels.length;h<c;h++){var f=n.channels[h],p=n.samplers[f.sampler],d=f.target,g=d.node,A=void 0!==n.parameters?n.parameters[p.input]:p.input,y=void 0!==n.parameters?n.parameters[p.output]:p.output;void 0!==d.node&&(o.push(this.getDependency("node",g)),s.push(this.getDependency("accessor",A)),a.push(this.getDependency("accessor",y)),u.push(p),l.push(d))}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(a),Promise.all(u),Promise.all(l)]).then((function(t){for(var e=t[0],n=t[1],o=t[2],s=t[3],a=t[4],u=[],l=0,h=e.length;l<h;l++){var c=e[l],f=n[l],p=o[l],d=s[l],g=a[l];if(void 0!==c){c.updateMatrix&&c.updateMatrix();var A=r._createAnimationTracks(c,f,p,d,g);if(A)for(var y=0;y<A.length;y++)u.push(A[y])}}return new tt(i,void 0,u)}))}},{key:"createNodeMesh",value:function(t){var e=this.json,r=this,n=e.nodes[t];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(t){var e=r._getNodeRef(r.meshCache,n.mesh,t);return void 0!==n.weights&&e.traverse((function(t){if(t.isMesh)for(var e=0,r=n.weights.length;e<r;e++)t.morphTargetInfluences[e]=n.weights[e]})),e}))}},{key:"loadNode",value:function(t){for(var e=this,r=this.json.nodes[t],n=e._loadNodeShallow(t),i=[],o=r.children||[],s=0,a=o.length;s<a;s++)i.push(e.getDependency("node",o[s]));var u=void 0===r.skin?Promise.resolve(null):e.getDependency("skin",r.skin);return Promise.all([n,Promise.all(i),u]).then((function(t){var e=t[0],r=t[1],n=t[2];null!==n&&e.traverse((function(t){t.isSkinnedMesh&&t.bind(n,SC)}));for(var i=0,o=r.length;i<o;i++)e.add(r[i]);return e}))}},{key:"_loadNodeShallow",value:function(t){var e=this.json,r=this.extensions,n=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];var i=e.nodes[t],o=i.name?n.createUniqueName(i.name):"",s=[],a=n._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return a&&s.push(a),void 0!==i.camera&&s.push(n.getDependency("camera",i.camera).then((function(t){return n._getNodeRef(n.cameraCache,i.camera,t)}))),n._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){s.push(t)})),this.nodeCache[t]=Promise.all(s).then((function(e){var s;if((s=!0===i.isBone?new et:e.length>1?new W:1===e.length?e[0]:new L)!==e[0])for(var a=0,u=e.length;a<u;a++)s.add(e[a]);if(i.name&&(s.userData.name=i.name,s.name=o),EC(s,i),i.extensions&&IC(r,s,i),void 0!==i.matrix){var l=new A;l.fromArray(i.matrix),s.applyMatrix4(l)}else void 0!==i.translation&&s.position.fromArray(i.translation),void 0!==i.rotation&&s.quaternion.fromArray(i.rotation),void 0!==i.scale&&s.scale.fromArray(i.scale);return n.associations.has(s)||n.associations.set(s,{}),n.associations.get(s).nodes=t,s})),this.nodeCache[t]}},{key:"loadScene",value:function(t){var e=this.extensions,r=this.json.scenes[t],n=this,i=new W;r.name&&(i.name=n.createUniqueName(r.name)),EC(i,r),r.extensions&&IC(e,i,r);for(var o=r.nodes||[],s=[],a=0,u=o.length;a<u;a++)s.push(n.getDependency("node",o[a]));return Promise.all(s).then((function(t){for(var e=0,r=t.length;e<r;e++)i.add(t[e]);return n.associations=function(t){var e,r=new Map,i=yr(n.associations);try{for(i.s();!(e=i.n()).done;){var o=pr(e.value,2),s=o[0],a=o[1];(s instanceof Q||s instanceof dt)&&r.set(s,a)}}catch(t){i.e(t)}finally{i.f()}return t.traverse((function(t){var e=n.associations.get(t);null!=e&&r.set(t,e)})),r}(i),i}))}},{key:"_createAnimationTracks",value:function(t,e,r,n,i){var o,s=[],a=t.name?t.name:t.uuid,u=[];switch(AC[i.path]===AC.weights?t.traverse((function(t){t.morphTargetInfluences&&u.push(t.name?t.name:t.uuid)})):u.push(a),AC[i.path]){case AC.weights:o=At;break;case AC.rotation:o=yt;break;case AC.position:case AC.scale:o=gt;break;default:if(1===r.itemSize)o=At;else o=gt}for(var l=void 0!==n.interpolation?yC[n.interpolation]:rt,h=this._getArrayFromAccessor(r),c=0,f=u.length;c<f;c++){var p=new o(u[c]+"."+AC[i.path],e.array,h,l);"CUBICSPLINE"===n.interpolation&&this._createCubicSplineTrackInterpolant(p),s.push(p)}return s}},{key:"_getArrayFromAccessor",value:function(t){var e=t.array;if(t.normalized){for(var r=bC(e.constructor),n=new Float32Array(e.length),i=0,o=e.length;i<o;i++)n[i]=e[i]*r;e=n}return e}},{key:"_createCubicSplineTrackInterpolant",value:function(t){t.createInterpolant=function(t){return new(this instanceof yt?lC:aC)(this.times,this.values,this.getValueSize()/3,t)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}]),t}();function MC(t,e,r){var n=e.attributes,i=[];function o(e,n){return r.getDependency("accessor",e).then((function(e){t.setAttribute(n,e)}))}for(var s in n){var a=gC[s]||s.toLowerCase();a in t.attributes||i.push(o(n[s],a))}if(void 0!==e.indices&&!t.index){var u=r.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));i.push(u)}return nt.workingColorSpace!==_&&"COLOR_0"in n&&console.warn('THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "'.concat(nt.workingColorSpace,'" not supported.')),EC(t,e),function(t,e,r){var n=e.attributes,i=new vt;if(void 0!==n.POSITION){var o=r.json.accessors[n.POSITION],s=o.min,a=o.max;if(void 0!==s&&void 0!==a){if(i.set(new B(s[0],s[1],s[2]),new B(a[0],a[1],a[2])),o.normalized){var u=bC(cC[o.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}var l=e.targets;if(void 0!==l){for(var h=new B,c=new B,f=0,p=l.length;f<p;f++){var d=l[f];if(void 0!==d.POSITION){var g=r.json.accessors[d.POSITION],A=g.min,y=g.max;if(void 0!==A&&void 0!==y){if(c.setX(Math.max(Math.abs(A[0]),Math.abs(y[0]))),c.setY(Math.max(Math.abs(A[1]),Math.abs(y[1]))),c.setZ(Math.max(Math.abs(A[2]),Math.abs(y[2]))),g.normalized){var v=bC(cC[g.componentType]);c.multiplyScalar(v)}h.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(h)}t.boundingBox=i;var m=new mt;i.getCenter(m.center),m.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,e,r),Promise.all(i).then((function(){return void 0!==e.targets?function(t,e,r){for(var n=!1,i=!1,o=!1,s=0,a=e.length;s<a;s++){var u=e[s];if(void 0!==u.POSITION&&(n=!0),void 0!==u.NORMAL&&(i=!0),void 0!==u.COLOR_0&&(o=!0),n&&i&&o)break}if(!n&&!i&&!o)return Promise.resolve(t);for(var l=[],h=[],c=[],f=0,p=e.length;f<p;f++){var d=e[f];if(n){var g=void 0!==d.POSITION?r.getDependency("accessor",d.POSITION):t.attributes.position;l.push(g)}if(i){var A=void 0!==d.NORMAL?r.getDependency("accessor",d.NORMAL):t.attributes.normal;h.push(A)}if(o){var y=void 0!==d.COLOR_0?r.getDependency("accessor",d.COLOR_0):t.attributes.color;c.push(y)}}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c)]).then((function(e){var r=e[0],s=e[1],a=e[2];return n&&(t.morphAttributes.position=r),i&&(t.morphAttributes.normal=s),o&&(t.morphAttributes.color=a),t.morphTargetsRelative=!0,t}))}(t,e.targets,r):t}))}var TC=function(t){rr(r,Nw);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It;return Ze(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new A,t}return tr(r,[{key:"parse",value:function(t){var e=this,n=hr(nr(r.prototype),"parse",this).call(this,t),i=n.glbBytes.slice().buffer;return new Promise((function(t,r){var o=e.manager,s=e.fetchOptions,a=o.getHandler("path.gltf")||new Pw(o);"include"===s.credentials&&"cors"===s.mode&&a.setCrossOrigin("use-credentials"),"credentials"in s&&a.setWithCredentials("include"===s.credentials),s.headers&&a.setRequestHeader(s.headers);var u=e.workingPath;!/[\\/]$/.test(u)&&u.length&&(u+="/");var l=e.adjustmentTransform;a.parse(i,u,(function(e){var r=n.batchTable,i=n.featureTable,o=e.scene,s=i.getData("RTC_CENTER");s&&(o.position.x+=s[0],o.position.y+=s[1],o.position.z+=s[2]),e.scene.updateMatrix(),e.scene.matrix.multiply(l),e.scene.matrix.decompose(e.scene.position,e.scene.quaternion,e.scene.scale),e.batchTable=r,e.featureTable=i,o.batchTable=r,o.featureTable=i,t(e)}),r)}))}}]),r}(),LC=function(t){rr(r,Lw);var e=ur(r);function r(){return Ze(this,r),e.apply(this,arguments)}return tr(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Rw(e);console.assert("pnts"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=t.slice(28,28+o+s),h=new Mw(l,0,o,s),c=28+o+s,f=t.slice(c,c+a+u),p=new Tw(f,h.getData("BATCH_LENGTH")||h.getData("POINTS_LENGTH"),0,a,u);return Promise.resolve({version:n,featureTable:h,batchTable:p})}}]),r}();var RC={RGB:"color",POSITION:"position"},NC=function(t){rr(r,LC);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It;return Ze(this,r),(t=e.call(this)).manager=n,t}return tr(r,[{key:"parse",value:function(t){var e=this;return hr(nr(r.prototype),"parse",this).call(this,t).then(function(){var t=Ke(Xe().mark((function t(r){var n,i,o,s,a,u,c,f,p,g,A,y,v,m,_,I,E,x,w,C,b,S,M,T,L,R,N,P,D,k,Q,O,U,G,z;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r.featureTable,i=new F,o=n.header.extensions,s=new B,!o||!o["3DTILES_draco_point_compression"]){t.next=19;break}if(u=o["3DTILES_draco_point_compression"],c=u.byteOffset,f=u.byteLength,p=u.properties,null!=(g=e.manager.getHandler("draco.drc"))){t.next=9;break}throw new Error("PNTSLoader: dracoLoader not available.");case 9:for(y in A={},p)y in RC&&y in p&&(A[RC[y]]=p[y]);return v={attributeIDs:A,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},m=n.getBuffer(c,f),t.next=15,g.decodeGeometry(m,v);case 15:(a=t.sent).attributes.color&&(i.vertexColors=!0),t.next=31;break;case 19:if(_=n.getData("POINTS_LENGTH"),I=n.getData("POSITION",_,"FLOAT","VEC3"),E=n.getData("RGB",_,"UNSIGNED_BYTE","VEC3"),x=n.getData("RGBA",_,"UNSIGNED_BYTE","VEC4"),w=n.getData("RGB565",_,"UNSIGNED_SHORT","SCALAR"),C=n.getData("CONSTANT_RGBA",_,"UNSIGNED_BYTE","VEC4"),b=n.getData("POSITION_QUANTIZED",_,"UNSIGNED_SHORT","VEC3"),S=n.getData("QUANTIZED_VOLUME_SCALE",_,"FLOAT","VEC3"),M=n.getData("QUANTIZED_VOLUME_OFFSET",_,"FLOAT","VEC3"),a=new l,b){for(T=new Float32Array(3*_),L=0;L<_;L++)for(R=0;R<3;R++)T[N=3*L+R]=b[N]/65535*S[R];s.x=M[0],s.y=M[1],s.z=M[2],a.setAttribute("position",new h(T,3,!1))}else a.setAttribute("position",new h(I,3,!1));if(null!==x)a.setAttribute("color",new h(x,4,!0)),i.vertexColors=!0,i.transparent=!0,i.depthWrite=!1;else if(null!==E)a.setAttribute("color",new h(E,3,!0)),i.vertexColors=!0;else if(null!==w){for(P=new Uint8Array(3*_),D=0;D<_;D++)for(j=w[D],V=void 0,H=void 0,q=void 0,V=j>>11,H=j>>5&63,q=31&j,k=[Math.round(V/31*255),Math.round(H/63*255),Math.round(q/31*255)],Q=0;Q<3;Q++)P[3*D+Q]=k[Q];a.setAttribute("color",new h(P,3,!0)),i.vertexColors=!0}else null!==C&&(O=new d(C[0],C[1],C[2]),i.color=O,(U=C[3]/255)<1&&(i.opacity=U,i.transparent=!0,i.depthWrite=!1));case 31:return["BATCH_LENGTH","NORMAL","NORMAL_OCT16P"].forEach((function(t){t in n.header&&console.warn('PNTSLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))})),(G=new X(a,i)).position.copy(s),r.scene=G,r.scene.featureTable=n,(z=n.getData("RTC_CENTER"))&&(r.scene.position.x+=z[0],r.scene.position.y+=z[1],r.scene.position.z+=z[2]),t.abrupt("return",r);case 39:case"end":return t.stop()}var j,V,H,q}),t)})));return function(e){return t.apply(this,arguments)}}())}}]),r}(),PC=function(t){rr(r,Lw);var e=ur(r);function r(){return Ze(this,r),e.apply(this,arguments)}return tr(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Rw(e);console.assert("i3dm"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=e.getUint32(28,!0),h=t.slice(32,32+o+s),c=new Mw(h,0,o,s),f=32+o+s,p=t.slice(f,f+a+u),d=new Tw(p,c.getData("INSTANCES_LENGTH"),0,a,u),g=f+a+u,A=new Uint8Array(t,g,i-g),y=null,v=null;if(l)y=A,v=Promise.resolve();else{var m=this.resolveExternalURL(Bw(A));v=fetch(m,this.fetchOptions).then((function(t){if(!t.ok)throw new Error('I3DMLoaderBase : Failed to load file "'.concat(m,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()})).then((function(t){y=new Uint8Array(t)}))}return v.then((function(){return{version:n,featureTable:c,batchTable:d,glbBytes:y}}))}}]),r}(),DC=new B,kC=new B,FC=new B,QC=new B,OC=new g,UC=new B,GC=new A,zC=function(t){rr(r,PC);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It;return Ze(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new A,t}return tr(r,[{key:"resolveExternalURL",value:function(t){return this.manager.resolveURL(hr(nr(r.prototype),"resolveExternalURL",this).call(this,t))}},{key:"parse",value:function(t){var e=this;return hr(nr(r.prototype),"parse",this).call(this,t).then((function(t){var r=t.featureTable,n=t.batchTable,i=t.glbBytes.slice().buffer;return new Promise((function(t,o){var s=e.fetchOptions,a=e.manager,u=a.getHandler("path.gltf")||new Pw(a);"include"===s.credentials&&"cors"===s.mode&&u.setCrossOrigin("use-credentials"),"credentials"in s&&u.setWithCredentials("include"===s.credentials),s.headers&&u.setRequestHeader(s.headers);var l=e.workingPath;/[\\/]$/.test(l)||(l+="/");var h=e.adjustmentTransform;u.parse(i,l,(function(e){var i=r.getData("INSTANCES_LENGTH"),o=r.getData("POSITION",i,"FLOAT","VEC3"),s=r.getData("NORMAL_UP",i,"FLOAT","VEC3"),a=r.getData("NORMAL_RIGHT",i,"FLOAT","VEC3"),u=r.getData("SCALE_NON_UNIFORM",i,"FLOAT","VEC3"),l=r.getData("SCALE",i,"FLOAT","SCALAR");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","EAST_NORTH_UP","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach((function(t){t in r.header&&console.warn('I3DMLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))}));var c=new Map,f=[];e.scene.traverse((function(t){if(t.isMesh){var e=t.geometry,r=t.material,n=new M(e,r,i);n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),f.push(n),c.set(t,n)}}));for(var p=new B,d=0;d<i;d++)p.x+=o[3*d+0]/i,p.y+=o[3*d+1]/i,p.z+=o[3*d+2]/i;c.forEach((function(t,e){var r=e.parent;r&&(r.remove(e),r.add(t),t.updateMatrixWorld(),t.position.copy(p).applyMatrix4(t.matrixWorld))}));for(var g=0;g<i;g++){QC.set(o[3*g+0]-p.x,o[3*g+1]-p.y,o[3*g+2]-p.z),s?(kC.set(s[3*g+0],s[3*g+1],s[3*g+2]),FC.set(a[3*g+0],a[3*g+1],a[3*g+2]),DC.crossVectors(FC,kC).normalize(),GC.makeBasis(FC,kC,DC),OC.setFromRotationMatrix(GC)):OC.set(0,0,0,1),l?UC.setScalar(l[g]):u?UC.set(u[3*g+0],u[3*g+1],u[3*g+2]):UC.set(1,1,1),GC.compose(QC,OC,UC).multiply(h);for(var A=0,y=f.length;A<y;A++){f[A].setMatrixAt(g,GC)}}e.batchTable=n,e.featureTable=r,e.scene.batchTable=n,e.scene.featureTable=r,t(e)}),o)}))}))}}]),r}(),jC=function(t){rr(r,Lw);var e=ur(r);function r(){return Ze(this,r),e.apply(this,arguments)}return tr(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Rw(e);console.assert("cmpt"===r,'CMPTLoader: The magic bytes equal "cmpt".');var n=e.getUint32(4,!0);console.assert(1===n,'CMPTLoader: The version listed in the header is "1".');var i=e.getUint32(8,!0);console.assert(i===t.byteLength,"CMPTLoader: The contents buffer length listed in the header matches the file.");for(var o=e.getUint32(12,!0),s=[],a=16,u=0;u<o;u++){var l=new DataView(t,a,12),h=Rw(l),c=l.getUint32(4,!0),f=l.getUint32(8,!0),p=new Uint8Array(t,a,f);s.push({type:h,buffer:p,version:c}),a+=f}return{version:n,tiles:s}}}]),r}(),VC=function(t){rr(r,jC);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It;return Ze(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new A,t}return tr(r,[{key:"parse",value:function(t){var e=hr(nr(r.prototype),"parse",this).call(this,t),n=this.manager,i=this.adjustmentTransform,o=[];for(var s in e.tiles){var a=e.tiles[s],u=a.type,l=a.buffer;switch(u){case"b3dm":var h=l.slice(),c=new TC(n);c.workingPath=this.workingPath,c.fetchOptions=this.fetchOptions,c.adjustmentTransform.copy(i);var f=c.parse(h.buffer);o.push(f);break;case"pnts":var p=l.slice(),d=new NC(n);d.workingPath=this.workingPath,d.fetchOptions=this.fetchOptions;var g=d.parse(p.buffer);o.push(g);break;case"i3dm":var A=l.slice(),y=new zC(n);y.workingPath=this.workingPath,y.fetchOptions=this.fetchOptions,y.adjustmentTransform.copy(i);var v=y.parse(A.buffer);o.push(v)}}return Promise.all(o).then((function(t){var e=new W;return t.forEach((function(t){e.add(t.scene)})),{tiles:t,scene:e}}))}}]),r}(),HC=function(){function t(){Ze(this,t),this.name="CESIUM_RTC"}return tr(t,[{key:"afterRoot",value:function(t){if(t.parser.json.extensions&&t.parser.json.extensions.CESIUM_RTC){var e=t.parser.json.extensions.CESIUM_RTC.center;e&&(t.scene.position.x+=e[0],t.scene.position.y+=e[1],t.scene.position.z+=e[2])}}}]),t}(),qC=function(t){rr(r,Lw);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It;return Ze(this,r),(t=e.call(this)).manager=n,t}return tr(r,[{key:"parse",value:function(t){var e=this;return new Promise((function(r,n){var i=e.manager,o=e.fetchOptions,s=i.getHandler("path.gltf")||i.getHandler("path.glb");s||((s=new Pw(i)).register((function(){return new HC})),"include"===o.credentials&&"cors"===o.mode&&s.setCrossOrigin("use-credentials"),"credentials"in o&&s.setWithCredentials("include"===o.credentials),o.headers&&s.setRequestHeader(o.headers));var a=s.resourcePath||s.path||e.workingPath;!/[\\/]$/.test(a)&&a.length&&(a+="/"),s.parse(t,a,(function(t){r(t)}),n)}))}}]),r}(),YC=new A,XC=function(t){rr(r,W);var e=ur(r);function r(t){var n;return Ze(this,r),(n=e.call(this)).name="TilesRenderer.TilesGroup",n.tilesRenderer=t,n}return tr(r,[{key:"raycast",value:function(t,e){this.tilesRenderer.optimizeRaycast&&this.tilesRenderer.raycast(t,e)}},{key:"updateMatrixWorld",value:function(t){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||t){null===this.parent?YC.copy(this.matrix):YC.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;for(var e=YC.elements,r=this.matrixWorld.elements,n=!1,i=0;i<16;i++){var o=e[i],s=r[i];if(Math.abs(o-s)>Number.EPSILON){n=!0;break}}if(n){this.matrixWorld.copy(YC);for(var a=this.children,u=0,l=a.length;u<l;u++)a[u].updateMatrixWorld()}}}}]),r}(),WC=new A,JC=new Et,KC=new B,ZC=[];function $C(t,e){return t.distance-e.distance}function tb(t,e,r){t.traverse((function(t){Object.getPrototypeOf(t).raycast.call(t,e,r)}))}function eb(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=t.group,o=t.activeTiles;t.ensureChildrenArePreprocessed(e),null===n&&(n=JC,WC.copy(i.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(WC));for(var s=[],a=e.children,u=0,l=a.length;u<l;u++){var h=a[u];if(h.__used)null!==h.cached.boundingVolume.intersectRay(n,KC)&&(KC.applyMatrix4(i.matrixWorld),s.push({distance:KC.distanceToSquared(r.ray.origin),tile:h}))}s.sort($C);var c=null,f=1/0;if(o.has(e)){var p=function(t,e){tb(t,e,ZC),ZC.sort($C);var r=ZC[0]||null;return ZC.length=0,r}(e.cached.scene,r);p&&(c=p,f=p.distance*p.distance)}for(var d=0,g=s.length;d<g;d++){var A=s[d],y=A.distance,v=A.tile;if(y>f)break;var m=eb(t,v,r,n);if(m){var _=m.distance*m.distance;_<f&&(c=m,f=_)}}return c}function rb(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=t.group,s=t.activeTiles,a=e.cached,u=a.scene,l=a.boundingVolume;if(t.ensureChildrenArePreprocessed(e),null===i&&(i=JC,WC.copy(o.matrixWorld).invert(),i.copy(r.ray).applyMatrix4(WC)),e.__used&&l.intersectsRay(i)){s.has(e)&&tb(u,r,n);for(var h=e.children,c=0,f=h.length;c<f;c++)rb(t,h[c],r,n,i)}}var nb=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new vt,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new A;Ze(this,t),this.box=e.clone(),this.transform=r.clone(),this.inverseTransform=new A,this.points=new Array(8).fill().map((function(){return new B}))}return tr(t,[{key:"update",value:function(){var t=this.points,e=this.inverseTransform,r=this.transform,n=this.box;e.copy(r).invert();for(var i=n.min,o=n.max,s=0,a=-1;a<=1;a+=2)for(var u=-1;u<=1;u+=2)for(var l=-1;l<=1;l+=2)t[s].set(a<0?i.x:o.x,u<0?i.y:o.y,l<0?i.z:o.z).applyMatrix4(r),s++}},{key:"intersectsFrustum",value:function(t){for(var e=this.points,r=t.planes,n=0;n<6;n++){for(var i=r[n],o=-1/0,s=0;s<8;s++){var a=e[s],u=i.distanceToPoint(a);o=o<u?u:o}if(o<0)return!1}return!0}}]),t}(),ib=new xt,ob=new B,sb={};function ab(t){var e=t.x,r=t.y,n=t.z;t.x=n,t.y=e,t.z=r}function ub(t){return-(t-Math.PI/2)}function lb(t){return-t+Math.PI/2}function hb(t){var e=t<0?arguments.length>2&&void 0!==arguments[2]?arguments[2]:"W":arguments.length>1&&void 0!==arguments[1]?arguments[1]:"E",r=~~(t=Math.abs(t)),n=60*(t-r),i=~~n,o=~~(60*(n-i));return"".concat(r,"° ").concat(i,"' ").concat(o,'" ').concat(e)}var cb=Object.freeze({__proto__:null,swapToGeoFrame:ab,swapToThreeFrame:function(t){var e=t.x,r=t.y,n=t.z;t.z=e,t.x=r,t.y=n},sphericalPhiToLatitude:ub,latitudeToSphericalPhi:lb,toLatLonString:function(t,e){var r,n,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ib.theta=e,ib.phi=lb(t),ob.setFromSpherical(ib),ib.setFromVector3(ob),r.lat=ub(ib.phi),r.lon=ib.theta,r}(t,e,sb);return i?(r="".concat((K.RAD2DEG*o.lat).toFixed(4),"°"),n="".concat((K.RAD2DEG*o.lon).toFixed(4),"°")):(r=hb(K.RAD2DEG*o.lat,"N","S"),n=hb(K.RAD2DEG*o.lon,"E","W")),"".concat(r," ").concat(n)}}),fb=new xt,pb=new B,db=new B,gb=new B,Ab=new B,yb=new B,vb=new B,mb=new B,_b=new B,Ib=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;Ze(this,t),this.radius=new B(e,r,n)}return tr(t,[{key:"constructLatLonFrame",value:function(t,e,r){return this.getCartographicToPosition(t,e,0,_b),this.getCartographicToNormal(t,e,mb),this.getNorthernTangent(t,e,vb),yb.crossVectors(vb,mb),r.makeBasis(yb,vb,mb).setPosition(_b)}},{key:"getNorthernTangent",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ab,i=1,o=t+1e-7;t>Math.PI/4&&(i=-1,o=t-1e-7);var s=this.getCartographicToNormal(t,e,db).normalize(),a=this.getCartographicToNormal(o,e,gb).normalize();return n.crossVectors(s,a).normalize().multiplyScalar(i),r.crossVectors(n,s).normalize()}},{key:"getCartographicToPosition",value:function(t,e,r,n){this.getCartographicToNormal(t,e,pb);var i=this.radius;db.copy(pb),db.x*=Math.pow(i.x,2),db.y*=Math.pow(i.y,2),db.z*=Math.pow(i.z,2);var o=Math.sqrt(pb.dot(db));return db.divideScalar(o),n.copy(db).addScaledVector(pb,r)}},{key:"getPositionToCartographic",value:function(t,e){this.getPositionToSurfacePoint(t,db),this.getPositionToNormal(t,pb);var r=gb.subVectors(t,db);return e.lon=Math.atan2(pb.y,pb.x),e.lat=Math.asin(pb.z),e.height=Math.sign(r.dot(t))*r.length(),e}},{key:"getCartographicToNormal",value:function(t,e,r){return fb.set(1,lb(t),e),r.setFromSpherical(fb).normalize(),ab(r),r}},{key:"getPositionToNormal",value:function(t,e){var r=this.radius;return e.copy(t),e.x/=Math.pow(r.x,2),e.y/=Math.pow(r.y,2),e.z/=Math.pow(r.z,2),e.normalize(),e}},{key:"getPositionToSurfacePoint",value:function(t,e){var r=this.radius,n=1/Math.pow(r.x,2),i=1/Math.pow(r.y,2),o=1/Math.pow(r.z,2),s=t.x*t.x*n,a=t.y*t.y*i,u=t.z*t.z*o,l=s+a+u,h=Math.sqrt(1/l),c=db.copy(t).multiplyScalar(h);if(l<.1)return isFinite(h)?e.copy(c):null;var f,p,d,g,A,y,v,m=gb.set(c.x*n*2,c.y*i*2,c.z*o*2),_=(1-h)*t.length()/(.5*m.length()),I=0;do{I=(f=s*(A=(p=1/(1+(_-=I)*n))*p)+a*(y=(d=1/(1+_*i))*d)+u*(v=(g=1/(1+_*o))*g)-1)/(-2*(s*(A*p)*n+a*(y*d)*i+u*(v*g)*o))}while(Math.abs(f)>1e-12);return e.set(t.x*p,t.y*d,t.z*g)}}]),t}(),Eb=Math.PI,xb=Eb/2,wb=new B,Cb=new B,bb=new B,Sb=new A,Bb=0,Mb=[];function Tb(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?(Mb[Bb]||(Mb[Bb]=new B),Bb++,Mb[Bb-1]):new B}function Lb(){Bb=0}var Rb=function(t){rr(r,Ib);var e=ur(r);function r(t,n,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-xb,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:xb,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Eb,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0;return Ze(this,r),(o=e.call(this,t,n,i)).latStart=s,o.latEnd=a,o.lonStart=u,o.lonEnd=l,o.heightStart=h,o.heightEnd=c,o}return tr(r,[{key:"_getPoints",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.latStart,r=this.latEnd,n=this.lonStart,i=this.lonEnd,o=this.heightStart,s=this.heightEnd,a=K.mapLinear(.5,0,1,e,r),u=K.mapLinear(.5,0,1,n,i),l=Math.floor(n/xb)*xb,h=[[-Eb/2,0],[Eb/2,0],[0,l],[0,l+Eb/2],[0,l+Eb],[0,l+3*Eb/2],[e,i],[r,i],[e,n],[r,n],[0,n],[0,i],[a,u],[e,u],[r,u],[a,n],[a,i]],c=[],f=h.length,p=0;p<=1;p++)for(var d=K.mapLinear(p,0,1,o,s),g=0,A=f;g<A;g++){var y=pr(h[g],2),v=y[0],m=y[1];if(v>=e&&v<=r&&m>=n&&m<=i){var _=Tb(t);c.push(_),this.getCartographicToPosition(v,m,d,_)}}return c}},{key:"getBoundingBox",value:function(t,e){Lb();var r=this.latStart,n=this.latEnd,i=this.lonStart,o=this.lonEnd;if(n-r<Eb/2){var s=K.mapLinear(.5,0,1,r,n),a=K.mapLinear(.5,0,1,i,o);this.getCartographicToNormal(s,a,bb),Cb.set(0,0,1),wb.crossVectors(Cb,bb),Cb.crossVectors(wb,bb),e.makeBasis(wb,Cb,bb)}else wb.set(1,0,0),Cb.set(0,1,0),bb.set(0,0,1),e.makeBasis(wb,Cb,bb);Sb.copy(e).invert();for(var u=this._getPoints(!0),l=0,h=u.length;l<h;l++)u[l].applyMatrix4(Sb);t.makeEmpty(),t.setFromPoints(u)}},{key:"getBoundingSphere",value:function(t,e){Lb();var r=this._getPoints(!0);t.makeEmpty(),t.setFromPoints(r,e)}}]),r}();function Nb(t){return Nb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nb(t)}function Pb(t){var e=function(t,e){if("object"!==Nb(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==Nb(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===Nb(e)?e:String(e)}function Db(t,e,r){return(e=Pb(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kb(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const Fb=1/Math.PI*180,Qb=1/180*Math.PI,Ob={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function Ub(t,{precision:e=Ob.precision}={}){return t=function(t){return Math.round(t/Ob.EPSILON)*Ob.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function Gb(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function zb(t){return function(t,e){return Hb(t,(t=>t*Qb),e)}(t)}function jb(t){return function(t,e){return Hb(t,(t=>t*Fb),e)}(t)}function Vb(t,e,r){const n=Ob.EPSILON;r&&(Ob.EPSILON=r);try{if(t===e)return!0;if(Gb(t)&&Gb(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!Vb(t[r],e[r]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):"number"==typeof t&&"number"==typeof e&&Math.abs(t-e)<=Ob.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{Ob.EPSILON=n}}function Hb(t,e,r){if(Gb(t)){const n=t;r=r||function(t){return t.clone?t.clone():new Array(t.length)}(n);for(let i=0;i<r.length&&i<n.length;++i)r[i]=e(t[i],i,r);return r}return e(t)}class qb extends(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Array)){clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+e];return this.check()}toArray(t=[],e=0){for(let r=0;r<this.ELEMENTS;++r)t[e+r]=this[r];return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Gb(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Ob)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+Ub(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!Vb(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,r){if(void 0===r)return this.lerp(this,t,e);for(let n=0;n<this.ELEMENTS;++n){const i=t[n];this[n]=i+r*(e[n]-i)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),e[r]);return this.check()}add(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]+=e[t];return this.check()}subtract(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]-=e[t];return this.check()}scale(t){if("number"==typeof t)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;else for(let e=0;e<this.ELEMENTS&&e<t.length;++e)this[e]*=t[e];return this.check()}multiplyByScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}check(){if(Ob.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),e);return this.check()}get elements(){return this}}function Yb(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function Xb(t,e,r=""){if(Ob.debug&&!function(t,e){if(t.length!==e)return!1;for(let e=0;e<t.length;++e)if(!Number.isFinite(t[e]))return!1;return!0}(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}class Wb extends qb{get x(){return this[0]}set x(t){this[0]=Yb(t)}get y(){return this[1]}set y(t){this[1]=Yb(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let r=0;r<this.ELEMENTS;++r){const n=this[r]-t[r];e+=n*n}return Yb(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return Yb(e)}normalize(){const t=this.magnitude();if(0!==t)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e[t];return this.check()}divide(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return kb(t>=0&&t<this.ELEMENTS,"index is out of range"),Yb(this[t])}setComponent(t,e){return kb(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}var Jb,Kb=1e-6,Zb="undefined"!=typeof Float32Array?Float32Array:Array;function $b(t,e,r){const n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o||1;return t[0]=(r[0]*n+r[4]*i+r[8]*o)/s,t[1]=(r[1]*n+r[5]*i+r[9]*o)/s,t[2]=(r[2]*n+r[6]*i+r[10]*o)/s,t}function tS(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function eS(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Jb=new Zb(2),Zb!=Float32Array&&(Jb[0]=0,Jb[1]=0),function(){var t=function(){var t=new Zb(3);return Zb!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}()}();const rS=[0,0,0];let nS;class iS extends Wb{static get ZERO(){return nS||(nS=new iS(0,0,0),Object.freeze(nS)),nS}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&Gb(t)?this.copy(t):(Ob.debug&&(Yb(t),Yb(e),Yb(r)),this[0]=t,this[1]=e,this[2]=r)}set(t,e,r){return this[0]=t,this[1]=e,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Ob.debug&&(Yb(t.x),Yb(t.y),Yb(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=Yb(t)}angle(t){return r=t,n=(e=this)[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2],l=Math.sqrt(n*n+i*i+o*o)*Math.sqrt(s*s+a*a+u*u),h=l&&tS(e,r)/l,Math.acos(Math.min(Math.max(h,-1),1));var e,r,n,i,o,s,a,u,l,h}cross(t){return function(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2];t[0]=i*u-o*a,t[1]=o*s-n*u,t[2]=n*a-i*s}(this,this,t),this.check()}rotateX({radians:t,origin:e=rS}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}rotateY({radians:t,origin:e=rS}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=rS}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return eS(this,this,t),this.check()}transformAsVector(t){return $b(this,this,t),this.check()}transformByMatrix3(t){return function(t,e,r){var n=e[0],i=e[1],o=e[2];t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8]}(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){const n=e[0],i=e[1];t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return function(t,e,r){var n=r[0],i=r[1],o=r[2],s=r[3],a=e[0],u=e[1],l=e[2],h=i*l-o*u,c=o*a-n*l,f=n*u-i*a,p=i*f-o*c,d=o*h-n*f,g=n*c-i*h,A=2*s;h*=A,c*=A,f*=A,p*=2,d*=2,g*=2,t[0]=a+h+p,t[1]=u+c+d,t[2]=l+f+g}(this,this,t),this.check()}}class oS extends qb{toString(){let t="[";if(Ob.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+e])}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=" ".concat(this[e])}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,r){return this[e*this.RANK+t]=Yb(r),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)e[t]=this[r+t];return e}setColumn(t,e){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)this[r+t]=e[t];return this}}function sS(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],l=e[6],h=e[7],c=e[8],f=e[9],p=e[10],d=e[11],g=e[12],A=e[13],y=e[14],v=e[15],m=r[0],_=r[1],I=r[2],E=r[3];return t[0]=m*n+_*a+I*c+E*g,t[1]=m*i+_*u+I*f+E*A,t[2]=m*o+_*l+I*p+E*y,t[3]=m*s+_*h+I*d+E*v,m=r[4],_=r[5],I=r[6],E=r[7],t[4]=m*n+_*a+I*c+E*g,t[5]=m*i+_*u+I*f+E*A,t[6]=m*o+_*l+I*p+E*y,t[7]=m*s+_*h+I*d+E*v,m=r[8],_=r[9],I=r[10],E=r[11],t[8]=m*n+_*a+I*c+E*g,t[9]=m*i+_*u+I*f+E*A,t[10]=m*o+_*l+I*p+E*y,t[11]=m*s+_*h+I*d+E*v,m=r[12],_=r[13],I=r[14],E=r[15],t[12]=m*n+_*a+I*c+E*g,t[13]=m*i+_*u+I*f+E*A,t[14]=m*o+_*l+I*p+E*y,t[15]=m*s+_*h+I*d+E*v,t}var aS=function(t,e,r,n,i){var o,s=1/Math.tan(e/2);return t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n),t};var uS,lS=function(t,e,r,n,i,o,s){var a=1/(e-r),u=1/(n-i),l=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*a,t[13]=(i+n)*u,t[14]=(s+o)*l,t[15]=1,t};!function(){var t=function(){var t=new Zb(4);return Zb!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}(),function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"}(uS||(uS={}));const hS=45*Math.PI/180,cS=1,fS=.1,pS=500,dS=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class gS extends oS{static get IDENTITY(){return function(){yS||(yS=new gS,Object.freeze(yS));return yS}()}static get ZERO(){return function(){AS||(AS=new gS([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(AS));return AS}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return uS}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=o,this[6]=s,this[7]=a,this[8]=u,this[9]=l,this[10]=h,this[11]=c,this[12]=f,this[13]=p,this[14]=d,this[15]=g,this.check()}setRowMajor(t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g){return this[0]=t,this[1]=i,this[2]=u,this[3]=f,this[4]=e,this[5]=o,this[6]=l,this[7]=p,this[8]=r,this[9]=s,this[10]=h,this[11]=d,this[12]=n,this[13]=a,this[14]=c,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(dS)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=r+r,a=n+n,u=i+i,l=r*s,h=n*s,c=n*a,f=i*s,p=i*a,d=i*u,g=o*s,A=o*a,y=o*u;t[0]=1-c-d,t[1]=h+y,t[2]=f-A,t[3]=0,t[4]=h-y,t[5]=1-l-d,t[6]=p+g,t[7]=0,t[8]=f+A,t[9]=p-g,t[10]=1-l-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum(t){const{left:e,right:r,bottom:n,top:i,near:o=fS,far:s=pS}=t;return s===1/0?function(t,e,r,n,i,o){const s=2*o/(r-e),a=2*o/(i-n),u=(r+e)/(r-e),l=(i+n)/(i-n),h=-1,c=-1,f=-2*o;t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=u,t[9]=l,t[10]=h,t[11]=c,t[12]=0,t[13]=0,t[14]=f,t[15]=0}(this,e,r,n,i,o):function(t,e,r,n,i,o,s){var a=1/(r-e),u=1/(i-n),l=1/(o-s);t[0]=2*o*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(i+n)*u,t[10]=(s+o)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*l,t[15]=0}(this,e,r,n,i,o,s),this.check()}lookAt(t){const{eye:e,center:r=[0,0,0],up:n=[0,1,0]}=t;return function(t,e,r,n){var i,o,s,a,u,l,h,c,f,p,d=e[0],g=e[1],A=e[2],y=n[0],v=n[1],m=n[2],_=r[0],I=r[1],E=r[2];Math.abs(d-_)<Kb&&Math.abs(g-I)<Kb&&Math.abs(A-E)<Kb?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(h=d-_,c=g-I,f=A-E,i=v*(f*=p=1/Math.hypot(h,c,f))-m*(c*=p),o=m*(h*=p)-y*f,s=y*c-v*h,(p=Math.hypot(i,o,s))?(i*=p=1/p,o*=p,s*=p):(i=0,o=0,s=0),a=c*s-f*o,u=f*i-h*s,l=h*o-c*i,(p=Math.hypot(a,u,l))?(a*=p=1/p,u*=p,l*=p):(a=0,u=0,l=0),t[0]=i,t[1]=a,t[2]=h,t[3]=0,t[4]=o,t[5]=u,t[6]=c,t[7]=0,t[8]=s,t[9]=l,t[10]=f,t[11]=0,t[12]=-(i*d+o*g+s*A),t[13]=-(a*d+u*g+l*A),t[14]=-(h*d+c*g+f*A),t[15]=1)}(this,e,r,n),this.check()}ortho(t){const{left:e,right:r,bottom:n,top:i,near:o=fS,far:s=pS}=t;return lS(this,e,r,n,i,o,s),this.check()}orthographic(t){const{fovy:e=hS,aspect:r=cS,focalDistance:n=1,near:i=fS,far:o=pS}=t;vS(e);const s=e/2,a=n*Math.tan(s),u=a*r;return this.ortho({left:-u,right:u,bottom:-a,top:a,near:i,far:o})}perspective(t){const{fovy:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}=t;return vS(e),aS(this,e,r,n,i),this.check()}determinant(){return e=(t=this)[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],u=t[7],l=t[8],h=t[9],c=t[10],f=t[11],p=t[12],d=t[13],g=t[14],A=t[15],(e*s-r*o)*(c*A-f*g)-(e*a-n*o)*(h*A-f*d)+(e*u-i*o)*(h*g-c*d)+(r*a-n*s)*(l*A-f*p)-(r*u-i*s)*(l*g-c*p)+(n*u-i*a)*(l*d-h*p);var t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g,A}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const r=this.getScale(e),n=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const r=this.getScale(e),n=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*n,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*n,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],s=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=s,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],u=e[6],l=e[7],h=e[8],c=e[9],f=e[10],p=e[11],d=e[12],g=e[13],A=e[14],y=e[15],v=r*a-n*s,m=r*u-i*s,_=r*l-o*s,I=n*u-i*a,E=n*l-o*a,x=i*l-o*u,w=h*g-c*d,C=h*A-f*d,b=h*y-p*d,S=c*A-f*g,B=c*y-p*g,M=f*y-p*A,T=v*M-m*B+_*S+I*b-E*C+x*w;T&&(T=1/T,t[0]=(a*M-u*B+l*S)*T,t[1]=(i*B-n*M-o*S)*T,t[2]=(g*x-A*E+y*I)*T,t[3]=(f*E-c*x-p*I)*T,t[4]=(u*b-s*M-l*C)*T,t[5]=(r*M-i*b+o*C)*T,t[6]=(A*_-d*x-y*m)*T,t[7]=(h*x-f*_+p*m)*T,t[8]=(s*B-a*b+l*w)*T,t[9]=(n*b-r*B-o*w)*T,t[10]=(d*E-g*_+y*v)*T,t[11]=(c*_-h*E-p*v)*T,t[12]=(a*C-s*S-u*w)*T,t[13]=(r*S-n*C+i*w)*T,t[14]=(g*m-d*I-A*v)*T,t[15]=(h*I-c*m+f*v)*T)}(this,this),this.check()}multiplyLeft(t){return sS(this,t,this),this.check()}multiplyRight(t){return sS(this,this,t),this.check()}rotateX(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],s=e[5],a=e[6],u=e[7],l=e[8],h=e[9],c=e[10],f=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+l*n,t[5]=s*i+h*n,t[6]=a*i+c*n,t[7]=u*i+f*n,t[8]=l*i-o*n,t[9]=h*i-s*n,t[10]=c*i-a*n,t[11]=f*i-u*n}(this,this,t),this.check()}rotateY(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],s=e[1],a=e[2],u=e[3],l=e[8],h=e[9],c=e[10],f=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-l*n,t[1]=s*i-h*n,t[2]=a*i-c*n,t[3]=u*i-f*n,t[8]=o*n+l*i,t[9]=s*n+h*i,t[10]=a*n+c*i,t[11]=u*n+f*i}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],s=e[1],a=e[2],u=e[3],l=e[4],h=e[5],c=e[6],f=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+l*n,t[1]=s*i+h*n,t[2]=a*i+c*n,t[3]=u*i+f*n,t[4]=l*i-o*n,t[5]=h*i-s*n,t[6]=c*i-a*n,t[7]=f*i-u*n}(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return function(t,e,r,n){var i,o,s,a,u,l,h,c,f,p,d,g,A,y,v,m,_,I,E,x,w,C,b,S,B=n[0],M=n[1],T=n[2],L=Math.hypot(B,M,T);L<Kb||(B*=L=1/L,M*=L,T*=L,i=Math.sin(r),s=1-(o=Math.cos(r)),a=e[0],u=e[1],l=e[2],h=e[3],c=e[4],f=e[5],p=e[6],d=e[7],g=e[8],A=e[9],y=e[10],v=e[11],m=B*B*s+o,_=M*B*s+T*i,I=T*B*s-M*i,E=B*M*s-T*i,x=M*M*s+o,w=T*M*s+B*i,C=B*T*s+M*i,b=M*T*s-B*i,S=T*T*s+o,t[0]=a*m+c*_+g*I,t[1]=u*m+f*_+A*I,t[2]=l*m+p*_+y*I,t[3]=h*m+d*_+v*I,t[4]=a*E+c*x+g*w,t[5]=u*E+f*x+A*w,t[6]=l*E+p*x+y*w,t[7]=h*E+d*x+v*w,t[8]=a*C+c*b+g*S,t[9]=u*C+f*b+A*S,t[10]=l*C+p*b+y*S,t[11]=h*C+d*b+v*S,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return function(t,e,r){var n=r[0],i=r[1],o=r[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return function(t,e,r){var n,i,o,s,a,u,l,h,c,f,p,d,g=r[0],A=r[1],y=r[2];e===t?(t[12]=e[0]*g+e[4]*A+e[8]*y+e[12],t[13]=e[1]*g+e[5]*A+e[9]*y+e[13],t[14]=e[2]*g+e[6]*A+e[10]*y+e[14],t[15]=e[3]*g+e[7]*A+e[11]*y+e[15]):(n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],l=e[6],h=e[7],c=e[8],f=e[9],p=e[10],d=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=s,t[4]=a,t[5]=u,t[6]=l,t[7]=h,t[8]=c,t[9]=f,t[10]=p,t[11]=d,t[12]=n*g+a*A+c*y+e[12],t[13]=i*g+u*A+f*y+e[13],t[14]=o*g+l*A+p*y+e[14],t[15]=s*g+h*A+d*y+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=function(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,t}(e||[-0,-0,-0,-0],t,this),Xb(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:r}=t;let n;switch(r){case 2:n=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t}(e||[-0,-0],t,this);break;case 3:n=eS(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Xb(n,t.length),n}transformAsVector(t,e){let r;switch(t.length){case 2:r=function(t,e,r){const n=e[0],i=e[1],o=r[3]*n+r[7]*i||1;return t[0]=(r[0]*n+r[4]*i)/o,t[1]=(r[1]*n+r[5]*i)/o,t}(e||[-0,-0],t,this);break;case 3:r=$b(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Xb(r,t.length),r}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,r){return this.identity().translate([t,e,r])}}let AS,yS;function vS(t){if(t>2*Math.PI)throw Error("expected radians")}var mS=.1,_S=1e-12,IS=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;function ES(t){return t}function xS(t,e=[]){return function(t,e=[],r=ES){return"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):"x"in t?(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}(t,e,Ob._cartographicRadians?ES:zb)}function wS(t,e){return function(t,e,r=ES){return"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):"x"in e?(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}(t,e,Ob._cartographicRadians?ES:jb)}new iS;const CS=new iS,bS=new iS,SS=new iS;const BS=new iS,MS={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},TS={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},LS={east:new iS,north:new iS,up:new iS,west:new iS,south:new iS,down:new iS},RS=new iS,NS=new iS,PS=new iS;function DS(t,e,r,n,i,o){const s=MS[e]&&MS[e][r];let a,u,l;kb(s&&(!n||n===s));const h=BS.copy(i);if(Vb(h.x,0,1e-14)&&Vb(h.y,0,1e-14)){const t=Math.sign(h.z);a=RS.fromArray(TS[e]),"east"!==e&&"west"!==e&&a.scale(t),u=NS.fromArray(TS[r]),"east"!==r&&"west"!==r&&u.scale(t),l=PS.fromArray(TS[n]),"east"!==n&&"west"!==n&&l.scale(t)}else{const{up:i,east:o,north:s}=LS;o.set(-h.y,h.x,0).normalize(),t.geodeticSurfaceNormal(h,i),s.copy(i).cross(o);const{down:c,west:f,south:p}=LS;c.copy(i).scale(-1),f.copy(o).scale(-1),p.copy(s).scale(-1),a=LS[e],u=LS[r],l=LS[n]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=u.x,o[5]=u.y,o[6]=u.z,o[7]=0,o[8]=l.x,o[9]=l.y,o[10]=l.z,o[11]=0,o[12]=h.x,o[13]=h.y,o[14]=h.z,o[15]=1,o}const kS=new iS,FS=new iS,QS=new iS,OS=new iS,US=new iS,GS=new iS;class zS{constructor(t=0,e=0,r=0){Db(this,"radii",void 0),Db(this,"radiiSquared",void 0),Db(this,"radiiToTheFourth",void 0),Db(this,"oneOverRadii",void 0),Db(this,"oneOverRadiiSquared",void 0),Db(this,"minimumRadius",void 0),Db(this,"maximumRadius",void 0),Db(this,"centerToleranceSquared",mS),Db(this,"squaredXOverSquaredZ",void 0),kb(t>=0),kb(e>=0),kb(r>=0),this.radii=new iS(t,e,r),this.radiiSquared=new iS(t*t,e*e,r*r),this.radiiToTheFourth=new iS(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new iS(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new iS(0===t?0:1/(t*t),0===e?0:1/(e*e),0===r?0:1/(r*r)),this.minimumRadius=Math.min(t,e,r),this.maximumRadius=Math.max(t,e,r),0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const r=FS,n=QS,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const o=Math.sqrt(r.dot(n));return n.scale(1/o),r.scale(i),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){GS.from(t);const r=this.scaleToGeodeticSurface(GS,OS);if(!r)return;const n=this.geodeticSurfaceNormal(r,FS),i=US;i.copy(GS).subtract(r);const o=Math.atan2(n.y,n.x),s=Math.asin(n.z),a=Math.sign(tS(i,GS))*function(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}(i);return wS([o,s,a],e)}eastNorthUpToFixedFrame(t,e=new gS){return DS(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,i=new gS){return DS(this,t,e,r,n,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return kS.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=xS(t),n=r[0],i=r[1],o=Math.cos(i);return kS.set(o*Math.cos(n),o*Math.sin(n),Math.sin(i)).normalize(),kS.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return kS.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=[]){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:o}=e;CS.from(t);const s=CS.x,a=CS.y,u=CS.z,l=n.x,h=n.y,c=n.z,f=s*s*l*l,p=a*a*h*h,d=u*u*c*c,g=f+p+d,A=Math.sqrt(1/g);if(!Number.isFinite(A))return;const y=bS;if(y.copy(t).scale(A),g<o)return y.to(r);const v=i.x,m=i.y,_=i.z,I=SS;I.set(y.x*v*2,y.y*m*2,y.z*_*2);let E,x,w,C,b=(1-A)*CS.len()/(.5*I.len()),S=0;do{b-=S,E=1/(1+b*v),x=1/(1+b*m),w=1/(1+b*_);const t=E*E,e=x*x,r=w*w;C=f*t+p*e+d*r-1,S=C/(-2*(f*(t*E)*v+p*(e*x)*m+d*(r*w)*_))}while(Math.abs(C)>_S);return CS.scale([E,x,w]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){OS.from(t);const r=OS.x,n=OS.y,i=OS.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(r*r*o.x+n*n*o.y+i*i*o.z);return OS.multiplyScalar(s).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return OS.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return OS.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){kb(Vb(this.radii.x,this.radii.y,IS)),kb(this.radii.z>0),OS.from(t);const n=OS.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return OS.set(0,0,n).to(r)}}Db(zS,"WGS84",new zS(6378137,6378137,6356752.314245179));var jS=new B,VS=new B,HS=new B,qS=new B,YS=new B,XS=new B,WS=new Et,JS=new B,KS=new A,ZS=new B,$S=new B,tB=new B,eB=new g,rB=new B,nB=new B,iB=function(){function t(e,r,n,i,o){Ze(this,t),this.sphere=null,this.obb=null,this.region=null,this.regionObb=null,this.scale=null,this.threeLayer=e,this.heightOffset=r,this.xOffset=n,this.yOffset=i,this.yScale=o}return tr(t,[{key:"intersectsRay",value:function(t){var e=this.sphere,r=this.obb||this.regionObb;return!(e&&!t.intersectsSphere(e))&&!(r&&(WS.copy(t).applyMatrix4(r.inverseTransform),!WS.intersectsBox(r.box)))}},{key:"intersectRay",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.sphere,n=this.obb||this.regionObb,i=-1/0,o=-1/0;r&&t.intersectSphere(r,YS)&&(i=r.containsPoint(t.origin)?0:t.origin.distanceToSquared(YS)),n&&(WS.copy(t).applyMatrix4(n.inverseTransform),WS.intersectBox(n.box,XS)&&(o=n.box.containsPoint(WS.origin)?0:WS.origin.distanceToSquared(XS)));var s=Math.max(i,o);return s===-1/0?null:(t.at(Math.sqrt(s),e),e)}},{key:"distanceToPoint",value:function(t){var e=this.sphere,r=this.obb||this.regionObb,n=-1/0,i=-1/0;return e&&(n=Math.max(e.distanceToPoint(t),0)),r&&(qS.copy(t).applyMatrix4(r.inverseTransform),i=r.box.distanceToPoint(qS)),n>i?n:i}},{key:"intersectsFrustum",value:function(t){var e=this.obb||this.regionObb,r=this.sphere;return!(r&&!t.intersectsSphere(r))&&(!(e&&!e.intersectsFrustum(t))&&Boolean(r||e))}},{key:"getOBB",value:function(t,e){var r=this.obb||this.regionObb;r?(t.copy(r.box),e.copy(r.transform)):(this.getAABB(t),e.identity())}},{key:"getAABB",value:function(t){if(this.sphere)this.sphere.getBoundingBox(t);else{var e=this.obb||this.regionObb;t.copy(e.box).applyMatrix4(e.transform)}}},{key:"getSphere",value:function(t){if(this.sphere)t.copy(this.sphere);else if(this.region)this.region.getBoundingSphere(t);else{var e=this.obb||this.regionObb;e.box.getBoundingSphere(t),t.applyMatrix4(e.transform)}}},{key:"setObbData",value:function(t,e,r){var n=new nb,i=new B,o=this.threeLayer.distanceToVector3(t[3],t[3]).x,s=this.threeLayer.distanceToVector3(t[4],t[4]).x,a=this.threeLayer.distanceToVector3(t[5],t[5]).x;jS.set(o,s,a);var u=this.threeLayer.distanceToVector3(t[6],t[6]).x*this.yScale,l=this.threeLayer.distanceToVector3(t[7],t[7]).x*this.yScale,h=this.threeLayer.distanceToVector3(t[8],t[8]).x*this.yScale;VS.set(u,l,h);var c=this.threeLayer.distanceToVector3(t[9],t[9]).x,f=this.threeLayer.distanceToVector3(t[10],t[10]).x,p=this.threeLayer.distanceToVector3(t[11],t[11]).x;HS.set(c,f,p),ZS.set(t[3],t[4],t[5]),$S.set(t[6],t[7],t[8]),tB.set(t[9],t[10],t[11]);var d=jS.length(),g=VS.length(),A=HS.length(),y=ZS.length(),v=$S.length(),m=tB.length();if(i.set(d/y,g/v,A/m),this.scale=i,jS.normalize(),VS.normalize(),HS.normalize(),0===d&&jS.crossVectors(VS,HS),0===g&&VS.crossVectors(jS,HS),0===A&&HS.crossVectors(jS,VS),n.transform.set(jS.x,VS.x,HS.x,t[0],jS.y,VS.y,HS.y,t[1],jS.z,VS.z,HS.z,t[2],0,0,0,1).premultiply(e),r){r.decompose(nB,eB,rB);var _=KS.makeRotationFromQuaternion(eB);n.transform.multiply(_)}var I=zS.WGS84.cartesianToCartographic([n.transform.elements[12],n.transform.elements[13],n.transform.elements[14]],JS),E=this.threeLayer.coordinateToVector3([I.x,I.y],I.z),x=this.threeLayer.distanceToVector3(E.z+this.heightOffset,E.z+this.heightOffset).x;n.transform.elements[12]=E.x+this.xOffset,n.transform.elements[13]=E.y+this.yOffset,n.transform.elements[14]=x,n.box.min.set(-d,-g,-A),n.box.max.set(d,g,A),n.update(),this.obb=n}},{key:"setSphereData",value:function(t,e,r,n,i){var o=new mt;o.center.set(t,e,r),o.radius=n,o.applyMatrix4(i),this.sphere=o}},{key:"setRegionData",value:function(t,e,r,n,i,o){var s=new Rb(fw,fw,dw,e,n,t,r,i,o),a=new nb;s.getBoundingBox(a.box,a.transform),a.update(),this.region=s,this.regionObb=a}}]),t}(),oB=Symbol("INITIAL_FRUSTUM_CULLED"),sB=new A,aB=new A,uB=new B,lB=new B,hB=new B,cB=new g,fB=new B(1,0,0),pB=new B(0,1,0);function dB(t,e){t.traverse((function(t){t.frustumCulled=t[oB]&&e}))}var gB=function(t){rr(r,Sw);var e=ur(r);function r(){var t;Ze(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];(t=e.call.apply(e,[this].concat(i))).group=new XC(ar(t)),t.cameras=[],t.cameraMap=new Map,t.cameraInfo=[],t.activeTiles=new Set,t.visibleTiles=new Set,t._autoDisableRendererCulling=!0,t.optimizeRaycast=!0,t.onLoadTileSet=null,t.onLoadModel=null,t.onDisposeModel=null,t.onTileVisibilityChange=null;var s=new wt;s.setURLModifier((function(e){return t.preprocessURL?t.preprocessURL(e):e})),t.manager=s;var a=ar(t);return t._overridenRaycast=function(t,e){a.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,t,e)},t}return tr(r,[{key:"autoDisableRendererCulling",get:function(){return this._autoDisableRendererCulling},set:function(t){this._autoDisableRendererCulling!==t&&(fr(nr(r.prototype),"_autoDisableRendererCulling",t,this,!0),this.forEachLoadedModel((function(e){dB(e,!t)})))}},{key:"getBounds",value:function(t){if(!this.root)return!1;var e=this.root.cached.boundingVolume;return!e||(e.getAABB(t),!0)}},{key:"getOrientedBounds",value:function(t,e){if(!this.root)return!1;var r=this.root.cached.boundingVolume;return!r||(r.getOBB(t,e),!0)}},{key:"getBoundingSphere",value:function(t){if(!this.root)return!1;var e=this.root.cached.boundingVolume;return!!e&&(e.getSphere(t),!0)}},{key:"forEachLoadedModel",value:function(t){this.traverse((function(e){var r=e.cached.scene;r&&t(r,e)}))}},{key:"raycast",value:function(t,e){if(this.root)if(t.firstHitOnly){var r=eb(this,this.root,t);r&&e.push(r)}else rb(this,this.root,t,e)}},{key:"hasCamera",value:function(t){return this.cameraMap.has(t)}},{key:"setCamera",value:function(t){var e=this.cameras,r=this.cameraMap;return!r.has(t)&&(r.set(t,new S),e.push(t),!0)}},{key:"setResolution",value:function(t,e,r){var n=this.cameraMap;return!!n.has(t)&&(e instanceof S?n.get(t).copy(e):n.get(t).set(e,r),!0)}},{key:"setResolutionFromRenderer",value:function(t,e){var r=this.cameraMap;if(!r.has(t))return!1;var n=r.get(t);return e.getSize(n),n.multiplyScalar(e.getPixelRatio()),!0}},{key:"deleteCamera",value:function(t){var e=this.cameras,r=this.cameraMap;if(r.has(t)){var n=e.indexOf(t);return e.splice(n,1),r.delete(t),!0}return!1}},{key:"fetchTileSet",value:function(t){for(var e,n=this,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];var a=(e=hr(nr(r.prototype),"fetchTileSet",this)).call.apply(e,[this,t].concat(o));return a.then((function(e){n.onLoadTileSet&&Promise.resolve().then((function(){n.onLoadTileSet(e,t)}))})),a}},{key:"update",value:function(){var t=this.group,e=this.cameras,n=this.cameraMap,i=this.cameraInfo;if(0!==e.length){for(;i.length>e.length;)i.pop();for(;i.length<e.length;)i.push({frustum:new Ct,isOrthographic:!1,sseDenominator:-1,position:new B,invScale:-1,pixelSize:0});aB.copy(t.matrixWorld).invert(),uB.setFromMatrixScale(aB);var o=uB.x;Math.abs(Math.max(uB.x-uB.y,uB.x-uB.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(var s=0,a=i.length;s<a;s++){var u=e[s],l=i[s],h=l.frustum,c=l.position,f=n.get(u);0!==f.width&&0!==f.height||console.warn("TilesRenderer: resolution for camera error calculation is not set.");var p=u.projectionMatrix.elements;if(l.isOrthographic=1===p[15],l.isOrthographic){var d=2/p[0],g=2/p[5];l.pixelSize=Math.max(g/f.height,d/f.width)}else l.sseDenominator=2/p[5]/f.height;l.invScale=o,sB.copy(t.matrixWorld),sB.premultiply(u.matrixWorldInverse),sB.premultiply(u.projectionMatrix),h.setFromProjectionMatrix(sB),c.set(0,0,0),c.applyMatrix4(u.matrixWorld),c.applyMatrix4(aB)}hr(nr(r.prototype),"update",this).call(this)}else console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}},{key:"preprocessNode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;hr(nr(r.prototype),"preprocessNode",this).call(this,t,e,n);var i=new A;if(t.transform)for(var o=t.transform,s=0;s<16;s++)i.elements[s]=o[s];else i.identity();n&&i.premultiply(n.cached.transform);var a=(new A).copy(i).invert(),u=new iB(this.threeLayer,this.heightOffset,this.xOffset,this.yOffset,this.yScale);"sphere"in t.boundingVolume&&u.setSphereData.apply(u,dr(t.boundingVolume.sphere).concat([i])),"box"in t.boundingVolume&&u.setObbData(t.boundingVolume.box,i,a),"region"in t.boundingVolume&&u.setRegionData.apply(u,dr(t.boundingVolume.region)),t.cached={loadIndex:0,transform:i,transformInverse:a,active:!1,inFrustum:[],boundingVolume:u,scene:null,geometry:null,material:null}}},{key:"parseTile",value:function(t,e,r){var n=this;e._loadIndex=e._loadIndex||0,e._loadIndex++;var i=e.content.uri.split(/[\\\/]/g);i.pop();var o=i.join("/"),s=this.fetchOptions,a=this.manager,u=e._loadIndex,l=null,h=this.rootTileSet.asset&&this.rootTileSet.asset.gltfUpAxis||"y",c=e.cached,f=c.transform,p=c.boundingVolume.scale,d=c.transformInverse,g=new A;switch(h.toLowerCase()){case"x":g.makeRotationAxis(pB,-Math.PI/2);break;case"y":g.makeRotationAxis(fB,Math.PI/2);break;case"z":g.identity()}var y=(Rw(t)||r).toLowerCase();switch(y){case"b3dm":var v=new TC(a);v.workingPath=o,v.fetchOptions=s,v.adjustmentTransform.copy(g),l=v.parse(t);break;case"pnts":var m=new NC(a);m.workingPath=o,m.fetchOptions=s,l=m.parse(t);break;case"i3dm":var _=new zC(a);_.workingPath=o,_.fetchOptions=s,_.adjustmentTransform.copy(g),l=_.parse(t);break;case"cmpt":var I=new VC(a);I.workingPath=o,I.fetchOptions=s,I.adjustmentTransform.copy(g),l=I.parse(t).then((function(t){return t.scene}));break;case"gltf":case"glb":var E=new qC(a);E.workingPath=o,E.fetchOptions=s,l=E.parse(t);break;default:console.warn('TilesRenderer: Content type "'.concat(y,'" not supported.')),l=Promise.resolve(null)}return l.then((function(t){var r,i;if(t.isObject3D?(r=t,i=null):(r=t.scene,i=t),e._loadIndex===u){r.updateMatrix(),"glb"!==y&&"gltf"!==y||r.matrix.multiply(g),r.matrix.premultiply(f);var o=zS.WGS84.cartesianToCartographic([r.matrix.elements[12],r.matrix.elements[13],r.matrix.elements[14]],uB),s=n.threeLayer.coordinateToVector3([o.x,o.y],o.z),a=n.threeLayer.distanceToVector3(s.z+n.heightOffset,s.z+n.heightOffset).x;r.matrix.elements[12]=s.x+n.xOffset,r.matrix.elements[13]=s.y+n.yOffset,r.matrix.elements[14]=a,r.matrix.decompose(r.position,r.quaternion,r.scale),d.decompose(lB,cB,hB),r.applyQuaternion(cB),r.scale.copy(p),r.traverse((function(t){t[oB]=t.frustumCulled})),dB(r,!n.autoDisableRendererCulling),r.traverse((function(t){t.raycast=n._overridenRaycast}));var l=[],h=[],A=[];r.traverse((function(t){if(t.geometry&&h.push(t.geometry),t.material){var e=t.material;for(var r in l.push(t.material),e){var n=e[r];n&&n.isTexture&&A.push(n)}}})),c.materials=l,c.geometry=h,c.textures=A,c.scene=r,c.metadata=i,n.onLoadModel&&n.onLoadModel(r,e)}}))}},{key:"disposeTile",value:function(t){var e=t.cached;if(e.scene){for(var r=e.materials,n=e.geometry,i=e.textures,o=e.scene.parent,s=0,a=n.length;s<a;s++)n[s].dispose();for(var u=0,l=r.length;u<l;u++)r[u].dispose();for(var h=0,c=i.length;h<c;h++){i[h].dispose()}o&&o.remove(e.scene),this.onDisposeModel&&this.onDisposeModel(e.scene,t),e.scene=null,e.materials=null,e.textures=null,e.geometry=null,e.metadata=null}this.activeTiles.delete(t),this.visibleTiles.delete(t),t._loadIndex++}},{key:"setTileVisible",value:function(t,e){var r=t.cached.scene,n=this.visibleTiles,i=this.group;e?(i.add(r),n.add(t),r.updateMatrixWorld(!0)):(i.remove(r),n.delete(t)),this.onTileVisibilityChange&&this.onTileVisibilityChange(r,t,e)}},{key:"setTileActive",value:function(t,e){var r=this.activeTiles;e?r.add(t):r.delete(t)}},{key:"calculateError",value:function(t){for(var e=t.cached,r=e.inFrustum,n=this.cameras,i=this.cameraInfo,o=e.boundingVolume,s=-1/0,a=1/0,u=0,l=n.length;u<l;u++)if(r[u]){var h=i[u],c=h.invScale,f=void 0;if(h.isOrthographic){var p=h.pixelSize;f=t.geometricError/(p*c)}else{var d=o.distanceToPoint(h.position)*c,g=h.sseDenominator;f=t.geometricError/(d*g),a=Math.min(a,d)}s=Math.max(s,f)}t.__distanceFromCamera=a,t.__error=s}},{key:"tileInView",value:function(t){for(var e=t.cached,r=e.boundingVolume,n=e.inFrustum,i=this.cameraInfo,o=!1,s=0,a=i.length;s<a;s++){var u=i[s].frustum;r.intersectsFrustum(u)?(o=!0,n[s]=!0):n[s]=!1}return o}}]),r}(),AB=new B,yB=["x","y","z"],vB=function(t){rr(r,H);var e=ur(r);function r(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:40;Ze(this,r);for(var s=new l,a=[],u=0;u<3;u++){var c=yB[u],f=yB[(u+1)%3];AB.set(0,0,0);for(var p=0;p<o;p++){var d=void 0;d=2*Math.PI*p/(o-1),AB[c]=Math.sin(d),AB[f]=Math.cos(d),a.push(AB.x,AB.y,AB.z),d=2*Math.PI*(p+1)/(o-1),AB[c]=Math.sin(d),AB[f]=Math.cos(d),a.push(AB.x,AB.y,AB.z)}}return s.setAttribute("position",new h(new Float32Array(a),3)),s.computeBoundingSphere(),(n=e.call(this,s,new O({color:i,toneMapped:!1}))).sphere=t,n.type="SphereHelper",n}return tr(r,[{key:"updateMatrixWorld",value:function(t){var e=this.sphere;this.position.copy(e.center),this.scale.setScalar(e.radius),hr(nr(r.prototype),"updateMatrixWorld",this).call(this,t)}}]),r}(),mB=new B,_B=new B,IB=new B,EB=new B,xB=new B;function wB(t){for(var e=t.latStart,r=void 0===e?-Math.PI/2:e,n=t.latEnd,i=void 0===n?Math.PI/2:n,o=t.lonStart,s=void 0===o?0:o,a=t.lonEnd,u=void 0===a?2*Math.PI:a,l=t.heightStart,h=void 0===l?0:l,c=t.heightEnd,f=void 0===c?0:c,p=new St(1,1,1,32,32),d=p.attributes,g=d.normal,A=d.position,y=A.clone(),v=0,m=A.count;v<m;v++){IB.fromBufferAttribute(A,v);var _=K.mapLinear(IB.x,-.5,.5,r,i),I=K.mapLinear(IB.y,-.5,.5,s,u),E=h;t.getCartographicToNormal(_,I,mB),IB.z<0&&(E=f),t.getCartographicToPosition(_,I,E,IB),A.setXYZ.apply(A,[v].concat(dr(IB)))}p.computeVertexNormals();for(var x=0,w=y.count;x<w;x++){IB.fromBufferAttribute(y,x);var C=K.mapLinear(IB.x,-.5,.5,r,i),b=K.mapLinear(IB.y,-.5,.5,s,u);mB.fromBufferAttribute(g,x),t.getCartographicToNormal(C,b,_B),Math.abs(mB.dot(_B))>.1&&(IB.z>0&&_B.multiplyScalar(-1),g.setXYZ.apply(g,[x].concat(dr(_B))))}return p}var CB=function(t){rr(r,H);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Rb,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;return Ze(this,r),(t=e.call(this)).ellipsoidRegion=n,t.material.color.set(i),t.update(),t}return tr(r,[{key:"update",value:function(){var t=wB(this.ellipsoidRegion);this.geometry.dispose(),this.geometry=new bt(t,80)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),r}(),bB=function(t){rr(r,V);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Rb,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;return Ze(this,r),(t=e.call(this)).ellipsoidRegion=n,t.material.color.set(i),t.update(),t}return tr(r,[{key:"update",value:function(){this.geometry.dispose();var t=wB(this.ellipsoidRegion),e=this.lonStart;this.lonEnd-e>=2*Math.PI?(t.groups.splice(2,2),this.geometry=function(t){var e,r=(t=t.toNonIndexed()).groups,n=t.attributes,i=n.position,o=n.normal,s=[],a=[],u=yr(r);try{for(u.s();!(e=u.n()).done;)for(var c=e.value,f=c.start,p=c.count,d=f,g=f+p;d<g;d++)EB.fromBufferAttribute(i,d),xB.fromBufferAttribute(o,d),a.push.apply(a,dr(EB)),s.push.apply(s,dr(xB))}catch(t){u.e(t)}finally{u.f()}var A=new l;return A.setAttribute("position",new h(new Float32Array(a),3)),A.setAttribute("normal",new h(new Float32Array(s),3)),A}(t)):this.geometry=t}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),r}(),SB=Symbol("ORIGINAL_MATERIAL"),BB=Symbol("HAS_RANDOM_COLOR"),MB=Symbol("HAS_RANDOM_NODE_COLOR"),TB=Symbol("LOAD_TIME");function LB(){}var RB=0,NB=1,PB=2,DB=3,kB=4,FB=5,QB=6,OB=7,UB=8,GB=9,zB=10,jB=new mt,VB=function(t){rr(r,gB);var e=ur(r);function r(){var t;Ze(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];var s=(t=e.call.apply(e,[this].concat(i))).group,a=new W;a.name="DebugTilesRenderer.boxGroup",s.add(a);var u=new W;u.name="DebugTilesRenderer.sphereGroup",s.add(u);var l=new W;return l.name="DebugTilesRenderer.regionGroup",s.add(l),t.displayBoxBounds=!1,t.displaySphereBounds=!1,t.displayRegionBounds=!1,t.colorMode=0,t.customColorCallback=null,t.boxGroup=a,t.sphereGroup=u,t.regionGroup=l,t.maxDebugDepth=-1,t.maxDebugDistance=-1,t.maxDebugError=-1,t.getDebugColor=function(t,e){e.setRGB(t,t,t)},t.extremeDebugDepth=-1,t.extremeDebugError=-1,t}return tr(r,[{key:"initExtremes",value:function(){var t=-1;this.traverse((function(e){t=Math.max(t,e.__depth)}));var e=-1;this.traverse((function(t){e=Math.max(e,t.geometricError)})),this.extremeDebugDepth=t,this.extremeDebugError=e}},{key:"fetchTileSet",value:function(){for(var t,e=this,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];var s=(t=hr(nr(r.prototype),"fetchTileSet",this)).call.apply(t,[this].concat(i));return s.then((function(){Promise.resolve().then((function(){e.initExtremes()}))})).catch((function(){})),s}},{key:"getTileInformationFromActiveObject",value:function(t){var e=null;return this.activeTiles.forEach((function(r){if(e)return!0;var n=r.cached.scene;n&&n.traverse((function(n){n===t&&(e=r)}))})),e?{distanceToCamera:e.__distanceFromCamera,geometricError:e.geometricError,screenSpaceError:e.__error,depth:e.__depth,isLeaf:e.__isLeaf}:null}},{key:"update",value:function(){var t=this;if(hr(nr(r.prototype),"update",this).call(this),this.root){this.boxGroup.visible=this.displayBoxBounds,this.sphereGroup.visible=this.displaySphereBounds,this.regionGroup.visible=this.displayRegionBounds;var e=-1;e=-1===this.maxDebugDepth?this.extremeDebugDepth:this.maxDebugDepth;var n=-1;n=-1===this.maxDebugError?this.extremeDebugError:this.maxDebugError;var i=-1;-1===this.maxDebugDistance?(this.root.cached.boundingVolume.getSphere(jB),i=jB.radius):i=this.maxDebugDistance;var o,s=this.errorTarget,a=this.colorMode,u=this.visibleTiles;10===a&&(o=Array.from(u).sort((function(t,e){return t[TB]-e[TB]}))),u.forEach((function(r){var u,l,h,c=r.cached.scene;7===a&&(u=Math.random(),l=.5+.5*Math.random(),h=.375+.25*Math.random()),c.traverse((function(c){8===a&&(u=Math.random(),l=.5+.5*Math.random(),h=.375+.25*Math.random());var f=c.material;if(f){var p=c[SB];if(0===a&&f!==p)c.material.dispose(),c.material=c[SB];else if(0!==a&&f===p)if(c.isPoints){var d=new F;d.size=p.size,d.sizeAttenuation=p.sizeAttenuation,c.material=d}else c.material=new U,c.material.flatShading=!0;switch(7!==a&&delete c.material[BB],8!==a&&delete c.material[MB],a){case 4:var g=r.__depth/e;t.getDebugColor(g,c.material.color);break;case 5:var A=r.__depthFromRenderedParent/e;t.getDebugColor(A,c.material.color);break;case 1:var y=r.__error/s;y>1?c.material.color.setRGB(1,0,0):t.getDebugColor(y,c.material.color);break;case 2:var v=Math.min(r.geometricError/n,1);t.getDebugColor(v,c.material.color);break;case 3:var m=Math.min(r.__distanceFromCamera/i,1);t.getDebugColor(m,c.material.color);break;case 6:r.children&&0!==r.children.length?t.getDebugColor(0,c.material.color):t.getDebugColor(1,c.material.color);break;case 8:c.material[MB]||(c.material.color.setHSL(u,l,h),c.material[MB]=!0);break;case 7:c.material[BB]||(c.material.color.setHSL(u,l,h),c.material[BB]=!0);break;case 9:t.customColorCallback?t.customColorCallback(r,c):console.warn("DebugTilesRenderer: customColorCallback not defined");break;case 10:var _=o.indexOf(r);t.getDebugColor(_/(o.length-1),c.material.color)}}}))}))}}},{key:"parseTile",value:function(t,e,n){var i=this;return hr(nr(r.prototype),"parseTile",this).call(this,t,e,n).then((function(){var t=e.cached,r=t.scene;if(r){var n=t.boundingVolume,o=n.sphere,s=n.obb,a=n.region;if(s){var u=new W;u.name="DebugTilesRenderer.boxHelperGroup",u.matrix.copy(s.transform),u.matrixAutoUpdate=!1;var l=new Bt(s.box,nw(e.__depth));l.raycast=LB,u.add(l),t.boxHelperGroup=u,i.visibleTiles.has(e)&&i.displayBoxBounds&&(i.boxGroup.add(u),u.updateMatrixWorld(!0))}if(o){var h=new vB(o,nw(e.__depth));h.raycast=LB,t.sphereHelper=h,i.visibleTiles.has(e)&&i.displaySphereBounds&&(i.sphereGroup.add(h),h.updateMatrixWorld(!0))}if(a){var c,f=new CB(a,nw(e.__depth));f.raycast=LB;var p=new mt;a.getBoundingSphere(p),f.position.copy(p.center),p.center.multiplyScalar(-1),(c=f.geometry).translate.apply(c,dr(p.center)),t.regionHelper=f,i.visibleTiles.has(e)&&i.displayRegionBounds&&(i.regionGroup.add(f),f.updateMatrixWorld(!0))}r.traverse((function(t){var e=t.material;e&&(t[SB]=e)}))}}))}},{key:"setTileVisible",value:function(t,e){hr(nr(r.prototype),"setTileVisible",this).call(this,t,e);var n=t.cached,i=this.sphereGroup,o=this.boxGroup,s=this.regionGroup,a=n.boxHelperGroup,u=n.sphereHelper,l=n.regionHelper;e?(a&&(o.add(a),a.updateMatrixWorld(!0)),u&&(i.add(u),u.updateMatrixWorld(!0)),l&&(s.add(l),l.updateMatrixWorld(!0))):(a&&o.remove(a),u&&i.remove(u),l&&s.remove(l))}},{key:"disposeTile",value:function(t){hr(nr(r.prototype),"disposeTile",this).call(this,t);var e=t.cached;e.boxHelperGroup&&(e.boxHelperGroup.children[0].geometry.dispose(),delete e.boxHelperGroup),e.sphereHelper&&(e.sphereHelper.geometry.dispose(),delete e.sphereHelper)}}]),r}(),HB=new Ib(fw,fw,dw),qB=function(){function t(){Ze(this,t),this.creditsCount={}}return tr(t,[{key:"_adjustCredits",value:function(t,e){for(var r=this.creditsCount,n=t.split(/;/g),i=0,o=n.length;i<o;i++){var s=n[i];s in r||(r[s]=0),r[s]+=e?1:-1,r[s]<=0&&delete r[s]}}},{key:"addCredits",value:function(t){this._adjustCredits(t,!0)}},{key:"removeCredits",value:function(t){this._adjustCredits(t,!1)}},{key:"toString",value:function(){return Object.keys(this.creditsCount).sort().join(", ")}}]),t}(),YB="".concat("https://tile.googleapis.com","/v1/3dtiles/root.json"),XB=new A,WB=new Mt,JB=function(t){return function(t){rr(r,t);var e=ur(r);function r(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:YB;return Ze(this,r),(n=e.call(this,new URL("".concat(i,"?key=").concat(t)).toString()))._credits=new qB,n.fetchOptions.mode="cors",n.parseQueue.maxJobs=10,n.downloadQueue.maxJobs=30,n.lruCache.minSize=3e3,n.lruCache.maxSize=5e3,n.errorTarget=20,n.onLoadTileSet=function(e){var r;n.traverse((function(t){return!(!t.content||!t.content.uri)&&(r=new URL(t.content.uri).searchParams.get("session"),!0)})),n.preprocessURL=function(e){return e=new URL(e),/^http/.test(e.protocol)&&(e.searchParams.append("session",r),e.searchParams.append("key",t)),e.toString()},n.onLoadTileSet=null},n.onTileVisibilityChange=function(t,e,r){var i=e.cached.metadata.asset.copyright||"";r?n._credits.addCredits(i):n._credits.removeCredits(i)},n}return tr(r,[{key:"ellipsoid",get:function(){return HB}},{key:"getCreditsString",value:function(){return this._credits.toString()}},{key:"setLatLonToYUp",value:function(t,e){var r=this.ellipsoid,n=this.group;WB.set(Math.PI/2,Math.PI/2,0),XB.makeRotationFromEuler(WB),r.constructLatLonFrame(t,e,n.matrix).multiply(XB).invert().decompose(n.position,n.quaternion,n.scale)}}]),r}(t)},KB=JB(gB),ZB=JB(VB),$B=function(t){return function(t){rr(r,t);var e=ur(r);function r(t,n){var i;return Ze(this,r),(i=e.call(this))._tokenState=0,i._ionAccessToken=n,i._ionAssetId=t,i._tileSetVersion=-1,i.preprocessURL=function(t){return t=new URL(t),/^http/.test(t.protocol)&&-1!=i._tileSetVersion&&t.searchParams.append("v",i._tileSetVersion),t.toString()},i}return tr(r,[{key:"update",value:function(){var t=this,e=this._tokenState;if(0===e){this._tokenState=1;var n=new URL("https://api.cesium.com/v1/assets/".concat(this._ionAssetId,"/endpoint"));n.searchParams.append("access_token",this._ionAccessToken),fetch(n,{mode:"cors"}).then((function(t){return t.ok?t.json():Promise.reject("".concat(t.status," : ").concat(t.statusText))})).then((function(e){t._tokenState=2;var r=new URL(e.url);t._tileSetVersion=r.searchParams.get("v"),t.rootURL=r,t.fetchOptions.headers=t.fetchOptions.headers||{},t.fetchOptions.headers.Authorization="Bearer ".concat(e.accessToken)})).catch((function(){t._tokenState=3}))}else 2===e&&hr(nr(r.prototype),"update",this).call(this)}}]),r}(t)},tM=$B(gB),eM=$B(VB),rM=new WeakMap,nM=function(t){rr(r,m);var e=ur(r);function r(t){var n;return Ze(this,r),(n=e.call(this,t)).decoderPath="",n.decoderConfig={},n.decoderBinary=null,n.decoderPending=null,n.workerLimit=4,n.workerPool=[],n.workerNextTaskID=1,n.workerSourceURL="",n.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},n.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},n}return tr(r,[{key:"setDecoderPath",value:function(t){return this.decoderPath=t,this}},{key:"setDecoderConfig",value:function(t){return this.decoderConfig=t,this}},{key:"setWorkerLimit",value:function(t){return this.workerLimit=t,this}},{key:"load",value:function(t,e,r,n){var i=this,o=new v(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){i.parse(t,e,n)}),r,n)}},{key:"parse",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};this.decodeDracoFile(t,e,null,null,C).catch(r)}},{key:"decodeDracoFile",value:function(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:_,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:function(){},s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:i};return this.decodeGeometry(t,s).then(e).catch(o)}},{key:"decodeGeometry",value:function(t,e){var r,n=this,i=JSON.stringify(e);if(rM.has(t)){var o=rM.get(t);if(o.key===i)return o.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,a=t.byteLength,u=this._getWorker(s,a).then((function(n){return r=n,new Promise((function(n,i){r._callbacks[s]={resolve:n,reject:i},r.postMessage({type:"decode",id:s,taskConfig:e,buffer:t},[t])}))})).then((function(t){return n._createGeometry(t.geometry)}));return u.catch((function(){return!0})).then((function(){r&&s&&n._releaseTask(r,s)})),rM.set(t,{key:i,promise:u}),u}},{key:"_createGeometry",value:function(t){var e=new l;t.index&&e.setIndex(new h(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var n=t.attributes[r],i=n.name,o=n.array,s=n.itemSize,a=new h(o,s);"color"===i&&(this._assignVertexColorSpace(a,n.vertexColorSpace),a.normalized=o instanceof Float32Array==!1),e.setAttribute(i,a)}return e}},{key:"_assignVertexColorSpace",value:function(t,e){if(e===C)for(var r=new d,n=0,i=t.count;n<i;n++)r.fromBufferAttribute(t,n).convertSRGBToLinear(),t.setXYZ(n,r.r,r.g,r.b)}},{key:"_loadLibrary",value:function(t,e){var r=new v(this.manager);return r.setPath(this.decoderPath),r.setResponseType(e),r.setWithCredentials(this.withCredentials),new Promise((function(e,n){r.load(t,e,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var t=this;if(this.decoderPending)return this.decoderPending;var e="object"!==("undefined"==typeof WebAssembly?"undefined":We(WebAssembly))||"js"===this.decoderConfig.type,r=[];return e?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];e||(t.decoderConfig.wasmBinary=r[1]);var i=iM.toString(),o=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}},{key:"_getWorker",value:function(t,e){var r=this;return this._initDecoder().then((function(){if(r.workerPool.length<r.workerLimit){var n=new Worker(r.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(t){var e=t.data;switch(e.type){case"decode":n._callbacks[e.id].resolve(e);break;case"error":n._callbacks[e.id].reject(e);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+e.type+'"')}},r.workerPool.push(n)}else r.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));var i=r.workerPool[r.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i}))}},{key:"_releaseTask",value:function(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(t){return t._taskLoad})))}},{key:"dispose",value:function(){for(var t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}]),r}();function iM(){var t,e;function r(t,e,r,n,i,o){var s=o.num_components(),a=r.num_points()*s,u=a*i.BYTES_PER_ELEMENT,l=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,i),h=t._malloc(u);e.GetAttributeDataArrayForAllPoints(r,o,l,u,h);var c=new i(t.HEAPF32.buffer,h,a).slice();return t._free(h),{name:n,array:c,itemSize:s}}onmessage=function(n){var i=n.data;switch(i.type){case"init":t=i.decoderConfig,e=new Promise((function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)}));break;case"decode":var o=i.buffer,s=i.taskConfig;e.then((function(t){var e=t.draco,n=new e.Decoder;try{var a=function(t,e,n,i){var o,s,a=i.attributeIDs,u=i.attributeTypes,l=e.GetEncodedGeometryType(n);if(l===t.TRIANGULAR_MESH)o=new t.Mesh,s=e.DecodeArrayToMesh(n,n.byteLength,o);else{if(l!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new t.PointCloud,s=e.DecodeArrayToPointCloud(n,n.byteLength,o)}if(!s.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+s.error_msg());var h={index:null,attributes:[]};for(var c in a){var f=self[u[c]],p=void 0,d=void 0;if(i.useUniqueIDs)d=a[c],p=e.GetAttributeByUniqueId(o,d);else{if(-1===(d=e.GetAttributeId(o,t[a[c]])))continue;p=e.GetAttribute(o,d)}var g=r(t,e,o,c,f,p);"color"===c&&(g.vertexColorSpace=i.vertexColorSpace),h.attributes.push(g)}l===t.TRIANGULAR_MESH&&(h.index=function(t,e,r){var n=r.num_faces(),i=3*n,o=4*i,s=t._malloc(o);e.GetTrianglesUInt32Array(r,o,s);var a=new Uint32Array(t.HEAPF32.buffer,s,i).slice();return t._free(s),{array:a,itemSize:1}}(t,e,o));return t.destroy(o),h}(e,n,new Int8Array(o),s),u=a.attributes.map((function(t){return t.array.buffer}));a.index&&u.push(a.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:a},u)}catch(t){console.error(t),self.postMessage({type:"error",id:i.id,error:t.message})}finally{e.destroy(n)}}))}}}var oM,sM,aM,uM=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;Ze(this,t),this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return tr(t,[{key:"_initWorker",value:function(t){if(!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}},{key:"_getIdleWorker",value:function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}},{key:"_onMessage",value:function(t,e){var r=this.workersResolve[t];if(r&&r(e),this.queue.length){var n=this.queue.shift(),i=n.resolve,o=n.msg,s=n.transfer;this.workersResolve[t]=i,this.workers[t].postMessage(o,s)}else this.workerStatus^=1<<t}},{key:"setWorkerCreator",value:function(t){this.workerCreator=t}},{key:"setWorkerLimit",value:function(t){this.pool=t}},{key:"postMessage",value:function(t,e){var r=this;return new Promise((function(n){var i=r._getIdleWorker();-1!==i?(r._initWorker(i),r.workerStatus|=1<<i,r.workersResolve[i]=n,r.workers[i].postMessage(t,e)):r.queue.push({resolve:n,msg:t,transfer:e})}))}},{key:"dispose",value:function(){this.workers.forEach((function(t){return t.terminate()})),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}]),t}(),lM=0,hM=2,cM=2,fM=0,pM=1,dM=10,gM=tr((function t(){Ze(this,t),this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null})),AM=function(){function t(e,r,n,i){Ze(this,t),this._dataView=new DataView(e.buffer,e.byteOffset+r,n),this._littleEndian=i,this._offset=0}return tr(t,[{key:"_nextUint8",value:function(){var t=this._dataView.getUint8(this._offset);return this._offset+=1,t}},{key:"_nextUint16",value:function(){var t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}},{key:"_nextUint32",value:function(){var t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}},{key:"_nextUint64",value:function(){var t=this._dataView.getUint32(this._offset,this._littleEndian)+Math.pow(2,32)*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}},{key:"_nextInt32",value:function(){var t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}},{key:"_skip",value:function(t){return this._offset+=t,this}},{key:"_scan",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this._offset,n=0;this._dataView.getUint8(this._offset)!==e&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}]),t}(),yM=[171,75,84,88,32,50,48,187,13,10,26,10];function vM(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")}function mM(t){var e=new Uint8Array(t.buffer,t.byteOffset,yM.length);if(e[0]!==yM[0]||e[1]!==yM[1]||e[2]!==yM[2]||e[3]!==yM[3]||e[4]!==yM[4]||e[5]!==yM[5]||e[6]!==yM[6]||e[7]!==yM[7]||e[8]!==yM[8]||e[9]!==yM[9]||e[10]!==yM[10]||e[11]!==yM[11])throw new Error("Missing KTX 2.0 identifier.");var r=new gM,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new AM(t,yM.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();var o=i._nextUint32();r.supercompressionScheme=i._nextUint32();for(var s=i._nextUint32(),a=i._nextUint32(),u=i._nextUint32(),l=i._nextUint32(),h=i._nextUint64(),c=i._nextUint64(),f=new AM(t,yM.length+n,3*o*8,!0),p=0;p<o;p++)r.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+f._nextUint64(),f._nextUint64()),uncompressedByteLength:f._nextUint64()});for(var d=new AM(t,s,a,!0),g={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},A=(g.descriptorBlockSize/4-6)/4,y=0;y<A;y++){var v={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelType:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&v.channelType?(v.sampleLower=d._nextInt32(),v.sampleUpper=d._nextInt32()):(v.sampleLower=d._nextUint32(),v.sampleUpper=d._nextUint32()),g.samples[y]=v}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(g);for(var m=new AM(t,u,l,!0);m._offset<l;){var _=m._nextUint32(),I=m._scan(_),E=vM(I),x=m._scan(_-I.byteLength);r.keyValue[E]=E.match(/^ktx/i)?vM(x):x,m._offset%4&&m._skip(4-m._offset%4)}if(c<=0)return r;for(var w=new AM(t,h,c,!0),C=w._nextUint16(),b=w._nextUint16(),S=w._nextUint32(),B=w._nextUint32(),M=w._nextUint32(),T=w._nextUint32(),L=[],R=0;R<o;R++)L.push({imageFlags:w._nextUint32(),rgbSliceByteOffset:w._nextUint32(),rgbSliceByteLength:w._nextUint32(),alphaSliceByteOffset:w._nextUint32(),alphaSliceByteLength:w._nextUint32()});var N=h+w._offset,P=N+S,D=P+B,k=D+M,F=new Uint8Array(t.buffer,t.byteOffset+N,S),Q=new Uint8Array(t.buffer,t.byteOffset+P,B),O=new Uint8Array(t.buffer,t.byteOffset+D,M),U=new Uint8Array(t.buffer,t.byteOffset+k,T);return r.globalData={endpointCount:C,selectorCount:b,imageDescs:L,endpointsData:F,selectorsData:Q,tablesData:O,extendedData:U},r}var _M,IM,EM,xM={env:{emscripten_notify_memory_growth:function(t){aM=new Uint8Array(sM.exports.memory.buffer)}}},wM=function(){function t(){Ze(this,t)}return tr(t,[{key:"init",value:function(){return oM||(oM="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+CM).then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.instantiate(t,xM)})).then(this._init):WebAssembly.instantiate(Buffer.from(CM,"base64"),xM).then(this._init))}},{key:"_init",value:function(t){sM=t.instance,xM.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!sM)throw new Error("ZSTDDecoder: Await .init() before decoding.");var r=t.byteLength,n=sM.exports.malloc(r);aM.set(t,n),e=e||Number(sM.exports.ZSTD_findDecompressedSize(n,r));var i=sM.exports.malloc(e),o=sM.exports.ZSTD_decompress(i,e,n,r),s=aM.slice(i,i+o);return sM.exports.free(n),sM.exports.free(i),s}}]),t}(),CM="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",bM=new WeakMap,SM=0,BM=function(t){rr(n,m);var e,r=ur(n);function n(t){var e;return Ze(this,n),(e=r.call(this,t)).transcoderPath="",e.transcoderBinary=null,e.transcoderPending=null,e.workerPool=new uM,e.workerSourceURL="",e.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'),e}return tr(n,[{key:"setTranscoderPath",value:function(t){return this.transcoderPath=t,this}},{key:"setWorkerLimit",value:function(t){return this.workerPool.setWorkerLimit(t),this}},{key:"detectSupport",value:function(t){return!0===t.isWebGPURenderer?this.workerConfig={astcSupported:t.hasFeature("texture-compression-astc"),etc1Supported:!1,etc2Supported:t.hasFeature("texture-compression-etc2"),dxtSupported:t.hasFeature("texture-compression-bc"),bptcSupported:!1,pvrtcSupported:!1}:(this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},t.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1)),this}},{key:"init",value:function(){var t=this;if(!this.transcoderPending){var e=new v(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);var r=e.loadAsync("basis_transcoder.js"),i=new v(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);var o=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([r,o]).then((function(e){var r=pr(e,2),i=r[0],o=r[1],s=n.BasisWorker.toString(),a=["/* constants */","let _EngineFormat = "+JSON.stringify(n.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(n.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(n.BasisFormat),"/* basis_transcoder.js */",i,"/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([a])),t.transcoderBinary=o,t.workerPool.setWorkerCreator((function(){var e=new Worker(t.workerSourceURL),r=t.transcoderBinary.slice(0);return e.postMessage({type:"init",config:t.workerConfig,transcoderBinary:r},[r]),e}))})),SM>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),SM++}return this.transcoderPending}},{key:"load",value:function(t,e,r,n){var i=this;if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");var o=new v(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){if(bM.has(t))return bM.get(t).promise.then(e).catch(n);i._createTexture(t).then((function(t){return e?e(t):null})).catch(n)}),r,n)}},{key:"_createTextureFrom",value:function(t,e){var r,n=t.faces,i=t.width,o=t.height,s=t.format,a=t.type,u=t.error,l=t.dfdFlags;if("error"===a)return Promise.reject(u);if(6===e.faceCount)r=new Ft(n,s,kt);else{var h=n[0].mipmaps;r=e.layerCount>1?new Qt(h,i,o,e.layerCount,s,kt):new Ot(h,i,o,s,kt)}return r.minFilter=1===n[0].mipmaps.length?P:D,r.magFilter=P,r.generateMipmaps=!1,r.needsUpdate=!0,r.colorSpace=PM(e),r.premultiplyAlpha=!!(1&l),r}},{key:"_createTexture",value:(e=Ke(Xe().mark((function t(e){var r,n,i,o,s=this,a=arguments;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=a.length>1&&void 0!==a[1]?a[1]:{},0===(n=mM(new Uint8Array(e))).vkFormat){t.next=4;break}return t.abrupt("return",RM(n));case 4:return i=r,o=this.init().then((function(){return s.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])})).then((function(t){return s._createTextureFrom(t.data,n)})),bM.set(e,{promise:o}),t.abrupt("return",o);case 8:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"dispose",value:function(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),SM--,this}}]),n}();BM.BasisFormat={ETC1S:0,UASTC_4x4:1},BM.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},BM.EngineFormat={RGBAFormat:Tt,RGBA_ASTC_4x4_Format:Ut,RGBA_BPTC_Format:Gt,RGBA_ETC2_EAC_Format:zt,RGBA_PVRTC_4BPPV1_Format:jt,RGBA_S3TC_DXT5_Format:Vt,RGB_ETC1_Format:Ht,RGB_ETC2_Format:qt,RGB_PVRTC_4BPPV1_Format:Yt,RGB_S3TC_DXT1_Format:Xt},BM.BasisWorker=function(){var t,e,r,n=_EngineFormat,i=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(s){var c,f=s.data;switch(f.type){case"init":t=f.config,c=f.transcoderBinary,e=new Promise((function(t){r={wasmBinary:c,onRuntimeInitialized:t},BASIS(r)})).then((function(){r.initializeBasis(),void 0===r.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":e.then((function(){try{var e=function(e){var s=new r.KTX2File(new Uint8Array(e));function c(){s.close(),s.delete()}if(!s.isValid())throw c(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");var f=s.isUASTC()?o.UASTC_4x4:o.ETC1S,p=s.getWidth(),d=s.getHeight(),g=s.getLayers()||1,A=s.getLevels(),y=s.getFaces(),v=s.getHasAlpha(),m=s.getDFDFlags(),_=function(e,r,s,h){for(var c,f,p=e===o.ETC1S?a:u,d=0;d<p.length;d++){var g=p[d];if(t[g.if]&&(g.basisFormat.includes(e)&&!(h&&g.transcoderFormat.length<2)&&(!g.needsPowerOfTwo||l(r)&&l(s))))return{transcoderFormat:c=g.transcoderFormat[h?1:0],engineFormat:f=g.engineFormat[h?1:0]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),c=i.RGBA32,f=n.RGBAFormat,{transcoderFormat:c,engineFormat:f}}(f,p,d,v),I=_.transcoderFormat,E=_.engineFormat;if(!p||!d||!A)throw c(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!s.startTranscoding())throw c(),new Error("THREE.KTX2Loader: .startTranscoding failed");for(var x=[],w=[],C=0;C<y;C++){for(var b=[],S=0;S<A;S++){for(var B=[],M=void 0,T=void 0,L=0;L<g;L++){var R=s.getImageLevelInfo(S,L,C);0!==C||0!==S||0!==L||R.origWidth%4==0&&R.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),A>1?(M=R.origWidth,T=R.origHeight):(M=R.width,T=R.height);var N=new Uint8Array(s.getImageTranscodedSizeInBytes(S,L,0,I));if(!s.transcodeImage(N,S,L,C,I,0,-1,-1))throw c(),new Error("THREE.KTX2Loader: .transcodeImage failed.");B.push(N)}var P=h(B);b.push({data:P,width:M,height:T}),w.push(P.buffer)}x.push({mipmaps:b,width:p,height:d,format:E})}return c(),{faces:x,buffers:w,width:p,height:d,hasAlpha:v,format:E,dfdFlags:m}}(f.buffer),s=e.faces,c=e.buffers,p=e.width,d=e.height,g=e.hasAlpha,A=e.format,y=e.dfdFlags;self.postMessage({type:"transcode",id:f.id,faces:s,width:p,height:d,hasAlpha:g,format:A,dfdFlags:y},c)}catch(t){console.error(t),self.postMessage({type:"error",id:f.id,error:t.message})}}))}}));var s=[{if:"astcSupported",basisFormat:[o.UASTC_4x4],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.BC1,i.BC3],engineFormat:[n.RGB_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.ETC1],engineFormat:[n.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],a=s.sort((function(t,e){return t.priorityETC1S-e.priorityETC1S})),u=s.sort((function(t,e){return t.priorityUASTC-e.priorityUASTC}));function l(t){return t<=2||0==(t&t-1)&&0!==t}function h(t){if(1===t.length)return t[0];for(var e=0,r=0;r<t.length;r++){e+=t[r].byteLength}for(var n=new Uint8Array(e),i=0,o=0;o<t.length;o++){var s=t[o];n.set(s,i),i+=s.byteLength}return n}};var MM=new Set([Tt,Lt,Rt]),TM=(er(_M={},109,Tt),er(_M,97,Tt),er(_M,37,Tt),er(_M,43,Tt),er(_M,103,Lt),er(_M,83,Lt),er(_M,16,Lt),er(_M,22,Lt),er(_M,100,Rt),er(_M,76,Rt),er(_M,15,Rt),er(_M,9,Rt),er(_M,166,Nt),er(_M,165,Nt),_M),LM=(er(IM={},109,Pt),er(IM,97,Dt),er(IM,37,kt),er(IM,43,kt),er(IM,103,Pt),er(IM,83,Dt),er(IM,16,kt),er(IM,22,kt),er(IM,100,Pt),er(IM,76,Dt),er(IM,15,kt),er(IM,9,kt),er(IM,166,kt),er(IM,165,kt),IM);function RM(t){return NM.apply(this,arguments)}function NM(){return NM=Ke(Xe().mark((function t(e){var r,n,i,o,s,a,u,l,h,c,f;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.vkFormat,void 0!==TM[r]){t.next=3;break}throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");case 3:if(e.supercompressionScheme!==hM){t.next=8;break}return EM||(EM=new Promise(function(){var t=Ke(Xe().mark((function t(e){var r;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new wM,t.next=3,r.init();case 3:e(r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())),t.next=7,EM;case 7:n=t.sent;case 8:i=[],o=0;case 10:if(!(o<e.levels.length)){t.next=31;break}if(s=Math.max(1,e.pixelWidth>>o),a=Math.max(1,e.pixelHeight>>o),u=e.pixelDepth?Math.max(1,e.pixelDepth>>o):0,l=e.levels[o],h=void 0,e.supercompressionScheme!==lM){t.next=20;break}h=l.levelData,t.next=25;break;case 20:if(e.supercompressionScheme!==hM){t.next=24;break}h=n.decode(l.levelData,l.uncompressedByteLength),t.next=25;break;case 24:throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");case 25:c=void 0,c=LM[r]===Pt?new Float32Array(h.buffer,h.byteOffset,h.byteLength/Float32Array.BYTES_PER_ELEMENT):LM[r]===Dt?new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT):h,i.push({data:c,width:s,height:a,depth:u});case 28:o++,t.next=10;break;case 31:if(!MM.has(TM[r])){t.next=35;break}f=0===e.pixelDepth?new Zt(i[0].data,e.pixelWidth,e.pixelHeight):new $t(i[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth),t.next=38;break;case 35:if(!(e.pixelDepth>0)){t.next=37;break}throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");case 37:f=new Ot(i,e.pixelWidth,e.pixelHeight);case 38:return f.mipmaps=i,f.type=LM[r],f.format=TM[r],f.colorSpace=PM(e),f.needsUpdate=!0,t.abrupt("return",Promise.resolve(f));case 44:case"end":return t.stop()}}),t)}))),NM.apply(this,arguments)}function PM(t){var e=t.dataFormatDescriptor[0];return e.colorPrimaries===pM?e.transferFunction===cM?C:_:e.colorPrimaries===dM?e.transferFunction===cM?Wt:Jt:(e.colorPrimaries===fM||console.warn('THREE.KTX2Loader: Unsupported color primaries, "'.concat(e.colorPrimaries,'"')),Kt)}var DM=!1,kM=!1,FM=0,QM=function(){function t(e,r,n,i){var o=this;Ze(this,t),this.threelayer=n,this.map=n.map,this.layerClass=i,this.statsUpdate=r.statsUpdate;var s=n.getScene(),a=n.getRenderer().context;1*u.REVISION<152&&(a.outputEncoding=u.sRGBEncoding);var l=n.getCamera();this.scene=s,this.renderer=a,this.camera=l,this.multiles=[],this.meshs=[],this._raycaster=new u.Raycaster,this._raycaster.firstHitOnly=!0,this._mouse=new u.Vector2;var h=new nM;h.setDecoderPath(r.decoderPath);var c=new BM;c.setTranscoderPath(r.transcoderPath),c.detectSupport(a),e.forEach((function(t){var e=new gB(t.url,n);if(e.errorTarget=t.errorTarget||6,e.maxDepth=t.maxDepth||1/0,e.displayBoxBounds=DM,e.displaySphereBounds=kM,e.colorMode=parseFloat(FM),e.heightOffset=t.heightOffset||0,e.xOffset=t.xOffset||0,e.yOffset=t.yOffset||0,e.yScale="EPSG:4326"===n.getMap().getProjection().code?t.yScale||.7945:1,e.lruCache.minSize=t.cacheMinSize||600,e.lruCache.maxSize=t.cacheMaxSize||800,e.parseQueue.maxJobs=t.parseJobs||1,e.downloadQueue.maxJobs=t.downJobs||4,e.setCamera(l),e.setResolutionFromRenderer(l,a),o.multiles.length>0){var r=o.multiles[0];e.lruCache=r.lruCache,e.downloadQueue=r.downloadQueue}e.fetchOptions.mode="cors";var i=new Pw(e.manager);i.setDRACOLoader(h),i.setKTX2Loader(c),e.manager.addHandler(/\.gltf$/,i),o.meshs.push(e.group),o.scene.add(e.group),o.multiles.push(e)})),this.layerClass.updatables.push(this)}return tr(t,[{key:"identify",value:function(t,e){var r=this.map.coordToContainerPoint(t),n=r.x,i=r.y,o=this._raycaster,s=this._mouse,a=this.camera,u=this.map.getSize(),l=u.width,h=u.height;return s.x=n/l*2-1,s.y=-i/h*2+1,o.setFromCamera(s,a),e&&e.length?o.intersectObjects(e,!0):o.intersectObjects(this.meshs,!0)}},{key:"tick",value:function(t){this.multiles.forEach((function(t){t.update()})),this.statsUpdate&&this.statsUpdate()}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"findRoot",value:function(t){for(;t.position.x<=0;)t=t.parent;return t}},{key:"selectGeometry",value:function(t,e){var r,n=this,i=(null==e?void 0:e.hidePosition)||-999,o=void 0===(null==e?void 0:e.hideGeoFlag)||(null==e?void 0:e.hideGeoFlag),s=[],a={},l=[];t.forEach((function(t){var e=t[0],r=t[1];if(e.geometry.getAttribute("_batchid")){for(var l=e;!l.batchTable;)l=l.parent;var h=n.findRoot(e);h.updateMatrix();var c=[];o&&(a[r]={object:e,values:c});for(var f=e.geometry.attributes.position.array,p=e.geometry.attributes.normal.array,d=e.geometry.index.array,g=e.geometry.attributes._batchid.array,A=[],y=[],v=[],m=-1,_=0;_<g.length;_++)g[_]===r&&(A.push(f[3*_+0]),A.push(f[3*_+1]),A.push(f[3*_+2]),y.push(p[3*_+0]),y.push(p[3*_+1]),y.push(p[3*_+2]),o&&(c.push([3*_+0,f[3*_+0]]),c.push([3*_+1,f[3*_+1]]),c.push([3*_+2,f[3*_+2]]),f[3*_+0]=i,f[3*_+1]=i,f[3*_+2]=i),-1===m&&(m=d[_]),v.push(d[_]-m));o&&(e.geometry.attributes.position.needsUpdate=!0);var I=new u.BufferGeometry;I.setAttribute("position",new u.BufferAttribute(new Float32Array(A),3)),I.setAttribute("normal",new u.BufferAttribute(new Float32Array(y),3)),I.setIndex(new u.Uint16BufferAttribute(new Uint16Array(v),1)),I.computeBoundingBox(),s.push([I,h])}})),r=null!=e&&e.material?null==e?void 0:e.material:new u.MeshBasicMaterial({color:(null==e?void 0:e.color)||"red",side:u.DoubleSide,transparent:!0,opacity:(null==e?void 0:e.opacity)||.5});var h=new u.Vector3,c=new u.Vector3,f=new u.Quaternion,p=s.length,d=new u.BatchedMesh(p,18e3*p,9e4*p,r);d.frustumCulled=!1,d.perObjectFrustumCulled=!1,null!=e&&e.data&&(d.userData.data=e.data),this.scene.add(d);var g=new u.Vector3,A=new u.Vector3,y=new u.Quaternion;return s.forEach((function(t,e){var r=d.addGeometry(t[0]);if(0===e)t[1].matrix.decompose(g,y,A),d.rotation.x=Math.PI/2,d.applyMatrix4(t[1].matrix);else{t[1].matrix.decompose(h,f,c);var n=c.x/A.x,i=c.y/A.y,o=c.z/A.z,s=n/c.x,a=i/c.y,l=o/c.z,p=h.x-g.x,v=h.y-g.y,m=h.z-g.z,_=y.angleTo(f);_>0&&console.log(_,"需要旋转的角度");var I=new u.Matrix4;I.compose(new u.Vector3(p*s,m*l,-v*a),new u.Quaternion,new u.Vector3(n,i,o)),d.setMatrixAt(r,I)}})),l.push(d),{meshs:l,hideObjects:a,material:r}}},{key:"cancelSelect",value:function(t){var e=this,r=t.meshs,n=t.hideObjects,i=t.material;r.forEach((function(t){e.scene.remove(t),t.geometry&&t.geometry.dispose()})),null==i||i.dispose();var o=function(){var t=n[s],e=t.object,r=t.values,i=e.geometry.attributes.position.array;r.forEach((function(t){i[t[0]]=t[1]})),e.geometry.attributes.position.needsUpdate=!0};for(var s in n)o()}},{key:"findObjectInfo",value:function(t){var e=new maptalks.Coordinate({x:t[0],y:t[1]}),r=this.identify(e);if(r.length>0&&r[0].object.material){var n=r[0],i=n.face,o=n.object,s=o.geometry.getAttribute("_batchid");if(s){for(var a=o;!a.batchTable;)a=a.parent;var l=a.batchTable,h=s.getX(i.a),c=l.getKeys(),f=this.findRoot(o);f.updateMatrix();for(var p=o.geometry.attributes.position.array,d=o.geometry.index.array,g=o.geometry.attributes._batchid.array,A=[],y=[],v=-1,m=0;m<g.length;m++)g[m]===h&&(A.push(p[3*m+0]),A.push(p[3*m+1]),A.push(p[3*m+2]),-1===v&&(v=d[m]),y.push(d[m]-v));var _=new u.BufferGeometry;_.setAttribute("position",new u.BufferAttribute(new Float32Array(A),3)),_.setIndex(new u.Uint16BufferAttribute(new Uint16Array(y),1)),_.computeBoundingBox();var I=new u.Mesh(_,new u.MeshBasicMaterial({color:"yellow",side:u.DoubleSide,transparent:!0,opacity:.5}));return I.rotation.x=Math.PI/2,I.applyMatrix4(f.matrix),this.scene.add(I),{batchData:c.map((function(t){return{key:t,value:l.getData(t)[h]}})),object:o,hoveredBatchid:h,mesh:I}}}}},{key:"cancelFindResult",value:function(t){this.scene.remove(t),t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()}},{key:"dispose",value:function(){this.threelayer.removeMesh(this.meshs),this.multiles.forEach((function(t){t.dispose()})),this.removeAnimation()}}]),t}(),OM={radius:100,altitude:0},UM=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),o=t.Util.extend({},OM,o,{layer:s,coordinate:e}),(a=r.call(this))._initOptions(o);var u=o.altitude;a._createGroup(),a.getObject3d().add(i);var l=s.distanceToVector3(u,u).x,h=s.coordinateToVector3(e,l);return a.getObject3d().position.copy(h),a}return tr(n)}(),GM=function(){function t(e,r,n){Ze(this,t),this.threeLayer=r,this.groupId=n;var i=new u.LoadingManager,o=new Pw(i),s=new nM(i);s.setDecoderPath(e),o.setDRACOLoader(s),i.addHandler(/\.gltf$/,o),i.addHandler(/\.glb$/,o),this.loader=new qC(i)}var e;return tr(t,[{key:"addModel",value:(e=Ke(Xe().mark((function t(e,r,n){var i,o,s=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loader.workingPath=this.loader.workingPathForURL(e),t.next=3,this.loader.load(e);case 3:return i=t.sent,(o=new UM([parseFloat(r.longitude),parseFloat(r.latitude)],i.scene,n,this.threeLayer)).setProperties(r),this.groupId?this.threeLayer.addMesh1(o,this.groupId):this.threeLayer.addMesh(o),this.clickFunc=n.clickFunc,this.model=o,n.zoomChange&&(this.model.zoomChange=function(){n.zoomChange(s.model)}),this._bindMapEvents(),t.abrupt("return",this);case 12:case"end":return t.stop()}}),t,this)}))),function(t,r,n){return e.apply(this,arguments)})},{key:"_bindMapEvents",value:function(){this.model&&this.model.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.model&&this.model.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){var e=t.target.getProperties();"click"===t.type&&e&&this.clickFunc&&this.clickFunc(e)}},{key:"hide",value:function(){this.model.hide()}},{key:"show",value:function(){this.model.show()}},{key:"dispose",value:function(){if(this._closeEvent(),this.model){this.groupId?this.threeLayer.removeMesh1(this.model,this.groupId):this.threeLayer.removeMesh(this.model);var t=this.model.object3d.children[0];t.traverse((function(e){"Mesh"===e.type&&(e.geometry.dispose(),e.material.dispose(),t.remove(e))}))}}}]),t}(),zM=function(t){rr(r,u.Group);var e=ur(r);function r(t,n){var i;return Ze(this,r),(i=e.call(this)).name=n,i.customId=ZE(),t.add(ar(i)),i.customType="layer",i}return tr(r)}(),jM=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};try{URL.revokeObjectURL(jM(""))}catch(t){jM=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)}}var VM=Uint8Array,HM=Uint16Array,qM=Uint32Array,YM=new VM([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),XM=new VM([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),WM=new VM([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),JM=function(t,e){for(var r=new HM(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];var i=new qM(r[30]);for(n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},KM=JM(YM,2),ZM=KM[0],$M=KM[1];ZM[28]=258,$M[258]=28;for(var tT=JM(XM,0)[0],eT=new HM(32768),rT=0;rT<32768;++rT){var nT=(43690&rT)>>>1|(21845&rT)<<1;nT=(61680&(nT=(52428&nT)>>>2|(13107&nT)<<2))>>>4|(3855&nT)<<4,eT[rT]=((65280&nT)>>>8|(255&nT)<<8)>>>1}var iT=function(t,e,r){for(var n=t.length,i=0,o=new HM(e);i<n;++i)++o[t[i]-1];var s,a=new HM(e);for(i=0;i<e;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){s=new HM(1<<e);var u=15-e;for(i=0;i<n;++i)if(t[i])for(var l=i<<4|t[i],h=e-t[i],c=a[t[i]-1]++<<h,f=c|(1<<h)-1;c<=f;++c)s[eT[c]>>>u]=l}else for(s=new HM(n),i=0;i<n;++i)t[i]&&(s[i]=eT[a[t[i]-1]++]>>>15-t[i]);return s},oT=new VM(288);for(rT=0;rT<144;++rT)oT[rT]=8;for(rT=144;rT<256;++rT)oT[rT]=9;for(rT=256;rT<280;++rT)oT[rT]=7;for(rT=280;rT<288;++rT)oT[rT]=8;var sT=new VM(32);for(rT=0;rT<32;++rT)sT[rT]=5;var aT=iT(oT,9,1),uT=iT(sT,5,1),lT=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},hT=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&r},cT=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&e)},fT=function(t){return(t/8|0)+(7&t&&1)},pT=function(t,e,r){var n=t.length;if(!n||r&&!r.l&&n<5)return e||new VM(0);var i=!e||r,o=!r||r.i;r||(r={}),e||(e=new VM(3*n));var s=function(t){var r=e.length;if(t>r){var n=new VM(Math.max(2*r,t));n.set(e),e=n}},a=r.f||0,u=r.p||0,l=r.b||0,h=r.l,c=r.d,f=r.m,p=r.n,d=8*n;do{if(!h){r.f=a=hT(t,u,1);var g=hT(t,u+1,3);if(u+=3,!g){var A=t[(S=fT(u)+4)-4]|t[S-3]<<8,y=S+A;if(y>n){if(o)throw"unexpected EOF";break}i&&s(l+A),e.set(t.subarray(S,y),l),r.b=l+=A,r.p=u=8*y;continue}if(1==g)h=aT,c=uT,f=9,p=5;else{if(2!=g)throw"invalid block type";var v=hT(t,u,31)+257,m=hT(t,u+10,15)+4,_=v+hT(t,u+5,31)+1;u+=14;for(var I=new VM(_),E=new VM(19),x=0;x<m;++x)E[WM[x]]=hT(t,u+3*x,7);u+=3*m;var w=lT(E),C=(1<<w)-1,b=iT(E,w,1);for(x=0;x<_;){var S,B=b[hT(t,u,C)];if(u+=15&B,(S=B>>>4)<16)I[x++]=S;else{var M=0,T=0;for(16==S?(T=3+hT(t,u,3),u+=2,M=I[x-1]):17==S?(T=3+hT(t,u,7),u+=3):18==S&&(T=11+hT(t,u,127),u+=7);T--;)I[x++]=M}}var L=I.subarray(0,v),R=I.subarray(v);f=lT(L),p=lT(R),h=iT(L,f,1),c=iT(R,p,1)}if(u>d){if(o)throw"unexpected EOF";break}}i&&s(l+131072);for(var N=(1<<f)-1,P=(1<<p)-1,D=u;;D=u){var k=(M=h[cT(t,u)&N])>>>4;if((u+=15&M)>d){if(o)throw"unexpected EOF";break}if(!M)throw"invalid length/literal";if(k<256)e[l++]=k;else{if(256==k){D=u,h=null;break}var F=k-254;if(k>264){var Q=YM[x=k-257];F=hT(t,u,(1<<Q)-1)+ZM[x],u+=Q}var O=c[cT(t,u)&P],U=O>>>4;if(!O)throw"invalid distance";u+=15&O;R=tT[U];if(U>3){Q=XM[U];R+=cT(t,u)&(1<<Q)-1,u+=Q}if(u>d){if(o)throw"unexpected EOF";break}i&&s(l+131072);for(var G=l+F;l<G;l+=4)e[l]=e[l-R],e[l+1]=e[l+1-R],e[l+2]=e[l+2-R],e[l+3]=e[l+3-R];l=G}}r.l=h,r.p=D,r.b=l,h&&(a=1,r.m=f,r.d=c,r.n=p)}while(!a);return l==e.length?e:function(t,e,r){(null==e||e<0)&&(e=0),(null==r||r>t.length)&&(r=t.length);var n=new(t instanceof HM?HM:t instanceof qM?qM:VM)(r-e);return n.set(t.subarray(e,r)),n}(e,0,l)},dT=new VM(0);var gT="undefined"!=typeof TextDecoder&&new TextDecoder;try{gT.decode(dT,{stream:!0}),1}catch(t){}function AT(t,e,r){var n=r.length-t-1;if(e>=r[n])return n-1;if(e<=r[t])return t;for(var i=t,o=n,s=Math.floor((i+o)/2);e<r[s]||e>=r[s+1];)e<r[s]?o=s:i=s,s=Math.floor((i+o)/2);return s}function yT(t,e){for(var r=1,n=2;n<=t;++n)r*=n;for(var i=1,o=2;o<=e;++o)i*=o;for(var s=2;s<=t-e;++s)i*=s;return r/i}function vT(t,e,r,n,i){var o=function(t,e,r,n,i){for(var o=i<t?i:t,s=[],a=AT(t,n,e),u=function(t,e,r,n,i){for(var o=[],s=0;s<=r;++s)o[s]=0;for(var a=[],u=0;u<=n;++u)a[u]=o.slice(0);for(var l=[],h=0;h<=r;++h)l[h]=o.slice(0);l[0][0]=1;for(var c=o.slice(0),f=o.slice(0),p=1;p<=r;++p){c[p]=e-i[t+1-p],f[p]=i[t+p]-e;for(var d=0,g=0;g<p;++g){var A=f[g+1],y=c[p-g];l[p][g]=A+y;var v=l[g][p-1]/l[p][g];l[g][p]=d+A*v,d=y*v}l[p][p]=d}for(var m=0;m<=r;++m)a[0][m]=l[m][r];for(var _=0;_<=r;++_){for(var I=0,E=1,x=[],w=0;w<=r;++w)x[w]=o.slice(0);x[0][0]=1;for(var C=1;C<=n;++C){var b=0,S=_-C,B=r-C;_>=C&&(x[E][0]=x[I][0]/l[B+1][S],b=x[E][0]*l[S][B]);for(var M=_-1<=B?C-1:r-_,T=S>=-1?1:-S;T<=M;++T)x[E][T]=(x[I][T]-x[I][T-1])/l[B+1][S+T],b+=x[E][T]*l[S+T][B];_<=B&&(x[E][C]=-x[I][C-1]/l[B+1][_],b+=x[E][C]*l[_][B]),a[C][_]=b;var L=I;I=E,E=L}}for(var R=r,N=1;N<=n;++N){for(var P=0;P<=r;++P)a[N][P]*=R;R*=r-N}return a}(a,n,t,o,e),l=[],h=0;h<r.length;++h){var c=r[h].clone(),f=c.w;c.x*=f,c.y*=f,c.z*=f,l[h]=c}for(var p=0;p<=o;++p){for(var d=l[a-t].clone().multiplyScalar(u[p][0]),g=1;g<=t;++g)d.add(l[a-t+g].clone().multiplyScalar(u[p][g]));s[p]=d}for(var A=o+1;A<=i+1;++A)s[A]=new te(0,0,0);return s}(t,e,r,n,i);return function(t){for(var e=t.length,r=[],n=[],i=0;i<e;++i){var o=t[i];r[i]=new B(o.x,o.y,o.z),n[i]=o.w}for(var s=[],a=0;a<e;++a){for(var u=r[a].clone(),l=1;l<=a;++l)u.sub(s[a-l].clone().multiplyScalar(yT(a,l)*n[l]));s[a]=u.divideScalar(n[0])}return s}(o)}var mT,_T,IT,ET=function(t){rr(r,ee);var e=ur(r);function r(t,n,i,o,s){var a;Ze(this,r),(a=e.call(this)).degree=t,a.knots=n,a.controlPoints=[],a.startKnot=o||0,a.endKnot=s||a.knots.length-1;for(var u=0;u<i.length;++u){var l=i[u];a.controlPoints[u]=new te(l.x,l.y,l.z,l.w)}return a}return tr(r,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new B,r=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),n=function(t,e,r,n){for(var i=AT(t,n,e),o=function(t,e,r,n){var i=[],o=[],s=[];i[0]=1;for(var a=1;a<=r;++a){o[a]=e-n[t+1-a],s[a]=n[t+a]-e;for(var u=0,l=0;l<a;++l){var h=s[l+1],c=o[a-l],f=i[l]/(h+c);i[l]=u+h*f,u=c*f}i[a]=u}return i}(i,n,t,e),s=new te(0,0,0,0),a=0;a<=t;++a){var u=r[i-t+a],l=o[a],h=u.w*l;s.x+=u.x*h,s.y+=u.y*h,s.z+=u.z*h,s.w+=u.w*l}return s}(this.degree,this.knots,this.controlPoints,r);return 1!==n.w&&n.divideScalar(n.w),e.set(n.x,n.y,n.z)}},{key:"getTangent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new B,r=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),n=vT(this.degree,this.knots,this.controlPoints,r,1);return e.copy(n[1]).normalize(),e}}]),r}(),xT=function(t){rr(r,m);var e=ur(r);function r(t){return Ze(this,r),e.call(this,t)}return tr(r,[{key:"load",value:function(t,e,r,n){var i=this,o=""===i.path?y.extractUrlBase(t):i.path,s=new v(this.manager);s.setPath(i.path),s.setResponseType("arraybuffer"),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(t,(function(r){try{e(i.parse(r,o))}catch(e){n?n(e):console.error(e),i.manager.itemError(t)}}),r,n)}},{key:"parse",value:function(t,e){if(function(t){var e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===UT(t,0,e.length)}(t))mT=(new BT).parse(t);else{var r=UT(t);if(!function(t){var e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0;function n(e){var n=t[e-1];return t=t.slice(r+e),r++,n}for(var i=0;i<e.length;++i){if(n(1)===e[i])return!1}return!0}(r))throw new Error("THREE.FBXLoader: Unknown format.");if(LT(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+LT(r));mT=(new ST).parse(r)}var n=new ft(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new wT(n,this.manager).parse(mT)}}]),r}(),wT=function(){function t(e,r){Ze(this,t),this.textureLoader=e,this.manager=r}return tr(t,[{key:"parse",value:function(){_T=this.parseConnections();var t=this.parseImages(),e=this.parseTextures(t),r=this.parseMaterials(e),n=this.parseDeformers(),i=(new CT).parse(n);return this.parseScene(n,i,r),IT}},{key:"parseConnections",value:function(){var t=new Map;"Connections"in mT&&mT.Connections.connections.forEach((function(e){var r=e[0],n=e[1],i=e[2];t.has(r)||t.set(r,{parents:[],children:[]});var o={ID:n,relationship:i};t.get(r).parents.push(o),t.has(n)||t.set(n,{parents:[],children:[]});var s={ID:r,relationship:i};t.get(n).children.push(s)}));return t}},{key:"parseImages",value:function(){var t={},e={};if("Video"in mT.Objects){var r=mT.Objects.Video;for(var n in r){var i=r[n];if(t[parseInt(n)]=i.RelativeFilename||i.Filename,"Content"in i){var o=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,s="string"==typeof i.Content&&""!==i.Content;if(o||s){var a=this.parseImage(r[n]);e[i.RelativeFilename||i.Filename]=a}}}}for(var u in t){var l=t[u];void 0!==e[l]?t[u]=e[l]:t[u]=t[u].split("\\").pop()}return t}},{key:"parseImage",value:function(t){var e,r=t.Content,n=t.RelativeFilename||t.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":e="image/bmp";break;case"jpg":case"jpeg":e="image/jpeg";break;case"png":e="image/png";break;case"tif":e="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),e="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof r)return"data:"+e+";base64,"+r;var o=new Uint8Array(r);return window.URL.createObjectURL(new Blob([o],{type:e}))}},{key:"parseTextures",value:function(t){var e=new Map;if("Texture"in mT.Objects){var r=mT.Objects.Texture;for(var n in r){var i=this.parseTexture(r[n],t);e.set(parseInt(n),i)}}return e}},{key:"parseTexture",value:function(t,e){var r=this.loadTexture(t,e);r.ID=t.id,r.name=t.attrName;var n=t.WrapModeU,i=t.WrapModeV,o=void 0!==n?n.value:0,s=void 0!==i?i.value:0;if(r.wrapS=0===o?k:ut,r.wrapT=0===s?k:ut,"Scaling"in t){var a=t.Scaling.value;r.repeat.x=a[0],r.repeat.y=a[1]}if("Translation"in t){var u=t.Translation.value;r.offset.x=u[0],r.offset.y=u[1]}return r}},{key:"loadTexture",value:function(t,e){var r,n,i=this.textureLoader.path,o=_T.get(t.id).children;void 0!==o&&o.length>0&&void 0!==e[o[0].ID]&&(0!==(r=e[o[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0));var s=t.FileName.slice(-3).toLowerCase();if("tga"===s){var a=this.manager.getHandler(".tga");null===a?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),n=new dt):(a.setPath(this.textureLoader.path),n=a.load(r))}else if("dds"===s){var u=this.manager.getHandler(".dds");null===u?(console.warn("FBXLoader: DDS loader not found, creating placeholder texture for",t.RelativeFilename),n=new dt):(u.setPath(this.textureLoader.path),n=u.load(r))}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),n=new dt):n=this.textureLoader.load(r);return this.textureLoader.setPath(i),n}},{key:"parseMaterials",value:function(t){var e=new Map;if("Material"in mT.Objects){var r=mT.Objects.Material;for(var n in r){var i=this.parseMaterial(r[n],t);null!==i&&e.set(parseInt(n),i)}}return e}},{key:"parseMaterial",value:function(t,e){var r=t.id,n=t.attrName,i=t.ShadingModel;if("object"===We(i)&&(i=i.value),!_T.has(r))return null;var o,s=this.parseParameters(t,e,r);switch(i.toLowerCase()){case"phong":o=new re;break;case"lambert":o=new ne;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),o=new re}return o.setValues(s),o.name=n,o}},{key:"parseParameters",value:function(t,e,r){var n={};t.BumpFactor&&(n.bumpScale=t.BumpFactor.value),t.Diffuse?n.color=(new d).fromArray(t.Diffuse.value).convertSRGBToLinear():!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(n.color=(new d).fromArray(t.DiffuseColor.value).convertSRGBToLinear()),t.DisplacementFactor&&(n.displacementScale=t.DisplacementFactor.value),t.Emissive?n.emissive=(new d).fromArray(t.Emissive.value).convertSRGBToLinear():!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(n.emissive=(new d).fromArray(t.EmissiveColor.value).convertSRGBToLinear()),t.EmissiveFactor&&(n.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(n.opacity=parseFloat(t.Opacity.value)),n.opacity<1&&(n.transparent=!0),t.ReflectionFactor&&(n.reflectivity=t.ReflectionFactor.value),t.Shininess&&(n.shininess=t.Shininess.value),t.Specular?n.specular=(new d).fromArray(t.Specular.value).convertSRGBToLinear():t.SpecularColor&&"Color"===t.SpecularColor.type&&(n.specular=(new d).fromArray(t.SpecularColor.value).convertSRGBToLinear());var i=this;return _T.get(r).children.forEach((function(t){var r=t.relationship;switch(r){case"Bump":n.bumpMap=i.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":n.aoMap=i.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=i.getTexture(e,t.ID),void 0!==n.map&&(n.map.colorSpace=C);break;case"DisplacementColor":n.displacementMap=i.getTexture(e,t.ID);break;case"EmissiveColor":n.emissiveMap=i.getTexture(e,t.ID),void 0!==n.emissiveMap&&(n.emissiveMap.colorSpace=C);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=i.getTexture(e,t.ID);break;case"ReflectionColor":n.envMap=i.getTexture(e,t.ID),void 0!==n.envMap&&(n.envMap.mapping=ie,n.envMap.colorSpace=C);break;case"SpecularColor":n.specularMap=i.getTexture(e,t.ID),void 0!==n.specularMap&&(n.specularMap.colorSpace=C);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=i.getTexture(e,t.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(t,e){return"LayeredTexture"in mT.Objects&&e in mT.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=_T.get(e).children[0].ID),t.get(e)}},{key:"parseDeformers",value:function(){var t={},e={};if("Deformer"in mT.Objects){var r=mT.Objects.Deformer;for(var n in r){var i=r[n],o=_T.get(parseInt(n));if("Skin"===i.attrType){var s=this.parseSkeleton(o,r);s.ID=n,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),s.geometryID=o.parents[0].ID,t[n]=s}else if("BlendShape"===i.attrType){var a={id:n};a.rawTargets=this.parseMorphTargets(o,r),a.id=n,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[n]=a}}}return{skeletons:t,morphTargets:e}}},{key:"parseSkeleton",value:function(t,e){var r=[];return t.children.forEach((function(t){var n=e[t.ID];if("Cluster"===n.attrType){var i={ID:t.ID,indices:[],weights:[],transformLink:(new A).fromArray(n.TransformLink.a)};"Indexes"in n&&(i.indices=n.Indexes.a,i.weights=n.Weights.a),r.push(i)}})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(t,e){for(var r=[],n=0;n<t.children.length;n++){var i=t.children[n],o=e[i.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;s.geoID=_T.get(parseInt(i.ID)).children.filter((function(t){return void 0===t.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(t,e,r){IT=new W;var n=this.parseModels(t.skeletons,e,r),i=mT.Objects.Model,o=this;n.forEach((function(t){var e=i[t.ID];o.setLookAtProperties(t,e),_T.get(t.ID).parents.forEach((function(e){var r=n.get(e.ID);void 0!==r&&r.add(t)})),null===t.parent&&IT.add(t)})),this.bindSkeleton(t.skeletons,e,n),this.addGlobalSceneSettings(),IT.traverse((function(t){if(t.userData.transformData){t.parent&&(t.userData.transformData.parentMatrix=t.parent.matrix,t.userData.transformData.parentMatrixWorld=t.parent.matrixWorld);var e=FT(t.userData.transformData);t.applyMatrix4(e),t.updateWorldMatrix()}}));var s=(new bT).parse();1===IT.children.length&&IT.children[0].isGroup&&(IT.children[0].animations=s,IT=IT.children[0]),IT.animations=s}},{key:"parseModels",value:function(t,e,r){var n=new Map,i=mT.Objects.Model;for(var o in i){var s=parseInt(o),a=i[o],u=_T.get(s),l=this.buildSkeleton(u,t,s,a.attrName);if(!l){switch(a.attrType){case"Camera":l=this.createCamera(u);break;case"Light":l=this.createLight(u);break;case"Mesh":l=this.createMesh(u,e,r);break;case"NurbsCurve":l=this.createCurve(u,e);break;case"LimbNode":case"Root":l=new et;break;default:l=new W}l.name=a.attrName?z.sanitizeNodeName(a.attrName):"",l.userData.originalName=a.attrName,l.ID=s}this.getTransformData(l,a),n.set(s,l)}return n}},{key:"buildSkeleton",value:function(t,e,r,n){var i=null;return t.parents.forEach((function(t){var o=function(){var o=e[s];o.rawBones.forEach((function(e,s){if(e.ID===t.ID){var a=i;(i=new et).matrixWorld.copy(e.transformLink),i.name=n?z.sanitizeNodeName(n):"",i.userData.originalName=n,i.ID=r,o.bones[s]=i,null!==a&&i.add(a)}}))};for(var s in e)o()})),i}},{key:"createCamera",value:function(t){var e,r;if(t.children.forEach((function(t){var e=mT.Objects.NodeAttribute[t.ID];void 0!==e&&(r=e)})),void 0===r)e=new L;else{var n=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1);var i=1;void 0!==r.NearPlane&&(i=r.NearPlane.value/1e3);var o=1e3;void 0!==r.FarPlane&&(o=r.FarPlane.value/1e3);var s=window.innerWidth,a=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(s=r.AspectWidth.value,a=r.AspectHeight.value);var u=s/a,l=45;void 0!==r.FieldOfView&&(l=r.FieldOfView.value);var h=r.FocalLength?r.FocalLength.value:null;switch(n){case 0:e=new J(l,u,i,o),null!==h&&e.setFocalLength(h);break;case 1:e=new Z(-s/2,s/2,a/2,-a/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),e=new L}}return e}},{key:"createLight",value:function(t){var e,r;if(t.children.forEach((function(t){var e=mT.Objects.NodeAttribute[t.ID];void 0!==e&&(r=e)})),void 0===r)e=new L;else{var n;n=void 0===r.LightType?0:r.LightType.value;var i=16777215;void 0!==r.Color&&(i=(new d).fromArray(r.Color.value).convertSRGBToLinear());var o=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(o=0);var s=0;void 0!==r.FarAttenuationEnd&&(s=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value);switch(n){case 0:e=new E(i,o,s,1);break;case 1:e=new x(i,o);break;case 2:var a=Math.PI/3;void 0!==r.InnerAngle&&(a=K.degToRad(r.InnerAngle.value));var u=0;void 0!==r.OuterAngle&&(u=K.degToRad(r.OuterAngle.value),u=Math.max(u,1)),e=new I(i,o,s,a,u,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),e=new E(i,o)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(e.castShadow=!0)}return e}},{key:"createMesh",value:function(t,e,r){var n,i=null,o=null,s=[];return t.children.forEach((function(t){e.has(t.ID)&&(i=e.get(t.ID)),r.has(t.ID)&&s.push(r.get(t.ID))})),s.length>1?o=s:s.length>0?o=s[0]:(o=new re({name:m.DEFAULT_MATERIAL_NAME,color:13421772}),s.push(o)),"color"in i.attributes&&s.forEach((function(t){t.vertexColors=!0})),i.FBX_Deformer?(n=new j(i,o)).normalizeSkinWeights():n=new V(i,o),n}},{key:"createCurve",value:function(t,e){var r=t.children.reduce((function(t,r){return e.has(r.ID)&&(t=e.get(r.ID)),t}),null),n=new O({name:m.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new q(r,n)}},{key:"getTransformData",value:function(t,e){var r={};"InheritType"in e&&(r.inheritType=parseInt(e.InheritType.value)),r.eulerOrder="RotationOrder"in e?QT(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(r.translation=e.Lcl_Translation.value),"PreRotation"in e&&(r.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(r.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(r.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(r.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(r.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(r.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(r.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(r.rotationPivot=e.RotationPivot.value),t.userData.transformData=r}},{key:"setLookAtProperties",value:function(t,e){"LookAtProperty"in e&&_T.get(t.ID).children.forEach((function(e){if("LookAtProperty"===e.relationship){var r=mT.Objects.Model[e.ID];if("Lcl_Translation"in r){var n=r.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(n),IT.add(t.target)):t.lookAt((new B).fromArray(n))}}}))}},{key:"bindSkeleton",value:function(t,e,r){var n=this.parsePoseNodes(),i=function(){var i=t[o];_T.get(parseInt(i.ID)).parents.forEach((function(t){if(e.has(t.ID)){var o=t.ID;_T.get(o).parents.forEach((function(t){r.has(t.ID)&&r.get(t.ID).bind(new $(i.bones),n[t.ID])}))}}))};for(var o in t)i()}},{key:"parsePoseNodes",value:function(){var t={};if("Pose"in mT.Objects){var e=mT.Objects.Pose;for(var r in e)if("BindPose"===e[r].attrType&&e[r].NbPoseNodes>0){var n=e[r].PoseNode;Array.isArray(n)?n.forEach((function(e){t[e.Node]=(new A).fromArray(e.Matrix.a)})):t[n.Node]=(new A).fromArray(n.Matrix.a)}}return t}},{key:"addGlobalSceneSettings",value:function(){if("GlobalSettings"in mT){if("AmbientColor"in mT.GlobalSettings){var t=mT.GlobalSettings.AmbientColor.value,e=t[0],r=t[1],n=t[2];if(0!==e||0!==r||0!==n){var i=new d(e,r,n).convertSRGBToLinear();IT.add(new oe(i,1))}}"UnitScaleFactor"in mT.GlobalSettings&&(IT.userData.unitScaleFactor=mT.GlobalSettings.UnitScaleFactor.value)}}}]),t}(),CT=function(){function t(){Ze(this,t),this.negativeMaterialIndices=!1}return tr(t,[{key:"parse",value:function(t){var e=new Map;if("Geometry"in mT.Objects){var r=mT.Objects.Geometry;for(var n in r){var i=_T.get(parseInt(n)),o=this.parseGeometry(i,r[n],t);e.set(parseInt(n),o)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),e}},{key:"parseGeometry",value:function(t,e,r){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,r);case"NurbsCurve":return this.parseNurbsGeometry(e)}}},{key:"parseMeshGeometry",value:function(t,e,r){var n=r.skeletons,i=[],o=t.parents.map((function(t){return mT.Objects.Model[t.ID]}));if(0!==o.length){var s=t.children.reduce((function(t,e){return void 0!==n[e.ID]&&(t=n[e.ID]),t}),null);t.children.forEach((function(t){void 0!==r.morphTargets[t.ID]&&i.push(r.morphTargets[t.ID])}));var a=o[0],u={};"RotationOrder"in a&&(u.eulerOrder=QT(a.RotationOrder.value)),"InheritType"in a&&(u.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(u.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(u.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(u.scale=a.GeometricScaling.value);var l=FT(u);return this.genGeometry(e,s,i,l)}}},{key:"genGeometry",value:function(t,e,r,n){var i=new l;t.attrName&&(i.name=t.attrName);var o=this.parseGeoNode(t,e),s=this.genBuffers(o),a=new se(s.vertex,3);if(a.applyMatrix4(n),i.setAttribute("position",a),s.colors.length>0&&i.setAttribute("color",new se(s.colors,3)),e&&(i.setAttribute("skinIndex",new ae(s.weightsIndices,4)),i.setAttribute("skinWeight",new se(s.vertexWeights,4)),i.FBX_Deformer=e),s.normal.length>0){var u=(new ue).getNormalMatrix(n),h=new se(s.normal,3);h.applyNormalMatrix(u),i.setAttribute("normal",h)}if(s.uvs.forEach((function(t,e){var r=0===e?"uv":"uv".concat(e);i.setAttribute(r,new se(s.uvs[e],2))})),o.material&&"AllSame"!==o.material.mappingType){var c=s.materialIndex[0],f=0;if(s.materialIndex.forEach((function(t,e){t!==c&&(i.addGroup(f,e-f,c),c=t,f=e)})),i.groups.length>0){var p=i.groups[i.groups.length-1],d=p.start+p.count;d!==s.materialIndex.length&&i.addGroup(d,s.materialIndex.length-d,c)}0===i.groups.length&&i.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(i,t,r,n),i}},{key:"parseGeoNode",value:function(t,e){var r={};if(r.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],r.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(r.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(r.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(r.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){r.uv=[];for(var n=0;t.LayerElementUV[n];)t.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(t.LayerElementUV[n])),n++}return r.weightTable={},null!==e&&(r.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(n,i){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:e,weight:t.weights[i]})}))}))),r}},{key:"genBuffers",value:function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,i=!1,o=[],s=[],a=[],u=[],l=[],h=[],c=this;return t.vertexIndices.forEach((function(f,p){var d,g=!1;f<0&&(f^=-1,g=!0);var A=[],y=[];if(o.push(3*f,3*f+1,3*f+2),t.color){var v=PT(p,r,f,t.color);a.push(v[0],v[1],v[2])}if(t.skeleton){if(void 0!==t.weightTable[f]&&t.weightTable[f].forEach((function(t){y.push(t.weight),A.push(t.id)})),y.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var m=[0,0,0,0],_=[0,0,0,0];y.forEach((function(t,e){var r=t,n=A[e];_.forEach((function(t,e,i){if(r>t){i[e]=r,r=t;var o=m[e];m[e]=n,n=o}}))})),A=m,y=_}for(;y.length<4;)y.push(0),A.push(0);for(var I=0;I<4;++I)l.push(y[I]),h.push(A[I])}if(t.normal){var E=PT(p,r,f,t.normal);s.push(E[0],E[1],E[2])}t.material&&"AllSame"!==t.material.mappingType&&(d=PT(p,r,f,t.material)[0])<0&&(c.negativeMaterialIndices=!0,d=0),t.uv&&t.uv.forEach((function(t,e){var n=PT(p,r,f,t);void 0===u[e]&&(u[e]=[]),u[e].push(n[0]),u[e].push(n[1])})),n++,g&&(c.genFace(e,t,o,d,s,a,u,l,h,n),r++,n=0,o=[],s=[],a=[],u=[],l=[],h=[])})),e}},{key:"getNormalNewell",value:function(t){for(var e=new B(0,0,0),r=0;r<t.length;r++){var n=t[r],i=t[(r+1)%t.length];e.x+=(n.y-i.y)*(n.z+i.z),e.y+=(n.z-i.z)*(n.x+i.x),e.z+=(n.x-i.x)*(n.y+i.y)}return e.normalize(),e}},{key:"getNormalTangentAndBitangent",value:function(t){var e=this.getNormalNewell(t),r=(Math.abs(e.z)>.5?new B(0,1,0):new B(0,0,1)).cross(e).normalize(),n=e.clone().cross(r).normalize();return{normal:e,tangent:r,bitangent:n}}},{key:"flattenVertex",value:function(t,e,r){return new S(t.dot(e),t.dot(r))}},{key:"genFace",value:function(t,e,r,n,i,o,s,a,u,l){var h;if(l>3){for(var c=[],f=0;f<r.length;f+=3)c.push(new B(e.vertexPositions[r[f]],e.vertexPositions[r[f+1]],e.vertexPositions[r[f+2]]));for(var p=this.getNormalTangentAndBitangent(c),d=p.tangent,g=p.bitangent,A=[],y=0,v=c;y<v.length;y++){var m=v[y];A.push(this.flattenVertex(m,d,g))}h=le.triangulateShape(A,[])}else h=[[0,1,2]];var _,I=yr(h);try{var E=function(){var l=pr(_.value,3),h=l[0],c=l[1],f=l[2];t.vertex.push(e.vertexPositions[r[3*h]]),t.vertex.push(e.vertexPositions[r[3*h+1]]),t.vertex.push(e.vertexPositions[r[3*h+2]]),t.vertex.push(e.vertexPositions[r[3*c]]),t.vertex.push(e.vertexPositions[r[3*c+1]]),t.vertex.push(e.vertexPositions[r[3*c+2]]),t.vertex.push(e.vertexPositions[r[3*f]]),t.vertex.push(e.vertexPositions[r[3*f+1]]),t.vertex.push(e.vertexPositions[r[3*f+2]]),e.skeleton&&(t.vertexWeights.push(a[4*h]),t.vertexWeights.push(a[4*h+1]),t.vertexWeights.push(a[4*h+2]),t.vertexWeights.push(a[4*h+3]),t.vertexWeights.push(a[4*c]),t.vertexWeights.push(a[4*c+1]),t.vertexWeights.push(a[4*c+2]),t.vertexWeights.push(a[4*c+3]),t.vertexWeights.push(a[4*f]),t.vertexWeights.push(a[4*f+1]),t.vertexWeights.push(a[4*f+2]),t.vertexWeights.push(a[4*f+3]),t.weightsIndices.push(u[4*h]),t.weightsIndices.push(u[4*h+1]),t.weightsIndices.push(u[4*h+2]),t.weightsIndices.push(u[4*h+3]),t.weightsIndices.push(u[4*c]),t.weightsIndices.push(u[4*c+1]),t.weightsIndices.push(u[4*c+2]),t.weightsIndices.push(u[4*c+3]),t.weightsIndices.push(u[4*f]),t.weightsIndices.push(u[4*f+1]),t.weightsIndices.push(u[4*f+2]),t.weightsIndices.push(u[4*f+3])),e.color&&(t.colors.push(o[3*h]),t.colors.push(o[3*h+1]),t.colors.push(o[3*h+2]),t.colors.push(o[3*c]),t.colors.push(o[3*c+1]),t.colors.push(o[3*c+2]),t.colors.push(o[3*f]),t.colors.push(o[3*f+1]),t.colors.push(o[3*f+2])),e.material&&"AllSame"!==e.material.mappingType&&(t.materialIndex.push(n),t.materialIndex.push(n),t.materialIndex.push(n)),e.normal&&(t.normal.push(i[3*h]),t.normal.push(i[3*h+1]),t.normal.push(i[3*h+2]),t.normal.push(i[3*c]),t.normal.push(i[3*c+1]),t.normal.push(i[3*c+2]),t.normal.push(i[3*f]),t.normal.push(i[3*f+1]),t.normal.push(i[3*f+2])),e.uv&&e.uv.forEach((function(e,r){void 0===t.uvs[r]&&(t.uvs[r]=[]),t.uvs[r].push(s[r][2*h]),t.uvs[r].push(s[r][2*h+1]),t.uvs[r].push(s[r][2*c]),t.uvs[r].push(s[r][2*c+1]),t.uvs[r].push(s[r][2*f]),t.uvs[r].push(s[r][2*f+1])}))};for(I.s();!(_=I.n()).done;)E()}catch(t){I.e(t)}finally{I.f()}}},{key:"addMorphTargets",value:function(t,e,r,n){if(0!==r.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var i=this;r.forEach((function(r){r.rawTargets.forEach((function(r){var o=mT.Objects.Geometry[r.geoID];void 0!==o&&i.genMorphGeometry(t,e,o,n,r.name)}))}))}}},{key:"genMorphGeometry",value:function(t,e,r,n,i){for(var o=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],s=void 0!==r.Vertices?r.Vertices.a:[],a=void 0!==r.Indexes?r.Indexes.a:[],u=3*t.attributes.position.count,l=new Float32Array(u),h=0;h<a.length;h++){var c=3*a[h];l[c]=s[3*h],l[c+1]=s[3*h+1],l[c+2]=s[3*h+2]}var f={vertexIndices:o,vertexPositions:l},p=this.genBuffers(f),d=new se(p.vertex,3);d.name=i||r.attrName,d.applyMatrix4(n),t.morphAttributes.position.push(d)}},{key:"parseNormals",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.Normals.a,i=[];return"IndexToDirect"===r&&("NormalIndex"in t?i=t.NormalIndex.a:"NormalsIndex"in t&&(i=t.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseUVs",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.UV.a,i=[];return"IndexToDirect"===r&&(i=t.UVIndex.a),{dataSize:2,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseVertexColors",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.Colors.a,i=[];"IndexToDirect"===r&&(i=t.ColorIndex.a);for(var o=0,s=new d;o<n.length;o+=4)s.fromArray(n,o).convertSRGBToLinear().toArray(n,o);return{dataSize:4,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseMaterialIndices",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if("NoMappingInformation"===e)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=t.Materials.a,i=[],o=0;o<n.length;++o)i.push(o);return{dataSize:1,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseNurbsGeometry",value:function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new l;for(var r,n,i=e-1,o=t.KnotVector.a,s=[],a=t.Points.a,u=0,h=a.length;u<h;u+=4)s.push((new te).fromArray(a,u));if("Closed"===t.Form)s.push(s[0]);else if("Periodic"===t.Form){r=i,n=o.length-1-r;for(var c=0;c<i;++c)s.push(s[c])}var f=new ET(i,o,s,r,n).getPoints(12*s.length);return(new l).setFromPoints(f)}}]),t}(),bT=function(){function t(){Ze(this,t)}return tr(t,[{key:"parse",value:function(){var t=[],e=this.parseClips();if(void 0!==e)for(var r in e){var n=e[r],i=this.addClip(n);t.push(i)}return t}},{key:"parseClips",value:function(){if(void 0!==mT.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var e=this.parseAnimationLayers(t);return this.parseAnimStacks(e)}}},{key:"parseAnimationCurveNodes",value:function(){var t=mT.Objects.AnimationCurveNode,e=new Map;for(var r in t){var n=t[r];if(null!==n.attrName.match(/S|R|T|DeformPercent/)){var i={id:n.id,attr:n.attrName,curves:{}};e.set(i.id,i)}}return e}},{key:"parseAnimationCurves",value:function(t){var e=mT.Objects.AnimationCurve;for(var r in e){var n={id:e[r].id,times:e[r].KeyTime.a.map(RT),values:e[r].KeyValueFloat.a},i=_T.get(n.id);if(void 0!==i){var o=i.parents[0].ID,s=i.parents[0].relationship;s.match(/X/)?t.get(o).curves.x=n:s.match(/Y/)?t.get(o).curves.y=n:s.match(/Z/)?t.get(o).curves.z=n:s.match(/DeformPercent/)&&t.has(o)&&(t.get(o).curves.morph=n)}}}},{key:"parseAnimationLayers",value:function(t){var e=mT.Objects.AnimationLayer,r=new Map,n=function(){var e=[],n=_T.get(parseInt(i));void 0!==n&&(n.children.forEach((function(r,n){if(t.has(r.ID)){var i=t.get(r.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===e[n]){var o=_T.get(r.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID;if(void 0!==o){var s=mT.Objects.Model[o.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",r);var a={modelName:s.attrName?z.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};IT.traverse((function(t){t.ID===s.id&&(a.transform=t.matrix,t.userData.transformData&&(a.eulerOrder=t.userData.transformData.eulerOrder))})),a.transform||(a.transform=new A),"PreRotation"in s&&(a.preRotation=s.PreRotation.value),"PostRotation"in s&&(a.postRotation=s.PostRotation.value),e[n]=a}}e[n]&&(e[n][i.attr]=i)}else if(void 0!==i.curves.morph){if(void 0===e[n]){var u=_T.get(r.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID,l=_T.get(u).parents[0].ID,h=_T.get(l).parents[0].ID,c=_T.get(h).parents[0].ID,f=mT.Objects.Model[c],p={modelName:f.attrName?z.sanitizeNodeName(f.attrName):"",morphName:mT.Objects.Deformer[u].attrName};e[n]=p}e[n][i.attr]=i}}})),r.set(parseInt(i),e))};for(var i in e)n();return r}},{key:"parseAnimStacks",value:function(t){var e=mT.Objects.AnimationStack,r={};for(var n in e){var i=_T.get(parseInt(n)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var o=t.get(i[0].ID);r[n]={name:e[n].attrName,layer:o}}return r}},{key:"addClip",value:function(t){var e=[],r=this;return t.layer.forEach((function(t){e=e.concat(r.generateTracks(t))})),new tt(t.name,-1,e)}},{key:"generateTracks",value:function(t){var e=[],r=new B,n=new B;if(t.transform&&t.transform.decompose(r,new g,n),r=r.toArray(),n=n.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){var i=this.generateVectorTrack(t.modelName,t.T.curves,r,"position");void 0!==i&&e.push(i)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){var o=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);void 0!==o&&e.push(o)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){var s=this.generateVectorTrack(t.modelName,t.S.curves,n,"scale");void 0!==s&&e.push(s)}if(void 0!==t.DeformPercent){var a=this.generateMorphTrack(t);void 0!==a&&e.push(a)}return e}},{key:"generateVectorTrack",value:function(t,e,r,n){var i=this.getTimesForAllAxes(e),o=this.getKeyframeTrackValues(i,e,r);return new gt(t+"."+n,i,o)}},{key:"generateRotationTrack",value:function(t,e,r,n,i){var o,s;if(void 0!==e.x&&void 0!==e.y&&void 0!==e.z){var a=this.interpolateRotations(e.x,e.y,e.z,i);o=a[0],s=a[1]}void 0!==r&&((r=r.map(K.degToRad)).push(i),r=(new Mt).fromArray(r),r=(new g).setFromEuler(r)),void 0!==n&&((n=n.map(K.degToRad)).push(i),n=(new Mt).fromArray(n),n=(new g).setFromEuler(n).invert());var u=new g,l=new Mt,h=[];if(!s||!o)return new yt(t+".quaternion",[],[]);for(var c=0;c<s.length;c+=3){if(l.set(s[c],s[c+1],s[c+2],i),u.setFromEuler(l),void 0!==r&&u.premultiply(r),void 0!==n&&u.multiply(n),c>2)(new g).fromArray(h,(c-3)/3*4).dot(u)<0&&u.set(-u.x,-u.y,-u.z,-u.w);u.toArray(h,c/3*4)}return new yt(t+".quaternion",o,h)}},{key:"generateMorphTrack",value:function(t){var e=t.DeformPercent.curves.morph,r=e.values.map((function(t){return t/100})),n=IT.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new At(t.modelName+".morphTargetInfluences["+n+"]",e.times,r)}},{key:"getTimesForAllAxes",value:function(t){var e=[];if(void 0!==t.x&&(e=e.concat(t.x.times)),void 0!==t.y&&(e=e.concat(t.y.times)),void 0!==t.z&&(e=e.concat(t.z.times)),(e=e.sort((function(t,e){return t-e}))).length>1){for(var r=1,n=e[0],i=1;i<e.length;i++){var o=e[i];o!==n&&(e[r]=o,n=o,r++)}e=e.slice(0,r)}return e}},{key:"getKeyframeTrackValues",value:function(t,e,r){var n=r,i=[],o=-1,s=-1,a=-1;return t.forEach((function(t){if(e.x&&(o=e.x.times.indexOf(t)),e.y&&(s=e.y.times.indexOf(t)),e.z&&(a=e.z.times.indexOf(t)),-1!==o){var r=e.x.values[o];i.push(r),n[0]=r}else i.push(n[0]);if(-1!==s){var u=e.y.values[s];i.push(u),n[1]=u}else i.push(n[1]);if(-1!==a){var l=e.z.values[a];i.push(l),n[2]=l}else i.push(n[2])})),i}},{key:"interpolateRotations",value:function(t,e,r,n){var i=[],o=[];i.push(t.times[0]),o.push(K.degToRad(t.values[0])),o.push(K.degToRad(e.values[0])),o.push(K.degToRad(r.values[0]));for(var s=1;s<t.values.length;s++){var a=[t.values[s-1],e.values[s-1],r.values[s-1]];if(!(isNaN(a[0])||isNaN(a[1])||isNaN(a[2]))){var u=a.map(K.degToRad),l=[t.values[s],e.values[s],r.values[s]];if(!(isNaN(l[0])||isNaN(l[1])||isNaN(l[2]))){var h=l.map(K.degToRad),c=[l[0]-a[0],l[1]-a[1],l[2]-a[2]],f=[Math.abs(c[0]),Math.abs(c[1]),Math.abs(c[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){var p=Math.max.apply(Math,f)/180,d=sr(Mt,dr(u).concat([n])),A=sr(Mt,dr(h).concat([n])),y=(new g).setFromEuler(d),v=(new g).setFromEuler(A);y.dot(v)&&v.set(-v.x,-v.y,-v.z,-v.w);for(var m=t.times[s-1],_=t.times[s]-m,I=new g,E=new Mt,x=0;x<1;x+=1/p)I.copy(y.clone().slerp(v.clone(),x)),i.push(m+x*_),E.setFromQuaternion(I,n),o.push(E.x),o.push(E.y),o.push(E.z)}else i.push(t.times[s]),o.push(K.degToRad(t.values[s])),o.push(K.degToRad(e.values[s])),o.push(K.degToRad(r.values[s]))}}}return[i,o]}}]),t}(),ST=function(){function t(){Ze(this,t)}return tr(t,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(t){this.nodeStack.push(t),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),this.currentIndent-=1}},{key:"setCurrentProp",value:function(t,e){this.currentProp=t,this.currentPropName=e}},{key:"parse",value:function(t){this.currentIndent=0,this.allNodes=new TT,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach((function(t,n){var i=t.match(/^[\s\t]*;/),o=t.match(/^[\s\t]*$/);if(!i&&!o){var s=t.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),a=t.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=t.match("^\\t{"+(e.currentIndent-1)+"}}");s?e.parseNodeBegin(t,s):a?e.parseNodeProperty(t,a,r[++n]):u?e.popStack():t.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(t)}})),this.allNodes}},{key:"parseNodeBegin",value:function(t,e){var r=e[1].trim().replace(/^"/,"").replace(/"$/,""),n=e[2].split(",").map((function(t){return t.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:r},o=this.parseNodeAttr(n),s=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(r,i):r in s?("PoseNode"===r?s.PoseNode.push(i):void 0!==s[r].id&&(s[r]={},s[r][s[r].id]=s[r]),""!==o.id&&(s[r][o.id]=i)):"number"==typeof o.id?(s[r]={},s[r][o.id]=i):"Properties70"!==r&&(s[r]="PoseNode"===r?[i]:i),"number"==typeof o.id&&(i.id=o.id),""!==o.name&&(i.attrName=o.name),""!==o.type&&(i.attrType=o.type),this.pushStack(i)}},{key:"parseNodeAttr",value:function(t){var e=t[0];""!==t[0]&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",n="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),n=t[2]),{id:e,name:r,type:n}}},{key:"parseNodeProperty",value:function(t,e,r){var n=e[1].replace(/^"/,"").replace(/"$/,"").trim(),i=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===n&&","===i&&(i=r.replace(/"/g,"").replace(/,$/,"").trim());var o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===n){var s=i.split(",").slice(1),a=parseInt(s[0]),u=parseInt(s[1]),l=i.split(",").slice(3);n="connections",function(t,e){for(var r=0,n=t.length,i=e.length;r<i;r++,n++)t[n]=e[r]}(i=[a,u],l=l.map((function(t){return t.trim().replace(/^"/,"")}))),void 0===o[n]&&(o[n]=[])}"Node"===n&&(o.id=i),n in o&&Array.isArray(o[n])?o[n].push(i):"a"!==n?o[n]=i:o.a=i,this.setCurrentProp(o,n),"a"===n&&","!==i.slice(-1)&&(o.a=OT(i))}else this.parseNodeSpecialProperty(t,n,i)}},{key:"parseNodePropertyContinued",value:function(t){var e=this.getCurrentNode();e.a+=t,","!==t.slice(-1)&&(e.a=OT(e.a))}},{key:"parseNodeSpecialProperty",value:function(t,e,r){var n=r.split('",').map((function(t){return t.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=n[0],o=n[1],s=n[2],a=n[3],u=n[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":u=parseFloat(u);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":u=OT(u)}this.getPrevNode()[i]={type:o,type2:s,flag:a,value:u},this.setCurrentProp(this.getPrevNode(),i)}}]),t}(),BT=function(){function t(){Ze(this,t)}return tr(t,[{key:"parse",value:function(t){var e=new MT(t);e.skip(23);var r=e.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new TT;!this.endOfContent(e);){var i=this.parseNode(e,r);null!==i&&n.add(i.name,i)}return n}},{key:"endOfContent",value:function(t){return t.size()%16==0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}},{key:"parseNode",value:function(t,e){var r={},n=e>=7500?t.getUint64():t.getUint32(),i=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();var o=t.getUint8(),s=t.getString(o);if(0===n)return null;for(var a=[],u=0;u<i;u++)a.push(this.parseProperty(t));var l=a.length>0?a[0]:"",h=a.length>1?a[1]:"",c=a.length>2?a[2]:"";for(r.singleProperty=1===i&&t.getOffset()===n;n>t.getOffset();){var f=this.parseNode(t,e);null!==f&&this.parseSubNode(s,r,f)}return r.propertyList=a,"number"==typeof l&&(r.id=l),""!==h&&(r.attrName=h),""!==c&&(r.attrType=c),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(t,e,r){if(!0===r.singleProperty){var n=r.propertyList[0];Array.isArray(n)?(e[r.name]=r,r.a=n):e[r.name]=n}else if("Connections"===t&&"C"===r.name){var i=[];r.propertyList.forEach((function(t,e){0!==e&&i.push(t)})),void 0===e.connections&&(e.connections=[]),e.connections.push(i)}else if("Properties70"===r.name){Object.keys(r).forEach((function(t){e[t]=r[t]}))}else if("Properties70"===t&&"P"===r.name){var o,s=r.propertyList[0],a=r.propertyList[1],u=r.propertyList[2],l=r.propertyList[3];0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===a||"ColorRGB"===a||"Vector"===a||"Vector3D"===a||0===a.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],e[s]={type:a,type2:u,flag:l,value:o}}else void 0===e[r.name]?"number"==typeof r.id?(e[r.name]={},e[r.name][r.id]=r):e[r.name]=r:"PoseNode"===r.name?(Array.isArray(e[r.name])||(e[r.name]=[e[r.name]]),e[r.name].push(r)):void 0===e[r.name][r.id]&&(e[r.name][r.id]=r)}},{key:"parseProperty",value:function(t){var e,r=t.getString(1);switch(r){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return e=t.getUint32(),t.getArrayBuffer(e);case"S":return e=t.getUint32(),t.getString(e);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var n=t.getUint32(),i=t.getUint32(),o=t.getUint32();if(0===i)switch(r){case"b":case"c":return t.getBooleanArray(n);case"d":return t.getFloat64Array(n);case"f":return t.getFloat32Array(n);case"i":return t.getInt32Array(n);case"l":return t.getInt64Array(n)}var s=function(t,e){return pT((function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"}(t),t.subarray(2,-4)),e)}(new Uint8Array(t.getArrayBuffer(o))),a=new MT(s.buffer);switch(r){case"b":case"c":return a.getBooleanArray(n);case"d":return a.getFloat64Array(n);case"f":return a.getFloat32Array(n);case"i":return a.getInt32Array(n);case"l":return a.getInt64Array(n)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+r)}}}]),t}(),MT=function(){function t(e,r){Ze(this,t),this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===r||r,this._textDecoder=new TextDecoder}return tr(t,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(t){this.offset+=t}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e}},{key:"getUint8",value:function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t}},{key:"getInt16",value:function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}},{key:"getInt32",value:function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getInt32Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e}},{key:"getUint32",value:function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getInt64",value:function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),2147483648&e?(e=4294967295&~e,4294967295===(t=4294967295&~t)&&(e=e+1&4294967295),-(4294967296*e+(t=t+1&4294967295))):4294967296*e+t}},{key:"getInt64Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e}},{key:"getUint64",value:function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),4294967296*e+t}},{key:"getFloat32",value:function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getFloat32Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e}},{key:"getFloat64",value:function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}},{key:"getFloat64Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e}},{key:"getArrayBuffer",value:function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}},{key:"getString",value:function(t){var e=this.offset,r=new Uint8Array(this.dv.buffer,e,t);this.skip(t);var n=r.indexOf(0);return n>=0&&(r=new Uint8Array(this.dv.buffer,e,n)),this._textDecoder.decode(r)}}]),t}(),TT=function(){function t(){Ze(this,t)}return tr(t,[{key:"add",value:function(t,e){this[t]=e}}]),t}();function LT(t){var e=t.match(/FBXVersion: (\d+)/);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function RT(t){return t/46186158e3}var NT=[];function PT(t,e,r,n){var i;switch(n.mappingType){case"ByPolygonVertex":i=t;break;case"ByPolygon":i=e;break;case"ByVertice":i=r;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}"IndexToDirect"===n.referenceType&&(i=n.indices[i]);var o=i*n.dataSize,s=o+n.dataSize;return function(t,e,r,n){for(var i=r,o=0;i<n;i++,o++)t[o]=e[i];return t}(NT,n.buffer,o,s)}var DT=new Mt,kT=new B;function FT(t){var e=new A,r=new A,n=new A,i=new A,o=new A,s=new A,a=new A,u=new A,l=new A,h=new A,c=new A,f=new A,p=t.inheritType?t.inheritType:0;if(t.translation&&e.setPosition(kT.fromArray(t.translation)),t.preRotation){var d=t.preRotation.map(K.degToRad);d.push(t.eulerOrder||Mt.DEFAULT_ORDER),r.makeRotationFromEuler(DT.fromArray(d))}if(t.rotation){var g=t.rotation.map(K.degToRad);g.push(t.eulerOrder||Mt.DEFAULT_ORDER),n.makeRotationFromEuler(DT.fromArray(g))}if(t.postRotation){var y=t.postRotation.map(K.degToRad);y.push(t.eulerOrder||Mt.DEFAULT_ORDER),i.makeRotationFromEuler(DT.fromArray(y)),i.invert()}t.scale&&o.scale(kT.fromArray(t.scale)),t.scalingOffset&&a.setPosition(kT.fromArray(t.scalingOffset)),t.scalingPivot&&s.setPosition(kT.fromArray(t.scalingPivot)),t.rotationOffset&&u.setPosition(kT.fromArray(t.rotationOffset)),t.rotationPivot&&l.setPosition(kT.fromArray(t.rotationPivot)),t.parentMatrixWorld&&(c.copy(t.parentMatrix),h.copy(t.parentMatrixWorld));var v=r.clone().multiply(n).multiply(i),m=new A;m.extractRotation(h);var _=new A;_.copyPosition(h);var I=_.clone().invert().multiply(h),E=m.clone().invert().multiply(I),x=o,w=new A;if(0===p)w.copy(m).multiply(v).multiply(E).multiply(x);else if(1===p)w.copy(m).multiply(E).multiply(v).multiply(x);else{var C=(new A).scale((new B).setFromMatrixScale(c)).clone().invert(),b=E.clone().multiply(C);w.copy(m).multiply(v).multiply(b).multiply(x)}var S=l.clone().invert(),M=s.clone().invert(),T=e.clone().multiply(u).multiply(l).multiply(r).multiply(n).multiply(i).multiply(S).multiply(a).multiply(s).multiply(o).multiply(M),L=(new A).copyPosition(T),R=h.clone().multiply(L);return f.copyPosition(R),(T=f.clone().multiply(w)).premultiply(h.invert()),T}function QT(t){var e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(t=t||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[t]}function OT(t){return t.split(",").map((function(t){return parseFloat(t)}))}function UT(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=t.byteLength),(new TextDecoder).decode(new Uint8Array(t,e,r))}var GT=function(){function t(e,r,n,i,o){Ze(this,t),this.threelayer=i,this.map=i.map,this.groupId=o,this.loader=new xT,this.loader.load(e,(function(t){t.traverse((function(t){t instanceof u.Mesh&&(t.geometry.computeVertexNormals(),t.scale.set(.04,.04,.04),t.rotation.set(1*Math.PI/2,1*-Math.PI/2,0))}));var e=i.toModel(t,{coordinate:r,altitude:n.altitude||0});o?i.addMesh1(e,o):i.addMesh(e),e.object3d.rotation.z=Math.PI/2}))}return tr(t,[{key:"dispose",value:function(){}}]),t}(),zT={altitude:0,speed:.015,height:10},jT=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s,a){var u;Ze(this,n),Array.isArray(e)&&(e=new t.Polygon([e])),i=t.Util.extend({},zT,i,{layer:s,polygon:e}),(u=r.call(this)).parent=a,u._initOptions(i);var l=i,h=l.altitude,c=l.height,f=u.createGeometry(e,s,c);u._createMesh(f,o);var p=s.altitudeToVector3(h,h).x,d=s.coordinateToVector3(e.getCenter(),p);return u.getObject3d().position.copy(d),u}return tr(n,[{key:"createGeometry",value:function(t,e,r){r=e.altitudeToVector3(r,r).x;var n=e.coordinateToVector3(t.getCenter()),i=t.getShell(),o=[],s=[];i.forEach((function(t){var r=e.coordinateToVector3(t).sub(n);o.push(r),s.push(r.x),s.push(r.y)}));for(var a=s,l=[],h=0,c=0;h<a.length-2;h+=2,c++)0===h?l[0]=Math.sqrt((a[2]-a[0])*(a[2]-a[0])+(a[3]-a[1])*(a[3]-a[1])):l[c]=l[c-1]+Math.sqrt((a[h+2]-a[h])*(a[h+2]-a[h])+(a[h+3]-a[h+1])*(a[h+3]-a[h+1]));for(var f=[],p=[],d=l[l.length-1],g=0,A=f.length,y=p.length;g<o.length-1;g++){var v=o[g],m=o[g+1],_=l[g];f[A++]=v.x,f[A++]=v.y,f[A++]=0,p[y++]=0===g?0:l[g-1]/d,p[y++]=0,f[A++]=m.x,f[A++]=m.y,f[A++]=0,p[y++]=_/d,p[y++]=0,f[A++]=v.x,f[A++]=v.y,f[A++]=r,p[y++]=0===g?0:l[g-1]/d,p[y++]=1,f[A++]=v.x,f[A++]=v.y,f[A++]=r,p[y++]=0===g?0:l[g-1]/d,p[y++]=1,f[A++]=m.x,f[A++]=m.y,f[A++]=0,p[y++]=_/d,p[y++]=0,f[A++]=m.x,f[A++]=m.y,f[A++]=r,p[y++]=_/d,p[y++]=1}var I=new u.BufferGeometry;return I.setAttribute("position",new u.BufferAttribute(new Float32Array(f),3)),I.setAttribute("uv",new u.BufferAttribute(new Float32Array(p),2)),I}}]),n}(),VT=function(){function t(e,r,n,i,o){Ze(this,t),this.threelayer=n,this.map=n.map,this.groupId=i,this.layerClass=o,this.opacity=r.opacity||.8,this.fadeOpacity=r.fadeOpacity||.65,this.color=r.color||"#0099FF",this.fadeColor=r.fadeColor||"#000",this.num=r.num||5,this.hiz=r.hiz||.15,this.data=e.data,this.coords=e.coords,this._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new u.Color(this.color)},fadeColor:{type:"uvs",value:new u.Color(this.fadeColor)},opacity:{type:"pv2",value:this.opacity},num:{type:"pv2",value:this.num},hiz:{type:"pv2",value:this.hiz},fadeOpacity:{value:this.fadeOpacity}};var s=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n precision lowp float;\n precision lowp int;\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n precision lowp float;\n precision lowp int;\n uniform float time;\n uniform float opacity;\n uniform vec3 color;\n uniform vec3 fadeColor;\n uniform float fadeOpacity;\n uniform float num;\n uniform float hiz;\n varying vec2 vUv;\n void main() {\n vec4 fragColor = vec4(0.);\n float sin = sin((vUv.y - time * hiz) * 10. * num);\n float high = 0.92;\n float medium = 0.4;\n if (sin > high) {\n fragColor = vec4(mix(vec3(.8, 1., 1.), color, (1. - sin) / (1. - high)), 1.);\n } else if(sin > medium) {\n fragColor = vec4(color, mix(1., 0., 1.-(sin - medium) / (high - medium)));\n } else {\n fragColor = vec4(color, 0.);\n }\n //vec3 fade = mix(color, vec3(0., 0., 0.), vUv.y);\n vec3 fade = mix(color, fadeColor, vUv.y);\n //fragColor = mix(fragColor, vec4(fade, 1.), 0.85);\n fragColor = mix(fragColor, vec4(fade, 1.), fadeOpacity);\n gl_FragColor = vec4(fragColor.rgb, fragColor.a * opacity * (1. - vUv.y));\n }\n ",blending:u.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:u.DoubleSide});this.interactive=void 0===r.interactive||r.interactive,this.groundWall=new jT(this.coords,{height:r.height||1e3,interactive:this.interactive},s,n,this),i?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this),this.clickFunc=r.clickFunc,this._bindMapEvents()}return tr(t,[{key:"_bindMapEvents",value:function(){this.groundWall&&this.groundWall.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.groundWall&&this.groundWall.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){var e=t.target.parent.data;"click"===t.type&&e&&this.clickFunc&&this.clickFunc(e)}},{key:"tick",value:function(t){this._uniforms.time.value+=this.hiz/10*60*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this._closeEvent(),this.groundWall&&(this.groupId?this.threelayer.removeMesh1(this.groundWall,this.groupId):this.threelayer.removeMesh(this.groundWall),this.groundWall.object3d.geometry&&this.groundWall.object3d.geometry.dispose(),this.groundWall.object3d.material&&(this.groundWall.object3d.material.dispose(),delete this.m))}}]),t}(),HT=function(){function t(e,r,n,i,o){if(Ze(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,this.opacity=r.opacity||.8,this.color=r.color||"#0099FF",this.fadeColor=r.fadeColor||"#000",this.repeatX=r.repeatX||10,this.speed=r.speed||.01,r.imgUrl){this.loader=new u.TextureLoader,this.texture=this.loader.load(r.imgUrl),this._uniforms={time:{type:"pv2",value:0},map:{value:this.texture},repeatX:{value:this.repeatX},uvTransform:{value:this.elements}};var s=new u.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n uniform mat3 uvTransform;\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n //vUv = (uvTransform * vec3(uv,1.0) ).xy;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n uniform float repeatX;\n void main() {\n vec4 fragColor = texture2D(map, vec2(1.0 - fract(vUv.x * repeatX + time * 2.), vUv.y));\n //vec4 fragColor = texture2D(map, vUv.x, vec2(fract(vUv.y * repeatX + time * 2.));\n //vec4 fragColor = texture2D(map, vec2(vUv.x, fract(vUv.y * repeatX + time * 2.)));\n gl_FragColor = fragColor;\n }\n ",transparent:!0,depthWrite:!1,depthTest:!1,side:u.DoubleSide});this.groundWall=new jT(e,{height:r.height||1e3},s,n),this.groupId?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this)}}return tr(t,[{key:"setUvTransform",value:function(t,e,r,n,i,o,s){this.elements=1}},{key:"tick",value:function(t){this._uniforms.time.value+=60*this.speed*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.groundWall&&(this.groupId?this.threelayer.removeMesh1(this.groundWall,this.groupId):this.threelayer.removeMesh(this.groundWall),this.groundWall.object3d.geometry&&this.groundWall.object3d.geometry.dispose(),this.groundWall.object3d.material&&(this.groundWall.object3d.material.dispose(),delete this.m),this.texture&&this.texture.dispose())}}]),t}();he.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new S(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},ce.line={uniforms:fe.merge([he.common,he.fog,he.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var qT,YT,XT=function(t){rr(r,pe);var e=ur(r);function r(t){var n;return Ze(this,r),(n=e.call(this,{type:"LineMaterial",uniforms:fe.clone(ce.line.uniforms),vertexShader:ce.line.vertexShader,fragmentShader:ce.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(ar(n),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===t?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),n.setValues(t),n}return tr(r)}(),WT=function(){function e(t,r,n,i){Ze(this,e),this.map=n.map,this.threeLayer=n,this.groupId=i,this.dashed=void 0!==r.dashed&&r.dashed,this.dashScale=void 0!==r.dashScale?r.dashScale:2,this.dashSize=void 0!==r.dashSize?r.dashSize:1,this.gapSize=void 0!==r.gapSize?r.gapSize:1,this.dashed?this.lineMaterial=new XT({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1,dashed:!0,defines:{USE_DASH:""},dashScale:this.dashScale,dashSize:this.dashSize,gapSize:this.gapSize}):this.lineMaterial=new XT({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1});var o=[];t.features.forEach((function(t){var e=t.geometry;o.push(e)})),this.lineItems=o}var r;return tr(e,[{key:"addLine",value:(r=Ke(Xe().mark((function e(){var r,n,i=this;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[],this.lineItems.forEach((function(e){"Polygon"===e.type?e.coordinates.forEach((function(e){var n=new t.LineString(e);r.push(n)})):e.coordinates.forEach((function(e){var n=new t.LineString(e[0]);r.push(n)}))})),r.length>0&&(n=this.threeLayer.toFatLines(r,{altitude:1,interactive:!1},this.lineMaterial),this.dashed&&(n.zoomChange=function(){if(i.map){var t=i.map.pixelToDistance(1,0);i.lineMaterial.dashScale=18.93/t}}),this.groupId?this.threeLayer.addMesh1(n,this.groupId):this.threeLayer.addMesh(n),this.line=n),e.abrupt("return",this);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"dispose",value:function(){this.groupId?this.threeLayer.removeMesh1(this.line,this.groupId):this.threeLayer.removeMesh(this.line),this.line.object3d.geometry&&this.line.object3d.geometry.dispose(),this.line.object3d.material&&this.line.object3d.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose()}}]),e}(),JT={altitude:0},KT=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({layer:s},JT,i),(a=r.call(this))._initOptions(i),a.height=i.height||50;for(var l=1/0,h=1/0,c=-1/0,f=-1/0,p=0;p<e.length;p++){var d=e[p].getCenter();l=Math.min(l,d.x),h=Math.min(h,d.y),c=Math.max(c,d.x),f=Math.max(f,d.y)}var g=new t.Coordinate((l+c)/2,(h+f)/2),A=s.coordinateToVector3(g),y=s.altitudeToVector3(a.height,a.height).x,v=[];a._geometriesAttributes=[],a._colorMap={};for(var m=0;m<e.length;m++){var _=nx(A,e[m],s,y),I=_.attributes.position.array;a._geometriesAttributes[m]={position:{count:I.length/3}},v.push(_)}a._datas=e,a._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new u.Color("#0099FF")},fadeColor:{type:"uvs",value:new u.Color("#000")},opacity:{type:"pv2",value:a.opacity},num:{type:"pv2",value:5},hiz:{type:"pv2",value:.15}},new u.ShaderMaterial({uniforms:a._uniforms,vertexShader:"\n precision lowp float;\n precision lowp int;\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n precision lowp float;\n precision lowp int;\n uniform float time;\n uniform float opacity;\n uniform vec3 color;\n uniform vec3 fadeColor;\n uniform float num;\n uniform float hiz;\n varying vec2 vUv;\n void main() {\n vec4 fragColor = vec4(0.);\n float sin = sin((vUv.y - time * hiz) * 10. * num);\n float high = 0.92;\n float medium = 0.4;\n if (sin > high) {\n fragColor = vec4(mix(vec3(.8, 1., 1.), color, (1. - sin) / (1. - high)), 1.);\n } else if(sin > medium) {\n fragColor = vec4(color, mix(1., 0., 1.-(sin - medium) / (high - medium)));\n } else {\n fragColor = vec4(color, 0.);\n }\n //vec3 fade = mix(color, vec3(0., 0., 0.), vUv.y);\n vec3 fade = mix(color, fadeColor, vUv.y);\n //fragColor = mix(fragColor, vec4(fade, 1.), 0.85);\n fragColor = mix(fragColor, vec4(fade, 1.), 0.65);\n gl_FragColor = vec4(fragColor.rgb, fragColor.a * opacity * (1. - vUv.y));\n }\n ",blending:u.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:u.DoubleSide});var E=new u.MeshBasicMaterial({side:u.DoubleSide,transparent:!0,opacity:.5,depthTest:!1,color:"blue"});a._createMesh(v[0],E);var x=s.coordinateToVector3(g,0);return a.getObject3d().position.copy(x),a._setPickObject3d(),a._init(),a}return tr(n,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"_setPickObject3d",value:function(){if(this._colorMap){for(var t=this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),r=this._geometriesAttributes.length,n=ix(this._geometriesAttributes),i=0,o=0;o<r;o++){var s=e.getColor(),a=s.getHex();this._colorMap[a]=o;var l=this._geometriesAttributes[o].position.count;this._datas[o].colorIndex=a;for(var h=0;h<l;h++)n[i]=s.r,n[i+1]=s.g,n[i+2]=s.b,i+=3}t.setAttribute("pickColor",new u.BufferAttribute(n,3,!0));var c=new u.ShaderMaterial({vertexShader:"\n attribute vec3 pickColor;\n varying vec3 vPickColor;\n void main(){\n vPickColor = pickColor;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec3 vPickColor;\n void main() {\n gl_FragColor = vec4(vPickColor, 1.0);\n }",side:u.DoubleSide,transparent:!0}),f=e.getColor().getHex(),p=new u.Mesh(t,c);p.position.copy(this.getObject3d().position),p._colorIndex=f,this.setPickObject3d(p)}}},{key:"getSelectMesh",value:function(){return console.log(this._datas[this.index]),this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}}]),n}(),ZT=function(){function e(t,r,n,i,o){Ze(this,e),this.map=n.map,this.threeLayer=n,this.groupId=i,this.layerClass=o;var s=[];t.features.forEach((function(t){var e=t.geometry;s.push(e)})),this.lineItems=s}var r;return tr(e,[{key:"addLine",value:(r=Ke(Xe().mark((function e(){var r,n;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],this.lineItems.forEach((function(e){"Polygon"===e.type?r.push(e):e.coordinates.forEach((function(e){var n=new t.Polygon(e);r.push(n)}))})),n=new KT(r,{},null,this.threeLayer),this.groupId?this.threeLayer.addMesh1(n,this.groupId):this.threeLayer.addMesh(n);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})}]),e}(),$T=new vt,tL=new B,eL=function(t){rr(r,Ae);var e=ur(r);function r(){var t;Ze(this,r),(t=e.call(this)).isLineSegmentsGeometry=!0,t.type="LineSegmentsGeometry";return t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new se([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),t.setAttribute("uv",new se([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return tr(r,[{key:"applyMatrix4",value:function(t){var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),r.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var r=new de(e,6,1);return this.setAttribute("instanceStart",new N(r,3,0)),this.setAttribute("instanceEnd",new N(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var r=new de(e,6,1);return this.setAttribute("instanceColorStart",new N(r,3,0)),this.setAttribute("instanceColorEnd",new N(r,3,3)),this}},{key:"fromWireframeGeometry",value:function(t){return this.setPositions(t.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(t){return this.setPositions(t.attributes.position.array),this}},{key:"fromMesh",value:function(t){return this.fromWireframeGeometry(new ge(t.geometry)),this}},{key:"fromLineSegments",value:function(t){var e=t.geometry;return this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new vt);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),$T.setFromBufferAttribute(e),this.boundingBox.union($T))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new mt),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var n=0,i=0,o=t.count;i<o;i++)tL.fromBufferAttribute(t,i),n=Math.max(n,r.distanceToSquared(tL)),tL.fromBufferAttribute(e,i),n=Math.max(n,r.distanceToSquared(tL));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}]),r}(),rL=new B,nL=new B,iL=new te,oL=new te,sL=new te,aL=new B,uL=new A,lL=new ye,hL=new B,cL=new vt,fL=new mt,pL=new te;function dL(t,e,r){return pL.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),pL.multiplyScalar(1/pL.w),pL.x=YT/r.width,pL.y=YT/r.height,pL.applyMatrix4(t.projectionMatrixInverse),pL.multiplyScalar(1/pL.w),Math.abs(Math.max(pL.x,pL.y))}var gL=function(t){rr(r,V);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new eL,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new XT({color:16777215*Math.random()});return Ze(this,r),(t=e.call(this,n,i)).isLineSegments2=!0,t.type="LineSegments2",t}return tr(r,[{key:"computeLineDistances",value:function(){for(var t=this.geometry,e=t.attributes.instanceStart,r=t.attributes.instanceEnd,n=new Float32Array(2*e.count),i=0,o=0,s=e.count;i<s;i++,o+=2)rL.fromBufferAttribute(e,i),nL.fromBufferAttribute(r,i),n[o]=0===o?0:n[o-1],n[o+1]=n[o]+rL.distanceTo(nL);var a=new de(n,2,1);return t.setAttribute("instanceDistanceStart",new N(a,1,0)),t.setAttribute("instanceDistanceEnd",new N(a,1,1)),this}},{key:"raycast",value:function(t,e){var r=this.material.worldUnits,n=t.camera;null!==n||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');var i=void 0!==t.params.Line2&&t.params.Line2.threshold||0;qT=t.ray;var o,s=this.matrixWorld,a=this.geometry,u=this.material;(YT=u.linewidth+i,null===a.boundingSphere&&a.computeBoundingSphere(),fL.copy(a.boundingSphere).applyMatrix4(s),r)?o=.5*YT:o=dL(n,Math.max(n.near,fL.distanceToPoint(qT.origin)),u.resolution);if(fL.radius+=o,!1!==qT.intersectsSphere(fL)){var l;if(null===a.boundingBox&&a.computeBoundingBox(),cL.copy(a.boundingBox).applyMatrix4(s),r)l=.5*YT;else l=dL(n,Math.max(n.near,cL.distanceToPoint(qT.origin)),u.resolution);cL.expandByScalar(l),!1!==qT.intersectsBox(cL)&&(r?function(t,e){for(var r=t.matrixWorld,n=t.geometry,i=n.attributes.instanceStart,o=n.attributes.instanceEnd,s=0,a=Math.min(n.instanceCount,i.count);s<a;s++){lL.start.fromBufferAttribute(i,s),lL.end.fromBufferAttribute(o,s),lL.applyMatrix4(r);var u=new B,l=new B;qT.distanceSqToSegment(lL.start,lL.end,l,u),l.distanceTo(u)<.5*YT&&e.push({point:l,pointOnLine:u,distance:qT.origin.distanceTo(l),object:t,face:null,faceIndex:s,uv:null,uv2:null})}}(this,e):function(t,e,r){var n=e.projectionMatrix,i=t.material.resolution,o=t.matrixWorld,s=t.geometry,a=s.attributes.instanceStart,u=s.attributes.instanceEnd,l=Math.min(s.instanceCount,a.count),h=-e.near;qT.at(1,sL),sL.w=1,sL.applyMatrix4(e.matrixWorldInverse),sL.applyMatrix4(n),sL.multiplyScalar(1/sL.w),sL.x*=i.x/2,sL.y*=i.y/2,sL.z=0,aL.copy(sL),uL.multiplyMatrices(e.matrixWorldInverse,o);for(var c=0,f=l;c<f;c++)if(iL.fromBufferAttribute(a,c),oL.fromBufferAttribute(u,c),iL.w=1,oL.w=1,iL.applyMatrix4(uL),oL.applyMatrix4(uL),!(iL.z>h&&oL.z>h)){if(iL.z>h){var p=iL.z-oL.z,d=(iL.z-h)/p;iL.lerp(oL,d)}else if(oL.z>h){var g=oL.z-iL.z,A=(oL.z-h)/g;oL.lerp(iL,A)}iL.applyMatrix4(n),oL.applyMatrix4(n),iL.multiplyScalar(1/iL.w),oL.multiplyScalar(1/oL.w),iL.x*=i.x/2,iL.y*=i.y/2,oL.x*=i.x/2,oL.y*=i.y/2,lL.start.copy(iL),lL.start.z=0,lL.end.copy(oL),lL.end.z=0;var y=lL.closestPointToPointParameter(aL,!0);lL.at(y,hL);var v=K.lerp(iL.z,oL.z,y),m=v>=-1&&v<=1,_=aL.distanceTo(hL)<.5*YT;if(m&&_){lL.start.fromBufferAttribute(a,c),lL.end.fromBufferAttribute(u,c),lL.start.applyMatrix4(o),lL.end.applyMatrix4(o);var I=new B,E=new B;qT.distanceSqToSegment(lL.start,lL.end,E,I),r.push({point:E,pointOnLine:I,distance:qT.origin.distanceTo(E),object:t,face:null,faceIndex:c,uv:null,uv2:null})}}}(this,n,e))}}}]),r}(),AL=function(t){rr(r,eL);var e=ur(r);function r(){var t;return Ze(this,r),(t=e.call(this)).isLineGeometry=!0,t.type="LineGeometry",t}return tr(r,[{key:"setPositions",value:function(t){for(var e=t.length-3,n=new Float32Array(2*e),i=0;i<e;i+=3)n[2*i]=t[i],n[2*i+1]=t[i+1],n[2*i+2]=t[i+2],n[2*i+3]=t[i+3],n[2*i+4]=t[i+4],n[2*i+5]=t[i+5];return hr(nr(r.prototype),"setPositions",this).call(this,n),this}},{key:"setColors",value:function(t){for(var e=t.length-3,n=new Float32Array(2*e),i=0;i<e;i+=3)n[2*i]=t[i],n[2*i+1]=t[i+1],n[2*i+2]=t[i+2],n[2*i+3]=t[i+3],n[2*i+4]=t[i+4],n[2*i+5]=t[i+5];return hr(nr(r.prototype),"setColors",this).call(this,n),this}},{key:"fromLine",value:function(t){var e=t.geometry;return this.setPositions(e.attributes.position.array),this}}]),r}(),yL=function(t){rr(r,gL);var e=ur(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new AL,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new XT({color:16777215*Math.random()});return Ze(this,r),(t=e.call(this,n,i)).isLine2=!0,t.type="Line2",t}return tr(r)}(),vL={altitude:0,height:10},mL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({},vL,i,{layer:s,coordinate:e}),a=r.call(this);var u=i,l=u.altitude,h=u.height;a._initOptions(i),a.map=s.map;var c=s.altitudeToVector3(h,h).x;a.beginSizeZoom=i.beginSizeZoom||3,a.endSizeZoom=i.endSizeZoom||12,a.spanSizeZoom=a.endSizeZoom-a.beginSizeZoom,a.stepSize=1/(a.endSizeZoom-a.beginSizeZoom+1);var f=[];f.push(0,0,c),f.push(0,0,0);var p=new AL;p.setPositions(f),a.object3d=new yL(p,o),a.object3d.computeLineDistances(),a.object3d.scale.set(1,1,1),a.object3d.__parent=ar(a);var d=s.distanceToVector3(l,l).x,g=s.coordinateToVector3(e,d);return a.getObject3d().position.copy(g),i.closeZoomChange||(a.zoomChange=function(){var t=a.getMap();if(t){var e=t.pixelToDistance(1,0);p.attributes.instanceStart.data.array[2]=c*e*a._getRate(),p.attributes.instanceStart.needsUpdate=!0}}),a}return tr(n,[{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}}]),n}(),_L=function(){function e(t,r,n,i){var o=this;Ze(this,e),0!=t.length?(this.map=n.map,this.threeLayer=n,this.groupId=i,this.height=r.height||50,this.renderOrder=r.renderOrder||0,this.isGradient=void 0===r.isGradient||r.isGradient,this.closeZoomChange=r.closeZoomChange||!1,this.dashed=void 0!==r.dashed&&r.dashed,this.dashScale=void 0!==r.dashScale?r.dashScale:2,this.dashSize=void 0!==r.dashSize?r.dashSize:1,this.gapSize=void 0!==r.gapSize?r.gapSize:1,this.meshs=[],t.forEach((function(t){var e;e=o.dashed?new XT({color:t.color||"#35FFAC",transparent:!0,linewidth:r.linewidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:o.dashScale,dashSize:o.dashSize,gapSize:o.gapSize}):new XT({color:t.color||"#35FFAC",linewidth:r.lineWidth||4,dashed:!1,transparent:!0,opacity:r.opacity||1}),o._setMaterialRes(n,e);var i=new mL([t.longitude,t.latitude],{height:t.height||o.height,interactive:!1,beginSizeZoom:r.beginSizeZoom||9,endSizeZoom:r.endSizeZoom||16,closeZoomChange:o.closeZoomChange},e,n);i.object3d.renderOrder=o.renderOrder,o.dashed&&(i.zoomChange=function(){if(o.map){var t=o.map.pixelToDistance(1,0);e.dashScale=18.93/t}}),o.isGradient&&(e.onBeforeCompile=function(t){t.vertexShader=t.vertexShader.replace("uniform float linewidth;","\n varying vec3 vPos;\n uniform float linewidth;\n "),t.vertexShader=t.vertexShader.replace("void main() {","\n void main() {\n vPos = position;\n "),t.fragmentShader=t.fragmentShader.replace("#include <common>","\n varying vec3 vPos;\n #include <common>\n "),t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( diffuseColor.rgb, alpha );","\n vec3 origin = vec3(0., 0., 0.);\n vec3 dis = vec3(0.,vPos.y, 0.);\n float distance = clamp(length(dis - origin), 0., 1.0);\n float opacity = 1. - distance / 1.;\n //float opacity = 1.;\n gl_FragColor = vec4( diffuseColor.rgb, alpha * opacity );\n ")}),void 0!==t.visible&&!1===t.visible&&i.hide(),o.meshs.push(i)})),i?this.threeLayer.addMesh1(this.meshs,this.groupId):this.threeLayer.addMesh(this.meshs),this.dataItems=t):console.error("需要绘制的点位数量为0")}return tr(e,[{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"_bindMapEvents",value:function(t){t&&t.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){"click"===t.type&&this.callback&&this.callback(t.target.data)}},{key:"show",value:function(){this.meshs.forEach((function(t){t.show()}))}},{key:"hide",value:function(){this.meshs.forEach((function(t){t.hide()}))}},{key:"pointShowHideByCode",value:function(e,r,n){for(var i=1/0,o=1/0,s=-1/0,a=-1/0,u=0;u<this.dataItems.length;u++){var l=this.dataItems[u];e.includes(l.code)?(i=Math.min(i,this.dataItems[u].longitude),o=Math.min(o,this.dataItems[u].latitude),s=Math.max(s,this.dataItems[u].longitude),a=Math.max(a,this.dataItems[u].latitude),l.visibility=1):l.visibility=.1}this.updateByVisibility(),r&&this.map.fitExtent(new t.Extent(i,o,s,a),n||0)}},{key:"updateByVisibility",value:function(){var t=this;this.meshs.forEach((function(e,r){.1===t.dataItems[r].visibility?e.hide():e.show()}))}},{key:"dispose",value:function(){var t=this;this.meshs.forEach((function(e){t.groupId?t.threeLayer.removeMesh1(e,t.groupId):t.threeLayer.removeMesh(e),e.object3d.geometry&&e.object3d.geometry.dispose(),e.object3d.material&&e.object3d.material.dispose()}))}}]),e}(),IL={altitude:0,height:0},EL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),o=t.Util.extend({},IL,o,{layer:s}),a=r.call(this);var l=o,h=l.width,c=l.height,f=l.altitude;a._initOptions(o);var p=new u.PlaneGeometry(h,c);a._createMesh(p,i);var d=s.distanceToVector3(f,f).x,g=s.coordinateToVector3(e,d);return a.getObject3d().position.copy(g),a}return tr(n)}(),xL=function(){function e(r,n,i,o,s,a,l){var h=this;Ze(this,e),this.threelayer=s,this.map=s.map,this.layerClass=a,this.groupId=l,this.millsec=o.millsec||1e3,this.duration=o.duration||75;var c=r.split(","),f=n.split(","),p=parseFloat(c[0]),d=parseFloat(c[1]),g=parseFloat(f[0]),A=parseFloat(f[1]),y=new t.Extent(p,d,g,A),v=1/0,m=1/0,_=-1/0,I=-1/0;[[p,d],[p,A],[g,A],[g,d]].forEach((function(t){var e=h.threelayer.coordinateToVector3(t),r=e.x,n=e.y;v=Math.min(r,v),m=Math.min(n,m),_=Math.max(r,_),I=Math.max(n,I)}));var E=Math.abs(_-v),x=Math.abs(I-m);i.length>1&&Ox.generateGifTexture(i,o.width,o.height).then((function(t){h.texture=t.texture,h.annie=new Nx(t.texture,t.colNum,t.rowNum,i.length,h.duration,t.colNum==t.rowNum);var e=new u.MeshBasicMaterial({map:t.texture,transparent:!0,opacity:void 0!==o.opacity?parseFloat(o.opacity):1}),r=new EL(y.getCenter(),e,{width:E,height:x,interactive:!1},s);h.groupId?h.threelayer.addMesh1(r,h.groupId):h.threelayer.addMesh(r),h.imgObj=r,h.layerClass.updatables.push(h)}))}return tr(e,[{key:"show",value:function(){var t;null===(t=this.imgObj)||void 0===t||t.show()}},{key:"hide",value:function(){var t;null===(t=this.imgObj)||void 0===t||t.hide()}},{key:"tick",value:function(t){var e;null===(e=this.annie)||void 0===e||e.update(this.millsec*t)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.imgObj,this.groupId):this.threelayer.removeMesh(this.imgObj),this.imgObj.object3d.geometry&&this.imgObj.object3d.geometry.dispose(),this.imgObj.object3d.material&&this.imgObj.object3d.material.dispose(),null===(t=this.texture)||void 0===t||t.dispose()}}]),e}(),wL={radius:50,altitude:0},CL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({},wL,i,{layer:s}),a=r.call(this),i.altitude,a._initOptions(i);var l=rx(e),h=s.coordinateToVector3(l),c=[];e.forEach((function(t){var e=s.coordinateToVector3(t);e.sub(h),c.push(e)}));var f=new u.CatmullRomCurve3(c),p=s.distanceToVector3(i.radius,i.radius).x,d=new u.TubeGeometry(f,2,p,20,!1);return a._createMesh(d,o),a.parent=null,a.getObject3d().position.set(h.x,h.y,p/2),a}return tr(n)}(),bL=function(){function t(e,r,n,i){Ze(this,t),this.threelayer=n,this.map=n.map,this.groupId=i;var o=new u.MeshMatcapMaterial({color:r.color||"red",side:u.DoubleSide});this.m=o;var s=new CL(e,{radius:r.radius||2},o,n);s.parent=this,this.groupId?this.threelayer.addMesh1(s,this.groupId):this.threelayer.addMesh(s),this.mesh=s}return tr(t,[{key:"dispose",value:function(){this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose(),this.mesh.object3d.material&&(this.mesh.object3d.material.dispose(),delete this.m)}}]),t}(),SL={radius:100,altitude:0},BL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s,a){var u;Ze(this,n),i=t.Util.extend({},SL,i,{layer:a,coordinate:e}),(u=r.call(this))._initOptions(i);var l=i.altitude;u.object3d=new yL(o,s),u.object3d.computeLineDistances(),u.object3d.scale.set(1,1,1),u.object3d.__parent=ar(u);var h=a.distanceToVector3(l,l).x,c=a.coordinateToVector3(e,h);return u.getObject3d().position.copy(c),u}return tr(n)}(),ML={altitude:0,height:0},TL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),o=t.Util.extend({},ML,o,{layer:s}),a=r.call(this);var l=o.altitude;a._initOptions(o);var h=o.scaleFactor||1,c=[],f=new u.ConeGeometry(1*h,2*h,10);f.translate(0,2.5*h,0),c.push(f);var p=new u.CylinderGeometry(.4*h,.6*h,3*h,10);c.push(p);var d=WE(c);d.computeVertexNormals(),a._createMesh(d,i);var g=s.distanceToVector3(l,l).x,A=s.coordinateToVector3(e,g);return a.getObject3d().position.copy(A),a}return tr(n)}(),LL=function(){function e(r,n,i,o,s){Ze(this,e),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s;var a=void 0===n.lineFlag||!1!==n.lineFlag,l=n.heightDiv||4,h=n.pointsLen||20,c=n.arrowColor||"rgb(0,255,255)",f=n.arrowNum||5;this.speedFactor=n.speedFactor||2e-4,this.material=null,this.curve=null,this.meshs=[],this.arrows=[],this.up=new u.Vector3(0,1,0),this.axis=new u.Vector3,a&&(this.lineMaterial=new XT({color:n.lineColor||"red",transparent:!0,linewidth:n.linewidth||4}),this._setMaterialRes(i,this.lineMaterial));var p=new u.MeshBasicMaterial({color:c,side:u.DoubleSide,transparent:!0});this.material=p;var d=new t.LineString(r),g=ax(d)/l,A=i.distanceToVector3(g,g).x,y=r[0],v=r[1],m=[y[0]/2+v[0]/2,y[1]/2+v[1]/2],_=i.coordinateToVector3(d.getCenter()),I=i.coordinateToVector3(y).sub(_),E=i.coordinateToVector3(v).sub(_),x=i.coordinateToVector3(m,A).sub(_),w=new u.CatmullRomCurve3([I,x,E],!1,"catmullrom");this.curve=w,this.centerPt=_;var C=w.getPoints(h),b=[];C.forEach((function(t){b.push(t.x,t.y,t.z)}));var S=new AL;S.setPositions(b);var B=new BL(d.getCenter(),{interactive:!1},S,this.lineMaterial,i);this.meshs.push(B),this.ArrowNum=f;var M=1/this.ArrowNum;this.addSpan=Math.floor(100*M)/100;for(var T=0;T<this.ArrowNum;T++){var L=new TL(r[0],p,{scaleFactor:n.scaleFactor||1},i);L.object3d.renderOrder=n.arrowOrder||1,this.arrows.push(L)}this.groupId?(this.threelayer.addMesh1(B,this.groupId),this.threelayer.addMesh1(this.arrows,this.groupId)):(this.threelayer.addMesh(B),this.threelayer.addMesh(this.arrows)),this.layerClass.updatables.push(this)}var r;return tr(e,[{key:"tick",value:function(t){if(this.curve)for(var e=this.speedFactor*performance.now(),r=0;r<this.ArrowNum;r++){var n=(e+this.addSpan*r)%1,i=this.curve.getPointAt(n).add(this.centerPt);this.arrows[r].getObject3d().position.copy(i);var o=this.curve.getTangentAt(n);this.axis.crossVectors(this.up,o).normalize();var s=Math.acos(this.up.dot(o));this.arrows[r].getObject3d().quaternion.setFromAxisAngle(this.axis,s)}}},{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"loadTexture",value:(r=Ke(Xe().mark((function t(e){var r;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.promiseToDoSomething(e);case 2:return r=t.sent,this.texture=new u.CanvasTexture(r.canvas),this.material=new u.MeshBasicMaterial({map:this.texture,side:u.DoubleSide,transparent:!0}),t.abrupt("return",this.material);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"promiseToDoSomething",value:function(t){return new Promise((function(e){var r=document.createElement("canvas").getContext("2d");r.canvas.width=64,r.canvas.height=64,r.translate(35,32),r.rotate(.5*-Math.PI),r.fillStyle=t,r.textAlign="center",r.textBaseline="middle",r.font="48px sans-serif",r.fillText("➡︎",0,0),setTimeout((function(){return e(r)}),4)}))}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.meshs&&(this.groupId?this.threelayer.removeMesh1(this.meshs,this.groupId):this.threelayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.arrows&&(this.groupId?this.threelayer.removeMesh1(this.arrows,this.groupId):this.threelayer.removeMesh(this.arrows),this.arrows.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.material&&this.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose(),this.texture&&this.texture.dispose(),this.curve&&delete this.curve}}]),e}(),RL=function(){function e(r,n,i,o,s){var a=this;Ze(this,e),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s;var l=void 0===n.lineFlag||!1!==n.lineFlag,h=n.pointsLen||20,c=n.arrowColor||"rgb(0,255,255)",f=n.arrowNum||5;this.speedFactor=n.speedFactor||2e-4,this.overFunc=n.overFunc,this.outFunc=n.outFunc,this.material=null,this.curve=null,this.arrows=[],this.up=new u.Vector3(0,1,0),this.axis=new u.Vector3,l&&(this.lineMaterial=new XT({transparent:!0,linewidth:n.linewidth||4,vertexColors:!0}),this._setMaterialRes(i,this.lineMaterial));var p=new u.MeshBasicMaterial({color:c,side:u.DoubleSide,transparent:!0});this.material=p;var d=[];r.forEach((function(t){d.push(t.coordinate)}));var g=new t.LineString(d),A=[],y=i.coordinateToVector3(g.getCenter());d.forEach((function(t){var e=i.coordinateToVector3(t).sub(y);if(t[2]){var r=i.distanceToVector3(t[2],t[2]).x;e.z=r}A.push(e)}));var v=new u.CatmullRomCurve3(A,!1,"catmullrom");this.curve=v,this.centerPt=y;var m=v.getPoints(h),_=[],I=[];m.forEach((function(t){_.push(t.x,t.y,t.z);var e=t.add(y),r=a.map.pointAtResToCoord(e,a.map.getGLRes());I.push([r.x,r.y])}));var E=vx(I,d,r,m),x=E.allColors,w=E.snapPoints,C=E.snapPointsH;this.snapPoints=w,this.snapPointsH=C;var b=new AL;b.setPositions(_),b.setColors(x);var S=new BL(g.getCenter(),{interactive:n.interactive||!1},b,this.lineMaterial,i);this._bindMapEvents(S),this.mesh=S,this.ArrowNum=f;var B=1/this.ArrowNum;this.addSpan=Math.floor(100*B)/100;for(var M=function(){var t=new TL(d[0],p,{scaleFactor:n.scaleFactor||1},i);t.object3d.renderOrder=n.arrowOrder||1,n.zoomChange&&(t.zoomChange=function(){n.zoomChange(t)}),a.arrows.push(t)},T=0;T<this.ArrowNum;T++)M();this.groupId?(this.threelayer.addMesh1(S,this.groupId),this.threelayer.addMesh1(this.arrows,this.groupId)):(this.threelayer.addMesh(S),this.threelayer.addMesh(this.arrows)),this.layerClass.updatables.push(this)}return tr(e,[{key:"_bindMapEvents",value:function(t){t&&t.on("click empty mouseover mouseout",this._setEvent,this)}},{key:"_closeEvent",value:function(){this.mesh&&this.mesh.off("click empty mouseover mouseout",this._setEvent,this)}},{key:"_setEvent",value:function(t){"mouseover"===t.type&&this.overFunc?this.overFunc():"mouseout"===t.type&&this.outFunc&&this.outFunc()}},{key:"findItemIndex",value:function(t,e,r){for(var n=0;n<t.length;n++)if(t[n].x===e&&t[n].y===r)return n}},{key:"tick",value:function(t){if(this.curve)for(var e=this.speedFactor*performance.now(),r=0;r<this.ArrowNum;r++){var n=(e+this.addSpan*r)%1,i=this.curve.getPointAt(n).add(this.centerPt);this.arrows[r].getObject3d().position.copy(i);var o=this.curve.getTangentAt(n);this.axis.crossVectors(this.up,o).normalize();var s=Math.acos(this.up.dot(o));this.arrows[r].getObject3d().quaternion.setFromAxisAngle(this.axis,s)}}},{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"addAnimation",value:function(){this.layerClass.updatables.push(this)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"hideArrows",value:function(){this.arrows.forEach((function(t){t.hide()}))}},{key:"showArrows",value:function(){this.arrows.forEach((function(t){t.show()}))}},{key:"dispose",value:function(){this.removeAnimation(),this.mesh&&(this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose()),this.arrows&&(this.groupId?this.threelayer.removeMesh1(this.arrows,this.groupId):this.threelayer.removeMesh(this.arrows),this.arrows.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.material&&this.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose(),this.texture&&this.texture.dispose(),this.curve&&delete this.curve}}]),e}(),NL=function(){function e(r,n,i,o,s){var a=this;Ze(this,e),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=s;var l=n.heightDiv||4,h=n.pointsLen||20;this.speedFactor=n.speedFactor||.01,this.sum=0,this.meshs=[];var c=new t.LineString(r),f=ax(c)/l,p=i.distanceToVector3(f,f).x,d=r[0],g=r[1],A=[d[0]/2+g[0]/2,d[1]/2+g[1]/2],y=i.coordinateToVector3(c.getCenter()),v=i.coordinateToVector3(d).sub(y),m=i.coordinateToVector3(g).sub(y),_=i.coordinateToVector3(A,p).sub(y);this.lineMaterialDash=new XT({color:n.lineDashColor||"red",transparent:!0,linewidth:n.lineDashWidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:1,dashSize:n.dashSize||20,gapSize:1}),this.lineMaterial=new XT({color:n.lineColor||"red",transparent:!0,linewidth:n.lineWidth||2,opacity:n.lineOpacity||.4}),this._setMaterialRes(i,this.lineMaterialDash),this._setMaterialRes(i,this.lineMaterial);var I=new u.CatmullRomCurve3([v,_,m],!1,"catmullrom").getPoints(h),E=[];I.forEach((function(t){E.push(t.x,t.y,t.z)}));var x=new AL;x.setPositions(E);var w=new BL(c.getCenter(),{interactive:!1},x,this.lineMaterialDash,i),C=new BL(c.getCenter(),{interactive:!1},x,this.lineMaterial,i),b=C.object3d.geometry.attributes.instanceDistanceEnd.array;this.len=b[b.length-1],this.dur=this.len/3,this.lineMaterialDash.onBeforeCompile=function(t){t.uniforms.actionRatio={value:0},t.uniforms.lineLength={value:a.len},t.fragmentShader=t.fragmentShader.replace("#include <common>","\n uniform float actionRatio;\n uniform float lineLength;\n #include <common>\n "),t.fragmentShader=t.fragmentShader.replace("if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard;","\n float halfDash = dashSize * 0.5;\n float currPos = (lineLength + dashSize) * actionRatio;\n float d = (vLineDistance + halfDash) - currPos;\n if (abs(d) > halfDash ) discard;\n \n float grad = ((vLineDistance + halfDash) - (currPos - halfDash)) / halfDash;\n ").replace("gl_FragColor = vec4( diffuseColor.rgb, alpha );","\n gl_FragColor = vec4( diffuseColor.rgb, alpha * grad);\n "),a.shaderDash=t},this.groupId?(this.threelayer.addMesh1(C,this.groupId),this.threelayer.addMesh1(w,this.groupId)):(this.threelayer.addMesh(C),this.threelayer.addMesh(w)),this.meshs.push(C),this.meshs.push(w),this.layerClass.updatables.push(this)}return tr(e,[{key:"tick",value:function(t){this.shaderDash&&(this.sum+=this.dur*t*this.speedFactor,this.sum%=1,this.shaderDash.uniforms.actionRatio.value=this.sum)}},{key:"setPath",value:function(t,e,r,n){for(var i=t.geometry.attributes.position,o=new u.CatmullRomCurve3([e,n,r],!1,"catmullrom").getPoints(20),s=0;s<=19;s++){var a=o[s];i.setXYZ(s,a.x,a.y,a.z)}i.needsUpdate=!0,t.computeLineDistances(),t.geometry.attributes.lineDistance.needsUpdate=!0,t.material.dashSize=20}},{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.meshs&&(this.groupId?this.threelayer.removeMesh1(this.meshs,this.groupId):this.threelayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.lineMaterialDash&&this.lineMaterialDash.dispose(),this.lineMaterial&&this.lineMaterial.dispose()}}]),e}(),PL={altitude:0},DL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),i=t.Util.extend({},PL,i,{layer:s}),(a=r.call(this))._initOptions(i),i.altitude;var l=e.length;0===l&&console.error("polygons is empty");for(var h=1/0,c=1/0,f=-1/0,p=-1/0,d=0;d<l;d++){var g=e[d],A=g.getCenter?g.getCenter():getGeoJSONCenter(g),y=void 0,v=void 0;Array.isArray(A)?(y=A[0],v=A[1]):A instanceof t.Coordinate&&(y=A.x,v=A.y),h=Math.min(h,y),c=Math.min(c,v),f=Math.max(f,y),p=Math.max(p,v)}var m=new t.Coordinate((h+f)/2,(c+p)/2);a.centerPt=s.coordinateToVector3(m,0);var _=[];a._geometriesAttributes=[],a._colorMap={};for(var I=0;I<e.length;I++){var E=a.getGeometry(e[I],s),x=E.attributes.position.array;a._geometriesAttributes[I]={position:{count:x.length/3}};for(var w=new u.Color(e[I].properties.color),C=new Float32Array(x.length),b=0;b<x.length;b++)C[3*b]=w.r,C[3*b+1]=w.g,C[3*b+2]=w.b;E.setAttribute("color1",new u.Float32BufferAttribute(C,3)),_.push(E)}a._datas=e;var S=WE(_);return a._createMesh(S,o),a.getObject3d().position.copy(a.centerPt),!0===i.interactive&&(a._setPickObject3d(),a._init()),a}return tr(n,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"_setPickObject3d",value:function(){if(this._colorMap){for(var t=this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),r=this._geometriesAttributes.length,n=ix(this._geometriesAttributes),i=0,o=0;o<r;o++){var s=e.getColor(),a=s.getHex();this._colorMap[a]=o;var l=this._geometriesAttributes[o].position.count;this._datas[o].colorIndex=a;for(var h=0;h<l;h++)n[i]=s.r,n[i+1]=s.g,n[i+2]=s.b,i+=3}t.setAttribute("pickColor",new u.BufferAttribute(n,3,!0));var c=new u.ShaderMaterial({vertexShader:"\n attribute vec3 pickColor;\n varying vec3 vPickColor;\n void main(){\n vPickColor = pickColor;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec3 vPickColor;\n void main() {\n gl_FragColor = vec4(vPickColor, 1.0);\n }",side:u.DoubleSide,transparent:!0}),f=e.getColor().getHex(),p=new u.Mesh(t,c);p.position.copy(this.getObject3d().position),p._colorIndex=f,this.setPickObject3d(p)}}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}},{key:"getGeometry",value:function(e,r){var n=[],i=[];if(e instanceof t.MultiPolygon)for(var o=e.getCoordinates(),s=0,a=o.length;s<a;s++){var l=this.getSingleGeometry(o[s],r,this.centerPt),h=l.positionsV,c=l.faces;if(s>0)for(var f=n.length,p=0,d=c.length;p<d;p++)c[p]+=f;h.forEach((function(t){n.push(t)})),c.forEach((function(t){i.push(t)}))}else{var g=this.getSingleGeometry(e,r,this.centerPt),A=g.positionsV,y=g.faces;n=A,i=y}var v=(new u.BufferGeometry).setFromPoints(n);return v.setIndex(i),v}},{key:"getSingleGeometry",value:function(e,r,n){Array.isArray(e)&&(e=new t.Polygon(e));var i=e.getShell(),o=e.getHoles(),s=[],a=[],u=[];i.forEach((function(t){var e=r.coordinateToVector3(t).sub(n);s.push(e.x,e.y,e.z),u.push(e)})),o&&o.length>0&&o.forEach((function(t){a.push(u.length),t.forEach((function(t){var e=r.coordinateToVector3(t).sub(n);s.push(e.x,e.y,e.z),u.push(e)}))}));var l=a.length>0?a:void 0,h=Ms(s,l,3);return{positionsV:u,faces:h}}}]),n}(),kL=function(){function e(r,n,i,o){var s=this;Ze(this,e),this.map=i.map,this.threeLayer=i,this.groupId=o,this.isToolTip=void 0!==n.isToolTip&&n.isToolTip,this.interactive=void 0!==n.interactive&&n.interactive,this.isSimplify=void 0!==n.isSimplify&&n.isSimplify,this.order=void 0!==n.renderOrder?n.renderOrder:0;var a={tolerance:n.tolerance||.01,highQuality:!0};this.clickFunc=n.clickFunc||null;var l=[];r.features.forEach((function(e){if(s.isSimplify){var r=Go(e,a),n=r.geometry.type;if(["Polygon","MultiPolygon"].includes(n)){var i=r.properties,o=t.GeoJSON.toGeometry(r);o.setProperties(i),l.push(o)}}else{var u=e.geometry.type;if(["Polygon","MultiPolygon"].includes(u)){var h=e.properties,c=t.GeoJSON.toGeometry(e);c.setProperties(h),l.push(c)}}})),this.material=new u.MeshBasicMaterial({vertexColors:!0,transparent:!0,opacity:void 0!==n.opacity?n.opacity:1}),this.dataItems=l}var r,n;return tr(e,[{key:"generatePolygon",value:(n=Ke(Xe().mark((function t(){var e,r,n=this;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.dataItems){t.next=2;break}return t.abrupt("return",null);case 2:return this.material.onBeforeCompile=function(t){e=n._createMergePolygonShaderPol(t),n.shader=e},(r=new DL(this.dataItems,{interactive:this.interactive},this.material,this.threeLayer)).parent=this,this.groupId?this.threeLayer.addMesh1(r,this.groupId):this.threeLayer.addMesh(r),this.mesh=r,r.object3d.renderOrder=this.order,!0===this.interactive&&(r.pickObject3d.renderOrder=this.order,this._bindMapEvents(r)),t.abrupt("return",this);case 10:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"_bindMapEvents",value:function(t){t&&t.on("click empty mousemove",this._setEvent,this)}},{key:"_closeEvent",value:function(){this.mesh&&this.mesh.off("click empty mousemove",this._setEvent,this)}},{key:"addContent",value:(r=Ke(Xe().mark((function t(e){return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(e);case 2:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"_setEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var r=e.properties.name;if(this.isToolTip){var n=this.mesh.getToolTip();n?n._content="".concat(r):this.mesh.setToolTip("".concat(r),{showTimeout:0,eventsPropagation:!0,dx:10})}}"click"===t.type&&e&&this.clickFunc&&this.addContent(e)}},{key:"dispose",value:function(){this.isToolTip&&this.mesh&&this.mesh.removeToolTip(),this.mesh&&(this.groupId?this.threeLayer.removeMesh1(this.mesh,this.groupId):this.threeLayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose(),this.mesh.object3d.material&&(this.mesh.object3d.material.userData&&delete this.mesh.object3d.material.userData,this.mesh.object3d.material.dispose()),!0===this.interactive&&(this.mesh.pickObject3d.geometry&&this.mesh.pickObject3d.geometry.dispose(),this.mesh.pickObject3d.material&&this.mesh.pickObject3d.material.dispose(),delete this.mesh.pickObject3d),delete this.mesh.object3d,delete this.mesh)}},{key:"_createMergePolygonShaderPol",value:function(t){return t.vertexShader="\n attribute vec3 color1;\n ".concat(t.vertexShader,"\n ").replace("#include <color_vertex>","#include <color_vertex>\n //vColor = texture(colors, vec2(colorIdx / 7., 0.)).rgb; // divide colorIdx by (amount of colors (3) - 1, thus 2)\n vColor = color1; // divide colorIdx by (amount of colors (3) - 1, thus 2)\n "),t}}]),e}(),FL={altitude:0,height:0},QL=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),o=t.Util.extend({},FL,o,{layer:s}),a=r.call(this);var l=o,h=l.width,c=l.height,f=l.triW,p=l.triH,d=l.altitude;a._initOptions(o);var g=[],A=new u.BufferGeometry,y=new Float32Array([-f/2,-p/2,0,0,p/2,0,f/2,-p/2,0]),v=new Float32Array([0,0,1]),m=new Float32Array([0,1,.5,.5,1,1]);A.setIndex(new u.Uint16BufferAttribute([0,1,2],1)),A.setAttribute("position",new u.BufferAttribute(y,3)),A.setAttribute("normal",new u.BufferAttribute(v,3)),A.setAttribute("uv",new u.BufferAttribute(m,2)),A.computeBoundingBox(),A.translate(0,-A.boundingBox.max.y,0),g.push(A);var _=new u.PlaneGeometry(h,c);_.computeBoundingBox(),_.translate(0,-_.boundingBox.max.y-p,0),g.push(_);var I=WE(g);I.computeVertexNormals(),a._createMesh(I,i);var E=s.distanceToVector3(d,d).x,x=s.coordinateToVector3(e,E);return a.getObject3d().position.copy(x),a}return tr(n)}(),OL=function(){function t(e,r,n,i){Ze(this,t),this.threelayer=n,this.map=n.map,this.groupId=i,r.lineImgSrc,r.arrowImgSrc,this.imgWidth=r.imgWidth||80,this.imgHeight=r.imgHeight||160;var o=r.rotation||0,s=r.width||20,a=r.height||10,l=n.distanceToVector3(s,s).x,h=n.distanceToVector3(a,a).x;r.anchor;var c=-(o+180)*Math.PI/180;this.material=new u.MeshBasicMaterial({color:r.color||"white",side:u.DoubleSide,depthTest:!1,transparent:!0}),this.mesh=new QL(e,this.material,{width:l,height:h,triW:r.triW||1.6,triH:r.triH||2},n),this.mesh.object3d.renderOrder=r.renderOrder||0,this.mesh.object3d.rotation.z=c,this.groupId?this.threelayer.addMesh1(this.mesh,this.groupId):this.threelayer.addMesh(this.mesh)}var e;return tr(t,[{key:"loadTexture",value:(e=Ke(Xe().mark((function t(e){var r,n,i,o;return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e,!e.includes(".svg")){t.next=8;break}return t.next=4,fetch(e);case 4:return n=t.sent,t.next=7,n.text();case 7:r=t.sent;case 8:return new DOMParser,t.next=11,Ox.addImageProcess(r);case 11:return i=t.sent,o=Ox.generateTextureOne(i,this.imgWidth,this.imgHeight),t.abrupt("return",o);case 14:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"dispose",value:function(){this.mesh&&(this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose()),this.material&&this.material.dispose()}}]),t}(),UL=function(){function e(r,n,i,o){var s=this;Ze(this,e),this.map=i.map,this.threeLayer=i,this.groupId=o,this.meshs=[],this.lineStrings=[];var a=n.lineColor||"#377EE8",l=n.lineWidth||1;this.fatLineMaterial=new XT({color:new u.Color(a),transparent:!0,linewidth:l,blending:u.AdditiveBlending}),r.features.forEach((function(e){var r=e.geometry;t.GeoJSON.toGeometry(e);var n=e.properties,o=.1;s.isExtrusion&&(o=n.height?200*n.height:.1),r.coordinates.forEach((function(r){var n=new t.LineString(r[0]),a=i.toFatLine(n,{altitude:.1===o?1:o,interactive:!1},s.fatLineMaterial);a.setProperties(e.properties),a.getObject3d().layers.enable(1),s.meshs.push(a),s.lineStrings.push(n)}))})),this.groupId?i.addMesh1(this.meshs,this.groupId):i.addMesh(this.meshs)}return tr(e,[{key:"dispose",value:function(){this.meshs&&(this.groupId?this.threeLayer.removeMesh1(this.meshs,this.groupId):this.threeLayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()})),this.meshs=[]),this.fatLineMaterial&&this.fatLineMaterial.dispose()}}]),e}(),GL="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",zL=0,jL=1,VL=2,HL=3,qL=4,YL=5,XL=6,WL=7,JL=8,KL=9,ZL=10,$L=11,tR=12,eR=13,rR=14,nR=15,iR=16,oR=17,sR=18,aR=19,uR=20,lR=21,hR=22,cR=23,fR=24,pR=25,dR=26,gR=27,AR=28,yR=29,vR=30,mR=31,_R=32,IR="srgb",ER="srgb-linear",xR=1,wR=2,CR=0,bR=1,SR=2,BR={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},MR=0,TR=2,LR=3,RR=Number(ve.replace(/\D+/g,"")),NR=RR>=152,PR=new Map([[Se,ER],[Be,IR]]),DR=new Map([[ER,Se],[IR,Be]]);function kR(t){return null===t?null:NR?t.outputColorSpace:PR.get(t.outputEncoding)}function FR(t,e){null!==t&&(NR?t.colorSpace=e:t.encoding=DR.get(e))}function QR(t){return RR<154?t.replace("colorspace_fragment","encodings_fragment"):t}var OR=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],UR=class extends pe{constructor(t=new te){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new Me(null),texelSize:new Me(new te),scale:new Me(1),kernel:new Me(0)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;\n#include <colorspace_fragment>\n}",vertexShader:"uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.fragmentShader=QR(this.fragmentShader),this.setTexelSize(t.x,t.y),this.kernelSize=TR}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.inputBuffer=t}get kernelSequence(){return OR[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(t){this.uniforms.scale.value=t}getScale(){return this.uniforms.scale.value}setScale(t){this.uniforms.scale.value=t}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(t){this.uniforms.kernel.value=t}setKernel(t){this.kernel=t}setTexelSize(t,e){this.uniforms.texelSize.value.set(t,e,.5*t,.5*e)}setSize(t,e){const r=1/t,n=1/e;this.uniforms.texelSize.value.set(r,n,.5*r,.5*n)}},GR=class extends pe{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new Me(null),opacity:new Me(1)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <dithering_pars_fragment>\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;\n#include <colorspace_fragment>\n#include <dithering_fragment>\n}",vertexShader:GL}),this.fragmentShader=QR(this.fragmentShader)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}getOpacity(t){return this.uniforms.opacity.value}setOpacity(t){this.uniforms.opacity.value=t}},zR=class extends pe{constructor(t=null,e){super({name:"DepthComparisonMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new Me(null),cameraNear:new Me(.3),cameraFar:new Me(1e3)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <packing>\n#include <clipping_planes_pars_fragment>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform float cameraNear;uniform float cameraFar;centroid varying float vViewZ;centroid varying vec4 vProjTexCoord;void main(){\n#include <clipping_planes_fragment>\nvec2 projTexCoord=(vProjTexCoord.xy/vProjTexCoord.w)*0.5+0.5;projTexCoord=clamp(projTexCoord,0.002,0.998);\n#if DEPTH_PACKING == 3201\nfloat fragCoordZ=unpackRGBAToDepth(texture2D(depthBuffer,projTexCoord));\n#else\nfloat fragCoordZ=texture2D(depthBuffer,projTexCoord).r;\n#endif\n#ifdef PERSPECTIVE_CAMERA\nfloat viewZ=perspectiveDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#else\nfloat viewZ=orthographicDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#endif\nfloat depthTest=(-vViewZ>-viewZ)?1.0:0.0;gl_FragColor.rg=vec2(0.0,depthTest);}",vertexShader:"#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include <skinbase_vertex>\n#include <begin_vertex>\n#include <morphtarget_vertex>\n#include <skinning_vertex>\n#include <project_vertex>\nvViewZ=mvPosition.z;vProjTexCoord=gl_Position;\n#include <clipping_planes_vertex>\n}"}),this.depthBuffer=t,this.depthPacking=Re,this.copyCameraSettings(e)}set depthBuffer(t){this.uniforms.depthBuffer.value=t}set depthPacking(t){this.defines.DEPTH_PACKING=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer(t,e=Re){this.depthBuffer=t,this.depthPacking=e}adoptCameraSettings(t){this.copyCameraSettings(t)}copyCameraSettings(t){t&&(this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far,t instanceof J?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},jR=class extends pe{constructor(){super({name:"DepthMaskMaterial",defines:{DEPTH_EPSILON:"0.0001",DEPTH_PACKING_0:"0",DEPTH_PACKING_1:"0",DEPTH_TEST_STRATEGY:xR},uniforms:{inputBuffer:new Me(null),depthBuffer0:new Me(null),depthBuffer1:new Me(null),cameraNearFar:new Me(new S(1,1))},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <packing>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer0;uniform highp sampler2D depthBuffer1;\n#else\nuniform mediump sampler2D depthBuffer0;uniform mediump sampler2D depthBuffer1;\n#endif\nuniform sampler2D inputBuffer;uniform vec2 cameraNearFar;float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#endif\n}varying vec2 vUv;void main(){vec2 depth;\n#if DEPTH_PACKING_0 == 3201\ndepth.x=unpackRGBAToDepth(texture2D(depthBuffer0,vUv));\n#else\ndepth.x=texture2D(depthBuffer0,vUv).r;\n#ifdef LOG_DEPTH\nfloat d=pow(2.0,depth.x*log2(cameraNearFar.y+1.0))-1.0;float a=cameraNearFar.y/(cameraNearFar.y-cameraNearFar.x);float b=cameraNearFar.y*cameraNearFar.x/(cameraNearFar.x-cameraNearFar.y);depth.x=a+b/d;\n#endif\n#endif\n#if DEPTH_PACKING_1 == 3201\ndepth.y=unpackRGBAToDepth(texture2D(depthBuffer1,vUv));\n#else\ndepth.y=texture2D(depthBuffer1,vUv).r;\n#ifdef LOG_DEPTH\nfloat d=pow(2.0,depth.y*log2(cameraNearFar.y+1.0))-1.0;float a=cameraNearFar.y/(cameraNearFar.y-cameraNearFar.x);float b=cameraNearFar.y*cameraNearFar.x/(cameraNearFar.x-cameraNearFar.y);depth.y=a+b/d;\n#endif\n#endif\nbool isMaxDepth=(depth.x==1.0);\n#ifdef PERSPECTIVE_CAMERA\ndepth.x=viewZToOrthographicDepth(getViewZ(depth.x),cameraNearFar.x,cameraNearFar.y);depth.y=viewZToOrthographicDepth(getViewZ(depth.y),cameraNearFar.x,cameraNearFar.y);\n#endif\n#if DEPTH_TEST_STRATEGY == 0\nbool keep=depthTest(depth.x,depth.y);\n#elif DEPTH_TEST_STRATEGY == 1\nbool keep=isMaxDepth||depthTest(depth.x,depth.y);\n#else\nbool keep=!isMaxDepth&&depthTest(depth.x,depth.y);\n#endif\nif(keep){gl_FragColor=texture2D(inputBuffer,vUv);}else{discard;}}",vertexShader:GL}),this.depthMode=De}set depthBuffer0(t){this.uniforms.depthBuffer0.value=t}set depthPacking0(t){this.defines.DEPTH_PACKING_0=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer0(t,e=be){this.depthBuffer0=t,this.depthPacking0=e}set depthBuffer1(t){this.uniforms.depthBuffer1.value=t}set depthPacking1(t){this.defines.DEPTH_PACKING_1=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer1(t,e=be){this.depthBuffer1=t,this.depthPacking1=e}get maxDepthStrategy(){return Number(this.defines.DEPTH_TEST_STRATEGY)}set maxDepthStrategy(t){this.defines.DEPTH_TEST_STRATEGY=t.toFixed(0),this.needsUpdate=!0}get keepFar(){return this.maxDepthStrategy}set keepFar(t){this.maxDepthStrategy=t?xR:wR}getMaxDepthStrategy(){return this.maxDepthStrategy}setMaxDepthStrategy(t){this.maxDepthStrategy=t}get epsilon(){return Number(this.defines.DEPTH_EPSILON)}set epsilon(t){this.defines.DEPTH_EPSILON=t.toFixed(16),this.needsUpdate=!0}getEpsilon(){return this.epsilon}setEpsilon(t){this.epsilon=t}get depthMode(){return Number(this.defines.DEPTH_MODE)}set depthMode(t){let e;switch(t){case ze:e="false";break;case Ge:e="true";break;case Ne:e="abs(d1 - d0) <= DEPTH_EPSILON";break;case Pe:e="abs(d1 - d0) > DEPTH_EPSILON";break;case De:e="d0 > d1";break;case Ue:e="d0 >= d1";break;case Oe:e="d0 <= d1";break;default:e="d0 < d1"}this.defines.DEPTH_MODE=t.toFixed(0),this.defines["depthTest(d0, d1)"]=e,this.needsUpdate=!0}getDepthMode(){return this.depthMode}setDepthMode(t){this.depthMode=t}adoptCameraSettings(t){this.copyCameraSettings(t)}copyCameraSettings(t){t&&(this.uniforms.cameraNearFar.value.set(t.near,t.far),t instanceof J?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},VR=class extends pe{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new Me(null),texelSize:new Me(new S)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#define WEIGHT_INNER 0.125\n#define WEIGHT_OUTER 0.0555555\nvarying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c;\n#include <colorspace_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.fragmentShader=QR(this.fragmentShader)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setSize(t,e){this.uniforms.texelSize.value.set(1/t,1/e)}},HR=class extends pe{constructor(t,e,r,n,i=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:ve.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new Me(null),depthBuffer:new Me(null),resolution:new Me(new S),texelSize:new Me(new S),cameraNear:new Me(.3),cameraFar:new Me(1e3),aspect:new Me(1),time:new Me(0)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:i}),t&&this.setShaderParts(t),e&&this.setDefines(e),r&&this.setUniforms(r),this.copyCameraSettings(n)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(t){this.uniforms.depthBuffer.value=t}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(t){this.defines.DEPTH_PACKING=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer(t,e=be){this.depthBuffer=t,this.depthPacking=e}setShaderData(t){this.setShaderParts(t.shaderParts),this.setDefines(t.defines),this.setUniforms(t.uniforms),this.setExtensions(t.extensions)}setShaderParts(t){return this.fragmentShader="#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if THREE_REVISION >= 137\nvec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE color0.a=clamp(color0.a,0.0,1.0);gl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include <colorspace_fragment>\n#endif\n#include <dithering_fragment>\n}".replace(BR.FRAGMENT_HEAD,t.get(BR.FRAGMENT_HEAD)||"").replace(BR.FRAGMENT_MAIN_UV,t.get(BR.FRAGMENT_MAIN_UV)||"").replace(BR.FRAGMENT_MAIN_IMAGE,t.get(BR.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}".replace(BR.VERTEX_HEAD,t.get(BR.VERTEX_HEAD)||"").replace(BR.VERTEX_MAIN_SUPPORT,t.get(BR.VERTEX_MAIN_SUPPORT)||""),this.fragmentShader=QR(this.fragmentShader),this.needsUpdate=!0,this}setDefines(t){for(const e of t.entries())this.defines[e[0]]=e[1];return this.needsUpdate=!0,this}setUniforms(t){for(const e of t.entries())this.uniforms[e[0]]=e[1];return this}setExtensions(t){this.extensions={};for(const e of t)this.extensions[e]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(t){this.encodeOutput!==t&&(t?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(t){return this.encodeOutput}setOutputEncodingEnabled(t){this.encodeOutput=t}get time(){return this.uniforms.time.value}set time(t){this.uniforms.time.value=t}setDeltaTime(t){this.uniforms.time.value+=t}adoptCameraSettings(t){this.copyCameraSettings(t)}copyCameraSettings(t){t&&(this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far,t instanceof J?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(t,e){const r=this.uniforms;r.resolution.value.set(t,e),r.texelSize.value.set(1/t,1/e),r.aspect.value=t/e}static get Section(){return BR}},qR=class extends pe{constructor(t=!1,e=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:ve.replace(/\D+/g,"")},uniforms:{inputBuffer:new Me(null),threshold:new Me(0),smoothing:new Me(1),range:new Me(null)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef RANGE\nuniform vec2 range;\n#elif defined(THRESHOLD)\nuniform float threshold;uniform float smoothing;\n#endif\nvarying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);\n#ifdef RANGE\nfloat low=step(range.x,l);float high=step(l,range.y);l*=low*high;\n#elif defined(THRESHOLD)\nl=smoothstep(threshold,threshold+smoothing,l);\n#endif\n#ifdef COLOR\ngl_FragColor=vec4(texel.rgb*l,l);\n#else\ngl_FragColor=vec4(l);\n#endif\n}",vertexShader:GL}),this.colorOutput=t,this.luminanceRange=e}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}get threshold(){return this.uniforms.threshold.value}set threshold(t){this.smoothing>0||t>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=t}getThreshold(){return this.threshold}setThreshold(t){this.threshold=t}get smoothing(){return this.uniforms.smoothing.value}set smoothing(t){this.threshold>0||t>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=t}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(t){this.smoothing=t}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(t){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(t){t?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(t){return this.colorOutput}setColorOutputEnabled(t){this.colorOutput=t}get useRange(){return null!==this.luminanceRange}set useRange(t){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(t){null!==t?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=t,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(t){this.luminanceRange=t}},YR=class extends pe{constructor(t=new S){super({name:"OutlineMaterial",uniforms:{inputBuffer:new Me(null),texelSize:new Me(new S)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"uniform lowp sampler2D inputBuffer;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 c0=texture2D(inputBuffer,vUv0).rg;vec2 c1=texture2D(inputBuffer,vUv1).rg;vec2 c2=texture2D(inputBuffer,vUv2).rg;vec2 c3=texture2D(inputBuffer,vUv3).rg;float d0=(c0.x-c1.x)*0.5;float d1=(c2.x-c3.x)*0.5;float d=length(vec2(d0,d1));float a0=min(c0.y,c1.y);float a1=min(c2.y,c3.y);float visibilityFactor=min(a0,a1);gl_FragColor.rg=(1.0-visibilityFactor>0.001)?vec2(d,0.0):vec2(0.0,d);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=vec2(uv.x+texelSize.x,uv.y);vUv1=vec2(uv.x-texelSize.x,uv.y);vUv2=vec2(uv.x,uv.y+texelSize.y);vUv3=vec2(uv.x,uv.y-texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.uniforms.texelSize.value.set(t.x,t.y),this.uniforms.maskTexture=this.uniforms.inputBuffer}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}setTexelSize(t,e){this.uniforms.texelSize.value.set(t,e)}setSize(t,e){this.uniforms.texelSize.value.set(1/t,1/e)}},XR=class extends pe{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new Me(null),supportBuffer:new Me(null),texelSize:new Me(new S),radius:new Me(.85)},blending:Te,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;\n#else\nuniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;\n#endif\nuniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius);\n#include <colorspace_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.fragmentShader=QR(this.fragmentShader)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}set supportBuffer(t){this.uniforms.supportBuffer.value=t}get radius(){return this.uniforms.radius.value}set radius(t){this.uniforms.radius.value=t}setSize(t,e){this.uniforms.texelSize.value.set(1/t,1/e)}},WR=new Le,JR=null;var KR=class t{constructor(t="Pass",e=new Ce,r=WR){this.name=t,this.renderer=null,this.scene=e,this.camera=r,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(t){if(this.rtt===t){const e=this.fullscreenMaterial;null!==e&&(e.needsUpdate=!0),this.rtt=!t}}set mainScene(t){}set mainCamera(t){}setRenderer(t){this.renderer=t}isEnabled(){return this.enabled}setEnabled(t){this.enabled=t}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(t){let e=this.screen;null!==e?e.material=t:(e=new V(function(){if(null===JR){const t=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]);void 0!==(JR=new l).setAttribute?(JR.setAttribute("position",new h(t,3)),JR.setAttribute("uv",new h(e,2))):(JR.addAttribute("position",new h(t,3)),JR.addAttribute("uv",new h(e,2)))}return JR}(),t),e.frustumCulled=!1,null===this.scene&&(this.scene=new Ce),this.scene.add(e),this.screen=e)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(t){this.fullscreenMaterial=t}getDepthTexture(){return null}setDepthTexture(t,e=be){}render(t,e,r,n,i){throw new Error("Render method not implemented!")}setSize(t,e){}initialize(t,e,r){}dispose(){for(const e of Object.keys(this)){const r=this[e];(r instanceof xe||r instanceof Q||r instanceof dt||r instanceof t)&&this[e].dispose()}}},ZR=class extends KR{constructor(t,e=!0){super("CopyPass"),this.fullscreenMaterial=new GR,this.needsSwap=!1,this.renderTarget=t,void 0===t&&(this.renderTarget=new xe(1,1,{minFilter:P,magFilter:P,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=e}get resize(){return this.autoResize}set resize(t){this.autoResize=t}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(t){this.autoResize=t}render(t,e,r,n,i){this.fullscreenMaterial.inputBuffer=e.texture,t.setRenderTarget(this.renderToScreen?null:this.renderTarget),t.render(this.scene,this.camera)}setSize(t,e){this.autoResize&&this.renderTarget.setSize(t,e)}initialize(t,e,r){void 0!==r&&(this.renderTarget.texture.type=r,r!==kt?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":kR(t)===IR&&FR(this.renderTarget.texture,IR))}},$R=class extends KR{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(t,e,r,n,i){const o=t.state.buffers.stencil;o.setLocked(!1),o.setTest(!1)}},tN=new d,eN=class extends KR{constructor(t=!0,e=!0,r=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=t,this.depth=e,this.stencil=r,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(t,e,r){this.color=t,this.depth=e,this.stencil=r}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(t){this.overrideClearColor=t}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(t){this.overrideClearAlpha=t}render(t,e,r,n,i){const o=this.overrideClearColor,s=this.overrideClearAlpha,a=t.getClearAlpha(),u=null!==o,l=s>=0;u?(t.getClearColor(tN),t.setClearColor(o,l?s:a)):l&&t.setClearAlpha(s),t.setRenderTarget(this.renderToScreen?null:e),t.clear(this.color,this.depth,this.stencil),u?t.setClearColor(tN,a):l&&t.setClearAlpha(a)}},rN=class extends KR{constructor(t,e,r=null){super("RenderPass",t,e),this.needsSwap=!1,this.clearPass=new eN,this.overrideMaterialManager=null===r?null:new gN(r),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(t){this.scene=t}set mainCamera(t){this.camera=t}get renderToScreen(){return super.renderToScreen}set renderToScreen(t){super.renderToScreen=t,this.clearPass.renderToScreen=t}get overrideMaterial(){const t=this.overrideMaterialManager;return null!==t?t.material:null}set overrideMaterial(t){const e=this.overrideMaterialManager;null!==t?null!==e?e.setMaterial(t):this.overrideMaterialManager=new gN(t):null!==e&&(e.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(t){this.overrideMaterial=t}get clear(){return this.clearPass.enabled}set clear(t){this.clearPass.enabled=t}getSelection(){return this.selection}setSelection(t){this.selection=t}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(t){this.ignoreBackground=t}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(t){this.skipShadowMapUpdate=t}getClearPass(){return this.clearPass}render(t,e,r,n,i){const o=this.scene,s=this.camera,a=this.selection,u=s.layers.mask,l=o.background,h=t.shadowMap.autoUpdate,c=this.renderToScreen?null:e;null!==a&&s.layers.set(a.getLayer()),this.skipShadowMapUpdate&&(t.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(o.background=null),this.clearPass.enabled&&this.clearPass.render(t,e),t.setRenderTarget(c),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(t,o,s):t.render(o,s),s.layers.mask=u,o.background=l,t.shadowMap.autoUpdate=h}},nN=class extends KR{constructor(t,e,{renderTarget:r,resolutionScale:n=1,width:i=yN.AUTO_SIZE,height:o=yN.AUTO_SIZE,resolutionX:s=i,resolutionY:a=o}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new rN(t,e,new ke({depthPacking:Re}));const u=this.renderPass;u.skipShadowMapUpdate=!0,u.ignoreBackground=!0;const l=u.clearPass;l.overrideClearColor=new d(16777215),l.overrideClearAlpha=1,this.renderTarget=r,void 0===this.renderTarget&&(this.renderTarget=new xe(1,1,{minFilter:it,magFilter:it}),this.renderTarget.texture.name="DepthPass.Target");const h=this.resolution=new yN(this,s,a,n);h.addEventListener("change",(t=>this.setSize(h.baseWidth,h.baseHeight)))}set mainScene(t){this.renderPass.mainScene=t}set mainCamera(t){this.renderPass.mainCamera=t}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}render(t,e,r,n,i){const o=this.renderToScreen?null:this.renderTarget;this.renderPass.render(t,o)}setSize(t,e){const r=this.resolution;r.setBaseSize(t,e),this.renderTarget.setSize(r.width,r.height)}};function iN(t,e,r){for(const n of e){const e="$1"+t+n.charAt(0).toUpperCase()+n.slice(1),i=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(const t of r.entries())null!==t[1]&&r.set(t[0],t[1].replace(i,e))}}function oN(t,e,r){let n=e.getFragmentShader(),i=e.getVertexShader();const o=void 0!==n&&/mainImage/.test(n),s=void 0!==n&&/mainUv/.test(n);if(r.attributes|=e.getAttributes(),void 0===n)throw new Error(`Missing fragment shader (${e.name})`);if(s&&0!=(r.attributes&SR))throw new Error(`Effects that transform UVs are incompatible with convolution effects (${e.name})`);if(!o&&!s)throw new Error(`Could not find mainImage or mainUv function (${e.name})`);{const a=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,u=r.shaderParts;let l=u.get(BR.FRAGMENT_HEAD)||"",h=u.get(BR.FRAGMENT_MAIN_UV)||"",c=u.get(BR.FRAGMENT_MAIN_IMAGE)||"",f=u.get(BR.VERTEX_HEAD)||"",p=u.get(BR.VERTEX_MAIN_SUPPORT)||"";const d=new Set,g=new Set;if(s&&(h+=`\t${t}MainUv(UV);\n`,r.uvTransformation=!0),null!==i&&/mainSupport/.test(i)){const e=/mainSupport *\([\w\s]*?uv\s*?\)/.test(i);p+=`\t${t}MainSupport(`,p+=e?"vUv);\n":");\n";for(const t of i.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const e of t[1].split(/\s*,\s*/))r.varyings.add(e),d.add(e),g.add(e);for(const t of i.matchAll(a))g.add(t[1])}for(const t of n.matchAll(a))g.add(t[1]);for(const t of e.defines.keys())g.add(t.replace(/\([\w\s,]*\)/g,""));for(const t of e.uniforms.keys())g.add(t);g.delete("while"),g.delete("for"),g.delete("if"),e.uniforms.forEach(((e,n)=>r.uniforms.set(t+n.charAt(0).toUpperCase()+n.slice(1),e))),e.defines.forEach(((e,n)=>r.defines.set(t+n.charAt(0).toUpperCase()+n.slice(1),e)));const A=new Map([["fragment",n],["vertex",i]]);iN(t,g,r.defines),iN(t,g,A),n=A.get("fragment"),i=A.get("vertex");const y=e.blendMode;if(r.blendModes.set(y.blendFunction,y),o){null!==e.inputColorSpace&&e.inputColorSpace!==r.colorSpace&&(c+=e.inputColorSpace===IR?"color0 = LinearTosRGB(color0);\n\t":"color0 = sRGBToLinear(color0);\n\t"),""!==e.outputColorSpace?r.colorSpace=e.outputColorSpace:null!==e.inputColorSpace&&(r.colorSpace=e.inputColorSpace);const i=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;c+=`${t}MainImage(color0, UV, `,0!=(r.attributes&bR)&&i.test(n)&&(c+="depth, ",r.readDepth=!0),c+="color1);\n\t";const o=t+"BlendOpacity";r.uniforms.set(o,y.opacity),c+=`color0 = blend${y.blendFunction}(color0, color1, ${o});\n\n\t`,l+=`uniform float ${o};\n\n`}if(l+=n+"\n",null!==i&&(f+=i+"\n"),u.set(BR.FRAGMENT_HEAD,l),u.set(BR.FRAGMENT_MAIN_UV,h),u.set(BR.FRAGMENT_MAIN_IMAGE,c),u.set(BR.VERTEX_HEAD,f),u.set(BR.VERTEX_MAIN_SUPPORT,p),null!==e.extensions)for(const t of e.extensions)r.extensions.add(t)}}var sN=class extends KR{constructor(t,...e){super("EffectPass"),this.fullscreenMaterial=new HR(null,null,null,t),this.listener=t=>this.handleEvent(t),this.effects=[],this.setEffects(e),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(t){for(const e of this.effects)e.mainScene=t}set mainCamera(t){this.fullscreenMaterial.copyCameraSettings(t);for(const e of this.effects)e.mainCamera=t}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(t){this.fullscreenMaterial.encodeOutput=t}get dithering(){return this.fullscreenMaterial.dithering}set dithering(t){const e=this.fullscreenMaterial;e.dithering=t,e.needsUpdate=!0}setEffects(t){for(const t of this.effects)t.removeEventListener("change",this.listener);this.effects=t.sort(((t,e)=>e.attributes-t.attributes));for(const t of this.effects)t.addEventListener("change",this.listener)}updateMaterial(){const t=new pN;let e=0;for(const r of this.effects)if(r.blendMode.blendFunction===KL)t.attributes|=r.getAttributes()&bR;else{if(0!=(t.attributes&r.getAttributes()&SR))throw new Error(`Convolution effects cannot be merged (${r.name})`);oN("e"+e++,r,t)}let r=t.shaderParts.get(BR.FRAGMENT_HEAD),n=t.shaderParts.get(BR.FRAGMENT_MAIN_IMAGE),i=t.shaderParts.get(BR.FRAGMENT_MAIN_UV);const o=/\bblend\b/g;for(const e of t.blendModes.values())r+=e.getShaderCode().replace(o,`blend${e.blendFunction}`)+"\n";0!=(t.attributes&bR)?(t.readDepth&&(n="float depth = readDepth(UV);\n\n\t"+n),this.needsDepthTexture=null===this.getDepthTexture()):this.needsDepthTexture=!1,t.colorSpace===IR&&(n+="color0 = sRGBToLinear(color0);\n\t"),t.uvTransformation?(i="vec2 transformedUv = vUv;\n"+i,t.defines.set("UV","transformedUv")):t.defines.set("UV","vUv"),t.shaderParts.set(BR.FRAGMENT_HEAD,r),t.shaderParts.set(BR.FRAGMENT_MAIN_IMAGE,n),t.shaderParts.set(BR.FRAGMENT_MAIN_UV,i);for(const[e,r]of t.shaderParts)null!==r&&t.shaderParts.set(e,r.trim().replace(/^#/,"\n#"));this.skipRendering=0===e,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(t)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(t,e=be){this.fullscreenMaterial.depthBuffer=t,this.fullscreenMaterial.depthPacking=e;for(const r of this.effects)r.setDepthTexture(t,e)}render(t,e,r,n,i){for(const r of this.effects)r.update(t,e,n);if(!this.skipRendering||this.renderToScreen){const i=this.fullscreenMaterial;i.inputBuffer=e.texture,i.time+=n*this.timeScale,t.setRenderTarget(this.renderToScreen?null:r),t.render(this.scene,this.camera)}}setSize(t,e){this.fullscreenMaterial.setSize(t,e);for(const r of this.effects)r.setSize(t,e)}initialize(t,e,r){this.renderer=t;for(const n of this.effects)n.initialize(t,e,r);this.updateMaterial(),void 0!==r&&r!==kt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const t of this.effects)t.removeEventListener("change",this.listener),t.dispose()}handleEvent(t){if("change"===t.type)this.recompile()}},aN=class extends KR{constructor({kernelSize:t=TR,resolutionScale:e=.5,width:r=yN.AUTO_SIZE,height:n=yN.AUTO_SIZE,resolutionX:i=r,resolutionY:o=n}={}){super("KawaseBlurPass"),this.renderTargetA=new xe(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const s=this.resolution=new yN(this,i,o,e);s.addEventListener("change",(t=>this.setSize(s.baseWidth,s.baseHeight))),this._blurMaterial=new UR,this._blurMaterial.kernelSize=t,this.copyMaterial=new GR}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(t){this._blurMaterial=t}get dithering(){return this.copyMaterial.dithering}set dithering(t){this.copyMaterial.dithering=t}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(t){this.blurMaterial.kernelSize=t}get width(){return this.resolution.width}set width(t){this.resolution.preferredWidth=t}get height(){return this.resolution.height}set height(t){this.resolution.preferredHeight=t}get scale(){return this.blurMaterial.scale}set scale(t){this.blurMaterial.scale=t}getScale(){return this.blurMaterial.scale}setScale(t){this.blurMaterial.scale=t}getKernelSize(){return this.kernelSize}setKernelSize(t){this.kernelSize=t}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}render(t,e,r,n,i){const o=this.scene,s=this.camera,a=this.renderTargetA,u=this.renderTargetB,l=this.blurMaterial,h=l.kernelSequence;let c=e;this.fullscreenMaterial=l;for(let e=0,r=h.length;e<r;++e){const r=0==(1&e)?a:u;l.kernel=h[e],l.inputBuffer=c.texture,t.setRenderTarget(r),t.render(o,s),c=r}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=c.texture,t.setRenderTarget(this.renderToScreen?null:r),t.render(o,s)}setSize(t,e){const r=this.resolution;r.setBaseSize(t,e);const n=r.width,i=r.height;this.renderTargetA.setSize(n,i),this.renderTargetB.setSize(n,i),this.blurMaterial.setSize(t,e)}initialize(t,e,r){void 0!==r&&(this.renderTargetA.texture.type=r,this.renderTargetB.texture.type=r,r!==kt?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):kR(t)===IR&&(FR(this.renderTargetA.texture,IR),FR(this.renderTargetB.texture,IR)))}static get AUTO_SIZE(){return yN.AUTO_SIZE}},uN=class extends KR{constructor({renderTarget:t,luminanceRange:e,colorOutput:r,resolutionScale:n=1,width:i=yN.AUTO_SIZE,height:o=yN.AUTO_SIZE,resolutionX:s=i,resolutionY:a=o}={}){super("LuminancePass"),this.fullscreenMaterial=new qR(r,e),this.needsSwap=!1,this.renderTarget=t,void 0===this.renderTarget&&(this.renderTarget=new xe(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const u=this.resolution=new yN(this,s,a,n);u.addEventListener("change",(t=>this.setSize(u.baseWidth,u.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(t,e,r,n,i){this.fullscreenMaterial.inputBuffer=e.texture,t.setRenderTarget(this.renderToScreen?null:this.renderTarget),t.render(this.scene,this.camera)}setSize(t,e){const r=this.resolution;r.setBaseSize(t,e),this.renderTarget.setSize(r.width,r.height)}initialize(t,e,r){void 0!==r&&r!==kt&&(this.renderTarget.texture.type=r,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},lN=class extends KR{constructor(t,e){super("MaskPass",t,e),this.needsSwap=!1,this.clearPass=new eN(!1,!1,!0),this.inverse=!1}set mainScene(t){this.scene=t}set mainCamera(t){this.camera=t}get inverted(){return this.inverse}set inverted(t){this.inverse=t}get clear(){return this.clearPass.enabled}set clear(t){this.clearPass.enabled=t}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(t){this.inverted=t}render(t,e,r,n,i){const o=t.getContext(),s=t.state.buffers,a=this.scene,u=this.camera,l=this.clearPass,h=this.inverted?0:1,c=1-h;s.color.setMask(!1),s.depth.setMask(!1),s.color.setLocked(!0),s.depth.setLocked(!0),s.stencil.setTest(!0),s.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),s.stencil.setFunc(o.ALWAYS,h,4294967295),s.stencil.setClear(c),s.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?l.render(t,null):(l.render(t,e),l.render(t,r))),this.renderToScreen?(t.setRenderTarget(null),t.render(a,u)):(t.setRenderTarget(e),t.render(a,u),t.setRenderTarget(r),t.render(a,u)),s.color.setLocked(!1),s.depth.setLocked(!1),s.stencil.setLocked(!1),s.stencil.setFunc(o.EQUAL,1,4294967295),s.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),s.stencil.setLocked(!0)}},hN=class extends KR{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new xe(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new VR,this.upsamplingMaterial=new XR,this.resolution=new S}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(t){if(this.levels!==t){const e=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let r=0;r<t;++r){const t=e.clone();t.texture.name="Downsampling.Mipmap"+r,this.downsamplingMipmaps.push(t)}this.upsamplingMipmaps.push(e);for(let r=1,n=t-1;r<n;++r){const t=e.clone();t.texture.name="Upsampling.Mipmap"+r,this.upsamplingMipmaps.push(t)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(t){this.upsamplingMaterial.radius=t}render(t,e,r,n,i){const{scene:o,camera:s}=this,{downsamplingMaterial:a,upsamplingMaterial:u}=this,{downsamplingMipmaps:l,upsamplingMipmaps:h}=this;let c=e;this.fullscreenMaterial=a;for(let e=0,r=l.length;e<r;++e){const r=l[e];a.setSize(c.width,c.height),a.inputBuffer=c.texture,t.setRenderTarget(r),t.render(o,s),c=r}this.fullscreenMaterial=u;for(let e=h.length-1;e>=0;--e){const r=h[e];u.setSize(c.width,c.height),u.inputBuffer=c.texture,u.supportBuffer=l[e].texture,t.setRenderTarget(r),t.render(o,s),c=r}}setSize(t,e){const r=this.resolution;r.set(t,e);let n=r.width,i=r.height;for(let t=0,e=this.downsamplingMipmaps.length;t<e;++t)n=Math.round(.5*n),i=Math.round(.5*i),this.downsamplingMipmaps[t].setSize(n,i),t<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[t].setSize(n,i)}initialize(t,e,r){if(void 0!==r){const e=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(const t of e)t.texture.type=r;if(r!==kt)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(kR(t)===IR)for(const t of e)FR(t.texture,IR)}}dispose(){super.dispose();for(const t of this.downsamplingMipmaps.concat(this.upsamplingMipmaps))t.dispose()}},cN=class extends KR{constructor(t,e="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=t,this.input=e}setInput(t){this.input=t}render(t,e,r,n,i){const o=this.fullscreenMaterial.uniforms;null!==e&&void 0!==o&&void 0!==o[this.input]&&(o[this.input].value=e.texture),t.setRenderTarget(this.renderToScreen?null:r),t.render(this.scene,this.camera)}initialize(t,e,r){void 0!==r&&r!==kt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},fN=.001,pN=class{constructor(){this.shaderParts=new Map([[BR.FRAGMENT_HEAD,null],[BR.FRAGMENT_MAIN_UV,null],[BR.FRAGMENT_MAIN_IMAGE,null],[BR.VERTEX_HEAD,null],[BR.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=CR,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=ER}},dN=!1,gN=class{constructor(t=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(t),this.meshCount=0,this.replaceMaterial=t=>{if(t.isMesh){let e;if(t.material.flatShading)switch(t.material.side){case G:e=this.materialsFlatShadedDoubleSide;break;case we:e=this.materialsFlatShadedBackSide;break;default:e=this.materialsFlatShaded}else switch(t.material.side){case G:e=this.materialsDoubleSide;break;case we:e=this.materialsBackSide;break;default:e=this.materials}this.originalMaterials.set(t,t.material),t.isSkinnedMesh?t.material=e[2]:t.isInstancedMesh?t.material=e[1]:t.material=e[0],++this.meshCount}}}cloneMaterial(t){if(!(t instanceof pe))return t.clone();const e=t.uniforms,r=new Map;for(const t in e){const n=e[t].value;n.isRenderTargetTexture&&(e[t].value=null,r.set(t,n))}const n=t.clone();for(const t of r)e[t[0]].value=t[1],n.uniforms[t[0]].value=t[1];return n}setMaterial(t){if(this.disposeMaterials(),this.material=t,null!==t){const e=this.materials=[this.cloneMaterial(t),this.cloneMaterial(t),this.cloneMaterial(t)];for(const r of e)r.uniforms=Object.assign({},t.uniforms),r.side=ct;e[2].skinning=!0,this.materialsBackSide=e.map((e=>{const r=this.cloneMaterial(e);return r.uniforms=Object.assign({},t.uniforms),r.side=we,r})),this.materialsDoubleSide=e.map((e=>{const r=this.cloneMaterial(e);return r.uniforms=Object.assign({},t.uniforms),r.side=G,r})),this.materialsFlatShaded=e.map((e=>{const r=this.cloneMaterial(e);return r.uniforms=Object.assign({},t.uniforms),r.flatShading=!0,r})),this.materialsFlatShadedBackSide=e.map((e=>{const r=this.cloneMaterial(e);return r.uniforms=Object.assign({},t.uniforms),r.flatShading=!0,r.side=we,r})),this.materialsFlatShadedDoubleSide=e.map((e=>{const r=this.cloneMaterial(e);return r.uniforms=Object.assign({},t.uniforms),r.flatShading=!0,r.side=G,r}))}}render(t,e,r){const n=t.shadowMap.enabled;if(t.shadowMap.enabled=!1,dN){const n=this.originalMaterials;this.meshCount=0,e.traverse(this.replaceMaterial),t.render(e,r);for(const t of n)t[0].material=t[1];this.meshCount!==n.size&&n.clear()}else{const n=e.overrideMaterial;e.overrideMaterial=this.material,t.render(e,r),e.overrideMaterial=n}t.shadowMap.enabled=n}disposeMaterials(){if(null!==this.material){const t=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const e of t)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return dN}static set workaroundEnabled(t){dN=t}},AN=-1,yN=class extends Fe{constructor(t,e=-1,r=-1,n=1){super(),this.resizable=t,this.baseSize=new S(1,1),this.preferredSize=new S(e,r),this.target=this.preferredSize,this.s=n,this.effectiveSize=new S,this.addEventListener("change",(()=>this.updateEffectiveSize())),this.updateEffectiveSize()}updateEffectiveSize(){const t=this.baseSize,e=this.preferredSize,r=this.effectiveSize,n=this.scale;e.width!==AN?r.width=e.width:e.height!==AN?r.width=Math.round(e.height*(t.width/Math.max(t.height,1))):r.width=Math.round(t.width*n),e.height!==AN?r.height=e.height:e.width!==AN?r.height=Math.round(e.width/Math.max(t.width/Math.max(t.height,1),1)):r.height=Math.round(t.height*n)}get width(){return this.effectiveSize.width}set width(t){this.preferredWidth=t}get height(){return this.effectiveSize.height}set height(t){this.preferredHeight=t}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(t){this.s!==t&&(this.s=t,this.preferredSize.setScalar(AN),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(t){this.scale=t}get baseWidth(){return this.baseSize.width}set baseWidth(t){this.baseSize.width!==t&&(this.baseSize.width=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(t){this.baseWidth=t}get baseHeight(){return this.baseSize.height}set baseHeight(t){this.baseSize.height!==t&&(this.baseSize.height=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(t){this.baseHeight=t}setBaseSize(t,e){this.baseSize.width===t&&this.baseSize.height===e||(this.baseSize.set(t,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(t){this.preferredSize.width!==t&&(this.preferredSize.width=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(t){this.preferredWidth=t}get preferredHeight(){return this.preferredSize.height}set preferredHeight(t){this.preferredSize.height!==t&&(this.preferredSize.height=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(t){this.preferredHeight=t}setPreferredSize(t,e){this.preferredSize.width===t&&this.preferredSize.height===e||(this.preferredSize.set(t,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(t){this.s=t.scale,this.baseSize.set(t.baseWidth,t.baseHeight),this.preferredSize.set(t.preferredWidth,t.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return AN}},vN=class extends Set{constructor(t,e=10){super(),this.l=e,this.exclusive=!1,void 0!==t&&this.set(t)}get layer(){return this.l}set layer(t){const e=this.l;for(const r of this)r.layers.disable(e),r.layers.enable(t);this.l=t}getLayer(){return this.layer}setLayer(t){this.layer=t}isExclusive(){return this.exclusive}setExclusive(t){this.exclusive=t}clear(){const t=this.layer;for(const e of this)e.layers.disable(t);return super.clear()}set(t){this.clear();for(const e of t)this.add(e);return this}indexOf(t){return this.has(t)?0:-1}add(t){return this.exclusive?t.layers.set(this.layer):t.layers.enable(this.layer),super.add(t)}delete(t){return this.has(t)&&t.layers.disable(this.layer),super.delete(t)}toggle(t){let e;return this.has(t)?(this.delete(t),e=!1):(this.add(t),e=!0),e}setVisible(t){for(const e of this)t?e.layers.enable(0):e.layers.disable(0);return this}},mN=new Map([[zL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}"],[jL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}"],[VL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}"],[HL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[qL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}"],[YL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}"],[XL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}"],[WL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}"],[JL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}"],[KL,null],[ZL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}"],[$L,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}"],[tR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}"],[eR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}"],[rR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}"],[nR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}"],[iR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}"],[oR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}"],[sR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}"],[aR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}"],[uR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[lR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}"],[hR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}"],[cR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}"],[fR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(2.0*y*x,1.0-2.0*(1.0-y)*(1.0-x),step(0.5,x));return mix(x,z,opacity);}"],[pR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 z=mix(mix(y2,x,step(0.5*x,y)),max(vec4(0.0),y2-1.0),step(x,(y2-1.0)));return mix(x,z,opacity);}"],[dR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(min(x*x/max(1.0-y,1e-12),1.0),y,step(1.0,y));return mix(x,z,opacity);}"],[gR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.r,yHSL.g,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[AR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y-min(x*y,1.0),opacity);}"],[yR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 w=step(0.5,y);vec4 z=mix(x-(1.0-y2)*x*(1.0-x),mix(x+(y2-1.0)*(sqrt(x)-x),x+(y2-1.0)*x*((16.0*x-12.0)*x+3.0),w*(1.0-step(0.25,x))),w);return mix(x,z,opacity);}"],[vR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}"],[mR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x+y-1.0,0.0),opacity);}"],[_R,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(max(1.0-min((1.0-x)/(2.0*y),1.0),0.0),min(x/(2.0*(1.0-y)),1.0),step(0.5,y));return mix(x,z,opacity);}"]]),_N=class extends Fe{constructor(t,e=1){super(),this._blendFunction=t,this.opacity=new Me(e)}getOpacity(){return this.opacity.value}setOpacity(t){this.opacity.value=t}get blendFunction(){return this._blendFunction}set blendFunction(t){this._blendFunction=t,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(t){this.blendFunction=t}getShaderCode(){return mN.get(this.blendFunction)}},IN=class extends Fe{constructor(t,e,{attributes:r=CR,blendFunction:n=cR,defines:i=new Map,uniforms:o=new Map,extensions:s=null,vertexShader:a=null}={}){super(),this.name=t,this.renderer=null,this.attributes=r,this.fragmentShader=e,this.vertexShader=a,this.defines=i,this.uniforms=o,this.extensions=s,this.blendMode=new _N(n),this.blendMode.addEventListener("change",(t=>this.setChanged())),this._inputColorSpace=ER,this._outputColorSpace=""}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(t){this._inputColorSpace=t,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t,this.setChanged()}set mainScene(t){}set mainCamera(t){}getName(){return this.name}setRenderer(t){this.renderer=t}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(t){this.attributes=t,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(t){this.fragmentShader=t,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(t){this.vertexShader=t,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(t,e=be){}update(t,e,r){}setSize(t,e){}initialize(t,e,r){}dispose(){for(const t of Object.keys(this)){const e=this[t];(e instanceof xe||e instanceof Q||e instanceof dt||e instanceof KR)&&this[t].dispose()}}},EN=class extends IN{constructor({blendFunction:t=AR,luminanceThreshold:e=.9,luminanceSmoothing:r=.025,mipmapBlur:n=!1,intensity:i=1,radius:o=.85,levels:s=8,kernelSize:a=LR,resolutionScale:u=.5,width:l=yN.AUTO_SIZE,height:h=yN.AUTO_SIZE,resolutionX:c=l,resolutionY:f=h}={}){super("BloomEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D map;\n#else\nuniform lowp sampler2D map;\n#endif\nuniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 texel=texture2D(map,uv);outputColor=vec4(texel.rgb*intensity,texel.a);}",{blendFunction:t,uniforms:new Map([["map",new Me(null)],["intensity",new Me(i)]])}),this.renderTarget=new xe(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new aN({kernelSize:a}),this.luminancePass=new uN({colorOutput:!0}),this.luminanceMaterial.threshold=e,this.luminanceMaterial.smoothing=r,this.mipmapBlurPass=new hN,this.mipmapBlurPass.enabled=n,this.mipmapBlurPass.radius=o,this.mipmapBlurPass.levels=s,this.uniforms.get("map").value=n?this.mipmapBlurPass.texture:this.renderTarget.texture;const p=this.resolution=new yN(this,c,f,u);p.addEventListener("change",(t=>this.setSize(p.baseWidth,p.baseHeight)))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(t){this.resolution.preferredWidth=t}get height(){return this.resolution.height}set height(t){this.resolution.preferredHeight=t}get dithering(){return this.blurPass.dithering}set dithering(t){this.blurPass.dithering=t}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(t){this.blurPass.kernelSize=t}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(t){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(t){this.uniforms.get("intensity").value=t}getIntensity(){return this.intensity}setIntensity(t){this.intensity=t}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}update(t,e,r){const n=this.renderTarget,i=this.luminancePass;i.enabled?(i.render(t,e),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(t,i.renderTarget):this.blurPass.render(t,i.renderTarget,n)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(t,e):this.blurPass.render(t,e,n)}setSize(t,e){const r=this.resolution;r.setBaseSize(t,e),this.renderTarget.setSize(r.width,r.height),this.blurPass.resolution.copy(r),this.luminancePass.setSize(t,e),this.mipmapBlurPass.setSize(t,e)}initialize(t,e,r){this.blurPass.initialize(t,e,r),this.luminancePass.initialize(t,e,r),this.mipmapBlurPass.initialize(t,e,r),void 0!==r&&(this.renderTarget.texture.type=r,kR(t)===IR&&FR(this.renderTarget.texture,IR))}},xN=class extends IN{constructor(t,e,{blendFunction:r=AR,patternTexture:n=null,patternScale:i=1,edgeStrength:o=1,pulseSpeed:s=0,visibleEdgeColor:a=16777215,hiddenEdgeColor:u=2230538,kernelSize:l=MR,blur:h=!1,xRay:c=!0,multisampling:f=0,resolutionScale:p=.5,width:g=yN.AUTO_SIZE,height:A=yN.AUTO_SIZE,resolutionX:y=g,resolutionY:v=A}={}){super("OutlineEffect","uniform lowp sampler2D edgeTexture;uniform lowp sampler2D maskTexture;uniform vec3 visibleEdgeColor;uniform vec3 hiddenEdgeColor;uniform float pulse;uniform float edgeStrength;\n#ifdef USE_PATTERN\nuniform lowp sampler2D patternTexture;varying vec2 vUvPattern;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec2 edge=texture2D(edgeTexture,uv).rg;vec2 mask=texture2D(maskTexture,uv).rg;\n#ifndef X_RAY\nedge.y=0.0;\n#endif\nedge*=(edgeStrength*mask.x*pulse);vec3 color=edge.x*visibleEdgeColor+edge.y*hiddenEdgeColor;float visibilityFactor=0.0;\n#ifdef USE_PATTERN\nvec4 patternColor=texture2D(patternTexture,vUvPattern);\n#ifdef X_RAY\nfloat hiddenFactor=0.5;\n#else\nfloat hiddenFactor=0.0;\n#endif\nvisibilityFactor=(1.0-mask.y>0.0)?1.0:hiddenFactor;visibilityFactor*=(1.0-mask.x)*patternColor.a;color+=visibilityFactor*patternColor.rgb;\n#endif\nfloat alpha=max(max(edge.x,edge.y),visibilityFactor);\n#ifdef ALPHA\noutputColor=vec4(color,alpha);\n#else\noutputColor=vec4(color,max(alpha,inputColor.a));\n#endif\n}",{uniforms:new Map([["maskTexture",new Me(null)],["edgeTexture",new Me(null)],["edgeStrength",new Me(o)],["visibleEdgeColor",new Me(new d(a))],["hiddenEdgeColor",new Me(new d(u))],["pulse",new Me(1)],["patternScale",new Me(i)],["patternTexture",new Me(null)]])}),this.blendMode.addEventListener("change",(t=>{this.blendMode.blendFunction===jL?this.defines.set("ALPHA","1"):this.defines.delete("ALPHA"),this.setChanged()})),this.blendMode.blendFunction=r,this.patternTexture=n,this.xRay=c,this.scene=t,this.camera=e,this.renderTargetMask=new xe(1,1),this.renderTargetMask.samples=f,this.renderTargetMask.texture.name="Outline.Mask",this.uniforms.get("maskTexture").value=this.renderTargetMask.texture,this.renderTargetOutline=new xe(1,1,{depthBuffer:!1}),this.renderTargetOutline.texture.name="Outline.Edges",this.uniforms.get("edgeTexture").value=this.renderTargetOutline.texture,this.clearPass=new eN,this.clearPass.overrideClearColor=new d(0),this.clearPass.overrideClearAlpha=1,this.depthPass=new nN(t,e),this.maskPass=new rN(t,e,new zR(this.depthPass.texture,e));const m=this.maskPass.clearPass;m.overrideClearColor=new d(16777215),m.overrideClearAlpha=1,this.blurPass=new aN({resolutionScale:p,resolutionX:y,resolutionY:v,kernelSize:l}),this.blurPass.enabled=h;const _=this.blurPass.resolution;_.addEventListener("change",(t=>this.setSize(_.baseWidth,_.baseHeight))),this.outlinePass=new cN(new YR);this.outlinePass.fullscreenMaterial.inputBuffer=this.renderTargetMask.texture,this.time=0,this.forceUpdate=!0,this.selection=new vN,this.selection.layer=10,this.pulseSpeed=s}set mainScene(t){this.scene=t,this.depthPass.mainScene=t,this.maskPass.mainScene=t}set mainCamera(t){this.camera=t,this.depthPass.mainCamera=t,this.maskPass.mainCamera=t,this.maskPass.overrideMaterial.copyCameraSettings(t)}get resolution(){return this.blurPass.resolution}getResolution(){return this.blurPass.getResolution()}get multisampling(){return this.renderTargetMask.samples}set multisampling(t){this.renderTargetMask.samples=t,this.renderTargetMask.dispose()}get patternScale(){return this.uniforms.get("patternScale").value}set patternScale(t){this.uniforms.get("patternScale").value=t}get edgeStrength(){return this.uniforms.get("edgeStrength").value}set edgeStrength(t){this.uniforms.get("edgeStrength").value=t}get visibleEdgeColor(){return this.uniforms.get("visibleEdgeColor").value}set visibleEdgeColor(t){this.uniforms.get("visibleEdgeColor").value=t}get hiddenEdgeColor(){return this.uniforms.get("hiddenEdgeColor").value}set hiddenEdgeColor(t){this.uniforms.get("hiddenEdgeColor").value=t}getBlurPass(){return this.blurPass}getSelection(){return this.selection}getPulseSpeed(){return this.pulseSpeed}setPulseSpeed(t){this.pulseSpeed=t}get width(){return this.resolution.width}set width(t){this.resolution.preferredWidth=t}get height(){return this.resolution.height}set height(t){this.resolution.preferredHeight=t}get selectionLayer(){return this.selection.layer}set selectionLayer(t){this.selection.layer=t}get dithering(){return this.blurPass.dithering}set dithering(t){this.blurPass.dithering=t}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(t){this.blurPass.kernelSize=t}get blur(){return this.blurPass.enabled}set blur(t){this.blurPass.enabled=t}get xRay(){return this.defines.has("X_RAY")}set xRay(t){this.xRay!==t&&(t?this.defines.set("X_RAY","1"):this.defines.delete("X_RAY"),this.setChanged())}isXRayEnabled(){return this.xRay}setXRayEnabled(t){this.xRay=t}get patternTexture(){return this.uniforms.get("patternTexture").value}set patternTexture(t){null!==t?(t.wrapS=t.wrapT=k,this.defines.set("USE_PATTERN","1"),this.setVertexShader("uniform float patternScale;varying vec2 vUvPattern;void mainSupport(const in vec2 uv){vUvPattern=uv*vec2(aspect,1.0)*patternScale;}")):(this.defines.delete("USE_PATTERN"),this.setVertexShader(null)),this.uniforms.get("patternTexture").value=t,this.setChanged()}setPatternTexture(t){this.patternTexture=t}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}setSelection(t){return this.selection.set(t),this}clearSelection(){return this.selection.clear(),this}selectObject(t){return this.selection.add(t),this}deselectObject(t){return this.selection.delete(t),this}update(t,e,r){const n=this.scene,i=this.camera,o=this.selection,s=this.uniforms.get("pulse"),a=n.background,u=i.layers.mask;(this.forceUpdate||o.size>0)&&(n.background=null,s.value=1,this.pulseSpeed>0&&(s.value=.375*Math.cos(this.time*this.pulseSpeed*10)+.625),this.time+=r,o.setVisible(!1),this.depthPass.render(t),o.setVisible(!0),i.layers.set(o.layer),this.maskPass.render(t,this.renderTargetMask),i.layers.mask=u,n.background=a,this.outlinePass.render(t,null,this.renderTargetOutline),this.blurPass.enabled&&this.blurPass.render(t,this.renderTargetOutline,this.renderTargetOutline)),this.forceUpdate=o.size>0}setSize(t,e){this.blurPass.setSize(t,e),this.renderTargetMask.setSize(t,e);const r=this.resolution;r.setBaseSize(t,e);const n=r.width,i=r.height;this.depthPass.setSize(n,i),this.renderTargetOutline.setSize(n,i),this.outlinePass.fullscreenMaterial.setSize(n,i)}initialize(t,e,r){this.blurPass.initialize(t,e,kt),void 0!==r&&(this.depthPass.initialize(t,e,r),this.maskPass.initialize(t,e,r),this.outlinePass.initialize(t,e,r))}},wN=class extends EN{constructor(t,e,r){super(r),this.setAttributes(this.getAttributes()|bR),this.camera=e,this.depthPass=new nN(t,e),this.clearPass=new eN(!0,!1,!1),this.clearPass.overrideClearColor=new d(0),this.depthMaskPass=new cN(new jR);const n=this.depthMaskMaterial;n.copyCameraSettings(e),n.depthBuffer1=this.depthPass.texture,n.depthPacking1=Re,n.depthMode=Ne,this.renderTargetMasked=new xe(1,1,{depthBuffer:!1}),this.renderTargetMasked.texture.name="Bloom.Masked",this.selection=new vN,this.selection.layer=11,this._inverted=!1,this._ignoreBackground=!1}set mainScene(t){this.depthPass.mainScene=t}set mainCamera(t){this.camera=t,this.depthPass.mainCamera=t,this.depthMaskMaterial.copyCameraSettings(t)}getSelection(){return this.selection}get depthMaskMaterial(){return this.depthMaskPass.fullscreenMaterial}get inverted(){return this._inverted}set inverted(t){this._inverted=t,this.depthMaskMaterial.depthMode=t?Pe:Ne}isInverted(){return this.inverted}setInverted(t){this.inverted=t}get ignoreBackground(){return this._ignoreBackground}set ignoreBackground(t){this._ignoreBackground=t,this.depthMaskMaterial.maxDepthStrategy=t?wR:xR}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(t){this.ignoreBackground=t}setDepthTexture(t,e=be){this.depthMaskMaterial.depthBuffer0=t,this.depthMaskMaterial.depthPacking0=e}update(t,e,r){const n=this.camera,i=this.selection,o=this.inverted;let s=e;if(this.ignoreBackground||!o||i.size>0){const r=n.layers.mask;n.layers.set(i.layer),this.depthPass.render(t),n.layers.mask=r,s=this.renderTargetMasked,this.clearPass.render(t,s),this.depthMaskPass.render(t,e,s)}super.update(t,s,r)}setSize(t,e){super.setSize(t,e),this.renderTargetMasked.setSize(t,e),this.depthPass.setSize(t,e)}initialize(t,e,r){super.initialize(t,e,r),this.clearPass.initialize(t,e,r),this.depthPass.initialize(t,e,r),this.depthMaskPass.initialize(t,e,r),t.capabilities.logarithmicDepthBuffer&&(this.depthMaskPass.fullscreenMaterial.defines.LOG_DEPTH="1"),void 0!==r&&(this.renderTargetMasked.texture.type=r,kR(t)===IR&&FR(this.renderTargetMasked.texture,IR))}},CN=function(){function t(e,r){Ze(this,t),this.layer=e;var n=e.getCamera(),i=e.getScene();this.effect=new wN(i,n,{blendFunction:zL,mipmapBlur:!0,luminanceThreshold:(null==r?void 0:r.threshold)||.4,luminanceSmoothing:(null==r?void 0:r.smoothing)||.2,intensity:(null==r?void 0:r.intensity)||5}),this.effectPass=new sN(n,this.effect),e.getComposer().addPass(this.effectPass)}return tr(t,[{key:"addSelection",value:function(t){this.effect.selection.add(t)}},{key:"delSelection",value:function(t){this.effect.selection.delete(t)}},{key:"clearSelection",value:function(){this.effect.selection.clear()}},{key:"dispose",value:function(){this.clearSelection(),this.layer.getComposer().removePass(this.effectPass)}}]),t}(),bN=function(){function t(e,r){Ze(this,t),this.layer=e;var n=e.getCamera(),i=e.getScene(),o=e.getRenderer().context;this.effect=new xN(i,n,{blendFunction:AR,multisampling:Math.min(4,o.capabilities.maxSamples),edgeStrength:r.strength||10,pulseSpeed:0,visibleEdgeColor:r.visibleEdgeColor||"#fff",hiddenEdgeColor:r.hiddenEdgeColor||2230538,height:480,blur:!1,xRay:!0}),this.effect.blurPass.enabled=void 0===r.blurPassState||r.blurPassState,this.effect.blurPass.blurMaterial.kernelSize=r.blurPassValue||5,this.effectPass=new sN(n,this.effect),e.getComposer().addPass(this.effectPass)}return tr(t,[{key:"addSelection",value:function(t){this.effect.selection.add(t)}},{key:"delSelection",value:function(t){this.effect.selection.delete(t)}},{key:"clearSelection",value:function(){this.effect.selection.clear()}},{key:"dispose",value:function(){this.clearSelection(),this.layer.getComposer().removePass(this.effectPass)}}]),t}(),SN=function t(){var e=0,r=document.createElement("div");function n(t){return r.appendChild(t.dom),t}function i(t){for(var n=0;n<r.children.length;n++)r.children[n].style.display=n===t?"block":"none";e=t}r.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",r.addEventListener("click",(function(t){t.preventDefault(),i(++e%r.children.length)}),!1);var o=(performance||Date).now(),s=o,a=0,u=n(new t.Panel("FPS","#0ff","#002")),l=n(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var h=n(new t.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:r,addPanel:n,showPanel:i,begin:function(){o=(performance||Date).now()},end:function(){a++;var t=(performance||Date).now();if(l.update(t-o,200),t>=s+1e3&&(u.update(1e3*a/(t-s),100),s=t,a=0,h)){var e=performance.memory;h.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){o=this.end()},domElement:r,setMode:i}};SN.Panel=function(t,e,r){var n=1/0,i=0,o=Math.round,s=o(window.devicePixelRatio||1),a=80*s,u=48*s,l=3*s,h=2*s,c=3*s,f=15*s,p=74*s,d=30*s,g=document.createElement("canvas");g.width=a,g.height=u,g.style.cssText="width:80px;height:48px";var A=g.getContext("2d");return A.font="bold "+9*s+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=r,A.fillRect(0,0,a,u),A.fillStyle=e,A.fillText(t,l,h),A.fillRect(c,f,p,d),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(c,f,p,d),{dom:g,update:function(u,y){n=Math.min(n,u),i=Math.max(i,u),A.fillStyle=r,A.globalAlpha=1,A.fillRect(0,0,a,f),A.fillStyle=e,A.fillText(o(u)+" "+t+" ("+o(n)+"-"+o(i)+")",l,h),A.drawImage(g,c+s,f,p-s,d,c,f,p-s,d),A.fillRect(c+p-s,f,s,d),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(c+p-s,f,s,o((1-u/y)*d))}}};var BN={radius:40,altitude:0},MN=function(e){rr(n,He);var r=ur(n);function n(e,i,o,s){var a;Ze(this,n),Array.isArray(e)||(e=[e]);var l=rx(e);a=r.call(this),i=t.Util.extend({center:l,layer:s},BN,i),a._initOptions(i);for(var h=s.coordinateToVector3(l),c=new u.Vector3(0,0,0),f=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1]),p=i.height,d=[],g=0,A=e.length;g<A;g++)if(g!==e.length-1){var y=e[g][0],v=e[g][1],m=p,_=e[g+1][0],I=e[g+1][1],E=p,x=s.distanceToVector3(m,m).x,w=s.coordinateToVector3([y,v],x),C=s.distanceToVector3(E,E).x,b=s.coordinateToVector3([_,I],C),S=new Float32Array(12);c.x=w.x,c.y=w.y,c.z=w.z,c.sub(h),S[0]=c.x,S[1]=c.y,S[2]=c.z,S[6]=c.x,S[7]=c.y,S[8]=0,c.x=b.x,c.y=b.y,c.z=b.z,c.sub(h),S[3]=c.x,S[4]=c.y,S[5]=c.z,S[9]=c.x,S[10]=c.y,S[11]=0;var B=new u.BufferGeometry;B.setAttribute("position",new u.BufferAttribute(S,3)),B.setAttribute("normal",new u.BufferAttribute(f,3)),B.setIndex([0,2,1,2,3,1]),d.push(B)}var M=WE(d);a._createMesh(M,o);var T=s.distanceToVector3(0,0).x,L=s.coordinateToVector3(l,T);return a.getObject3d().position.copy(L),a._data=i.data,a}return tr(n)}(),TN=function(){function t(e,r,n,i){Ze(this,t),this.map=n.map,this.threelayer=n,this.groupId=i,this.clickFunc=r.clickFunc;var o=new u.MeshBasicMaterial({side:u.DoubleSide,transparent:!0,opacity:r.opacity||.8,color:r.color||"#FF0000"}),s=new MN(e[0].coordinates,{height:r.height||400,data:e},o,n);this.groupId?this.threelayer.addMesh1(s,this.groupId):this.threelayer.addMesh(s),this.mesh=s,this._bindMapEvents()}return tr(t,[{key:"_bindMapEvents",value:function(){this.mesh&&this.mesh.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.mesh&&this.mesh.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){var e=t.target._data;"click"===t.type&&e&&this.clickFunc&&this.clickFunc(e)}},{key:"hide",value:function(){this.mesh.hide()}},{key:"show",value:function(){this.mesh.show()}},{key:"dispose",value:function(){this._closeEvent(),this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose(),this.mesh.object3d.material&&this.mesh.object3d.material.dispose()}}]),t}(),LN=function(t){rr(r,je);var e=ur(r);function r(t){var n;return Ze(this,r),(n=e.call(this,t)).type=Dt,n}return tr(r,[{key:"parse",value:function(t){var e=function(t,e){switch(t){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(e||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(e||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(e||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(e||""))}},r=function(t,e,r){e=e||1024;for(var n=t.pos,i=-1,o=0,s="",a=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));0>(i=a.indexOf("\n"))&&o<e&&n<t.byteLength;)s+=a,o+=a.length,n+=128,a+=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));return-1<i&&(!1!==r&&(t.pos+=o+i+1),s+a.slice(0,i))},n=function(t,e,r,n){var i=t[e+3],o=Math.pow(2,i-128)/255;r[n+0]=t[e+0]*o,r[n+1]=t[e+1]*o,r[n+2]=t[e+2]*o,r[n+3]=1},i=function(t,e,r,n){var i=t[e+3],o=Math.pow(2,i-128)/255;r[n+0]=Ve.toHalfFloat(Math.min(t[e+0]*o,65504)),r[n+1]=Ve.toHalfFloat(Math.min(t[e+1]*o,65504)),r[n+2]=Ve.toHalfFloat(Math.min(t[e+2]*o,65504)),r[n+3]=Ve.toHalfFloat(1)},o=new Uint8Array(t);o.pos=0;var s,a,u,l=function(t){var n,i,o=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,u=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,l={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for((t.pos>=t.byteLength||!(n=r(t)))&&e(1,"no header found"),(i=n.match(/^#\?(\S+)/))||e(3,"bad initial token"),l.valid|=1,l.programtype=i[1],l.string+=n+"\n";!1!==(n=r(t));)if(l.string+=n+"\n","#"!==n.charAt(0)){if((i=n.match(o))&&(l.gamma=parseFloat(i[1])),(i=n.match(s))&&(l.exposure=parseFloat(i[1])),(i=n.match(a))&&(l.valid|=2,l.format=i[1]),(i=n.match(u))&&(l.valid|=4,l.height=parseInt(i[1],10),l.width=parseInt(i[2],10)),2&l.valid&&4&l.valid)break}else l.comments+=n+"\n";return 2&l.valid||e(3,"missing format specifier"),4&l.valid||e(3,"missing image size specifier"),l}(o),h=l.width,c=l.height,f=function(t,r,n){var i=r;if(i<8||i>32767||2!==t[0]||2!==t[1]||128&t[2])return new Uint8Array(t);i!==(t[2]<<8|t[3])&&e(3,"wrong scanline width");var o=new Uint8Array(4*r*n);o.length||e(4,"unable to allocate buffer space");for(var s=0,a=0,u=4*i,l=new Uint8Array(4),h=new Uint8Array(u),c=n;c>0&&a<t.byteLength;){a+4>t.byteLength&&e(1),l[0]=t[a++],l[1]=t[a++],l[2]=t[a++],l[3]=t[a++],2==l[0]&&2==l[1]&&(l[2]<<8|l[3])==i||e(3,"bad rgbe scanline format");for(var f=0,p=void 0;f<u&&a<t.byteLength;){var d=(p=t[a++])>128;if(d&&(p-=128),(0===p||f+p>u)&&e(3,"bad scanline data"),d)for(var g=t[a++],A=0;A<p;A++)h[f++]=g;else h.set(t.subarray(a,a+p),f),f+=p,a+=p}for(var y=i,v=0;v<y;v++){var m=0;o[s]=h[v+m],m+=i,o[s+1]=h[v+m],m+=i,o[s+2]=h[v+m],m+=i,o[s+3]=h[v+m],s+=4}c--}return o}(o.subarray(o.pos),h,c);switch(this.type){case Pt:u=f.length/4;for(var p=new Float32Array(4*u),d=0;d<u;d++)n(f,4*d,p,4*d);s=p,a=Pt;break;case Dt:u=f.length/4;for(var g=new Uint16Array(4*u),A=0;A<u;A++)i(f,4*A,g,4*A);s=g,a=Dt;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:h,height:c,data:s,header:l.string,gamma:l.gamma,exposure:l.exposure,type:a}}},{key:"setDataType",value:function(t){return this.type=t,this}},{key:"load",value:function(t,e,n,i){return hr(nr(r.prototype),"load",this).call(this,t,(function(t,r){switch(t.type){case Pt:case Dt:t.colorSpace=_,t.minFilter=P,t.magFilter=P,t.generateMipmaps=!1,t.flipY=!0}e&&e(t,r)}),n,i)}}]),r}(),RN="__webglFramebuffer",NN=new u.Vector4,PN={bloom:!0},DN=1*u.REVISION>154?Math.PI:1;function kN(t,e){if(t){t.layers&&t.layers.set(e);var r=t.children;if(r&&r.length)for(var n=0,i=r.length;n<i;n++)kN(r[n],e)}}qe.prototype.renderScene=function(t){if(this.layer._callbackBaseObjectAnimation(),this._syncCamera(),t&&t.renderTarget){var e=t.renderTarget.fbo,r=e.width,n=e.height;this._renderTarget?(this._renderTarget.viewport.set(0,0,r,n),this._renderTarget.scissor.set(0,0,r,n)):(this._renderTarget=new u.WebGLRenderTarget(r,n,{depthBuffer:!1}),this.context.setRenderTarget(this._renderTarget),this.context.render(this.scene,this.camera));var i=this.context.properties.get(this._renderTarget),o=i[RN];i[RN]=t.renderTarget.getFramebuffer(t.renderTarget.fbo),this.context.setRenderTarget(this._renderTarget);var s=1===t.bloom&&t.sceneFilter,a=this.scene.children||[],l=!1;if(s){var h=t.sceneFilter;l=h(PN);for(var c=0,f=a.length;c<f;c++)if(a[c]&&a[c].layers){var p=a[c].__parent;a[c].bloom=!1,p&&(a[c].bloom=p.bloom);var d=0;(a[c]&&h(a[c])||!p)&&l&&(d=1),a[c].__layer!==d&&(kN(a[c],d),a[c].__layer=d)}}else for(var g=0,A=a.length;g<A;g++)a[g]&&a[g].layers&&0!==a[g].__layer&&(kN(a[g],0),a[g].__layer=0);this.camera.layers.set(l?1:0),this.context.render(this.scene,this.camera),i[RN]=o}else{var y=this.canvas,v=y.width,m=y.height,_=this.context.getViewport(NN);_.width===v&&_.height===m||this.context.setViewport(0,0,v,m),this.context.render(this.scene,this.camera),this.layer.updateComposer()}this.context.setRenderTarget(null),this.completeRender()},Ye.prototype.initEnvironment=function(t){var e=this.getScene(),r=(new LN).load(t,(function(){r.mapping=u.EquirectangularReflectionMapping,e.environment=r}))},Ye.prototype.initBloom=function(){var t=this.getThreeRenderer(),e=this.getScene(),r=this.getCamera();this.composer=new class{constructor(t=null,{depthBuffer:e=!0,stencilBuffer:r=!1,multisampling:n=0,frameBufferType:i}={}){this.renderer=null,this.inputBuffer=this.createBuffer(e,r,i,n),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new ZR,this.depthTexture=null,this.passes=[],this.timer=new class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(t){"undefined"!=typeof document&&void 0!==document.hidden&&(t?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=t)}get delta(){return this._delta*fN}get fixedDelta(){return this._fixedDelta*fN}set fixedDelta(t){this._fixedDelta=1e3*t}get elapsed(){return this._elapsed*fN}update(t){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(void 0!==t?t:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}handleEvent(t){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},this.autoRenderToScreen=!0,this.setRenderer(t)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(t){const e=this.inputBuffer,r=this.multisampling;r>0&&t>0?(this.inputBuffer.samples=t,this.outputBuffer.samples=t,this.inputBuffer.dispose(),this.outputBuffer.dispose()):r!==t&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(e.depthBuffer,e.stencilBuffer,e.texture.type,t),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(t){if(this.renderer=t,null!==t){const e=t.getSize(new S),r=t.getContext().getContextAttributes().alpha,n=this.inputBuffer.texture.type;n===kt&&kR(t)===IR&&(FR(this.inputBuffer.texture,IR),FR(this.outputBuffer.texture,IR),this.inputBuffer.dispose(),this.outputBuffer.dispose()),t.autoClear=!1,this.setSize(e.width,e.height);for(const e of this.passes)e.initialize(t,r,n)}}replaceRenderer(t,e=!0){const r=this.renderer,n=r.domElement.parentNode;return this.setRenderer(t),e&&null!==n&&(n.removeChild(r.domElement),n.appendChild(t.domElement)),r}createDepthTexture(){const t=this.depthTexture=new me;return this.inputBuffer.depthTexture=t,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(t.format=_e,t.type=Ie):t.type=Ee,t}deleteDepthTexture(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const t of this.passes)t.setDepthTexture(null)}}createBuffer(t,e,r,n){const i=this.renderer,o=null===i?new S:i.getDrawingBufferSize(new S),s={minFilter:P,magFilter:P,stencilBuffer:e,depthBuffer:t,type:r},a=new xe(o.width,o.height,s);return n>0&&(a.ignoreDepthForMultisampleCopy=!1,a.samples=n),r===kt&&kR(i)===IR&&FR(a.texture,IR),a.texture.name="EffectComposer.Buffer",a.texture.generateMipmaps=!1,a}setMainScene(t){for(const e of this.passes)e.mainScene=t}setMainCamera(t){for(const e of this.passes)e.mainCamera=t}addPass(t,e){const r=this.passes,n=this.renderer,i=n.getDrawingBufferSize(new S),o=n.getContext().getContextAttributes().alpha,s=this.inputBuffer.texture.type;if(t.setRenderer(n),t.setSize(i.width,i.height),t.initialize(n,o,s),this.autoRenderToScreen&&(r.length>0&&(r[r.length-1].renderToScreen=!1),t.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==e?r.splice(e,0,t):r.push(t),this.autoRenderToScreen&&(r[r.length-1].renderToScreen=!0),t.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){const e=this.createDepthTexture();for(t of r)t.setDepthTexture(e)}else t.setDepthTexture(this.depthTexture)}removePass(t){const e=this.passes,r=e.indexOf(t);if(-1!==r&&e.splice(r,1).length>0){if(null!==this.depthTexture){const r=(t,e)=>t||e.needsDepthTexture;e.reduce(r,!1)||(t.getDepthTexture()===this.depthTexture&&t.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&r===e.length&&(t.renderToScreen=!1,e.length>0&&(e[e.length-1].renderToScreen=!0))}}removeAllPasses(){const t=this.passes;this.deleteDepthTexture(),t.length>0&&(this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!1),this.passes=[])}render(t){const e=this.renderer,r=this.copyPass;let n,i,o,s=this.inputBuffer,a=this.outputBuffer,u=!1;void 0===t&&(this.timer.update(),t=this.timer.delta);for(const l of this.passes)l.enabled&&(l.render(e,s,a,t,u),l.needsSwap&&(u&&(r.renderToScreen=l.renderToScreen,n=e.getContext(),i=e.state.buffers.stencil,i.setFunc(n.NOTEQUAL,1,4294967295),r.render(e,s,a,t,u),i.setFunc(n.EQUAL,1,4294967295)),o=s,s=a,a=o),l instanceof lN?u=!0:l instanceof $R&&(u=!1))}setSize(t,e,r){const n=this.renderer,i=n.getSize(new S);void 0!==t&&void 0!==e||(t=i.width,e=i.height),i.width===t&&i.height===e||n.setSize(t,e,r);const o=n.getDrawingBufferSize(new S);this.inputBuffer.setSize(o.width,o.height),this.outputBuffer.setSize(o.width,o.height);for(const t of this.passes)t.setSize(o.width,o.height)}reset(){const t=this.timer.autoReset;this.dispose(),this.autoRenderToScreen=!0,this.timer.autoReset=t}dispose(){for(const t of this.passes)t.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}}(t,{frameBufferType:u.HalfFloatType}),this.composer.addPass(new rN(e,r))},Ye.prototype.delComposer=function(){var t;null===(t=this.composer)||void 0===t||t.dispose()},Ye.prototype.updateComposer=function(){var t;null===(t=this.composer)||void 0===t||t.render()},Ye.prototype.getComposer=function(){return this.composer},Ye.prototype._recursionMesh=function(t){for(;t&&t.parent!==this.getScene()&&!t.parent.customType;)t=t.parent;return t},Ye.prototype.identify=function(e,r){var n=this;if(!e)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(e)&&(e=new t.Coordinate(e)),!(e instanceof t.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var i=this.getMap().coordToContainerPoint(e);this._containerPoint=i;var o=i.x,s=i.y;this._initRaycaster(),this.fire("identify",{coordinate:e,options:r});var a=this._raycaster,l=this._mouse,h=this.getCamera(),c=this.getScene(),f=this.getMap().getSize();if(!c)return[];var p=f.width,d=f.height;l.x=o/p*2-1,l.y=-s/d*2+1,a.setFromCamera(l,h),a.layers&&a.layers.enableAll&&a.layers.enableAll(),function(t,e){t.linePrecision=e}(a,this._getLinePrecision(this.getMap().getResolution()));var g=[],A=[];c.children.forEach((function(e){var r=e.__parent;if(r&&r.getOptions){var n=r;n.getOptions().interactive&&n.isVisible()&&(n.identify&&t.Util.isFunction(n.identify)?A.push(n):g.push(e))}else(e instanceof u.Mesh||e instanceof u.Group)&&e.customType&&e.children.forEach((function(e){var r=e.__parent;if(r&&r.getOptions){var n=r;n.getOptions().interactive&&n.isVisible()&&(n.identify&&t.Util.isFunction(n.identify)?A.push(n):g.push(e))}}))}));var y=[],v=a.intersectObjects(g,!0);v&&Array.isArray(v)&&v.length&&(y=v.map((function(e){var r=e.object,i=e.instanceId,o=(r=n._recursionMesh(r)||{}).__parent||r;return o.faceIndex=e.faceIndex,o.index=e.index,o.intersect=e,t.Util.isNumber(i)&&(o.instanceId=i),o}))),this.renderPickScene(),A.length&&A.forEach((function(t){t.identify(e)&&y.push(t)}));for(var m=y.length,_=0;_<m;_++)if(y[_])for(var I=_+1;I<m;I++)y[_]===y[I]&&y.splice(I,1);var E=(r=t.Util.extend({},r)).count;return t.Util.isNumber(E)&&E>0?y.slice(0,E):y},Ye.prototype._zoomend=function(){var e=this.getScene();if(e){var r=this.getMap().getZoom();e.children.forEach((function(e){if(e.customType)e.children.forEach((function(e){var n=e.__parent;if(n&&n.getOptions){var i=n;i.zoomChange&&t.Util.isFunction(i.zoomChange)&&i.zoomChange(r);var o=i.getMinZoom(),s=i.getMaxZoom();r<o||r>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=r&&r<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}));else{var n=e.__parent;if(n&&n.getOptions){var i=n;i.zoomChange&&t.Util.isFunction(i.zoomChange)&&i.zoomChange(r);var o=i.getMinZoom(),s=i.getMaxZoom();r<o||r>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=r&&r<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}}))}},Ye.prototype.addMesh1=function(t,e){var r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=void 0;if(e&&(o=i.getObjectByProperty("customId",e)),t.forEach((function(t){if(t instanceof He){var e;if(o)o.add(t.getObject3d());else console.log("组不存在,销毁创建的对象"),null===(e=t.parent)||void 0===e||e.dispose();t.isAdd||(t.isAdd=!0,t.options.layer=r,t._fire("add",{target:t}))}})),this._zoomend(),n){var s=this._getRenderer();s&&s.setToRedraw()}return this},Ye.prototype.removeMesh1=function(e,r){var n=this,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return this;Array.isArray(e)||(e=[e]);var o=this.getScene(),s=o.getObjectByProperty("customId",r);if(e.forEach((function(e){if(e instanceof He){s?s.remove(e.getObject3d()):o.remove(e.getObject3d()),e.isAdd&&(e.isAdd=!1,e._fire("remove",{target:e})),e._animation&&t.Util.isFunction(e._animation)&&delete n._animationBaseObjectMap[e.getObject3d().uuid];var r=n._delayMeshes;if(r.length)for(var i=0,a=r.length;i<a;i++)if(r[i]===e){r.splice(i,1);break}}else e instanceof u.Object3D&&o.remove(e)})),i){var a=this._getRenderer();a&&a.setToRedraw()}return this};var FN=function(){function t(e,r,n){var i=this;Ze(this,t),this.map=r,this.animationId=null,this.updatables=[];var o=ZE();this.threeLayer=new Ye(o,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new u.Clock;var s=function t(){i.threeLayer._needsUpdate=!i.threeLayer._needsUpdate,i.threeLayer._needsUpdate&&i.threeLayer.redraw();var e,r=i.clock.getDelta(),n=yr(i.updatables);try{for(n.s();!(e=n.n()).done;){e.value.tick(r)}}catch(t){n.e(t)}finally{n.f()}i.statsFlag&&i.stats.update(),i.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new u.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),s()},this.threeLayer.addTo(r),this.layerId=o,this.layerName=e,this.dirty=!1,this.initFlag=!1,this.bloomFlag=n||!1,this.bloomStrength=null==n?void 0:n.bloomStrength,this.bloomThreshold=null==n?void 0:n.bloomThreshold,this.bloomRadius=null==n?void 0:n.bloomRadius,this.hdrPath=null==n?void 0:n.hdrPath,this.stats=new SN,this.stats.dom.style.display="none",document.body.appendChild(this.stats.dom),this.statsFlag=!1}var e;return tr(t,[{key:"createGroup",value:(e=Ke(Xe().mark((function t(e){return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,$E(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new zM(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=ZE();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function e(){t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate&&t.threeLayer.redraw();var r,n=t.clock.getDelta(),i=yr(t.updatables);try{for(i.s();!(r=i.n()).done;){r.value.tick(n)}}catch(t){i.e(t)}finally{i.f()}t.statsFlag&&t.stats.update(),t.animationId=requestAnimationFrame(e)};return new Promise((function(r){var n=t;t.threeLayer.prepareToDraw=function(t,i,o){n.hdrPath&&this.initEnvironment(n.hdrPath);var s=new u.DirectionalLight(16777215,1*DN);s.position.set(0,-10,10).normalize(),i.add(s),i.add(new u.AmbientLight(16777215,1*DN)),e(),this.initBloom(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new wx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new wx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar1",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Cx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Cx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar2",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar3",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Sx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Sx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new Tx(t,e,r||{},i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new Tx(t,e,r||{},i.threeLayer,n);o(s)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Px(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Px(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new Ix(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new Ix(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new shockEffect(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new shockEffect(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPoybyHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new TN(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new TN(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new ew(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new ew(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new QM(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new QM(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new GM(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new GM(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new GT(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new GT(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new VT(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new VT(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new HT(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new HT(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawBloomLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new UL(t,e,n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new UL(t,e,n.threeLayer,r);i(o)}))}))}},{key:"createBloomClass",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new CN(e.threeLayer,t);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new CN(e.threeLayer,t);r(n)}))}))}},{key:"createOutlineBloom",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new bN(e.threeLayer,t);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new bN(e.threeLayer,t);r(n)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new WT(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new WT(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new kL(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new kL(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ZT(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ZT(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _L(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _L(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bL(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bL(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new xL(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new xL(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new LL(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new LL(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripHeight1",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new RL(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new RL(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new NL(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new NL(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new OL(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new OL(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"setStateFlag",value:function(){this.statsFlag=!this.statsFlag,this.statsFlag?this.stats.dom.style.display="":this.stats.dom.style.display="none"}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.delComposer(),this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]),t}(),QN=function(){function t(e,r){var n=this;Ze(this,t),this.map=r,this.animationId=null,this.updatables=[];var i=ZE();this.threeLayer=new Ye(i,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new u.Clock;var o=function t(){var e;(n.threeLayer._needsUpdate=!n.threeLayer._needsUpdate,n.threeLayer._needsUpdate)&&(null===(e=n.threeLayer)||void 0===e||null===(e=e.getRenderer())||void 0===e||e.clearCanvas(),n.threeLayer.renderScene());var r,i=n.clock.getDelta(),o=yr(n.updatables);try{for(o.s();!(r=o.n()).done;){r.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}n.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new u.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),o()},this.threeLayer.addTo(r),this.layerId=i,this.layerName=e,this.dirty=!1,this.initFlag=!1}var e;return tr(t,[{key:"createGroup",value:(e=Ke(Xe().mark((function t(e){return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,$E(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new zM(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=ZE();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function e(){var r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(r=t.threeLayer)||void 0===r||null===(r=r.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var n,i=t.clock.getDelta(),o=yr(t.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(r){t.threeLayer.prepareToDraw=function(t,n,i){var o=new u.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),n.add(o),n.add(new u.AmbientLight(16777215)),e(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new wx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new wx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Tx(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Tx(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Px(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Px(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new Ix(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new Ix(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new Fx(t,e||{},r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new Fx(t,e||{},r.threeLayer,r);n(i)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new ew(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new ew(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new QM(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new QM(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new GM(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new GM(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new GT(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new GT(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new VT(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new VT(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new HT(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new HT(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new WT(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new WT(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new kL(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new kL(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ZT(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ZT(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _L(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _L(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bL(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bL(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new xL(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new xL(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new LL(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new LL(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new NL(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new NL(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new OL(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new OL(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]),t}(),ON=function(){function e(r,n,i,o){Ze(this,e),this.map=o,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new t.DrawTool({mode:r,symbol:{lineColor:i.lineColor||"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:i.polygonFill||"#E40D56",polygonOpacity:.2}}).addTo(this.map).enable(),this._bindEvent(),this._drawEnd=n,this.mode=r,this.toolLayer=new t.VectorLayer(t.Util.GUID(),{geometryEvents:!1,hitDetect:!1}).addTo(this.map),this.geometry&&(this.toolLayer.addGeometry(this.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(this.geometry.getCoordinates(),this.geometry.getRadius()):this._drawEnd(this.geometry.getCoordinates()))),i.zIndex&&this.toolLayer.setZIndex(i.zIndex),this.type="drawTool"}return tr(e,[{key:"getZIndex",value:function(){this.toolLayer&&this.toolLayer.getZIndex()}},{key:"setZIndex",value:function(t){this.toolLayer&&this.toolLayer.setZIndex(t)}},{key:"selectGeometryByPoint",value:function(){this.map.on("click",this._selectGeometry,this)}},{key:"endSelect",value:function(){this.toolLayer&&this.selectGeometry&&(this._changeSymbol(!1),this.selectGeometry.endEdit(),this.selectGeometry=null),this.map.off("click",this._selectGeometry,this)}},{key:"_selectGeometry",value:function(t){if(this.disableTool(),this.toolLayer){var e=this.toolLayer.identify(t.coordinate);this.selectGeometry&&(this.selectGeometry.endEdit(),this._changeSymbol(!1)),e&&(this.selectGeometry=e[0]),this.selectGeometry&&this._changeSymbol(!0)}}},{key:"_closeMapEvent",value:function(){this.map.off("click",this._selectGeometry,this)}},{key:"_changeSymbol",value:function(t){t?this.selectGeometry.setSymbol({lineColor:"#00ffff",lineWidth:2,lineDasharray:[5,5],polygonFill:"#00ffff",polygonOpacity:.2}):this.selectGeometry.setSymbol({lineColor:"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:"#E40D56",polygonOpacity:.2})}},{key:"deleteGeometry",value:function(){this.toolLayer&&this.selectGeometry&&(this.selectGeometry.endEdit(),this.toolLayer.removeGeometry(this.selectGeometry))}},{key:"undoDrawGeometry",value:function(){if(this.toolLayer){var t=this.toolLayer.getGeometries();if(t.length<1)return;this.toolLayer.removeGeometry(t[t.length-1])}}},{key:"_bindEvent",value:function(){this.drawTool.on("drawend",this.drawEnd,this)}},{key:"_closeEvent",value:function(){this.drawTool.off("drawend",this.drawEnd,this)}},{key:"drawEnd",value:function(t){this.toolLayer&&this.toolLayer.addGeometry(t.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(t.geometry.getCoordinates(),t.geometry.getRadius()):this._drawEnd(t.geometry.getCoordinates())),this.geometry=t.geometry}},{key:"disableTool",value:function(){this.drawTool.disable()}},{key:"clearGeometry",value:function(){this.toolLayer&&this.toolLayer.clear()}},{key:"setMode",value:function(t,e){this._drawEnd&&delete this._drawEnd,this._drawEnd=e,this.drawTool.setMode(t).enable(),this.mode=t}},{key:"startEdit",value:function(){this.disableTool(),this.selectGeometry&&this.selectGeometry.startEdit()}},{key:"endEdit",value:function(t){this.selectGeometry&&(this.selectGeometry.endEdit(),t&&("Circle"===this.mode?t(this.selectGeometry.getCoordinates(),this.geometry.getRadius()):t(this.selectGeometry.getCoordinates())))}},{key:"dispose",value:function(){this.drawTool&&(this._closeEvent(),this.endEdit(),this.disableTool(),delete this.drawTool),this._drawEnd&&delete this._drawEnd,this.geometry&&delete this.geometry,this.selectGeometry&&delete this.selectGeometry,this.map&&this._closeMapEvent(),this.map.removeLayer(this.toolLayer),delete this.toolLayer}}]),e}();function UN(){this.PI=3.141592653589793,this.x_PI=52.35987755982988,this.a=6378245,this.ee=.006693421622965943,this.EARTHRADIUS=6370996.81,this.MCBAND=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],this.LLBAND=[75,60,45,30,15,0],this.MC2LL=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],this.LL2MC=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],this._transformlat=function(t,e){var r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,r+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},this._transformlng=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,r+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},this._out_of_china=function(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271||!1},this._getLoop=function(t,e,r){for(;t>r;)t-=r-e;for(;t<e;)t+=r-e;return t},this._getRange=function(t,e,r){return null!=e&&(t=Math.max(t,e)),null!=r&&(t=Math.min(t,r)),t}}UN.prototype.BD2GCJ=function(t,e){var r=t-.0065,n=e-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_PI),o=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_PI);return[i*Math.cos(o),i*Math.sin(o)]},UN.prototype.GCJ2BD=function(t,e){var r=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*this.x_PI),n=Math.atan2(e,t)+3e-6*Math.cos(t*this.x_PI);return[r*Math.cos(n)+.0065,r*Math.sin(n)+.006]},UN.prototype.WGS2GCJ=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[t+(n=180*n/(this.a/s*Math.cos(i)*this.PI)),e+r]},UN.prototype.GCJ2WGS=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[2*t-(t+(n=180*n/(this.a/s*Math.cos(i)*this.PI))),2*e-(e+r)]},UN.prototype.WGS2BD=function(t,e){var r=this.WGS2GCJ(t,e);return r=this.GCJ2BD(r[0],r[1])},UN.prototype.BD2WGS=function(t,e){var r=this.BD2GCJ(t,e);return r=this.GCJ2WGS(r[0],r[1])},UN.prototype.BD_MKT2WGS=function(t,e){var r=null;t=Math.abs(t),e=Math.abs(e);for(var n=0;n<this.MCBAND.length;n++)if(e>=this.MCBAND[n]){r=this.MC2LL[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]},UN.prototype.BD_WGS2MKT=function(t,e){var r=null;t=this._getLoop(t,-180,180),e=this._getRange(e,-74,74);for(var n=0;n<this.LLBAND.length;n++)if(e>=this.LLBAND[n]){r=this.LL2MC[n];break}if(null!=r)for(n=this.LLBAND.length-1;n>=0;n--)if(e<=-this.LLBAND[n]){r=this.LL2MC[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]};var GN=function(){function e(r,n,i){Ze(this,e),this.map=n,this.overlayer=new t.VectorLayer("overLayer",{geometryEvents:!1,hitDetect:!1,forceRenderOnMoving:!0,forceRenderOnRotating:!0,enableSimplify:!1}),this.overlayer.addTo(this.map);var o=new t.MultiPolygon(r,{symbol:{polygonFill:i.color||"#000",polygonOpacity:i.opacity||1,lineWidth:0}});this.overlayer.addGeometry(o)}return tr(e,[{key:"dispose",value:function(){this.map.removeLayer(this.overlayer),delete this.toolLayer}}]),e}();
|
|
157
157
|
/*!
|
|
158
158
|
* maptalks.animatemarker v0.4.1
|
|
159
159
|
* LICENSE : MIT
|