!function t(e,n,r){function o(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return o(n||t)},c,c.exports,t,e,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s=0&&n.push(t)}),n.length<2)return[];n.includes(t[0])&&n.includes(t[t.length-1])&&t.push(t.shift()),n.includes(e[0])&&n.includes(e[e.length-1])&&e.push(e.shift()),n=[],t.forEach(function(t){e.includes(t)&&n.push(t)});for(var r=n[1],o=n[0],i=t.slice();i[0]!==r;)i.push(i.shift());for(var s=0,a=e.slice();a[0]!==o;)if(a.push(a.shift()),s++>10)throw new Error("Unexpected state");return a.shift(),a.pop(),i=i.concat(a)},r.setPolygonCentroid=function(t,e){var n=new THREE.Vector3,r=e.vertices;t.vertexIds.forEach(function(t){n.add(r[t])}),n.divideScalar(t.vertexIds.length),t.centroid.copy(n)},r.cleanPolygon=function(t,e){for(var n=[],r=e.vertices,o=0;oMath.PI-.01&&d0?function(t){t<0&&(r=!1)}:function(t){t>0&&(r=!1)}),r},r.distanceToSquared=function(t,e){var n=t.x-e.x,r=t.y-e.y,o=t.z-e.z;return n*n+r*r+o*o},r.isPointInPoly=function(t,e){for(var n=!1,r=-1,o=t.length,i=o-1;++rr-.5&&this.isPointInPoly(i,t))},r.triarea2=function(t,e,n){return(n.x-t.x)*(e.z-t.z)-(e.x-t.x)*(n.z-t.z)},r.vequal=function(t,e){return this.distanceToSquared(t,e)<1e-5};var o=function(t){this.content=[],this.scoreFunction=t};o.prototype.push=function(t){this.content.push(t),this.sinkDown(this.content.length-1)},o.prototype.pop=function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),t},o.prototype.remove=function(t){var e=this.content.indexOf(t),n=this.content.pop();e!==this.content.length-1&&(this.content[e]=n,this.scoreFunction(n)0;){var n=(t+1>>1)-1,r=this.content[n];if(!(this.scoreFunction(e)0;){var o=r.pop();if(o===n){for(var i=o,s=[];i.parent;)s.push(i),i=i.parent;return this.cleanUp(s),s.reverse()}o.closed=!0;for(var a=this.neighbours(t,o),u=0,h=a.length;u0)){i.push(e),e=t=e,n=t,a=s=a,u=s,h=s;continue}n=d,u=h}if(r.triarea2(t,e,c)>=0){if(!(r.vequal(t,e)||r.triarea2(t,n,c)<0)){i.push(n),e=t=n,n=t,a=s=u,u=s,h=s;continue}e=c,a=h}}return 0!==i.length&&r.vequal(i[i.length-1],o[o.length-1].left)||i.push(o[o.length-1].left),this.path=i,i};var h,c,d,f,v,l,p=function(){this.zones={}};p.createZone=function(t){return a.buildZone(t)},p.prototype.setZoneData=function(t,e){this.zones[t]=e},p.prototype.getGroup=function(t,e){if(!this.zones[t])return null;var n=null,o=Math.pow(50,2);return this.zones[t].groups.forEach(function(t,i){t.forEach(function(t){var s=r.distanceToSquared(t.centroid,e);s2))for(var x=0;x