/** * @license almond 0.3.0 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/almond for details */ /* * Copyright 2015-2017 WorldWind Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * @license * Copyright 2000, Silicon Graphics, Inc. All Rights Reserved. * Copyright 2014, Google Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice including the dates of first publication and * either this permission notice or a reference to http://oss.sgi.com/projects/FreeB/ * shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Original Code. The Original Code is: OpenGL Sample Implementation, * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. */ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE * @version 3.0.2 */ /*! JSZip - A Javascript class for generating and reading zip files (c) 2009-2014 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/master/LICENSE This AMD version of jszip was created with Webpack using the v2.x branch of jszip: https://github.com/Stuk/jszip/tree/v2.x */ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ /** * The following functions come from pako, from pako/lib/utils/strings * released under the MIT license, see pako https://github.com/nodeca/pako/ */ !function(t,e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define([],e):t.WorldWind=e()}(this,function(){var t,e,i;!function(r){function n(t,e){return v.call(t,e)}function o(t,e){var i,r,n,o,s,a,l,h,u,c,d,p=e&&e.split("/"),f=y.map,g=f&&f["*"]||{};if(t&&"."===t.charAt(0))if(e){for(p=p.slice(0,p.length-1),t=t.split("/"),s=t.length-1,y.nodeIdCompat&&b.test(t[s])&&(t[s]=t[s].replace(b,"")),t=p.concat(t),u=0;u0&&(t.splice(u-1,2),u-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((p||g)&&f){for(i=t.split("/"),u=i.length;u>0;u-=1){if(r=i.slice(0,u).join("/"),p)for(c=p.length;c>0;c-=1)if((n=f[p.slice(0,c).join("/")])&&(n=n[r])){o=n,a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r],h=u)}!o&&l&&(o=l,a=h),o&&(i.splice(0,a,o),t=i.join("/"))}return t}function s(t,e){return function(){var i=S.call(arguments,0);return"string"!=typeof i[0]&&1===i.length&&i.push(null),p.apply(r,i.concat([t,e]))}}function a(t){return function(e){return o(e,t)}}function l(t){return function(e){m[t]=e}}function h(t){if(n(E,t)){var e=E[t];delete E[t],_[t]=!0,d.apply(r,e)}if(!n(m,t)&&!n(_,t))throw new Error("No "+t);return m[t]}function u(t){var e,i=t?t.indexOf("!"):-1;return i>-1&&(e=t.substring(0,i),t=t.substring(i+1,t.length)),[e,t]}function c(t){return function(){return y&&y.config&&y.config[t]||{}}}var d,p,f,g,m={},E={},y={},_={},v=Object.prototype.hasOwnProperty,S=[].slice,b=/\.js$/;f=function(t,e){var i,r=u(t),n=r[0];return t=r[1],n&&(n=o(n,e),i=h(n)),n?t=i&&i.normalize?i.normalize(t,a(e)):o(t,e):(t=o(t,e),r=u(t),n=r[0],t=r[1],n&&(i=h(n))),{f:n?n+"!"+t:t,n:t,pr:n,p:i}},g={require:function(t){return s(t)},exports:function(t){var e=m[t];return void 0!==e?e:m[t]={}},module:function(t){return{id:t,uri:"",exports:m[t],config:c(t)}}},d=function(t,e,i,o){var a,u,c,d,p,y,v=[],S=typeof i;if(o=o||t,"undefined"===S||"function"===S){for(e=!e.length&&i.length?["require","exports","module"]:e,p=0;p180?e-360:e<-180?360+e:e},normalizedDegreesLatitude:function(t){var e=t%180;return e>90?180-e:e<-90?-180-e:e},normalizedDegreesLongitude:function(t){var e=t%360;return e>180?e-360:e<-180?360+e:e},normalizedRadians:function(t){var e=t%this.TWO_PI;return e>Math.PI?e-this.TWO_PI:e<-Math.PI?this.TWO_PI+e:e},normalizedRadiansLatitude:function(t){var e=t%Math.PI;return e>this.HALF_PI?Math.PI-e:e<-this.HALF_PI?-Math.PI-e:e},normalizedRadiansLongitude:function(t){var e=t%this.TWO_PI;return e>Math.PI?e-this.TWO_PI:e<-Math.PI?this.TWO_PI+e:e},isValidLatitude:function(t){return t>=-90&&t<=90},isValidLongitude:function(t){return t>=-180&&t<=180},toString:function(t){return t.toString()+"°"},toDecimalDegreesString:function(t){return t.toString()+"°"},toDMSString:function(t){var e,i,r,n,o;return e=t<0?-1:1,i=e*t,r=Math.floor(i),i=60*(i-r),n=Math.floor(i),i=60*(i-n),o=Math.round(i),60==o&&(n++,o=0),60==n&&(r++,n=0),(-1==e?"-":"")+r+"° "+n+"’ "+o+"”"},toDMString:function(t){var e,i,r,n,o,s;return e=t<0?-1:1,i=e*t,r=Math.floor(i),i=60*(i-r),n=Math.floor(i),i=60*(i-n),o=Math.round(i),60==o&&(n++,o=0),60==n&&(r++,n=0),s=0==o?n:n+o/60,(-1==e?"-":"")+r+"° "+s+"’"}}}),i("util/Logger",[],function(){"use strict";var t={LEVEL_NONE:0,LEVEL_SEVERE:1,LEVEL_WARNING:2,LEVEL_INFO:3,setLoggingLevel:function(t){e=t},getLoggingLevel:function(){return e},log:function(i,r){r&&i>0&&i<=e&&(i===t.LEVEL_SEVERE?console.error(r):i===t.LEVEL_WARNING?console.warn(r):i===t.LEVEL_INFO?console.info(r):console.log(r))},makeMessage:function(t,e,i){return t+"."+e+": "+(this.messageTable[i]?this.messageTable[i]:i)},logMessage:function(t,e,i,r){var n=this.makeMessage(e,i,r);return this.log(t,n),n},messageTable:{abstractInvocation:"The function called is abstract and must be overridden in a subclass.",indexOutOfRange:"The specified index is out of range.",invalidHeight:"The specified height is zero or negative.",invalidWidth:"The specified width is zero or negative.",invalidSize:"The specified size is zero or negative.",missingAltitudeMode:"The specified altitude mode is null or undefined.",missingAttributeName:"The specified DBase attribute file name is null or undefined.",missingArray:"The specified array is null, undefined or of insufficient length.",missingBoundaries:"The specified boundaries array is null or undefined.",missingBuffer:"The specified buffer descriptor is null or undefined.",missingColor:"The specified color is null or undefined.",missingDc:"The specified draw context is null or undefined.",missingDomElement:"The specified DOM element is null or undefined.",missingEntry:"The specified entry is null or undefined.",missingFont:"The specified font is null or undefined.",missingFrustum:"The specified frustum is null or undefined.",missingFunction:"The specified function is null or undefined.",missingGlContext:"The specified WebGL rendering context is null or undefined.",missingGlobe:"The specified globe is null or undefined.",missingImage:"The specified image is null or undefined.",missingIndices:"The specified indices array is null or undefined.",missingKey:"The specified key is null or undefined.",missingLevel:"The specified level is null or undefined.",missingLine:"The specified line is null or undefined.",missingList:"The specified list is null or undefined.",missingListener:"The specified listener is null or undefined",missingLocation:"The specified location is null or undefined.",missingMatrix:"The specified matrix is null or undefined.",missingNavigatorState:"The specified navigator state is null or undefined.",missingOffset:"The specified offset is null or undefined.",missingPath:"The specified path is null or undefined.",missingPlacename:"The specified place name is null or undefined.",missingPlane:"The specified plane is null or undefined.",missingPoint:"The specified point is null or undefined.",missingPoints:"The specified points array is null or undefined.",missingPosition:"The specified position is null or undefined.",missingPositions:"The specified positions array is null or undefined.",missingProgram:"The specified program is null or undefined.",missingProjection:"The specified projection is null or undefined.",missingRectangle:"The specified rectangle is null or undefined.",missingRenderable:"The specified renderable is null or undefined.",missingResource:"The specified resource is null or undefined.",missingResult:"The specified result variable is null or undefined.",missingResults:"The specified results array is null or undefined.",missingSector:"The specified sector is null or undefined.",missingShapeType:"The specified shape type is null or undefined.",missingSize:"The specified size is null or undefined.",missingText:"The specified text is null or undefined.",missingTexture:"The specified texture is null or undefined.",missingTile:"The specified tile is null or undefined.",missingType:"The specified type is null or undefined.",missingUrl:"The specified URL is null or undefined",missingVector:"The specified vector is null or undefined.",missingVertex:"The specified vertex is null or undefined.",missingViewport:"The specified viewport is null or undefined.",missingWorldWindow:"The specified WorldWindow is null or undefined.",notYetImplemented:"This function is not yet implemented"}},e=1;return t}),i("util/Color",["../util/Logger"],function(t){"use strict";var e=function(t,e,i,r){this.red=t,this.green=e,this.blue=i,this.alpha=r};return e.WHITE=new e(1,1,1,1),e.BLACK=new e(0,0,0,1),e.RED=new e(1,0,0,1),e.GREEN=new e(0,1,0,1),e.BLUE=new e(0,0,1,1),e.CYAN=new e(0,1,1,1),e.YELLOW=new e(1,1,0,1),e.MAGENTA=new e(1,0,1,1),e.LIGHT_GRAY=new e(.75,.75,.75,1),e.MEDIUM_GRAY=new e(.5,.5,.5,1),e.DARK_GRAY=new e(.25,.25,.25,1),e.TRANSPARENT=new e(0,0,0,0),e.prototype.set=function(t,e,i,r){return this.red=t,this.green=e,this.blue=i,this.alpha=r,this},e.prototype.copy=function(e){if(!e)throw new ArgumentError(t.logMessage(t.LEVEL_SEVERE,"Color","copy","missingColor"));return this.red=e.red,this.green=e.green,this.blue=e.blue,this.alpha=e.alpha,this},e.prototype.clone=function(){return new e(this.red,this.green,this.blue,this.alpha)},e.prototype.premultipliedComponents=function(t){var e=this.alpha;return t[0]=this.red*e,t[1]=this.green*e,t[2]=this.blue*e,t[3]=e,t},e.colorFromByteArray=function(t){return new e(t[0]/255,t[1]/255,t[2]/255,t[3]/255)},e.colorFromBytes=function(t,i,r,n){return new e(t/255,i/255,r/255,n/255)},e.colorFromHex=function(t){var i=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(t.substring(6,8),16);return e.colorFromBytes(i,r,n,o)},e.colorFromKmlHex=function(t){var i=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(t.substring(6,8),16);return e.colorFromBytes(o,n,r,i)},e.prototype.nextColor=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue);return t<255?this.red=(t+1)/255:e<255?(this.red=0,this.green=(e+1)/255):i<255?(this.red=0,this.green=0,this.blue=(i+1)/255):(this.red=1/255,this.green=0,this.blue=0),this},e.prototype.equals=function(t){var e=Math.round(255*this.red),i=Math.round(255*this.green),r=Math.round(255*this.blue),n=Math.round(255*this.alpha),o=Math.round(255*t.red),s=Math.round(255*t.green),a=Math.round(255*t.blue),l=Math.round(255*t.alpha);return e===o&&i===s&&r===a&&n===l},e.prototype.equalsBytes=function(t){var e=Math.round(255*this.red),i=Math.round(255*this.green),r=Math.round(255*this.blue),n=Math.round(255*this.alpha);return e===t[0]&&i===t[1]&&r===t[2]&&n===t[3]},e.prototype.toByteString=function(){return"("+Math.round(255*this.red)+","+Math.round(255*this.green)+","+Math.round(255*this.blue)+","+Math.round(255*this.alpha)+")"},e.prototype.toHexString=function(t){var e=Math.ceil(255*this.red).toString(16),i=Math.ceil(255*this.green).toString(16),r=Math.ceil(255*this.blue).toString(16),n=Math.ceil(255*this.alpha).toString(16),o="#";return o+=e.length<2?"0"+e:e,o+=i.length<2?"0"+i:i,o+=r.length<2?"0"+r:r,t&&(o+=n.length<2?"0"+n:n),o},e.prototype.toRGBAString=function(){return"rgba("+Math.floor(255*this.red)+" ,"+Math.floor(255*this.green)+" ,"+Math.floor(255*this.blue)+" ,"+this.alpha+")"},e}),i("error/ArgumentError",["../error/AbstractError"],function(t){"use strict";var e=function(e){t.call(this,"ArgumentError",e);var i;try{throw new Error}catch(t){i=t.stack}this.stack=i};return e.prototype=Object.create(t.prototype),e}),i("util/Font",["../error/ArgumentError","../util/Color","../util/Logger"],function(t,e,i){"use strict";var r=function(e,r,n,o,s,a){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Font","constructor","missingSize"));if(e<=0)throw new t(i.logMessage(i.LEVEL_SEVERE,"Font","constructor","invalidSize"));this._size=e,this.style=r||"normal",this.variant=n||"normal",this.weight=o||"normal",this.family=s||"sans-serif",this.horizontalAlignment=a||"center"};return Object.defineProperties(r.prototype,{size:{get:function(){return this._size},set:function(t){this._fontString=null,this._size=t}},style:{get:function(){return this._style},set:function(t){this._fontString=null,this._style=t}},variant:{get:function(){return this._variant},set:function(t){this._fontString=null,this._variant=t}},weight:{get:function(){return this._weight},set:function(t){this._fontString=null,this._weight=t}},family:{get:function(){return this._family},set:function(t){this._fontString=null,this._family=t}},horizontalAlignment:{get:function(){return this._horizontalAlignment},set:function(t){this._toString=null,this._horizontalAlignment=t}},fontString:{get:function(){return this._fontString||(this._fontString=this._style+" "+this.variant+" "+this._weight+" "+this._size.toString()+"px "+this._family),this._fontString}}}),r.prototype.toString=function(){return this._toString&&this._fontString||(this._toString=this.fontString+" "+this.horizontalAlignment),this._toString},r}),i("util/Insets",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i,r,n,o){if(4!==arguments.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"Insets","constructor","invalidArgumentCount"));this._top=i,this._left=r,this._bottom=n,this._right=o};return i.prototype.set=function(t,e,i,r){this._top=t,this._left=e,this._bottom=i,this._right=r},i.prototype.clone=function(){return new i(this._top,this._left,this._bottom,this._right)},i.prototype.toString=function(){return this._top+" "+this._left+" "+this._bottom+" "+this._right},Object.defineProperties(i.prototype,{top:{get:function(){return this._top},set:function(t){this._top=t}},left:{get:function(){return this._left},set:function(t){this._left=t}},bottom:{get:function(){return this._bottom},set:function(t){this._bottom=t}},right:{get:function(){return this._right},set:function(t){this._right=t}}}),i}),i("geom/Vec3",["../util/Logger","../error/ArgumentError"],function(t,e){"use strict";var i=function(t,e,i){this[0]=t,this[1]=e,this[2]=i};return i.prototype=new Float64Array(3),i.ZERO=new i(0,0,0),i.average=function(i,r){if(!i||i.length<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","average","missingArray"));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","average","missingResult"));var n,o=i.length;r[0]=0,r[1]=0,r[2]=0;for(var s=0,a=i.length;s.999},i.computeTriangleNormal=function(r,n,o){if(!r||!n||!o)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","areColinear","missingVector"));var s=(n[1]-r[1])*(o[2]-r[2])-(n[2]-r[2])*(o[1]-r[1]),a=(n[2]-r[2])*(o[0]-r[0])-(n[0]-r[0])*(o[2]-r[2]),l=(n[0]-r[0])*(o[1]-r[1])-(n[1]-r[1])*(o[0]-r[0]),h=s*s+a*a+l*l;return 0===h?new i(s,a,l):(h=Math.sqrt(h),new i(s/h,a/h,l/h))},i.findThreeIndependentVertices=function(t,e){var r=e&&e>0?e:3;if(!t||t.length<3*r)return null;for(var n=new i(t[0],t[1],t[2]),o=null,s=null,a=r;a0&&o>0?1:0},n.prototype.clip=function(n,o){if(!n||!o)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","clip","missingPoint"));if(n.equals(o))return null;var s,a,l,h=e.fromSegment(n,o),u=this.normal.dot(h.direction);return 0===u?(s=this.dot(h.origin),0===s?[n,o]:null):(a=-this.dot(h.origin)/u)<0||a>1?null:(l=h.pointAt(a,new r(0,0,0)),u>0?[l,o]:[n,l])},n}),i("geom/Rectangle",["../util/Logger"],function(t){"use strict";var e=function(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r};return e.prototype.set=function(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r},e.prototype.getMinX=function(){return this.x},e.prototype.getMinY=function(){return this.y},e.prototype.getMaxX=function(){return this.x+this.width},e.prototype.getMaxY=function(){return this.y+this.height},e.prototype.containsPoint=function(t){return t[0]>=this.x&&t[0]<=this.x+this.width&&t[1]>=this.y&&t[1]<=this.y+this.height},e.prototype.intersects=function(t){return!(t.x+t.widththis.x+this.width)&&(!(t.y+t.heightthis.y+this.height)))},e.prototype.intersectsRectangles=function(t){if(t)for(var e=0;ei?i:t},interpolate:function(t,e,i){return(1-t)*e+t*i},cbrt:function(t){return"function"==typeof Math.cbrt?Math.cbrt(t):Math.pow(t,1/3)},computeEllipsoidalGlobeIntersection:function(t,i,n,o){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeEllipsoidalGlobeIntersection","missingLine"));if(!o)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeEllipsoidalGlobeIntersection","missingResult"));var s,a=t.direction[0],l=t.direction[1],h=t.direction[2],u=t.origin[0],c=t.origin[1],d=t.origin[2],p=i/n,f=p*p,g=i*i,m=a*a+f*l*l+h*h,E=2*(u*a+f*c*l+d*h),y=u*u+f*c*c+d*d-g,_=E*E-4*m*y;return!(_<0)&&(s=(-E-Math.sqrt(_))/(2*m),o[0]=u+a*s,o[1]=c+l*s,o[2]=d+h*s,!0)},computeTriangleIntersection:function(t,i,n,o,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingLine"));if(!i||!n||!o)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingVertex"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingResult"));var a=t.direction[0],l=t.direction[1],h=t.direction[2],u=t.origin[0],c=t.origin[1],d=t.origin[2],p=n[0]-i[0],f=n[1]-i[1],g=n[2]-i[2],m=o[0]-i[0],E=o[1]-i[1],y=o[2]-i[2],_=l*y-h*E,v=h*m-a*y,S=a*E-l*m,b=p*_+f*v+g*S;if(b>-1e-5&&b<1e-5)return!1;var T=1/b,L=u-i[0],w=c-i[1],R=d-i[2],x=T*(L*_+w*v+R*S);if(x<-1e-5||x>1+1e-5)return!1;var M=w*g-R*f,C=R*p-L*g,A=L*f-w*p,P=T*(a*M+l*C+h*A);if(P<-1e-5||x+P>1+1e-5)return!1;var I=T*(m*M+E*C+y*A);return!(I<0)&&(s[0]=u+a*I,s[1]=c+l*I,s[2]=d+h*I,!0)},computeIndexedTrianglesIntersection:function(t,i,n,a){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingLine"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingPoints"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingIndices"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingResults"));for(var l=new o(0,0,0),h=new o(0,0,0),u=new o(0,0,0),c=new o(0,0,0),d=0,p=n.length;d0},computeTriStripIntersections:function(t,i,n,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingLine"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingPoints"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingIndices"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingResults"));var a,l,h,u,c,d,p,f,g,m,E,y,_,v,S,b,T,L,w,R,x,M,C,A,P,I,O,N,D,k,V=t.direction[0],F=t.direction[1],G=t.direction[2],W=t.origin[0],B=t.origin[1],U=t.origin[2];k=3*n[0],u=i[k++],c=i[k++],d=i[k],k=3*n[1],p=i[k++],f=i[k++],g=i[k];for(var K=2,j=n.length;K-1e-5&&N<1e-5||(D=1/N,w=W-a,R=B-l,x=U-h,(P=D*(w*b+R*T+x*L))<-1e-5||P>1+1e-5||(M=R*y-x*E,C=x*m-w*y,A=w*E-R*m,(I=D*(V*M+F*C+G*A))<-1e-5||P+I>1+1e-5||(O=D*(_*M+v*C+S*A))>=0&&s.push(new o(W+V*O,B+F*O,U+G*O))))},fabs:function(t){return t>=0?t:-t},fmod:function(t,e){return 0===e?0:t-Math.floor(t/e)*e},fract:function(t){return t-Math.floor(t)},mod:function(t,e){return(t%e+e)%e},max:function(t,e){return t>e?t:e},localCoordinateAxesAtPoint:function(t,i,n,o,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingVector"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingGlobe"));if(!n||!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingResult"));var a=t[0],l=t[1],h=t[2];i.surfaceNormalAtPoint(a,l,h,s),i.northTangentAtPoint(a,l,h,o),n.set(o[0],o[1],o[2]),n.cross(s),n.normalize(),o.set(s[0],s[1],s[2]),o.cross(n),o.normalize()},horizonDistanceForGlobeRadius:function(t,i){if(t<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","horizontalDistanceForGlobeRadius","The specified globe radius is negative."));return t>0&&i>0?Math.sqrt(i*(2*t+i)):0},perspectiveNearDistanceForFarDistance:function(t,i,n){if(t<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified distance is negative."));if(i<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified resolution is negative."));if(n<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified depth bits is negative."));var o=(1<0?1:t<0?-1:0},gudermannianInverse:function(e){return Math.log(Math.tan(Math.PI/4+e*t.DEGREES_TO_RADIANS/2))/Math.PI},epsg3857ToEpsg4326:function(e,i){var r=6378100,n=Math.PI/2-2*Math.atan(Math.exp(-i/r)),o=e/r;return[s.clamp(n*t.RADIANS_TO_DEGREES,-90,90),s.clamp(o*t.RADIANS_TO_DEGREES,-180,180)]},powerOfTwoFloor:function(t){var e=Math.floor(Math.log(t)/Math.log(2));return Math.pow(2,e)},normalizeAngle360:function(t){var e=t%360;return e>=0?e:e<0?360+e:360-e}};return s}),i("geom/Location",["../geom/Angle","../error/ArgumentError","../util/Logger","../geom/Plane","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t,e){this.latitude=t,this.longitude=e};return s.ZERO=new s(0,0),s.fromRadians=function(e,i){return new s(e*t.RADIANS_TO_DEGREES,i*t.RADIANS_TO_DEGREES)},s.prototype.copy=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","copy","missingLocation"));return this.latitude=t.latitude,this.longitude=t.longitude,this},s.prototype.set=function(t,e){return this.latitude=t,this.longitude=e,this},s.prototype.equals=function(t){return t&&t.latitude===this.latitude&&t.longitude===this.longitude},s.interpolateAlongPath=function(t,r,n,o,s){if(!n||!o)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateAlongPath","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateAlongPath","missingResult"));return t===WorldWind.GREAT_CIRCLE?this.interpolateGreatCircle(r,n,o,s):t&&t===WorldWind.RHUMB_LINE?this.interpolateRhumb(r,n,o,s):this.interpolateLinear(r,n,o,s)},s.interpolateGreatCircle=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateGreatCircle","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateGreatCircle","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.greatCircleAzimuth(r,n),h=this.greatCircleDistance(r,n);return this.greatCircleLocation(r,l,a*h,s)},s.greatCircleAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleAzimuth","missingLocation"));var o,s,a,l=r.latitude*t.DEGREES_TO_RADIANS,h=n.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n.longitude*t.DEGREES_TO_RADIANS;return l==h&&u==c?0:u==c?l>h?180:0:(s=Math.cos(h)*Math.sin(c-u),o=Math.cos(l)*Math.sin(h)-Math.sin(l)*Math.cos(h)*Math.cos(c-u),a=Math.atan2(s,o),isNaN(a)?0:a*t.RADIANS_TO_DEGREES)},s.greatCircleDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleDistance","missingLocation"));var o,s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(o=Math.sin((u-h)/2),s=Math.sin((d-c)/2),a=o*o+Math.cos(h)*Math.cos(u)*s*s,l=2*Math.asin(Math.sqrt(a)),isNaN(l)?0:l)},s.greatCircleLocation=function(r,n,o,s){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleLocation","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleLocation","missingResult"));if(0==o)return s.latitude=r.latitude,s.longitude=r.longitude,s;var a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n*t.DEGREES_TO_RADIANS;return a=Math.asin(Math.sin(h)*Math.cos(o)+Math.cos(h)*Math.sin(o)*Math.cos(c)),l=u+Math.atan2(Math.sin(o)*Math.sin(c),Math.cos(h)*Math.cos(o)-Math.sin(h)*Math.sin(o)*Math.cos(c)),isNaN(a)||isNaN(l)?(s.latitude=r.latitude,s.longitude=r.longitude):(s.latitude=t.normalizedDegreesLatitude(a*t.RADIANS_TO_DEGREES),s.longitude=t.normalizedDegreesLongitude(l*t.RADIANS_TO_DEGREES)),s},s.interpolateRhumb=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateRhumb","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateRhumb","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.rhumbAzimuth(r,n),h=this.rhumbDistance(r,n);return this.rhumbLocation(r,l,a*h,s)},s.rhumbAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbAzimuth","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=d-c,a=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(h/2+Math.PI/4)),o.fabs(s)>Math.PI&&(s=s>0?-(2*Math.PI-s):2*Math.PI+s),l=Math.atan2(s,a),isNaN(l)?0:l*t.RADIANS_TO_DEGREES)},s.rhumbDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbDistance","missingLocation"));var s,a,l,h,u,c=r.latitude*t.DEGREES_TO_RADIANS,d=n.latitude*t.DEGREES_TO_RADIANS,p=r.longitude*t.DEGREES_TO_RADIANS,f=n.longitude*t.DEGREES_TO_RADIANS;return c==d&&p==f?0:(s=d-c,a=f-p,l=Math.log(Math.tan(d/2+Math.PI/4)/Math.tan(c/2+Math.PI/4)),h=s/l,(isNaN(l)||isNaN(h))&&(h=Math.cos(c)),o.fabs(a)>Math.PI&&(a=a>0?-(2*Math.PI-a):2*Math.PI+a),u=Math.sqrt(s*s+h*h*a*a),isNaN(u)?0:u)},s.rhumbLocation=function(r,n,s,a){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbLocation","missingLocation"));if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbLocation","missingResult"));if(0==s)return a.latitude=r.latitude,a.longitude=r.longitude,a;var l,h,u=r.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n*t.DEGREES_TO_RADIANS,p=u+s*Math.cos(d),f=Math.log(Math.tan(p/2+Math.PI/4)/Math.tan(u/2+Math.PI/4)),g=(p-u)/f;return(isNaN(f)||isNaN(g)||!isFinite(g))&&(g=Math.cos(u)),l=s*Math.sin(d)/g,o.fabs(p)>Math.PI/2&&(p=p>0?Math.PI-p:-Math.PI-p),h=o.fmod(c+l+Math.PI,2*Math.PI)-Math.PI,isNaN(p)||isNaN(h)?(a.latitude=r.latitude,a.longitude=r.longitude):(a.latitude=t.normalizedDegreesLatitude(p*t.RADIANS_TO_DEGREES),a.longitude=t.normalizedDegreesLongitude(h*t.RADIANS_TO_DEGREES)),a},s.interpolateLinear=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateLinear","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateLinear","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.linearAzimuth(r,n),h=this.linearDistance(r,n);return this.linearLocation(r,l,a*h,s)},s.linearAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearAzimuth","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=d-c,a=u-h,o.fabs(s)>Math.PI&&(s=s>0?-(2*Math.PI-s):2*Math.PI+s),l=Math.atan2(s,a),isNaN(l)?0:l*t.RADIANS_TO_DEGREES)},s.linearDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearDistance","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=u-h,a=d-c,o.fabs(a)>Math.PI&&(a=a>0?-(2*Math.PI-a):2*Math.PI+a),l=Math.sqrt(s*s+a*a),isNaN(l)?0:l)},s.linearLocation=function(r,n,s,a){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearLocation","missingLocation"));if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearLocation","missingResult"));if(0==s)return a.latitude=r.latitude,a.longitude=r.longitude,a;var l,h=r.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n*t.DEGREES_TO_RADIANS,d=h+s*Math.cos(c);return o.fabs(d)>Math.PI/2&&(d=d>0?Math.PI-d:-Math.PI-d),l=o.fmod(u+s*Math.sin(c)+Math.PI,2*Math.PI)-Math.PI,isNaN(d)||isNaN(l)?(a.latitude=r.latitude,a.longitude=r.longitude):(a.latitude=t.normalizedDegreesLatitude(d*t.RADIANS_TO_DEGREES),a.longitude=t.normalizedDegreesLongitude(l*t.RADIANS_TO_DEGREES)),a},s.locationsCrossDateLine=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","locationsCrossDateline","missingLocation"));for(var r=null,n=0,s=t.length;n180&&l<360)return!0}r=a}return!1},s.greatCircleArcExtremeLocations=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleArcExtremeLocations","missingLocation"));for(var r=null,n=null,o=null,a=0,l=t.length;au[0].latitude)&&(r=u[0]),(null==n||n.latitude=l.latitude&&(c=l.latitude,h=l),d<=l.latitude&&(d=l.latitude,u=l);var f=s.greatCircleAzimuth(t,r),g=s.greatCircleDistance(t,r),m=s.greatCircleExtremeLocationsUsingAzimuth(t,f);for(n=0,a=m.length;n=0&&y<=g&&(c>=l.latitude&&(c=l.latitude,h=l),d<=l.latitude&&(d=l.latitude,u=l))}return[h,u]},s.greatCircleExtremeLocationsUsingAzimuth=function(r,n){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleArcExtremeLocationsUsingAzimuth","missingLocation"));var o=r.latitude,a=n*t.DEGREES_TO_RADIANS,l=-Math.tan(o)/Math.cos(a),h=Math.atan(l),u=h+Math.PI/2,c=h-Math.PI/2;return[s.greatCircleLocation(r,n,u,new s(0,0)),s.greatCircleLocation(r,n,c,new s(0,0))]},s.intersectionWithMeridian=function(t,e,i,o){var s=o.computePointFromLocation(t.latitude,t.longitude,new n(0,0,0)),a=o.computePointFromLocation(e.latitude,e.longitude,new n(0,0,0)),l=o.computePointFromLocation(90,i,new n(0,0,0)),h=o.computePointFromLocation(0,i,new n(0,0,0)),u=r.fromPoints(l,h,n.ZERO),c=new n(0,0,0);if(!u.intersectsSegmentAt(s,a,c))return null;var d=new WorldWind.Position(0,0,0);return o.computePositionFromPoint(c[0],c[1],c[2],d),d.latitude},s.meridianIntersection=function(t,e,i){var r=t.longitude<0?t.longitude+360:t.longitude,n=e.longitude<0?e.longitude+360:e.longitude;if(r===n)return null;var o=i<0?i+360:i,s=(e.latitude-t.latitude)/(n-r);return t.latitude+s*(o-r)},s.poles={NONE:0,NORTH:1,SOUTH:2},s}),i("geom/Position",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../util/WWMath"],function(t,e,i,r,n){"use strict";var o=function(t,e,i){this.latitude=t,this.longitude=e,this.altitude=i};return o.ZERO=new o(0,0,0),o.fromRadians=function(e,i,r){return new o(e*t.RADIANS_TO_DEGREES,i*t.RADIANS_TO_DEGREES,r)},o.prototype.copy=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","copy","missingPosition"));return this.latitude=t.latitude,this.longitude=t.longitude,this.altitude=t.altitude,this},o.prototype.equals=function(t){return t&&t.latitude===this.latitude&&t.longitude===this.longitude&&t.altitude===this.altitude},o.interpolateGreatCircle=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateGreatCircle","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateGreatCircle","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateGreatCircle(l,o,s,a),a},o.interpolateRhumb=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateRhumb","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateRhumb","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateRhumb(l,o,s,a),a},o.interpolateLinear=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateLinear","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateLinear","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateLinear(l,o,s,a),a},o.prototype.toString=function(){return"("+this.latitude.toString()+"°, "+this.longitude.toString()+"°, "+this.altitude.toString()+")"},o}),i("render/Texture",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Texture","constructor","missingGlContext"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"Texture","constructor","missingImage"));o||(o=r.CLAMP_TO_EDGE);var s=r.createTexture(),a=i.isPowerOfTwo(n.width)&&i.isPowerOfTwo(n.height);this.originalImageWidth=n.width,this.originalImageHeight=n.height,o!==r.REPEAT||a||(n=this.resizeImage(n),a=!0),this.imageWidth=n.width,this.imageHeight=n.height,this.size=n.width*n.height*4,r.bindTexture(r.TEXTURE_2D,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,a?r.LINEAR_MIPMAP_LINEAR:r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,o);var l=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");l&&r.texParameteri(r.TEXTURE_2D,l.TEXTURE_MAX_ANISOTROPY_EXT,4),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),a&&r.generateMipmap(r.TEXTURE_2D),this.textureId=s,this.creationTime=new Date};return r.prototype.dispose=function(t){t.deleteTexture(this.textureId),delete this.textureId},r.prototype.bind=function(t){return t.currentGlContext.bindTexture(t.currentGlContext.TEXTURE_2D,this.textureId),t.frameStatistics.incrementTextureLoadCount(1),!0},r.prototype.resizeImage=function(t){var e=document.createElement("canvas");return e.width=i.powerOfTwoFloor(t.width),e.height=i.powerOfTwoFloor(t.height),e.getContext("2d").drawImage(t,0,0,e.width,e.height),e},r}),i("geom/Matrix",["../geom/Angle","../error/ArgumentError","../util/Logger","../geom/Plane","../geom/Position","../geom/Rectangle","../render/Texture","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this[9]=h,this[10]=u,this[11]=c,this[12]=d,this[13]=p,this[14]=f,this[15]=g};return h.prototype=new Float64Array(16),h.fromIdentity=function(){return new h(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},h.principalAxesFromPoints=function(t,r,n,o){if(!t||t.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","principalAxesFromPoints","missingPoints"));if(!r||!n||!o)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","principalAxesFromPoints","An axis argument is null or undefined."));var s=h.fromIdentity();s.setToCovarianceOfPoints(t),s.eigensystemFromSymmetricMatrix(r,n,o),r.normalize(),n.normalize(),o.normalize()},h.prototype.set=function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){return this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this[9]=h,this[10]=u,this[11]=c,this[12]=d,this[13]=p,this[14]=f,this[15]=g,this},h.prototype.setToIdentity=function(){this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=1,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=1,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1},h.prototype.copy=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","copy","missingMatrix"));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]},h.prototype.equals=function(t){return t&&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]},h.prototype.columnMajorComponents=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","columnMajorComponents","missingResult"));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},h.prototype.setToTranslation=function(t,e,i){return this[0]=1,this[1]=0,this[2]=0,this[3]=t,this[4]=0,this[5]=1,this[6]=0,this[7]=e,this[8]=0,this[9]=0,this[10]=1,this[11]=i,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.setTranslation=function(t,e,i){return this[3]=t,this[7]=e,this[11]=i,this},h.prototype.setToScale=function(t,e,i){return this[0]=t,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=e,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=i,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.setScale=function(t,e,i){return this[0]=t,this[5]=e,this[10]=i,this},h.prototype.setToTransposeOfMatrix=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToTransposeOfMatrix","missingMatrix"));return this[0]=t[0],this[1]=t[4],this[2]=t[8],this[3]=t[12],this[4]=t[1],this[5]=t[5],this[6]=t[9],this[7]=t[13],this[8]=t[2],this[9]=t[6],this[10]=t[10],this[11]=t[14],this[12]=t[3],this[13]=t[7],this[14]=t[11],this[15]=t[15],this},h.prototype.setToMultiply=function(t,r){if(!t||!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToMultiply","missingMatrix"));var n=t,o=r;return this[0]=n[0]*o[0]+n[1]*o[4]+n[2]*o[8]+n[3]*o[12],this[1]=n[0]*o[1]+n[1]*o[5]+n[2]*o[9]+n[3]*o[13],this[2]=n[0]*o[2]+n[1]*o[6]+n[2]*o[10]+n[3]*o[14],this[3]=n[0]*o[3]+n[1]*o[7]+n[2]*o[11]+n[3]*o[15],this[4]=n[4]*o[0]+n[5]*o[4]+n[6]*o[8]+n[7]*o[12],this[5]=n[4]*o[1]+n[5]*o[5]+n[6]*o[9]+n[7]*o[13],this[6]=n[4]*o[2]+n[5]*o[6]+n[6]*o[10]+n[7]*o[14],this[7]=n[4]*o[3]+n[5]*o[7]+n[6]*o[11]+n[7]*o[15],this[8]=n[8]*o[0]+n[9]*o[4]+n[10]*o[8]+n[11]*o[12],this[9]=n[8]*o[1]+n[9]*o[5]+n[10]*o[9]+n[11]*o[13],this[10]=n[8]*o[2]+n[9]*o[6]+n[10]*o[10]+n[11]*o[14],this[11]=n[8]*o[3]+n[9]*o[7]+n[10]*o[11]+n[11]*o[15],this[12]=n[12]*o[0]+n[13]*o[4]+n[14]*o[8]+n[15]*o[12],this[13]=n[12]*o[1]+n[13]*o[5]+n[14]*o[9]+n[15]*o[13],this[14]=n[12]*o[2]+n[13]*o[6]+n[14]*o[10]+n[15]*o[14],this[15]=n[12]*o[3]+n[13]*o[7]+n[14]*o[11]+n[15]*o[15],this},h.prototype.setToCovarianceOfPoints=function(t){if(!t||t.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToCovarianceOfPoints","missingArray"));var r,n,o,s,l=0,h=0,u=0,c=0,d=0,p=0,f=0,g=new a(0,0,0);r=a.averageOfBuffer(t,new a(0,0,0));for(var m=0,E=t.length/3;m=0;r-=1){for(o=i[r],n=r+1;n<4;n+=1)o-=t[r][n]*i[n];i[r]=o/t[r][r]}},h.ludcmp=function(t,e){var i,r,n,o,s,a,l,h,u=[],c=1;for(r=0;r<4;r+=1){for(s=0,n=0;n<4;n+=1)(i=Math.abs(t[r][n]))>s&&(s=i);if(0==s)return 0;u[r]=1/s}for(n=0;n<4;n+=1){for(r=0;r=s&&(s=h,l=r)}if(n!=l){for(o=0;o<4;o+=1)h=t[l][o],t[l][o]=t[n][o],t[n][o]=h;c=-c,u[l]=u[n]}if(e[n]=l,0==t[n][n]&&(t[n][n]=1e-20),3!=n)for(h=1/t[n][n],r=n+1;r<4;r+=1)t[r][n]*=h}return c},h.prototype.invertOrthonormalMatrix=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","invertOrthonormalMatrix","missingMatrix"));var r=t;return this[0]=r[0],this[1]=r[4],this[2]=r[8],this[3]=0-r[0]*r[3]-r[4]*r[7]-r[8]*r[11],this[4]=r[1],this[5]=r[5],this[6]=r[9],this[7]=0-r[1]*r[3]-r[5]*r[7]-r[9]*r[11],this[8]=r[2],this[9]=r[6],this[10]=r[10],this[11]=0-r[2]*r[3]-r[6]*r[7]-r[10]*r[11],this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.eigensystemFromSymmetricMatrix=function(t,r,n){if(!t||!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","eigensystemFromSymmetricMatrix","missingResult"));if(this[1]!=this[4]||this[2]!=this[8]||this[6]!=this[9])throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","eigensystemFromSymmetricMatrix","Matrix is not symmetric"));for(var o,s,a,h,u,c,d,p,f,g,m,E=this[0],y=this[1],_=this[2],v=this[5],S=this[6],b=this[10],T=[[1,0,0],[0,1,0],[0,0,1]],L=0;L<32&&!(l.fabs(y)<1e-10&&l.fabs(_)<1e-10&&l.fabs(S)<1e-10);L++){if(0!=y)for(o=.5*(v-E)/y,s=o*o,a=s+1,h=a!=s?(o<0?-1:1)*(Math.sqrt(a)-l.fabs(o)):.5/o,u=1/Math.sqrt(h*h+1),c=u*h,E-=h*y,v+=h*y,y=0,d=u*_-c*S,S=c*_+u*S,_=d,p=0;p<3;p++)d=u*T[p][0]-c*T[p][1],T[p][1]=c*T[p][0]+u*T[p][1],T[p][0]=d;if(0!=_)for(o=.5*(b-E)/_,s=o*o,a=s+1,h=a!=s?(o<0?-1:1)*(Math.sqrt(a)-l.fabs(o)):.5/o,u=1/Math.sqrt(h*h+1),c=u*h,E-=h*_,b+=h*_,_=0,d=u*y-c*S,S=c*y+u*S,y=d,p=0;p<3;p++)d=u*T[p][0]-c*T[p][2],T[p][2]=c*T[p][0]+u*T[p][2],T[p][0]=d;if(0!=S)for(o=.5*(b-v)/S,s=o*o,a=s+1,h=a!=s?(o<0?-1:1)*(Math.sqrt(a)-l.fabs(o)):.5/o,u=1/Math.sqrt(h*h+1),c=u*h,v-=h*S,b+=h*S,S=0,d=u*y-c*_,_=c*y+u*_,y=d,p=0;p<3;p++)d=u*T[p][1]-c*T[p][2],T[p][2]=c*T[p][1]+u*T[p][2],T[p][1]=d}f=0,g=1,m=2,Es)for(var m=null,E=null,y=Math.ceil(g/s),_=1;_1&&(i=1),Math.acos(i)}}}),i("geom/Sector",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t,e,i,r){this.minLatitude=t,this.maxLatitude=e,this.minLongitude=i,this.maxLongitude=r};return s.ZERO=new s(0,0,0,0),s.FULL_SPHERE=new s(-90,90,-180,180),s.prototype.copy=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","copy","missingSector"));return this.minLatitude=t.minLatitude,this.maxLatitude=t.maxLatitude,this.minLongitude=t.minLongitude,this.maxLongitude=t.maxLongitude,this},s.prototype.isEmpty=function(){return this.minLatitude===this.maxLatitude&&this.minLongitude===this.maxLongitude},s.prototype.deltaLatitude=function(){return this.maxLatitude-this.minLatitude},s.prototype.deltaLongitude=function(){return this.maxLongitude-this.minLongitude},s.prototype.centroidLatitude=function(){return.5*(this.minLatitude+this.maxLatitude)},s.prototype.centroidLongitude=function(){return.5*(this.minLongitude+this.maxLongitude)},s.prototype.centroid=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","centroid","missingResult"));return t.latitude=this.centroidLatitude(),t.longitude=this.centroidLongitude(),t},s.prototype.minLatitudeRadians=function(){return this.minLatitude*t.DEGREES_TO_RADIANS},s.prototype.maxLatitudeRadians=function(){return this.maxLatitude*t.DEGREES_TO_RADIANS},s.prototype.minLongitudeRadians=function(){return this.minLongitude*t.DEGREES_TO_RADIANS},s.prototype.maxLongitudeRadians=function(){return this.maxLongitude*t.DEGREES_TO_RADIANS},s.prototype.setToBoundingSector=function(t){if(!t||t.length<2)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","setToBoundingSector","missingArray"));for(var i=90,n=-90,o=180,s=-180,a=0,l=t.length;aa&&(a=p);var f=d.longitude;if(f>=0&&fl&&(l=f),null!=h){var g=h.longitude;o.signum(f)!=o.signum(g)&&Math.abs(f-g)<180&&(l=0,n=0)}h=d}return i===a&&n===l?null:[new s(i,a,n,180),new s(i,a,-180,l)]},s.prototype.intersects=function(t){return t&&this.minLongitude<=t.maxLongitude&&this.maxLongitude>=t.minLongitude&&this.minLatitude<=t.maxLatitude&&this.maxLatitude>=t.minLatitude},s.prototype.overlaps=function(t){return t&&this.minLongitudet.minLongitude&&this.minLatitudet.minLatitude},s.prototype.contains=function(t){return t&&this.minLatitude<=t.minLatitude&&this.maxLatitude>=t.maxLatitude&&this.minLongitude<=t.minLongitude&&this.maxLongitude>=t.maxLongitude},s.prototype.containsLocation=function(t,e){return this.minLatitude<=t&&this.maxLatitude>=t&&this.minLongitude<=e&&this.maxLongitude>=e},s.prototype.intersection=function(t){if(!t instanceof s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","intersection","missingSector"));return this.minLatitudet.maxLatitude&&(this.maxLatitude=t.maxLatitude),this.minLongitudet.maxLongitude&&(this.maxLongitude=t.maxLongitude),this.maxLatitude0?(h.push(t.computePointFromPosition(this.minLatitude,d.longitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(this.maxLatitude,d.longitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(0,this.minLongitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(0,this.maxLongitude,l,new n(0,0,0)))):this.minLatitude<0?h.push(t.computePointFromPosition(this.maxLatitude,d.longitude,l,new n(0,0,0))):h.push(t.computePointFromPosition(this.minLatitude,d.longitude,l,new n(0,0,0))),this.deltaLongitude()>=360){var p=this.minLatitude;h.push(t.computePointFromPosition(p,0,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,90,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,-90,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,180,l,new n(0,0,0)));var f=this.maxLatitude;h.push(t.computePointFromPosition(f,0,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,90,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,-90,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,180,l,new n(0,0,0)))}else if(this.deltaLongitude()>180){var g=d.longitude,m=d.latitude,E=(this.minLongitude+g)/2;h.push(t.computePointFromPosition(m,E,l,new n(0,0,0))),E=(g+this.maxLongitude)/2,h.push(t.computePointFromPosition(m,E,l,new n(0,0,0))),h.push(t.computePointFromPosition(m,this.minLongitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(m,this.maxLongitude,l,new n(0,0,0)))}return h},s.prototype.union=function(t){if(!t instanceof s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","union","missingSector"));return this.minLatitude>t.minLatitude&&(this.minLatitude=t.minLatitude),this.maxLatitudet.minLongitude&&(this.minLongitude=t.minLongitude),this.maxLongitude0?r0?(e.t-i.t)*r+(e.t-t.t)*n:0},r.geom.transLeq=function(t,e){return t.t0?r0?(e.s-i.s)*r+(e.s-t.s)*n:0},r.geom.edgeGoesLeft=function(t){return r.geom.vertLeq(t.dst(),t.org)},r.geom.edgeGoesRight=function(t){return r.geom.vertLeq(t.org,t.dst())},r.geom.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},r.geom.vertCCW=function(t,e,i){return t.s*(e.t-i.t)+e.s*(i.t-t.t)+i.s*(t.t-e.t)>=0},r.geom.interpolate_=function(t,e,i,r){return t=t<0?0:t,i=i<0?0:i,t<=i?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)},r.geom.edgeIntersect=function(t,e,i,n,o){var s,a,l;r.geom.vertLeq(t,e)||(l=t,t=e,e=l),r.geom.vertLeq(i,n)||(l=i,i=n,n=l),r.geom.vertLeq(t,i)||(l=t,t=i,i=l,l=e,e=n,n=l),r.geom.vertLeq(i,e)?r.geom.vertLeq(e,n)?(s=r.geom.edgeEval(t,i,e),a=r.geom.edgeEval(i,e,n),s+a<0&&(s=-s,a=-a),o.s=r.geom.interpolate_(s,i.s,a,e.s)):(s=r.geom.edgeSign(t,i,e),a=-r.geom.edgeSign(t,n,e),s+a<0&&(s=-s,a=-a),o.s=r.geom.interpolate_(s,i.s,a,n.s)):o.s=(i.s+e.s)/2,r.geom.transLeq(t,e)||(l=t,t=e,e=l),r.geom.transLeq(i,n)||(l=i,i=n,n=l),r.geom.transLeq(t,i)||(l=t,t=i,i=l,l=e,e=n,n=l),r.geom.transLeq(i,e)?r.geom.transLeq(e,n)?(s=r.geom.transEval(t,i,e),a=r.geom.transEval(i,e,n),s+a<0&&(s=-s,a=-a),o.t=r.geom.interpolate_(s,i.t,a,e.t)):(s=r.geom.transSign(t,i,e),a=-r.geom.transSign(t,n,e),s+a<0&&(s=-s,a=-a),o.t=r.geom.interpolate_(s,i.t,a,n.t)):o.t=(i.t+e.t)/2},r.mesh={},r.mesh.makeEdge=function(t){var e=r.mesh.makeEdgePair_(t.eHead);return r.mesh.makeVertex_(e,t.vHead),r.mesh.makeVertex_(e.sym,t.vHead),r.mesh.makeFace_(e,t.fHead),e},r.mesh.meshSplice=function(t,e){var i=!1,n=!1;t!==e&&(e.org!==t.org&&(n=!0,r.mesh.killVertex_(e.org,t.org)),e.lFace!==t.lFace&&(i=!0,r.mesh.killFace_(e.lFace,t.lFace)),r.mesh.splice_(e,t),n||(r.mesh.makeVertex_(e,t.org),t.org.anEdge=t),i||(r.mesh.makeFace_(e,t.lFace),t.lFace.anEdge=t))},r.mesh.deleteEdge=function(t){var e=t.sym,i=!1;t.lFace!==t.rFace()&&(i=!0,r.mesh.killFace_(t.lFace,t.rFace())),t.oNext===t?r.mesh.killVertex_(t.org,null):(t.rFace().anEdge=t.oPrev(),t.org.anEdge=t.oNext,r.mesh.splice_(t,t.oPrev()),i||r.mesh.makeFace_(t,t.lFace)),e.oNext===e?(r.mesh.killVertex_(e.org,null),r.mesh.killFace_(e.lFace,null)):(t.lFace.anEdge=e.oPrev(),e.org.anEdge=e.oNext,r.mesh.splice_(e,e.oPrev())),r.mesh.killEdge_(t)},r.mesh.addEdgeVertex=function(t){var e=r.mesh.makeEdgePair_(t),i=e.sym;return r.mesh.splice_(e,t.lNext),e.org=t.dst(),r.mesh.makeVertex_(i,e.org),e.lFace=i.lFace=t.lFace,e},r.mesh.splitEdge=function(t){var e=r.mesh.addEdgeVertex(t),i=e.sym;return r.mesh.splice_(t.sym,t.sym.oPrev()),r.mesh.splice_(t.sym,i),t.sym.org=i.org,i.dst().anEdge=i.sym,i.sym.lFace=t.rFace(),i.winding=t.winding,i.sym.winding=t.sym.winding,i},r.mesh.connect=function(t,e){var i=!1,n=r.mesh.makeEdgePair_(t),o=n.sym;return e.lFace!==t.lFace&&(i=!0,r.mesh.killFace_(e.lFace,t.lFace)),r.mesh.splice_(n,t.lNext),r.mesh.splice_(o,e),n.org=t.dst(),o.org=e.org,n.lFace=o.lFace=t.lFace,t.lFace.anEdge=o,i||r.mesh.makeFace_(n,t.lFace),n},r.mesh.zapFace=function(t){var e,i=t.anEdge,n=i.lNext;do{if(e=n,n=e.lNext,e.lFace=null,null===e.rFace()){e.oNext===e?r.mesh.killVertex_(e.org,null):(e.org.anEdge=e.oNext,r.mesh.splice_(e,e.oPrev()));var o=e.sym;o.oNext===o?r.mesh.killVertex_(o.org,null):(o.org.anEdge=o.oNext,r.mesh.splice_(o,o.oPrev())),r.mesh.killEdge_(e)}}while(e!==i);var s=t.prev,a=t.next;a.prev=s,s.next=a},r.mesh.meshUnion=function(t,e){var i=t.fHead,r=t.vHead,n=t.eHead,o=e.fHead,s=e.vHead,a=e.eHead;return o.next!==o&&(i.prev.next=o.next,o.next.prev=i.prev,o.prev.next=i,i.prev=o.prev),s.next!==s&&(r.prev.next=s.next,s.next.prev=r.prev,s.prev.next=r,r.prev=s.prev),a.next!==a&&(n.sym.next.sym.next=a.next,a.next.sym.next=n.sym.next,a.sym.next.sym.next=n,n.sym.next=a.sym.next),t},r.mesh.deleteMesh=function(t){},r.mesh.makeEdgePair_=function(t){var e=new r.GluHalfEdge,i=new r.GluHalfEdge,n=t.sym.next;return i.next=n,n.sym.next=e,e.next=t,t.sym.next=i,e.sym=i,e.oNext=e,e.lNext=i,i.sym=e,i.oNext=i,i.lNext=e,e},r.mesh.splice_=function(t,e){var i=t.oNext,r=e.oNext;i.sym.lNext=e,r.sym.lNext=t,t.oNext=r,e.oNext=i},r.mesh.makeVertex_=function(t,e){var i=e.prev,n=new r.GluVertex(e,i);i.next=n,e.prev=n,n.anEdge=t;var o=t;do{o.org=n,o=o.oNext}while(o!==t)},r.mesh.makeFace_=function(t,e){var i=e.prev,n=new r.GluFace(e,i);i.next=n,e.prev=n,n.anEdge=t,n.inside=e.inside;var o=t;do{o.lFace=n,o=o.lNext}while(o!==t)},r.mesh.killEdge_=function(t){var e=t.next,i=t.sym.next;e.sym.next=i,i.sym.next=e},r.mesh.killVertex_=function(t,e){var i=t.anEdge,r=i;do{r.org=e,r=r.oNext}while(r!==i);var n=t.prev,o=t.next;o.prev=n,n.next=o},r.mesh.killFace_=function(t,e){ var i=t.anEdge,r=i;do{r.lFace=e,r=r.lNext}while(r!==i);var n=t.prev,o=t.next;o.prev=n,n.next=o},r.normal={},r.normal.S_UNIT_X_=1,r.normal.S_UNIT_Y_=0,r.normal.projectPolygon=function(t){var e=!1,i=[t.normal[0],t.normal[1],t.normal[2]];0===i[0]&&0===i[1]&&0===i[2]&&(r.normal.computeNormal_(t,i),e=!0);var n=t.sUnit,o=t.tUnit,s=r.normal.longAxis_(i);if(r.TRUE_PROJECT){r.normal.normalize_(i),n[s]=0,n[(s+1)%3]=r.normal.S_UNIT_X_,n[(s+2)%3]=r.normal.S_UNIT_Y_;var a=r.normal.dot_(n,i);n[0]-=a*i[0],n[1]-=a*i[1],n[2]-=a*i[2],r.normal.normalize_(n),o[0]=i[1]*n[2]-i[2]*n[1],o[1]=i[2]*n[0]-i[0]*n[2],o[2]=i[0]*n[1]-i[1]*n[0],r.normal.normalize_(o)}else n[s]=0,n[(s+1)%3]=r.normal.S_UNIT_X_,n[(s+2)%3]=r.normal.S_UNIT_Y_,o[s]=0,o[(s+1)%3]=i[s]>0?-r.normal.S_UNIT_Y_:r.normal.S_UNIT_Y_,o[(s+2)%3]=i[s]>0?r.normal.S_UNIT_X_:-r.normal.S_UNIT_X_;for(var l=t.mesh.vHead,h=l.next;h!==l;h=h.next)h.s=r.normal.dot_(h.coords,n),h.t=r.normal.dot_(h.coords,o);e&&r.normal.checkOrientation_(t)},r.normal.dot_=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},r.normal.normalize_=function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},r.normal.longAxis_=function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},r.normal.computeNormal_=function(t,e){var i,n=[-2*r.GLU_TESS_MAX_COORD,-2*r.GLU_TESS_MAX_COORD,-2*r.GLU_TESS_MAX_COORD],o=[2*r.GLU_TESS_MAX_COORD,2*r.GLU_TESS_MAX_COORD,2*r.GLU_TESS_MAX_COORD],s=[],a=[],l=t.mesh.vHead;for(i=l.next;i!==l;i=i.next)for(var h=0;h<3;++h){var u=i.coords[h];un[h]&&(n[h]=u,s[h]=i)}var c=0;if(n[1]-o[1]>n[0]-o[0]&&(c=1),n[2]-o[2]>n[c]-o[c]&&(c=2),o[c]>=n[c])return e[0]=0,e[1]=0,void(e[2]=1);var d=0,p=a[c],f=s[c],g=[0,0,0],m=[p.coords[0]-f.coords[0],p.coords[1]-f.coords[1],p.coords[2]-f.coords[2]],E=[0,0,0];for(i=l.next;i!==l;i=i.next){E[0]=i.coords[0]-f.coords[0],E[1]=i.coords[1]-f.coords[1],E[2]=i.coords[2]-f.coords[2],g[0]=m[1]*E[2]-m[2]*E[1],g[1]=m[2]*E[0]-m[0]*E[2],g[2]=m[0]*E[1]-m[1]*E[0];var y=g[0]*g[0]+g[1]*g[1]+g[2]*g[2];y>d&&(d=y,e[0]=g[0],e[1]=g[1],e[2]=g[2])}d<=0&&(e[0]=e[1]=e[2]=0,e[r.normal.longAxis_(m)]=1)},r.normal.checkOrientation_=function(t){for(var e=0,i=t.mesh.fHead,r=i.next;r!==i;r=r.next){var n=r.anEdge;if(!(n.winding<=0))do{e+=(n.org.s-n.dst().s)*(n.org.t+n.dst().t),n=n.lNext}while(n!==r.anEdge)}if(e<0){for(var o=t.mesh.vHead,s=o.next;s!==o;s=s.next)s.t=-s.t;t.tUnit[0]=-t.tUnit[0],t.tUnit[1]=-t.tUnit[1],t.tUnit[2]=-t.tUnit[2]}},r.render={},r.render.renderMesh=function(t,e,i){for(var n=!1,o=-1,s=e.fHead.prev;s!==e.fHead;s=s.prev)if(s.inside){n||(t.callBeginOrBeginData(r.primitiveType.GL_TRIANGLES),n=!0);var a=s.anEdge;do{if(i){var l=a.rFace().inside?0:1;o!==l&&(o=l,t.callEdgeFlagOrEdgeFlagData(!!o))}t.callVertexOrVertexData(a.org.data),a=a.lNext}while(a!==s.anEdge)}n&&t.callEndOrEndData()},r.render.renderBoundary=function(t,e){for(var i=e.fHead.next;i!==e.fHead;i=i.next)if(i.inside){t.callBeginOrBeginData(r.primitiveType.GL_LINE_LOOP);var n=i.anEdge;do{t.callVertexOrVertexData(n.org.data),n=n.lNext}while(n!==i.anEdge);t.callEndOrEndData()}},r.sweep={},r.sweep.SENTINEL_COORD_=4*r.GLU_TESS_MAX_COORD,r.sweep.TOLERANCE_NONZERO_=!1,r.sweep.computeInterior=function(t){t.fatalError=!1,r.sweep.removeDegenerateEdges_(t),r.sweep.initPriorityQ_(t),r.sweep.initEdgeDict_(t);for(var e;null!==(e=t.pq.extractMin());){for(;;){var i=t.pq.minimum();if(null===i||!r.geom.vertEq(i,e))break;i=t.pq.extractMin(),r.sweep.spliceMergeVertices_(t,e.anEdge,i.anEdge)}r.sweep.sweepEvent_(t,e)}var n=t.dict.getMin().getKey();t.event=n.eUp.org,r.sweep.doneEdgeDict_(t),r.sweep.donePriorityQ_(t),r.sweep.removeDegenerateFaces_(t.mesh),t.mesh.checkMesh()},r.sweep.addWinding_=function(t,e){t.winding+=e.winding,t.sym.winding+=e.sym.winding},r.sweep.edgeLeq_=function(t,e,i){var n=t.event,o=e.eUp,s=i.eUp;return o.dst()===n?s.dst()===n?r.geom.vertLeq(o.org,s.org)?r.geom.edgeSign(s.dst(),o.org,s.org)<=0:r.geom.edgeSign(o.dst(),s.org,o.org)>=0:r.geom.edgeSign(s.dst(),n,s.org)<=0:s.dst()===n?r.geom.edgeSign(o.dst(),n,o.org)>=0:r.geom.edgeEval(o.dst(),n,o.org)>=r.geom.edgeEval(s.dst(),n,s.org)},r.sweep.deleteRegion_=function(t,e){e.fixUpperEdge,e.eUp.activeRegion=null,t.dict.deleteNode(e.nodeUp),e.nodeUp=null},r.sweep.fixUpperEdge_=function(t,e){r.mesh.deleteEdge(t.eUp),t.fixUpperEdge=!1,t.eUp=e,e.activeRegion=t},r.sweep.topLeftRegion_=function(t){var e=t.eUp.org;do{t=t.regionAbove()}while(t.eUp.org===e);if(t.fixUpperEdge){var i=r.mesh.connect(t.regionBelow().eUp.sym,t.eUp.lNext);r.sweep.fixUpperEdge_(t,i),t=t.regionAbove()}return t},r.sweep.topRightRegion_=function(t){var e=t.eUp.dst();do{t=t.regionAbove()}while(t.eUp.dst()===e);return t},r.sweep.addRegionBelow_=function(t,e,i){var n=new r.ActiveRegion;return n.eUp=i,n.nodeUp=t.dict.insertBefore(e.nodeUp,n),i.activeRegion=n,n},r.sweep.isWindingInside_=function(t,e){switch(t.windingRule){case r.windingRule.GLU_TESS_WINDING_ODD:return 0!=(1&e);case r.windingRule.GLU_TESS_WINDING_NONZERO:return 0!==e;case r.windingRule.GLU_TESS_WINDING_POSITIVE:return e>0;case r.windingRule.GLU_TESS_WINDING_NEGATIVE:return e<0;case r.windingRule.GLU_TESS_WINDING_ABS_GEQ_TWO:return e>=2||e<=-2}return!1},r.sweep.computeWinding_=function(t,e){e.windingNumber=e.regionAbove().windingNumber+e.eUp.winding,e.inside=r.sweep.isWindingInside_(t,e.windingNumber)},r.sweep.finishRegion_=function(t,e){var i=e.eUp,n=i.lFace;n.inside=e.inside,n.anEdge=i,r.sweep.deleteRegion_(t,e)},r.sweep.finishLeftRegions_=function(t,e,i){for(var n=e,o=e.eUp;n!==i;){n.fixUpperEdge=!1;var s=n.regionBelow(),a=s.eUp;if(a.org!==o.org){if(!s.fixUpperEdge){r.sweep.finishRegion_(t,n);break}a=r.mesh.connect(o.lPrev(),a.sym),r.sweep.fixUpperEdge_(s,a)}o.oNext!==a&&(r.mesh.meshSplice(a.oPrev(),a),r.mesh.meshSplice(o,a)),r.sweep.finishRegion_(t,n),o=s.eUp,n=s}return o},r.sweep.addRightEdges_=function(t,e,i,n,o,s){var a=!0,l=i;do{r.sweep.addRegionBelow_(t,e,l.sym),l=l.oNext}while(l!==n);null===o&&(o=e.regionBelow().eUp.rPrev());for(var h,u=e,c=o;h=u.regionBelow(),l=h.eUp.sym,l.org===c.org;)l.oNext!==c&&(r.mesh.meshSplice(l.oPrev(),l),r.mesh.meshSplice(c.oPrev(),l)),h.windingNumber=u.windingNumber-l.winding,h.inside=r.sweep.isWindingInside_(t,h.windingNumber),u.dirty=!0,!a&&r.sweep.checkForRightSplice_(t,u)&&(r.sweep.addWinding_(l,c),r.sweep.deleteRegion_(t,u),r.mesh.deleteEdge(c)),a=!1,u=h,c=l;u.dirty=!0,s&&r.sweep.walkDirtyRegions_(t,u)},r.sweep.callCombine_=function(t,e,i,n,o){var s=[e.coords[0],e.coords[1],e.coords[2]];e.data=null,e.data=t.callCombineOrCombineData(s,i,n),null===e.data&&(o?t.fatalError||(t.callErrorOrErrorData(r.errorType.GLU_TESS_NEED_COMBINE_CALLBACK),t.fatalError=!0):e.data=i[0])},r.sweep.spliceMergeVertices_=function(t,e,i){var n=[null,null,null,null],o=[.5,.5,0,0];n[0]=e.org.data,n[1]=i.org.data,r.sweep.callCombine_(t,e.org,n,o,!1),r.mesh.meshSplice(e,i)},r.sweep.vertexWeights_=function(t,e,i,n,o){var s=r.geom.vertL1dist(e,t),a=r.geom.vertL1dist(i,t),l=o,h=o+1;n[l]=.5*a/(s+a),n[h]=.5*s/(s+a),t.coords[0]+=n[l]*e.coords[0]+n[h]*i.coords[0],t.coords[1]+=n[l]*e.coords[1]+n[h]*i.coords[1],t.coords[2]+=n[l]*e.coords[2]+n[h]*i.coords[2]},r.sweep.getIntersectData_=function(t,e,i,n,o,s){var a=[0,0,0,0],l=[i.data,n.data,o.data,s.data];e.coords[0]=e.coords[1]=e.coords[2]=0,r.sweep.vertexWeights_(e,i,n,a,0),r.sweep.vertexWeights_(e,o,s,a,2),r.sweep.callCombine_(t,e,l,a,!0)},r.sweep.checkForRightSplice_=function(t,e){var i=e.regionBelow(),n=e.eUp,o=i.eUp;if(r.geom.vertLeq(n.org,o.org)){if(r.geom.edgeSign(o.dst(),n.org,o.org)>0)return!1;r.geom.vertEq(n.org,o.org)?n.org!==o.org&&(t.pq.remove(n.org.pqHandle),r.sweep.spliceMergeVertices_(t,o.oPrev(),n)):(r.mesh.splitEdge(o.sym),r.mesh.meshSplice(n,o.oPrev()),e.dirty=i.dirty=!0)}else{if(r.geom.edgeSign(n.dst(),o.org,n.org)<0)return!1;e.regionAbove().dirty=e.dirty=!0,r.mesh.splitEdge(n.sym),r.mesh.meshSplice(o.oPrev(),n)}return!0},r.sweep.checkForLeftSplice_=function(t,e){var i,n=e.regionBelow(),o=e.eUp,s=n.eUp;if(r.geom.vertLeq(o.dst(),s.dst())){if(r.geom.edgeSign(o.dst(),s.dst(),o.org)<0)return!1;e.regionAbove().dirty=e.dirty=!0,i=r.mesh.splitEdge(o),r.mesh.meshSplice(s.sym,i),i.lFace.inside=e.inside}else{if(r.geom.edgeSign(s.dst(),o.dst(),s.org)>0)return!1;e.dirty=n.dirty=!0,i=r.mesh.splitEdge(s),r.mesh.meshSplice(o.lNext,s.sym),i.rFace().inside=e.inside}return!0},r.sweep.checkForIntersect_=function(t,e){var i=e.regionBelow(),n=e.eUp,o=i.eUp,s=n.org,a=o.org,l=n.dst(),h=o.dst(),u=new r.GluVertex;if(s===a)return!1;if(Math.min(s.t,l.t)>Math.max(a.t,h.t))return!1;if(r.geom.vertLeq(s,a)){if(r.geom.edgeSign(h,s,a)>0)return!1}else if(r.geom.edgeSign(l,a,s)<0)return!1;r.geom.edgeIntersect(l,s,h,a,u),r.geom.vertLeq(u,t.event)&&(u.s=t.event.s,u.t=t.event.t);var c=r.geom.vertLeq(s,a)?s:a;if(r.geom.vertLeq(c,u)&&(u.s=c.s,u.t=c.t),r.geom.vertEq(u,s)||r.geom.vertEq(u,a))return r.sweep.checkForRightSplice_(t,e),!1;if(!r.geom.vertEq(l,t.event)&&r.geom.edgeSign(l,t.event,u)>=0||!r.geom.vertEq(h,t.event)&&r.geom.edgeSign(h,t.event,u)<=0){if(h===t.event)return r.mesh.splitEdge(n.sym),r.mesh.meshSplice(o.sym,n),e=r.sweep.topLeftRegion_(e),n=e.regionBelow().eUp,r.sweep.finishLeftRegions_(t,e.regionBelow(),i),r.sweep.addRightEdges_(t,e,n.oPrev(),n,n,!0),!0;if(l===t.event){r.mesh.splitEdge(o.sym),r.mesh.meshSplice(n.lNext,o.oPrev()),i=e,e=r.sweep.topRightRegion_(e);var d=e.regionBelow().eUp.rPrev();return i.eUp=o.oPrev(),o=r.sweep.finishLeftRegions_(t,i,null),r.sweep.addRightEdges_(t,e,o.oNext,n.rPrev(),d,!0),!0}return r.geom.edgeSign(l,t.event,u)>=0&&(e.regionAbove().dirty=e.dirty=!0,r.mesh.splitEdge(n.sym),n.org.s=t.event.s,n.org.t=t.event.t),r.geom.edgeSign(h,t.event,u)<=0&&(e.dirty=i.dirty=!0,r.mesh.splitEdge(o.sym),o.org.s=t.event.s,o.org.t=t.event.t),!1}return r.mesh.splitEdge(n.sym),r.mesh.splitEdge(o.sym),r.mesh.meshSplice(o.oPrev(),n),n.org.s=u.s,n.org.t=u.t,n.org.pqHandle=t.pq.insert(n.org),r.sweep.getIntersectData_(t,n.org,s,l,a,h),e.regionAbove().dirty=e.dirty=i.dirty=!0,!1},r.sweep.walkDirtyRegions_=function(t,e){for(var i=e.regionBelow();;){for(;i.dirty;)e=i,i=i.regionBelow();if(!e.dirty&&(i=e,null===(e=e.regionAbove())||!e.dirty))return;e.dirty=!1;var n=e.eUp,o=i.eUp;if(n.dst()!==o.dst()&&r.sweep.checkForLeftSplice_(t,e)&&(i.fixUpperEdge?(r.sweep.deleteRegion_(t,i),r.mesh.deleteEdge(o),i=e.regionBelow(),o=i.eUp):e.fixUpperEdge&&(r.sweep.deleteRegion_(t,e),r.mesh.deleteEdge(n),e=i.regionAbove(),n=e.eUp)),n.org!==o.org)if(n.dst()===o.dst()||e.fixUpperEdge||i.fixUpperEdge||n.dst()!==t.event&&o.dst()!==t.event)r.sweep.checkForRightSplice_(t,e);else if(r.sweep.checkForIntersect_(t,e))return;n.org===o.org&&n.dst()===o.dst()&&(r.sweep.addWinding_(o,n),r.sweep.deleteRegion_(t,e),r.mesh.deleteEdge(n),e=i.regionAbove())}},r.sweep.connectRightVertex_=function(t,e,i){var n=i.oNext,o=e.regionBelow(),s=e.eUp,a=o.eUp,l=!1;if(s.dst()!==a.dst()&&r.sweep.checkForIntersect_(t,e),r.geom.vertEq(s.org,t.event)&&(r.mesh.meshSplice(n.oPrev(),s),e=r.sweep.topLeftRegion_(e),n=e.regionBelow().eUp,r.sweep.finishLeftRegions_(t,e.regionBelow(),o),l=!0),r.geom.vertEq(a.org,t.event)&&(r.mesh.meshSplice(i,a.oPrev()),i=r.sweep.finishLeftRegions_(t,o,null),l=!0),l)return void r.sweep.addRightEdges_(t,e,i.oNext,n,n,!0);var h;h=r.geom.vertLeq(a.org,s.org)?a.oPrev():s,h=r.mesh.connect(i.lPrev(),h),r.sweep.addRightEdges_(t,e,h,h.oNext,h.oNext,!1),h.sym.activeRegion.fixUpperEdge=!0,r.sweep.walkDirtyRegions_(t,e)},r.sweep.connectLeftDegenerate_=function(t,e,i){var n=e.eUp;if(r.geom.vertEq(n.org,i))return void(r.sweep.TOLERANCE_NONZERO_&&r.sweep.spliceMergeVertices_(t,n,i.anEdge));if(!r.geom.vertEq(n.dst(),i))return r.mesh.splitEdge(n.sym),e.fixUpperEdge&&(r.mesh.deleteEdge(n.oNext),e.fixUpperEdge=!1),r.mesh.meshSplice(i.anEdge,n),void r.sweep.sweepEvent_(t,i);if(r.sweep.TOLERANCE_NONZERO_){e=r.sweep.topRightRegion_(e);var o=e.regionBelow(),s=o.eUp.sym,a=s.oNext,l=a;o.fixUpperEdge&&(r.sweep.deleteRegion_(t,o),r.mesh.deleteEdge(s),s=a.oPrev()),r.mesh.meshSplice(i.anEdge,s),r.geom.edgeGoesLeft(a)||(a=null),r.sweep.addRightEdges_(t,e,s.oNext,l,a,!0)}},r.sweep.connectLeftVertex_=function(t,e){var i=new r.ActiveRegion;i.eUp=e.anEdge.sym;var n=t.dict.search(i).getKey(),o=n.regionBelow(),s=n.eUp,a=o.eUp;if(0===r.geom.edgeSign(s.dst(),e,s.org))return void r.sweep.connectLeftDegenerate_(t,n,e);var l,h=r.geom.vertLeq(a.dst(),s.dst())?n:o;if(n.inside||h.fixUpperEdge){if(h===n)l=r.mesh.connect(e.anEdge.sym,s.lNext);else{l=r.mesh.connect(a.dNext(),e.anEdge).sym}h.fixUpperEdge?r.sweep.fixUpperEdge_(h,l):r.sweep.computeWinding_(t,r.sweep.addRegionBelow_(t,n,l)),r.sweep.sweepEvent_(t,e)}else r.sweep.addRightEdges_(t,n,e.anEdge,e.anEdge,null,!0)},r.sweep.sweepEvent_=function(t,e){t.event=e;for(var i=e.anEdge;null===i.activeRegion;)if((i=i.oNext)===e.anEdge)return void r.sweep.connectLeftVertex_(t,e);var n=r.sweep.topLeftRegion_(i.activeRegion),o=n.regionBelow(),s=o.eUp,a=r.sweep.finishLeftRegions_(t,o,null);a.oNext===s?r.sweep.connectRightVertex_(t,n,a):r.sweep.addRightEdges_(t,n,a.oNext,s,s,!0)},r.sweep.addSentinel_=function(t,e){var i=new r.ActiveRegion,n=r.mesh.makeEdge(t.mesh);n.org.s=r.sweep.SENTINEL_COORD_,n.org.t=e,n.dst().s=-r.sweep.SENTINEL_COORD_,n.dst().t=e,t.event=n.dst(),i.eUp=n,i.windingNumber=0,i.inside=!1,i.fixUpperEdge=!1,i.sentinel=!0,i.dirty=!1,i.nodeUp=t.dict.insert(i)},r.sweep.initEdgeDict_=function(t){t.dict=new r.Dict(t,r.sweep.edgeLeq_),r.sweep.addSentinel_(t,-r.sweep.SENTINEL_COORD_),r.sweep.addSentinel_(t,r.sweep.SENTINEL_COORD_)},r.sweep.doneEdgeDict_=function(t){for(var e;null!==(e=t.dict.getMin().getKey());)e.sentinel,r.sweep.deleteRegion_(t,e);t.dict=null},r.sweep.removeDegenerateEdges_=function(t){for(var e,i=t.mesh.eHead,n=i.next;n!==i;n=e){e=n.next;var o=n.lNext;r.geom.vertEq(n.org,n.dst())&&n.lNext.lNext!==n&&(r.sweep.spliceMergeVertices_(t,o,n),r.mesh.deleteEdge(n),n=o,o=n.lNext),o.lNext===n&&(o!==n&&(o!==e&&o!==e.sym||(e=e.next),r.mesh.deleteEdge(o)),n!==e&&n!==e.sym||(e=e.next),r.mesh.deleteEdge(n))}},r.sweep.initPriorityQ_=function(t){var e=new r.PriorityQ(r.geom.vertLeq);t.pq=e;var i,n=t.mesh.vHead;for(i=n.next;i!==n;i=i.next)i.pqHandle=e.insert(i);e.init()},r.sweep.donePriorityQ_=function(t){t.pq.deleteQ(),t.pq=null},r.sweep.removeDegenerateFaces_=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e){e=i.next;var n=i.anEdge;n.lNext.lNext===n&&(r.sweep.addWinding_(n.oNext,n),r.mesh.deleteEdge(n))}},r.tessmono={},r.tessmono.tessellateMonoRegion_=function(t){for(var e=t.anEdge;r.geom.vertLeq(e.dst(),e.org);e=e.lPrev());for(;r.geom.vertLeq(e.org,e.dst());e=e.lNext);for(var i,n=e.lPrev();e.lNext!==n;)if(r.geom.vertLeq(e.dst(),n.org)){for(;n.lNext!==e&&(r.geom.edgeGoesLeft(n.lNext)||r.geom.edgeSign(n.org,n.dst(),n.lNext.dst())<=0);)i=r.mesh.connect(n.lNext,n),n=i.sym;n=n.lPrev()}else{for(;n.lNext!==e&&(r.geom.edgeGoesRight(e.lPrev())||r.geom.edgeSign(e.dst(),e.org,e.lPrev().org)>=0);)i=r.mesh.connect(e,e.lPrev()),e=i.sym;e=e.lNext}for(;n.lNext.lNext!==e;)i=r.mesh.connect(n.lNext,n),n=i.sym},r.tessmono.tessellateInterior=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e)e=i.next,i.inside&&r.tessmono.tessellateMonoRegion_(i)},r.tessmono.discardExterior=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e)e=i.next,i.inside||r.mesh.zapFace(i)},r.tessmono.setWindingNumber=function(t,e,i){for(var n,o=t.eHead.next;o!==t.eHead;o=n)n=o.next,o.rFace().inside!==o.lFace.inside?o.winding=o.lFace.inside?e:-e:i?r.mesh.deleteEdge(o):o.winding=0},r.Dict=function(t,e){this.head_=new r.DictNode,this.frame_=t,this.leq_=e},r.Dict.prototype.deleteDict_=function(){},r.Dict.prototype.insertBefore=function(t,e){do{t=t.prev}while(null!==t.key&&!this.leq_(this.frame_,t.key,e));var i=new r.DictNode(e,t.next,t);return t.next.prev=i,t.next=i,i},r.Dict.prototype.insert=function(t){return this.insertBefore(this.head_,t)},r.Dict.prototype.deleteNode=function(t){t.next.prev=t.prev,t.prev.next=t.next},r.Dict.prototype.search=function(t){var e=this.head_;do{e=e.next}while(null!==e.key&&!this.leq_(this.frame_,t,e.key));return e},r.Dict.prototype.getMin=function(){return this.head_.next},r.Dict.prototype.getMax=function(){return this.head_.prev},r.DictNode=function(t,e,i){this.key=t||null,this.next=e||this,this.prev=i||this},r.DictNode.prototype.getKey=function(){return this.key},r.DictNode.prototype.getSuccessor=function(){return this.next},r.DictNode.prototype.getPredecessor=function(){return this.prev},r.CachedVertex=function(){this.coords=[0,0,0],this.data=null},r.GluTesselator=function(){this.state=r.GluTesselator.tessState_.T_DORMANT,this.lastEdge_=null,this.mesh=null,this.callError_=null,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.relTolerance=r.GLU_TESS_DEFAULT_TOLERANCE,this.windingRule=r.windingRule.GLU_TESS_WINDING_ODD,this.fatalError=!1,this.dict=null,this.pq=null,this.event=null,this.callCombine_=null,this.boundaryOnly=!1,this.callBegin_=null,this.callEdgeFlag_=null,this.callVertex_=null,this.callEnd_=null,this.callMesh_=null,this.callBeginData_=null,this.callEdgeFlagData_=null,this.callVertexData_=null,this.callEndData_=null,this.callErrorData_=null,this.callCombineData_=null,this.polygonData_=null,this.emptyCache=!1,this.cacheCount=0,this.cache=new Array(r.TESS_MAX_CACHE);for(var t=0;t1)break;return void(this.relTolerance=e);case r.gluEnum.GLU_TESS_WINDING_RULE:var i=e;switch(i){case r.windingRule.GLU_TESS_WINDING_ODD:case r.windingRule.GLU_TESS_WINDING_NONZERO:case r.windingRule.GLU_TESS_WINDING_POSITIVE:case r.windingRule.GLU_TESS_WINDING_NEGATIVE:case r.windingRule.GLU_TESS_WINDING_ABS_GEQ_TWO:return void(this.windingRule=i)}break;case r.gluEnum.GLU_TESS_BOUNDARY_ONLY:return void(this.boundaryOnly=!!e);default:return void this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM)}this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_VALUE)},r.GluTesselator.prototype.gluGetTessProperty=function(t){switch(t){case r.gluEnum.GLU_TESS_TOLERANCE:return this.relTolerance;case r.gluEnum.GLU_TESS_WINDING_RULE:return this.windingRule;case r.gluEnum.GLU_TESS_BOUNDARY_ONLY:return this.boundaryOnly;default:this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM)}return!1},r.GluTesselator.prototype.gluTessNormal=function(t,e,i){this.normal[0]=t,this.normal[1]=e,this.normal[2]=i},r.GluTesselator.prototype.gluTessCallback=function(t,e){var i=e||null;switch(t){case r.gluEnum.GLU_TESS_BEGIN:return void(this.callBegin_=i);case r.gluEnum.GLU_TESS_BEGIN_DATA:return void(this.callBeginData_=i);case r.gluEnum.GLU_TESS_EDGE_FLAG:return void(this.callEdgeFlag_=i);case r.gluEnum.GLU_TESS_EDGE_FLAG_DATA:return void(this.callEdgeFlagData_=i);case r.gluEnum.GLU_TESS_VERTEX:return void(this.callVertex_=i);case r.gluEnum.GLU_TESS_VERTEX_DATA:return void(this.callVertexData_=i);case r.gluEnum.GLU_TESS_END:return void(this.callEnd_=i);case r.gluEnum.GLU_TESS_END_DATA:return void(this.callEndData_=i);case r.gluEnum.GLU_TESS_ERROR:return void(this.callError_=i);case r.gluEnum.GLU_TESS_ERROR_DATA:return void(this.callErrorData_=i);case r.gluEnum.GLU_TESS_COMBINE:return void(this.callCombine_=i);case r.gluEnum.GLU_TESS_COMBINE_DATA:return void(this.callCombineData_=i);case r.gluEnum.GLU_TESS_MESH:return void(this.callMesh_=i);default:return void this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM)}},r.GluTesselator.prototype.gluTessVertex=function(t,e){var i=!1,n=[0,0,0];this.requireState_(r.GluTesselator.tessState_.T_IN_CONTOUR),this.emptyCache&&(this.emptyCache_(),this.lastEdge_=null);for(var o=0;o<3;++o){var s=t[o];s<-r.GLU_TESS_MAX_COORD&&(s=-r.GLU_TESS_MAX_COORD,i=!0),s>r.GLU_TESS_MAX_COORD&&(s=r.GLU_TESS_MAX_COORD,i=!0),n[o]=s}if(i&&this.callErrorOrErrorData(r.errorType.GLU_TESS_COORD_TOO_LARGE),null===this.mesh){if(this.cacheCount0&&(this.emptyCache=!0)},r.GluTesselator.prototype.gluTessEndContour=function(){this.requireState_(r.GluTesselator.tessState_.T_IN_CONTOUR),this.state=r.GluTesselator.tessState_.T_IN_POLYGON},r.GluTesselator.prototype.gluTessEndPolygon=function(){if(this.requireState_(r.GluTesselator.tessState_.T_IN_POLYGON),this.state=r.GluTesselator.tessState_.T_DORMANT,null===this.mesh&&this.emptyCache_(),r.normal.projectPolygon(this),r.sweep.computeInterior(this),!this.fatalError){var t=this.mesh;if(this.boundaryOnly?r.tessmono.setWindingNumber(t,1,!0):r.tessmono.tessellateInterior(t),this.mesh.checkMesh(),this.callBegin_||this.callEnd_||this.callVertex_||this.callEdgeFlag_||this.callBeginData_||this.callEndData_||this.callVertexData_||this.callEdgeFlagData_)if(this.boundaryOnly)r.render.renderBoundary(this,this.mesh);else{var e=!(!this.callEdgeFlag_&&!this.callEdgeFlagData_);r.render.renderMesh(this,this.mesh,e)}if(this.callMesh_)return r.tessmono.discardExterior(this.mesh),this.callMesh_(this.mesh),this.mesh=null,void(this.polygonData_=null)}r.mesh.deleteMesh(this.mesh),this.polygonData_=null,this.mesh=null},r.GluTesselator.prototype.makeDormant_=function(){this.mesh&&r.mesh.deleteMesh(this.mesh),this.state=r.GluTesselator.tessState_.T_DORMANT,this.lastEdge_=null,this.mesh=null},r.GluTesselator.prototype.requireState_=function(t){this.state!==t&&this.gotoState_(t)},r.GluTesselator.prototype.gotoState_=function(t){for(;this.state!==t;)if(this.state=this.max_&&(this.max_*=2,this.keys_=r.PriorityQ.prototype.PQKeyRealloc_(this.keys_,this.max_)),this.keys_[e]=t,-(e+1)},r.PriorityQ.prototype.PQKeyRealloc_=function(t,e){var i=new Array(e),r=0;if(null!==t)for(;r0&&null===this.keys_[this.order_[this.size_-1]]);return t},r.PriorityQ.prototype.minimum=function(){if(0===this.size_)return this.heap_.minimum();var t=this.keys_[this.order_[this.size_-1]];if(!this.heap_.isEmpty()){var e=this.heap_.minimum();if(this.leq_(e,t))return e}return t},r.PriorityQ.prototype.isEmpty_=function(){return 0===this.size_&&this.heap_.isEmpty()},r.PriorityQ.prototype.remove=function(t){if(t>=0)return void this.heap_.remove(t);for(t=-(t+1),this.keys_[t]=null;this.size_>0&&null===this.keys_[this.order_[this.size_-1]];)--this.size_},r.PriorityQHeap=function(t){this.nodes_=r.PQNode.realloc(null,r.PriorityQHeap.INIT_SIZE_+1),this.handles_=r.PQHandleElem.realloc(null,r.PriorityQHeap.INIT_SIZE_+1),this.size_=0,this.max_=r.PriorityQHeap.INIT_SIZE_,this.freeList_=0,this.initialized_=!1,this.leq_=t,this.nodes_[1].handle=1},r.PriorityQHeap.INIT_SIZE_=32,r.PriorityQHeap.prototype.deleteHeap=function(){this.handles_=null,this.nodes_=null},r.PriorityQHeap.prototype.init=function(){for(var t=this.size_;t>=1;--t)this.floatDown_(t);this.initialized_=!0},r.PriorityQHeap.prototype.insert=function(t){var e=++this.size_;2*e>this.max_&&(this.max_*=2,this.nodes_=r.PQNode.realloc(this.nodes_,this.max_+1),this.handles_=r.PQHandleElem.realloc(this.handles_,this.max_+1));var i;return 0===this.freeList_?i=e:(i=this.freeList_,this.freeList_=this.handles_[i].node),this.nodes_[e].handle=i,this.handles_[i].node=e,this.handles_[i].key=t,this.initialized_&&this.floatUp_(e),i},r.PriorityQHeap.prototype.isEmpty=function(){return 0===this.size_},r.PriorityQHeap.prototype.minimum=function(){return this.handles_[this.nodes_[1].handle].key},r.PriorityQHeap.prototype.extractMin=function(){var t=this.nodes_,e=this.handles_,i=t[1].handle,r=e[i].key;return this.size_>0&&(t[1].handle=t[this.size_].handle,e[t[1].handle].node=1,e[i].key=null,e[i].node=this.freeList_,this.freeList_=i,--this.size_>0&&this.floatDown_(1)),r},r.PriorityQHeap.prototype.remove=function(t){var e=this.nodes_,i=this.handles_,r=i[t].node;e[r].handle=e[this.size_].handle,i[e[r].handle].node=r,r<=--this.size_&&(r<=1||this.leq_(i[e[r>>1].handle].key,i[e[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),i[t].key=null,i[t].node=this.freeList_,this.freeList_=t},r.PriorityQHeap.prototype.floatDown_=function(t){for(var e=this.nodes_,i=this.handles_,r=e[t].handle;;){var n=t<<1;nthis.size_||this.leq_(i[r].key,i[o].key)){e[t].handle=r,i[r].node=t;break}e[t].handle=o,i[o].node=t,t=n}},r.PriorityQHeap.prototype.floatUp_=function(t){for(var e=this.nodes_,i=this.handles_,r=e[t].handle;;){var n=t>>1,o=e[n].handle;if(0===n||this.leq_(i[o].key,i[r].key)){e[t].handle=r,i[r].node=t;break}e[t].handle=o,i[o].node=t,t=n}},r.ActiveRegion=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},r.ActiveRegion.prototype.regionBelow=function(){return this.nodeUp.getPredecessor().getKey()},r.ActiveRegion.prototype.regionAbove=function(){return this.nodeUp.getSuccessor().getKey()},"undefined"!=typeof module&&(module.exports=r),i("util/libtess",function(){}),i("util/measure/AreaMeasurer",["../../geom/Angle","../../error/ArgumentError","../../geom/Location","../Logger","./MeasurerUtils","../../geom/Sector","../../geom/Vec3","../libtess"],function(t,e,i,n,o,s,a,l){"use strict";var h=function(t){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"AreaMeasurer","constructor","missingWorldWindow"));this.wwd=t,this.DEFAULT_AREA_SAMPLING_STEPS=32,this._areaTerrainSamplingSteps=this.DEFAULT_AREA_SAMPLING_STEPS,this._maxSegmentLength=1e5,this.subdividedPositions=null,this.vecZ=new a(0,0,1),this.scratchLocation=new i(0,0)};return Object.defineProperties(h.prototype,{areaTerrainSamplingSteps:{get:function(){return this._areaTerrainSamplingSteps},set:function(t){this._areaTerrainSamplingSteps=t}},maxSegmentLength:{get:function(){return this._maxSegmentLength},set:function(t){this._maxSegmentLength=t}}}),h.prototype.getArea=function(t,e,i){var r=this.wwd.globe;return e?this.computeSurfaceAreaSampling(r,t,i):this.computeProjectedAreaGeometry(r,t,i)},h.prototype.computeSurfaceAreaSampling=function(e,i,r){var n=new s(0,0,0,0);n.setToBoundingSector(i), this.subdividedPositions=o.subdividePositions(e,i,!0,r,this._maxSegmentLength);for(var l=Math.max(this.DEFAULT_AREA_SAMPLING_STEPS,this._areaTerrainSamplingSteps),h=n.deltaLatitude()*t.DEGREES_TO_RADIANS,u=n.deltaLongitude()*t.DEGREES_TO_RADIANS,c=Math.max(h/l,u/l),d=Math.round(h/c),p=Math.round(u/c*Math.cos(n.centroidLatitude()*t.DEGREES_TO_RADIANS)),f=h/d,g=u/p,m=0,E=0;E=this.minActiveAltitude&&e.altitude<=this.maxActiveAltitude)},e.prototype.isLayerInView=function(t){return!0},e}),i("geom/Matrix3",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(t,e,i,r,n,o,s,a,l){this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l};return i.prototype=new Float64Array(9),i.fromIdentity=function(){return new i(1,0,0,0,1,0,0,0,1)},i.prototype.setToUnitYFlip=function(){return this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=-1,this[5]=1,this[6]=0,this[7]=0,this[8]=1,this},i.prototype.multiplyMatrix=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Matrix3","multiplyMatrix","missingMatrix"));var r,n,o,s=this,a=i;return r=s[0],n=s[1],o=s[2],s[0]=r*a[0]+n*a[3]+o*a[6],s[1]=r*a[1]+n*a[4]+o*a[7],s[2]=r*a[2]+n*a[5]+o*a[8],r=s[3],n=s[4],o=s[5],s[3]=r*a[0]+n*a[3]+o*a[6],s[4]=r*a[1]+n*a[4]+o*a[7],s[5]=r*a[2]+n*a[5]+o*a[8],r=s[6],n=s[7],o=s[8],s[6]=r*a[0]+n*a[3]+o*a[6],s[7]=r*a[1]+n*a[4]+o*a[7],s[8]=r*a[2]+n*a[5]+o*a[8],this},i.prototype.multiplyByTileTransform=function(t,e){var i=t.deltaLatitude(),r=t.deltaLongitude(),n=e.deltaLatitude(),o=e.deltaLongitude(),s=r/o,a=i/n,l=(t.minLongitude-e.minLongitude)/o,h=(t.minLatitude-e.minLatitude)/n,u=this;return u[2]+=u[0]*l+u[1]*h,u[5]+=u[3]*l+u[4]*h,u[8]+=u[6]*l+u[6]*h,u[0]*=s,u[1]*=a,u[3]*=s,u[4]*=a,u[6]*=s,u[7]*=a,this},i.prototype.columnMajorComponents=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Matrix3","columnMajorComponents","missingResult"));return i[0]=this[0],i[1]=this[3],i[2]=this[6],i[3]=this[1],i[4]=this[4],i[5]=this[7],i[6]=this[2],i[7]=this[5],i[8]=this[8],i},i}),i("shaders/SkyProgram",["../shaders/AtmosphereProgram"],function(t){"use strict";var e=function(e){t.call(this,e,"precision mediump int;\nconst int SAMPLE_COUNT = 2;\nconst float SAMPLES = 2.0;\nconst float PI = 3.141592653589;\nconst float Kr = 0.0025;\nconst float Kr4PI = Kr * 4.0 * PI;\nconst float Km = 0.0015;\nconst float Km4PI = Km * 4.0 * PI;\nconst float ESun = 15.0;\nconst float KmESun = Km * ESun;\nconst float KrESun = Kr * ESun;\nconst vec3 invWavelength = vec3(5.60204474633241, 9.473284437923038, 19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nuniform mat4 mvpMatrix;\nuniform vec3 vertexOrigin;\nuniform vec3 eyePoint;\nuniform float eyeMagnitude;\nuniform float eyeMagnitude2;\nuniform mediump vec3 lightDirection;\nuniform float atmosphereRadius;\nuniform float atmosphereRadius2;\nuniform float globeRadius;\nuniform float scale;\nuniform float scaleDepth;\nuniform float scaleOverScaleDepth;\nattribute vec4 vertexPoint;\nvarying vec3 primaryColor;\nvarying vec3 secondaryColor;\nvarying vec3 direction;\nfloat scaleFunc(float cos)\n{\n float x = 1.0 - cos;\n return scaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvoid sampleSky() {\n vec3 point = vertexPoint.xyz + vertexOrigin;\n vec3 ray = point - eyePoint;\n float far = length(ray);\n ray /= far;\n vec3 start;\n float startOffset;\n if (eyeMagnitude < atmosphereRadius) {\n start = eyePoint;\n float height = length(start);\n float depth = exp(scaleOverScaleDepth * (globeRadius - eyeMagnitude));\n float startAngle = dot(ray, start) / height;\n startOffset = depth*scaleFunc(startAngle);\n } else {\n float B = 2.0 * dot(eyePoint, ray);\n float C = eyeMagnitude2 - atmosphereRadius2;\n float det = max(0.0, B*B - 4.0 * C);\n float near = 0.5 * (-B - sqrt(det));\n start = eyePoint + ray * near;\n far -= near;\n float startAngle = dot(ray, start) / atmosphereRadius;\n float startDepth = exp(-1.0 / scaleDepth);\n startOffset = startDepth*scaleFunc(startAngle);\n }\n float sampleLength = far / SAMPLES;\n float scaledLength = sampleLength * scale;\n vec3 sampleRay = ray * sampleLength;\n vec3 samplePoint = start + sampleRay * 0.5;\n vec3 frontColor = vec3(0.0, 0.0, 0.0);\n for(int i=0; i=90&&h<270&&(p+=180),p=r.normalizeAngle360(p),{declination:d,rightAscension:p}},celestialToGeographic:function(n,o){if(!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","celestialToGeographic","missingCelestialLocation"));if(o instanceof Date==!1)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","celestialToGeographic","missingDate"));var s=this.computeJulianDate(o),a=s-2451545,l=r.normalizeAngle360(280.46061837+360.98564736629*a),h=r.normalizeAngle360(l-n.rightAscension),u=t.normalizedDegreesLongitude(-h);return{latitude:n.declination,longitude:u}},computeJulianDate:function(t){if(t instanceof Date==!1)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","computeJulianDate","missingDate"));var r=t.getUTCFullYear(),n=t.getUTCMonth()+1,o=t.getUTCDate(),s=t.getUTCHours(),a=t.getUTCMinutes(),l=t.getUTCSeconds(),h=(s+a/60+l/3600)/24;n<=2&&(r-=1,n+=12);var u=Math.floor(r/100),c=2-u+Math.floor(u/4);return Math.floor(365.25*(r+4716))+Math.floor(30.6001*(n+1))+o+c-1524.5+h}}}),i("util/WWUtil",["../error/ArgumentError","../geom/Line","../util/Logger","../geom/Rectangle","../geom/Vec3"],function(t,e,i,r,n){"use strict";var o={latLonRegex:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,suffixForMimeType:function(t){return"image/png"===t?"png":"image/jpeg"===t?"jpg":"application/bil16"===t?"bil":"application/bil32"===t?"bil":null},currentUrlSansFilePart:function(){for(var t=window.location.protocol,e=window.location.host,i=window.location.pathname,r=i.split("/"),n="",o=0,s=r.length;o0&&(n=n+"/"+r[o]);return t+"//"+e+n},worldwindlibLocation:function(){for(var t=document.getElementsByTagName("script"),e=0;e=0)return t[e].src.substring(0,i)+"/"}return null},urlPath:function(t){if(!t)return"";for(var e=t.split("/"),i="",r=0,n=e.length;rt.length)&&(i=t.length),i-=e.length;var r=t.lastIndexOf(e,i);return-1!==r&&r===i}};return o}),i("layer/AtmosphereLayer",["../error/ArgumentError","../shaders/GroundProgram","../layer/Layer","../util/Logger","../geom/Matrix","../geom/Matrix3","../geom/Sector","../shaders/SkyProgram","../util/SunPosition","../geom/Vec3","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(t){i.call(this,"Atmosphere"),this.pickEnabled=!1,this._nightImageSource=t||WorldWind.configuration.baseUrl+"images/dnb_land_ocean_ice_2012.png",this._activeLightDirection=new h(0,0,0),this._fullSphereSector=s.FULL_SPHERE,this._skyData={},this._skyWidth=128,this._skyHeight=128,this._numIndices=0,this._texMatrix=o.fromIdentity(),this._activeTexture=null};return c.prototype=Object.create(i.prototype),Object.defineProperties(c.prototype,{nightImageSource:{get:function(){return this._nightImageSource},set:function(t){this._nightImageSource=t}}}),c.prototype.doRender=function(t){t.globe.is2D()||(this.determineLightDirection(t),this.drawSky(t),this.drawGround(t))},c.prototype.applySkyVertices=function(t){var e,i,r=t.currentGlContext,n=t.currentProgram,o=this._skyData;o.verticesVboCacheKey||(o.verticesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(o.verticesVboCacheKey),i?(r.bindBuffer(r.ARRAY_BUFFER,i),r.vertexAttribPointer(0,3,r.FLOAT,!1,0,0)):(e=this.assembleVertexPoints(t,this._skyHeight,this._skyWidth,n.getAltitude()),i=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,i),r.bufferData(r.ARRAY_BUFFER,e,r.STATIC_DRAW),r.vertexAttribPointer(0,3,r.FLOAT,!1,0,0),t.gpuResourceCache.putResource(o.verticesVboCacheKey,i,4*e.length),t.frameStatistics.incrementVboLoadCount(1))},c.prototype.applySkyIndices=function(t){var e,i,r=t.currentGlContext,n=this._skyData;n.indicesVboCacheKey||(n.indicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(n.indicesVboCacheKey),i?r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i):(e=this.assembleTriStripIndices(this._skyWidth,this._skyHeight),i=r.createBuffer(),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),t.gpuResourceCache.putResource(n.indicesVboCacheKey,i,2*e.length))},c.prototype.drawSky=function(t){var e=t.currentGlContext,i=t.findAndBindProgram(a);i.loadGlobeRadius(e,t.globe.equatorialRadius),i.loadEyePoint(e,t.navigatorState.eyePoint),i.loadVertexOrigin(e,h.ZERO),i.loadModelviewProjection(e,t.navigatorState.modelviewProjection),i.loadLightDirection(e,this._activeLightDirection),i.setScale(e),this.applySkyVertices(t),this.applySkyIndices(t),e.depthMask(!1),e.frontFace(e.CW),e.enableVertexAttribArray(0),e.drawElements(e.TRIANGLE_STRIP,this._numIndices,e.UNSIGNED_SHORT,0),e.depthMask(!0),e.frontFace(e.CCW),e.disableVertexAttribArray(0)},c.prototype.drawGround=function(t){var i,r=t.currentGlContext,n=t.findAndBindProgram(e),o=t.terrain;n.loadGlobeRadius(r,t.globe.equatorialRadius),n.loadEyePoint(r,t.navigatorState.eyePoint),n.loadLightDirection(r,this._activeLightDirection),n.setScale(r),this.nightImageSource&&null!==this.time&&(this._activeTexture=t.gpuResourceCache.resourceForKey(this.nightImageSource),this._activeTexture||(this._activeTexture=t.gpuResourceCache.retrieveTexture(r,this.nightImageSource)),i=this._activeTexture&&this._activeTexture.bind(t)),o.beginRendering(t);for(var s=0,a=o.surfaceGeometry.length;s=this.dates.length-1?null:(this.currentIndex++,this.currentTime=this.dates[this.currentIndex],this.currentTime)},i.prototype.previous=function(){return this.currentIndex<=0?null:(this.currentIndex--,this.currentTime=this.dates[this.currentIndex],this.currentTime)},i.prototype.reset=function(){this.currentIndex=-1,this.currentTime=null},i.prototype.getTimeForScale=function(t){return this.currentIndex=t<=0?0:t>=1?this.dates.length-1:Math.floor(this.dates.length*t),this.currentTime=this.dates[this.currentIndex],this.currentTime},i}),i("util/AbsentResourceList",[],function(){"use strict";var t=function(t,e){this.maxTrys=t,this.minCheckInterval=e,this.tryAgainInterval=6e4,this.possiblyAbsent={}};return t.prototype.isResourceAbsent=function(t){var e=this.possiblyAbsent[t];if(!e)return!1;if(e.permanent)return!0;var i=Date.now()-e.timeOfLastMark;return i>this.tryAgainInterval?(delete this.possiblyAbsent[t],!1):ithis.maxTrys},t.prototype.markResourceAbsent=function(t){var e=this.possiblyAbsent[t];e||(e={timeOfLastMark:Date.now(),numTrys:0},this.possiblyAbsent[t]=e),e.numTrys=e.numTrys+1,e.timeOfLastMark=Date.now()},t.prototype.markResourceAbsentPermanently=function(t){var e=this.possiblyAbsent[t];e||(e={timeOfLastMark:Date.now(),numTrys:0},this.possiblyAbsent[t]=e),e.numTrys=e.numTrys+1,e.timeOfLastMark=Date.now(),e.permanent=!0},t.prototype.unmarkResourceAbsent=function(t){this.possiblyAbsent[t]&&delete this.possiblyAbsent[t]},t}),i("geom/Frustum",["../error/ArgumentError","../geom/Matrix","../geom/Plane","../util/Logger"],function(t,e,i,r){"use strict";var n=function(e,i,n,o,s,a){if(!(e&&i&&n&&o&&s&&a))throw new t(r.logMessage(r.LEVEL_SEVERE,"Frustum","constructor","missingPlane"));this._left=e,this._right=i,this._bottom=n,this._top=o,this._near=s,this._far=a,this._planes=[this._left,this._right,this._top,this._bottom,this._near,this._far]};return Object.defineProperties(n.prototype,{left:{get:function(){return this._left}},right:{get:function(){return this._right}},bottom:{get:function(){return this._bottom}},top:{get:function(){return this._top}},near:{get:function(){return this._near}},far:{get:function(){return this._far}}}),n.prototype.transformByMatrix=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"Frustum","transformByMatrix","missingMatrix"));return this._left.transformByMatrix(e),this._right.transformByMatrix(e),this._bottom.transformByMatrix(e),this._top.transformByMatrix(e),this._near.transformByMatrix(e),this._far.transformByMatrix(e),this},n.prototype.normalize=function(){return this._left.normalize(),this._right.normalize(),this._bottom.normalize(),this._top.normalize(),this._near.normalize(),this._far.normalize(),this},n.unitFrustum=function(){return new n(new i(1,0,0,1),new i(-1,0,0,1),new i(0,1,1,1),new i(0,-1,0,1),new i(0,0,-1,1),new i(0,0,1,1))},n.fromProjectionMatrix=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"Frustum","fromProjectionMatrix","missingMatrix"));var o,s,a,l,h,u,c,d,p,f,g;return o=e[12]+e[0],s=e[13]+e[1],a=e[14]+e[2],l=e[15]+e[3],h=Math.sqrt(o*o+s*s+a*a),u=new i(o/h,s/h,a/h,l/h),o=e[12]-e[0],s=e[13]-e[1],a=e[14]-e[2],l=e[15]-e[3],h=Math.sqrt(o*o+s*s+a*a),c=new i(o/h,s/h,a/h,l/h),o=e[12]+e[4],s=e[13]+e[5],a=e[14]+e[6],l=e[15]+e[7],h=Math.sqrt(o*o+s*s+a*a),p=new i(o/h,s/h,a/h,l/h),o=e[12]-e[4],s=e[13]-e[5],a=e[14]-e[6],l=e[15]-e[7],h=Math.sqrt(o*o+s*s+a*a),d=new i(o/h,s/h,a/h,l/h),o=e[12]+e[8],s=e[13]+e[9],a=e[14]+e[10],l=e[15]+e[11],h=Math.sqrt(o*o+s*s+a*a),f=new i(o/h,s/h,a/h,l/h),o=e[12]-e[8],s=e[13]-e[9],a=e[14]-e[10],l=e[15]-e[11],h=Math.sqrt(o*o+s*s+a*a),g=new i(o/h,s/h,a/h,l/h),new n(u,c,p,d,f,g)},n.prototype.containsPoint=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"Frustum","containsPoint","missingPoint"));return!(this._far.dot(e)<=0)&&(!(this._left.dot(e)<=0)&&(!(this._right.dot(e)<=0)&&(!(this._top.dot(e)<=0)&&(!(this._bottom.dot(e)<=0)&&!(this._near.dot(e)<=0)))))},n.prototype.intersectsSegment=function(e,i){if(!e||!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"Frustum","containsPoint","missingPoint"));if(this.containsPoint(e)||this.containsPoint(i))return!0;if(e.equals(i))return!1;for(var n=0,o=this._planes.length;ni&&(v=i),So&&(b=o),Ts&&(L=s),w=0?i:-i},c.prototype.effectiveRadius=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","effectiveRadius","missingPlane"));var i=e.normal;return.5*(h.fabs(this.r.dot(i))+h.fabs(this.s.dot(i))+h.fabs(this.t.dot(i)))},c.prototype.intersectsFrustum=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","intersectsFrustum","missingFrustum"));return this.tmp1.copy(this.bottomCenter),this.tmp2.copy(this.topCenter),!(this.intersectionPoint(e.near)<0)&&(!(this.intersectionPoint(e.far)<0)&&(!(this.intersectionPoint(e.left)<0)&&(!(this.intersectionPoint(e.right)<0)&&(!(this.intersectionPoint(e.top)<0)&&!(this.intersectionPoint(e.bottom)<0)))))},c.prototype.intersectionPoint=function(t){var e=t.normal,i=.5*(Math.abs(this.s.dot(e))+Math.abs(this.t.dot(e)));return this.intersectsAt(t,i,this.tmp1,this.tmp2)},c.prototype.intersectsAt=function(t,e,i,r){var n=t.dot(i),o=n<=-e,s=t.dot(r),a=s<=-e;if(o&&a)return-1;if(o==a)return 0;this.tmp3.copy(i),this.tmp3.subtract(r);var l=(e+n)/t.normal.dot(this.tmp3);return this.tmp3.copy(r),this.tmp3.subtract(i),this.tmp3.multiply(l),this.tmp3.add(i),o?i.copy(this.tmp3):r.copy(this.tmp3),l},c.prototype.adjustExtremes=function(t,e,i,r,n,o,s){var a=s.dot(t);e[0]>a&&(e[0]=a),e[1]l&&(r[0]=l),r[1]h&&(o[0]=h),o[1]Math.max(e*n,.5)},s.prototype.update=function(t){var e=t.globe.elevationTimestamp(),i=t.verticalExaggeration,r=t.globeStateKey;this.updateTimestamp==e&&this.updateVerticalExaggeration==i&&this.updateGlobeStateKey==r||(this.doUpdate(t),t.frameStatistics.incrementTileUpdateCount(1),this.updateTimestamp=e,this.updateVerticalExaggeration=i,this.updateGlobeStateKey=r)},s.prototype.doUpdate=function(t){var i=t.globe,r=t.verticalExaggeration,s=i.minAndMaxElevationsForSector(this.sector),a=s?s[0]*r:0,l=s?s[1]*r:0;a==l&&(a=l+10),this.extent||(this.extent=new e),this.extent.setToSector(this.sector,i,a,l),this.samplePoints||(this.sampleElevations=new Float64Array(9),this.samplePoints=new Float64Array(3*this.sampleElevations.length)),o.fillArray(this.sampleElevations,.5*(a+l)),i.computePointsForGrid(this.sector,3,3,this.sampleElevations,n.ZERO,this.samplePoints),this.referencePoint||(this.referencePoint=new n(0,0,0)),i.computePointFromPosition(this.sector.centroidLatitude(),this.sector.centroidLongitude(),0,this.referencePoint)},s.computeRow=function(t,e){var i=Math.floor((e+90)/t);return 90==e&&(i-=1),i},s.computeColumn=function(t,e){var i=Math.floor((e+180)/t);return 180==e&&(i-=1),i},s.computeLastRow=function(t,e){var i=Math.ceil((e+90)/t-1);return e+90t.levelNumber?1:0},n}),i("util/LevelSet",["../error/ArgumentError","../util/Level","../geom/Location","../util/Logger"],function(t,e,i,r){"use strict";var n=function(n,o,s,a,l){if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","missingSector"));if(!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified level zero delta is null or undefined"));if(o.latitude<=0||o.longitude<=0)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified level zero delta is less than or equal to zero."));if(s<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified number of levels is less than one."));if(a<1||l<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified tile width or tile height is less than one."));this.sector=n,this.levelZeroDelta=o,this.numLevels=s,this.tileWidth=a,this.tileHeight=l,this.levels=[];for(var h=0;h=this.levels.length?null:this.levels[t]},n.prototype.levelForTexelSize=function(t){var e=this.lastLevel();if(e.texelSize>=t)return e;for(var i=0,r=this.levels.length;i=i||r<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","constructor","The specified low-water value is undefined, greater than or equal to the capacity, or less than 1"));this._capacity=i,this._lowWater=r,this.usedCapacity=0,this.freeCapacity=i,this.entries={},this.listeners=[]};return Object.defineProperties(i.prototype,{capacity:{get:function(){return this._capacity},set:function(i){if(!i||i<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","capacity","Specified cache capacity is undefined, 0 or negative."));var r=this._capacity;this._capacity=i,this._capacity<=this.lowWater&&(this._lowWater=.85*this._capacity),this._capacity=this._capacity||i<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","lowWater","Specified cache low-water value is undefined, negative or not less than the current capacity."));this._lowWater=i}}}),i.prototype.entryForKey=function(t){if(!t)return null;var e=this.entries[t];return e?(e.lastUsed=Date.now(),e.entry):null},i.prototype.putEntry=function(i,r,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","missingKey."));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","missingEntry."));if(n<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","The specified entry size is less than 1."));var o,s=this.entries[i];s&&this.removeEntry(i),this.usedCapacity+n>this._capacity&&this.makeSpace(n),this.usedCapacity+=n,this.freeCapacity=this._capacity-this.usedCapacity,o={key:i,entry:r,size:n,lastUsed:Date.now()},this.entries[i]=o},i.prototype.clear=function(t){if(t)for(var e in this.entries)this.entries.hasOwnProperty(e)&&this.removeCacheEntry(e);this.entries={},this.freeCapacity=this._capacity,this.usedCapacity=0},i.prototype.removeEntry=function(t){if(t){var e=this.entries[t];e&&this.removeCacheEntry(e)}},i.prototype.removeCacheEntry=function(t){delete this.entries[t.key],this.usedCapacity-=t.size,this.freeCapacity=this._capacity-this.usedCapacity;for(var e=0,i=this.listeners.length;e-1&&this.listeners.splice(r,1)},i.prototype.makeSpace=function(t){var e=[];this.usedCapacity;for(var i in this.entries)this.entries.hasOwnProperty(i)&&e.push(this.entries[i]);e.sort(function(t,e){return t.lastUsed-e.lastUsed});for(var r=0,n=e.length;rthis._lowWater||this.freeCapacity=1&&this.opacity>=1){this.previousTiles={};for(var e=0;e0&&(t.surfaceTileRenderer.renderTiles(t,this.currentTiles,this.opacity,t.surfaceOpacity>=1),t.frameStatistics.incrementImageTileCount(this.currentTiles.length),this.inCurrentFrame=!0)}},u.prototype.fadeOutgoingTiles=function(t){for(var e=(t.timestamp-t.previousRedrawTimestamp)/t.fadeTime,i={},r=0;r0&&!i[n.imagePath]&&(n.opacity=Math.max(0,n.opacity-e),n.opacity>0&&(this.currentTiles.push(n),this.currentTilesInvalid=!0,t.redrawRequested=!0)))},u.prototype.isLayerInView=function(t){return t.terrain&&t.terrain.sector&&t.terrain.sector.intersects(this.levels.sector)},u.prototype.createTopLevelTiles=function(t){this.topLevelTiles=[],l.createTilesForLevel(this.levels.firstLevel(),this,this.topLevelTiles)},u.prototype.assembleTiles=function(t){this.currentTiles=[],this.topLevelTiles&&0!==this.topLevelTiles.length||this.createTopLevelTiles(t);for(var e=0,i=this.topLevelTiles.length;e=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},u.prototype.isTileTextureInMemory=function(t,e){return t.gpuResourceCache.containsResource(e.imagePath)},u.prototype.isTextureExpired=function(t){return this.expiration&&t.creationTime.getTime()<=this.expiration.getTime()},u.prototype.retrieveTileImage=function(t,e,i){if(this.currentRetrievals.indexOf(e.imagePath)<0){if(this.absentResourceList.isResourceAbsent(e.imagePath))return;var r=this.resourceUrlForTile(e,this.retrievalImageFormat),n=new Image,s=e.imagePath,a=t.gpuResourceCache,l=t.currentGlContext.canvas,h=this;if(!r)return void(this.currentTilesInvalid=!0);n.onload=function(){o.log(o.LEVEL_INFO,"Image retrieval succeeded: "+r);var u=h.createTexture(t,e,n);if(h.removeFromCurrentRetrievals(s),u&&(a.putResource(s,u,u.size),h.currentTilesInvalid=!0,h.absentResourceList.unmarkResourceAbsent(s),!i)){var c=document.createEvent("Event");c.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),l.dispatchEvent(c)}},n.onerror=function(){h.removeFromCurrentRetrievals(s),h.absentResourceList.markResourceAbsent(s),o.log(o.LEVEL_WARNING,"Image retrieval failed: "+r)},this.currentRetrievals.push(s),n.crossOrigin=this.crossOrigin,n.src=r}},u.prototype.createTexture=function(t,e,i){return new a(t.currentGlContext,i)},u.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},u.prototype.resourceUrlForTile=function(t,e){return this.urlBuilder?this.urlBuilder.urlForTile(t,e):null},u}),i("layer/MercatorTiledImageLayer",["../util/Color","../geom/Sector","../layer/TiledImageLayer","../geom/Vec2","../util/WWMath"],function(t,e,i,r,n){"use strict";var o=function(t,e,n,o,s,a,l){i.call(this,t,e,n,o,s,a,l),this.detectBlankImages=!1,this.testPixels=[new r(20,20),new r(235,20),new r(20,235),new r(235,235)],this.destCanvas=document.createElement("canvas"),this.destContext=this.destCanvas.getContext("2d")};return o.prototype=Object.create(i.prototype),o.prototype.createTile=function(t,r,o,s){var a,l,h,u,c,d,p=this.mapSizeForLevel(r.levelNumber),f=n.clamp(s*this.imageSize,0,p),g=n.clamp(o*this.imageSize,0,p),m=n.clamp(f+this.imageSize,0,p),E=n.clamp(g+this.imageSize,0,p);return a=f/p-.5,l=.5-E/p,h=90-360*Math.atan(Math.exp(2*-l*Math.PI))/Math.PI,u=360*a,a=m/p-.5,l=.5-g/p,c=90-360*Math.atan(Math.exp(2*-l*Math.PI))/Math.PI,d=360*a,t=new e(h,c,u,d),i.prototype.createTile.call(this,t,r,o,s)},o.prototype.createTexture=function(t,e,r){var o,s,a,l,h,u,c,d,p=t.canvas2D,f=t.ctx2D,g=this.destCanvas,m=this.destContext,E=m.createImageData(r.width,r.height),y=e.sector,_=n.gudermannianInverse(y.minLatitude),v=n.gudermannianInverse(y.maxLatitude);if(p.width=r.width,p.height=r.height,g.width=r.width,g.height=r.height,f.drawImage(r,0,0,r.width,r.height),o=f.getImageData(0,0,r.width,r.height),this.detectBlankImages&&this.isBlankImage(r,o))return this.absentResourceList.markResourceAbsentPermanently(e.imagePath),null;for(var S=0;S<1;S++)for(var b=0;b0;s--)r=0,n=1<0?o:"1.3.0",this.isWms130OrGreater=this.wmsVersion>="1.3.0",this.crs="EPSG:4326",this.timeString=s};return i.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","The image format is null or undefined."));var o=r.sector,s=i.fixGetMapString(this.serviceAddress);return s.search(/service=wms/i)<0&&(s+="service=WMS"),s+="&request=GetMap",s=s+"&version="+this.wmsVersion,s=s+"&transparent="+(this.transparent?"TRUE":"FALSE"),s=s+"&layers="+this.layerNames,s=s+"&styles="+this.styleNames,s=s+"&format="+n,s=s+"&width="+r.tileWidth,s=s+"&height="+r.tileHeight,this.timeString&&(s=s+"&time="+this.timeString),this.isWms130OrGreater?(s=s+"&crs="+this.crs,s+="&bbox=","CRS:84"===this.crs?(s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude):(s=s+o.minLatitude+","+o.minLongitude+",",s=s+o.maxLatitude+","+o.maxLongitude)):(s=s+"&srs="+this.crs,s+="&bbox=",s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude),s=s.replace(" ","%20")},i.fixGetMapString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","fixGetMapString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/))<0&&(i+="&"),i},i}),i("layer/BingWMSLayer",["../geom/Location","../geom/Sector","../layer/TiledImageLayer","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,e.FULL_SPHERE,new t(45,45),16,"image/png","BingWMS",256,256),this.displayName="Bing WMS",this.pickEnabled=!1,this.maxActiveAltitude=1e4,this.urlBuilder=new r("https://worldwind27.arc.nasa.gov/wms/virtualearth","ve","","1.3.0")};return n.prototype=Object.create(i.prototype),n}),i("layer/BMNGLandsatLayer",["../geom/Location","../geom/Sector","../layer/TiledImageLayer","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,e.FULL_SPHERE,new t(45,45),10,"image/jpeg","BMNGLandsat256",256,256),this.displayName="Blue Marble & Landsat",this.pickEnabled=!1,this.urlBuilder=new r("https://worldwind25.arc.nasa.gov/wms","BlueMarble-200405,esat","","1.3.0")};return n.prototype=Object.create(i.prototype),n}),i("layer/BMNGLayer",["../geom/Location","../geom/Sector","../layer/TiledImageLayer","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(n){i.call(this,e.FULL_SPHERE,new t(45,45),5,"image/jpeg",n||"BMNG256",256,256),this.displayName="Blue Marble",this.pickEnabled=!1,this.urlBuilder=new r("https://worldwind25.arc.nasa.gov/wms",n||"BlueMarble-200405","","1.3.0")};return n.prototype=Object.create(i.prototype),n}),i("layer/RenderableLayer",["../error/ArgumentError","../layer/Layer","../util/Logger"],function(t,e,i){"use strict";var r=function(t){e.call(this,t),this.renderables=[]};return r.prototype=Object.create(e.prototype),r.prototype.addRenderable=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"RenderableLayer","addRenderable","missingRenderable"));this.renderables.push(e)},r.prototype.addRenderables=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"RenderableLayer","addRenderables","The renderables array is null or undefined."));for(var r=0,n=e.length;r=0&&this.renderables.splice(e,1)},r.prototype.removeAllRenderables=function(){this.renderables=[]},r.prototype.doRender=function(t){for(var e=t.orderedRenderables.length,r=0,n=this.renderables.length;re&&(this.inCurrentFrame=!0)},r}),i("render/SurfaceTile",["../error/ArgumentError","../util/Logger","../geom/Matrix","../geom/Sector","../error/UnsupportedOperationError"],function(t,e,i,r,n){"use strict";var o=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","constructor","missingSector"));this.sector=i};return o.prototype.bind=function(t){throw new n(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","bind","abstractInvocation"))},o.prototype.applyInternalTransform=function(t,i){throw new n(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","applyInternalTransform","abstractInvocation"))},o}),i("shapes/SurfaceImage",["../error/ArgumentError","../util/Logger","../pick/PickedObject","../render/SurfaceTile"],function(t,e,i,r){"use strict";var n=function(i,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","constructor","missingSector"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","constructor","missingImage"));r.call(this,i),this.enabled=!0,this._imageSource=n,this.opacity=1,this.displayName="Surface Image",this.imageSourceWasUpdated=!0};return n.prototype=Object.create(r.prototype),Object.defineProperties(n.prototype,{imageSource:{get:function(){return this._imageSource},set:function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","imageSource","missingImage"));this._imageSource=i,this.imageSourceWasUpdated=!0}}}),n.prototype.bind=function(t){var e=t.gpuResourceCache.resourceForKey(this._imageSource);return e&&!this.imageSourceWasUpdated?e.bind(t):(e=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this._imageSource),this.imageSourceWasUpdated=!1,e?e.bind(t):void 0)},n.prototype.applyInternalTransform=function(t,e){},n.prototype.render=function(t){if(this.enabled&&t.terrain&&this.sector.overlaps(t.terrain.sector)){if(t.pickingMode&&(this.pickColor=t.uniquePickColor()),t.surfaceTileRenderer.renderTiles(t,[this],this.opacity*t.currentLayer.opacity),t.pickingMode){var e=new i(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(e)}t.currentLayer.inCurrentFrame=!0}},n}),i("layer/BMNGOneImageLayer",["../layer/RenderableLayer","../geom/Sector","../shapes/SurfaceImage","../util/WWUtil"],function(t,e,i,r){"use strict";var n=function(){t.call(this,"Blue Marble Image");var r=new i(e.FULL_SPHERE,WorldWind.configuration.baseUrl+"images/BMNG_world.topo.bathy.200405.3.2048x1024.jpg");this.addRenderable(r),this.pickEnabled=!1,this.minActiveAltitude=3e6};return n.prototype=Object.create(t.prototype),n}),i("util/PeriodicTimeSequence",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"PeriodicTimeSequence","constructor","missingString"));var n=r.split("/");if(3!==n.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"PeriodicTimeSequence","constructor","The interval string "+r+" does not contain 3 elements."));this.sequenceString=r,this.startTime=new Date(n[0]),this.endTime=new Date(n[1]),this.intervalMilliseconds=this.endTime.getTime()-this.startTime.getTime(),this._currentTime=this.startTime,this.infiniteInterval=this.startTime.getTime()==this.endTime.getTime(),this.period=i.parsePeriodString(n[2],!1)};return Object.defineProperties(i.prototype,{currentTime:{get:function(){return this._currentTime},set:function(t){this._currentTime=t}},scaleForCurrentTime:{get:function(){return this.currentTime?(this.currentTime.getTime()-this.startTime.getTime())/this.intervalMilliseconds:1}}}),i.prototype.next=function(){return this.currentTime?this.currentTime.getTime()>=this.endTime.getTime()&&!this.infiniteInterval?this.currentTime=null:this.currentTime=i.incrementTime(this.currentTime,this.period):this.currentTime=this.startTime,this.currentTime},i.prototype.previous=function(){return this.currentTime?this.currentTime.getTime()===this.startTime.getTime()?this.currentTime=null:this.currentTime=this.getTimeForScale(.9999*this.scaleForCurrentTime):this.currentTime=this.endTime,this.currentTime},i.prototype.reset=function(){this.currentTime=null},i.prototype.getTimeForScale=function(t){if(t<=0)return this.startTime;if(t>=1)return this.endTime;var e=new Date(this.startTime.getTime()),r=e,n=0;for(n=0;n0;h--)a[h]>=l[h]&&(a[h-1]=a[h-1]+Math.floor(a[h]/l[h]),a[h]=a[h]%l[h]);return a},i}),i("util/LevelRowColumnUrlBuilder",["../error/ArgumentError","../util/Logger","../util/WWUtil"],function(t,e,i){"use strict";var r=function(t,e){this.serverAddress=t,t&&0!==t.length||(this.serverAddress=i.currentUrlSansFilePart()),this.pathToData=e};return r.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","The image format is null or undefined."));var o=this.serverAddress;return this.pathToData&&(o=o+"/"+this.pathToData),o=o+"/"+r.level.levelNumber.toString(),o=o+"/"+r.row.toString(),o=o+"/"+r.row.toString()+"_"+r.column.toString(),o=o+"."+i.suffixForMimeType(n),o=o.replace(" ","%20")},r}),i("layer/RestTiledImageLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../geom/Sector","../layer/TiledImageLayer","../util/LevelRowColumnUrlBuilder","../util/WWUtil"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,a,l){var h=s.urlPath(t+"/"+i);n.call(this,l&&l.sector||r.FULL_SPHERE,l&&l.levelZeroTileDelta||new e(45,45),l&&l.numLevels||5,l&&l.imageFormat||"image/jpeg",h,l&&l.tileWidth||256,l&&l.tileHeight||256),this.displayName=a,this.pickEnabled=!1,this.urlBuilder=new o(t,i)};return a.prototype=Object.create(n.prototype),a}),i("layer/BMNGRestLayer",["../error/ArgumentError","../layer/Layer","../util/Logger","../util/PeriodicTimeSequence","../layer/RestTiledImageLayer"],function(t,e,i,r,n){"use strict";var o=function(t,i,n,s){e.call(this,n||"Blue Marble time series"),this.time=s||new Date("2004-01"),this.timeSequence=new r("2004-01-01/2004-12-01/P1M"),this.serverAddress=t,this.pathToData=i,this.layers={},this.layerNames=[{month:"BlueMarble-200401",time:o.availableTimes[0]},{month:"BlueMarble-200402",time:o.availableTimes[1]},{month:"BlueMarble-200403",time:o.availableTimes[2]},{month:"BlueMarble-200404",time:o.availableTimes[3]},{month:"BlueMarble-200405",time:o.availableTimes[4]},{month:"BlueMarble-200406",time:o.availableTimes[5]},{month:"BlueMarble-200407",time:o.availableTimes[6]},{month:"BlueMarble-200408",time:o.availableTimes[7]},{month:"BlueMarble-200409",time:o.availableTimes[8]},{month:"BlueMarble-200410",time:o.availableTimes[9]},{month:"BlueMarble-200411",time:o.availableTimes[10]},{month:"BlueMarble-200412",time:o.availableTimes[11]}],this.pickEnabled=!1};return o.prototype=Object.create(e.prototype),o.availableTimes=[new Date("2004-01"),new Date("2004-02"),new Date("2004-03"),new Date("2004-04"),new Date("2004-05"),new Date("2004-06"),new Date("2004-07"),new Date("2004-08"),new Date("2004-09"),new Date("2004-10"),new Date("2004-11"),new Date("2004-12")],o.prototype.prePopulate=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"BMNGRestLayer","prePopulate","missingWorldWindow"));for(var r=0;r=this.layerNames[11].time.getTime())return this.layerNames[11].month;for(var i=0;i=r&&e<=n){return e-r=this._touches.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","touch","indexOutOfRange"));return this._touches[i]},r.prototype.recognizeSimultaneouslyWith=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","recognizeSimultaneouslyWith","The specified gesture recognizer is null or undefined."));-1==this._canRecognizeWith.indexOf(i)&&(this._canRecognizeWith.push(i),i._canRecognizeWith.push(this))},r.prototype.canRecognizeSimultaneouslyWith=function(t){return-1!=this._canRecognizeWith.indexOf(t)},r.prototype.requireRecognizerToFail=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","requireRecognizerToFail","The specified gesture recognizer is null or undefined"));-1==this._requiresFailureOf.indexOf(i)&&(this._requiresFailureOf.push(i),i._requiredToFailBy.push(this))},r.prototype.requiresRecognizerToFail=function(t){return-1!=this._requiresFailureOf.indexOf(t)},r.prototype.requiredToFailByRecognizer=function(t){return-1!=this._requiredToFailBy.indexOf(t)},r.prototype.reset=function(){this._state=WorldWind.POSSIBLE,this._nextState=null,this._clientX=0,this._clientY=0,this._clientStartX=0,this._clientStartY=0,this._translationX=0,this._translationY=0,this._mouseButtonMask=0,this._touches=[],this._touchCentroidShiftX=0,this._touchCentroidShiftY=0},r.prototype.prepareToRecognize=function(){},r.prototype.mouseDown=function(t){},r.prototype.mouseMove=function(t){},r.prototype.mouseUp=function(t){},r.prototype.touchStart=function(t){},r.prototype.touchMove=function(t){},r.prototype.touchCancel=function(t){},r.prototype.touchEnd=function(t){},r.prototype.transitionToState=function(t){this._nextState=null,t==WorldWind.FAILED?(this._state=t,this.updateRecognizersWaitingForFailure(),this.resetIfEventsEnded()):t==WorldWind.RECOGNIZED?(this.tryToRecognize(t),this._state==t&&(this.prepareToRecognize(),this.callGestureCallbacks(),this.resetIfEventsEnded())):t==WorldWind.BEGAN?(this.tryToRecognize(t),this._state==t&&(this.prepareToRecognize(),this.callGestureCallbacks())):t==WorldWind.CHANGED?(this._state=t,this.callGestureCallbacks()):t==WorldWind.CANCELLED?(this._state=t,this.callGestureCallbacks(),this.resetIfEventsEnded()):t==WorldWind.ENDED&&(this._state=t,this.callGestureCallbacks(),this.resetIfEventsEnded())},r.prototype.updateRecognizersWaitingForFailure=function(){for(var t=0,e=this._requiredToFailBy.length;t0)){var e=1<this.maxMouseMovement&&(this.state=WorldWind.FAILED)}},e.prototype.mouseUp=function(t){if(this.state==WorldWind.POSSIBLE&&0==this.mouseButtonMask){this.clicks.length==this.numberOfClicks?(this.clientX=this.clicks[0].clientX,this.clientY=this.clicks[0].clientY,this.state=WorldWind.RECOGNIZED):this.failAfterDelay(this.maxClickInterval)}},e.prototype.touchStart=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.failAfterDelay=function(t){var e=this;e.timeout&&window.clearTimeout(e.timeout),e.timeout=window.setTimeout(function(){e.timeout=null,e.state==WorldWind.POSSIBLE&&(e.state=WorldWind.FAILED)},t)},e.prototype.cancelFailAfterDelay=function(){var t=this;t.timeout&&(window.clearTimeout(t.timeout),t.timeout=null)},e}),i("formats/collada/ColladaAsset",[],function(){"use strict";var t=function(t){this.xmlAsset=t.getElementsByTagName("asset")[0],this.asset={daeVersion:t.querySelector("COLLADA").getAttribute("version")}};return t.prototype.parse=function(){if(!this.xmlAsset)return null;for(var t=0;t1){e=!1;break}return e},fetchFile:function(e,i){var r=new XMLHttpRequest;r.onload=function(){this.status>=200&&this.status<400?i(this.response):(t.log(t.LEVEL_SEVERE,"sever error: "+this.status),i(null))},r.onerror=function(e){t.log(t.LEVEL_SEVERE,"connection error: "+e),i(null)},r.open("get",e,!0),r.send()}}}),i("formats/collada/ColladaImage",["./ColladaUtils"],function(t){"use strict";var e=function(t,e){this.filename="",this.map=t,this.name=e,this.path=""};return e.prototype.parse=function(e){for(var i=0;i3&&(0===T&&(v=S),T>2*h&&(g.push(v),g.push(b))),g.push(S),m+=h}}var I={vertices:new Float32Array(l[0][1]),indexedRendering:E,material:s};return this.transformMeshInfo(I,l,g),I},e.prototype.parseInputs=function(t,e,i){for(var r=[],n=0,o=t.querySelectorAll("input"),s=0;s0;a&&this.applyTexture(t,e,i);var l=null!=e.normals&&e.normals.length>0;l&&!t.pickingMode&&this.applyLighting(t,e),this.applyMatrix(t,l,a,r,n),e.indexedRendering?(this.applyIndices(t,e),o.drawElements(o.TRIANGLES,e.indices.length,o.UNSIGNED_SHORT,0)):o.drawArrays(o.TRIANGLES,0,Math.floor(e.vertices.length/3)),this.resetDraw(t,l,a)},h.prototype.applyVertices=function(t,e){var i,r=t.currentGlContext,n=t.currentProgram;e.verticesVboCacheKey||(e.verticesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(e.verticesVboCacheKey),i||(i=r.createBuffer(),t.gpuResourceCache.putResource(e.verticesVboCacheKey,i,e.vertices.length),e.refreshVertexBuffer=!0),r.bindBuffer(r.ARRAY_BUFFER,i),e.refreshVertexBuffer&&(r.bufferData(r.ARRAY_BUFFER,e.vertices,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),e.refreshVertexBuffer=!1),r.enableVertexAttribArray(n.vertexPointLocation),r.vertexAttribPointer(n.vertexPointLocation,3,r.FLOAT,!1,0,0)},h.prototype.applyColor=function(t,e){var r=t.currentGlContext,n=t.currentProgram;if(e)if("constant"===e.techniqueType)var o=e.reflective;else o=e.diffuse;var s,a=1,l=1,h=1,u=1;o&&(a=o[0],l=o[1],h=o[2],u=null!=o[3]?o[3]:1);var c=new i(a,l,h,u);s=u*t.currentLayer.opacity,r.depthMask(s>=1||t.pickingMode),n.loadColor(r,t.pickingMode?this.pickColor:c),n.loadOpacity(r,t.pickingMode?s>0?1:0:s)},h.prototype.applyTexture=function(t,e,i){var r,n,o,s=t.currentGlContext,a=t.currentProgram;if(i.textures.diffuse)var l=i.textures.diffuse.mapId;else l=i.textures.reflective.mapId;var h=this.useTexturePaths?this.images[l].path:this.images[l].filename;this._activeTexture=t.gpuResourceCache.resourceForKey(this.dirPath+h+""),this._activeTexture||(o=e.isClamp?s.CLAMP_TO_EDGE:s.REPEAT,this._activeTexture=t.gpuResourceCache.retrieveTexture(s,this.dirPath+h+"",o)),(r=this._activeTexture&&this._activeTexture.bind(t))&&(e.texCoordsVboCacheKey||(e.texCoordsVboCacheKey=t.gpuResourceCache.generateCacheKey()),n=t.gpuResourceCache.resourceForKey(e.texCoordsVboCacheKey),n||(n=s.createBuffer(),t.gpuResourceCache.putResource(e.texCoordsVboCacheKey,n,e.uvs.length),e.refreshTexCoordBuffer=!0),s.bindBuffer(s.ARRAY_BUFFER,n),e.refreshTexCoordBuffer&&(s.bufferData(s.ARRAY_BUFFER,e.uvs,s.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),e.refreshTexCoordBuffer=!1),a.loadTextureEnabled(s,!0),s.enableVertexAttribArray(a.vertexTexCoordLocation),s.vertexAttribPointer(a.vertexTexCoordLocation,2,s.FLOAT,!1,0,0),a.loadTextureUnit(s,s.TEXTURE0),a.loadModulateColor(s,t.pickingMode))},h.prototype.applyLighting=function(t,e){var i,r=t.currentGlContext,n=t.currentProgram;n.loadApplyLighting(r,!0),e.normalsVboCacheKey||(e.normalsVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(e.normalsVboCacheKey),i||(i=r.createBuffer(),t.gpuResourceCache.putResource(e.normalsVboCacheKey,i,e.normals.length),e.refreshNormalBuffer=!0),r.bindBuffer(r.ARRAY_BUFFER,i),e.refreshNormalBuffer&&(r.bufferData(r.ARRAY_BUFFER,e.normals,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),e.refreshNormalBuffer=!1),r.enableVertexAttribArray(n.normalVectorLocation),r.vertexAttribPointer(n.normalVectorLocation,3,r.FLOAT,!1,0,0)},h.prototype.applyMatrix=function(t,e,i,r,o){var s=n.fromIdentity();if(s.copy(t.navigatorState.modelviewProjection),s.multiplyMatrix(this.transformationMatrix),r&&this.localTransforms&&s.multiplyMatrix(r),e&&!t.pickingMode){var a=n.fromIdentity();a.copy(t.navigatorState.modelviewNormalTransform),a.multiplyMatrix(this.normalMatrix),o&&this.localTransforms&&a.multiplyMatrix(o),t.currentProgram.loadModelviewInverse(t.currentGlContext,a)}i&&this._activeTexture&&(t.currentProgram.loadTextureMatrix(t.currentGlContext,this._texCoordMatrix),this._activeTexture=null),t.currentProgram.loadModelviewProjection(t.currentGlContext,s)},h.prototype.applyIndices=function(t,e){var i,r=t.currentGlContext;e.indicesVboCacheKey||(e.indicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(e.indicesVboCacheKey),i||(i=r.createBuffer(),t.gpuResourceCache.putResource(e.indicesVboCacheKey,i,e.indices.length),e.refreshIndicesBuffer=!0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),e.refreshIndicesBuffer&&(r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.indices,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),e.refreshIndicesBuffer=!1)},h.prototype.resetDraw=function(t,e,i){var r=t.currentGlContext,n=t.currentProgram;e&&!t.pickingMode&&(n.loadApplyLighting(r,!1),r.disableVertexAttribArray(n.normalVectorLocation)),i&&r.disableVertexAttribArray(n.vertexTexCoordLocation),r.disableVertexAttribArray(n.vertexPointLocation)},h.prototype.endDrawing=function(t){t.bindProgram(null)},h.prototype.computeTransformationMatrix=function(t){this.transformationMatrix=n.fromIdentity(),this.transformationMatrix.multiplyByLocalCoordinateTransform(this.placePoint,t),this.transformationMatrix.multiplyByRotation(1,0,0,this.xRotation),this.transformationMatrix.multiplyByRotation(0,1,0,this.yRotation),this.transformationMatrix.multiplyByRotation(0,0,1,this.zRotation),this.transformationMatrix.multiplyByScale(this.scale,this.scale,this.scale),this.transformationMatrix.multiplyByTranslation(this.xTranslation,this.yTranslation,this.zTranslation),this.computeNormalMatrix()},h.prototype.computeNormalMatrix=function(){var t=new l(0,0,0);this.transformationMatrix.extractRotationAngles(t),this.normalMatrix=n.fromIdentity(),this.normalMatrix.multiplyByRotation(-1,0,0,t[0]),this.normalMatrix.multiplyByRotation(0,-1,0,t[1]),this.normalMatrix.multiplyByRotation(0,0,-1,t[2])},h.prototype.mustRenderNode=function(t){var e=!0;if(this.hideNodes){e=-1===this.nodesToHide.indexOf(t)}return e},h}),i("formats/collada/ColladaLoader",["../../error/ArgumentError","./ColladaAsset","./ColladaImage","./ColladaMaterial","./ColladaMesh","./ColladaNode","./ColladaScene","./ColladaUtils","../../util/Logger"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(e,i){if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"ColladaLoader","constructor","missingPosition"));this.position=e,this.dirPath="/",this.init(i)};return h.prototype.init=function(t){t&&(this.dirPath=t.dirPath||"/"),this.scene={type:"SceneTree",dirPath:this.dirPath,images:{},metadata:{},materials:{},meshes:{},root:{children:[]}},this.xmlDoc=null},h.prototype.load=function(t,e){-1===t.indexOf("://")&&(t=this.dirPath+t),a.fetchFile(t,function(t){if(t)try{i=this.parse(t)}catch(t){i=null,l.log(l.LEVEL_SEVERE,"error parsing collada file: "+t)}else var i=null;e(i)}.bind(this))},h.prototype.parse=function(t){this.init();var i=new DOMParser;this.xmlDoc=i.parseFromString(t,"text/xml");var r=this.xmlDoc.querySelectorAll("library_nodes node"),n=this.xmlDoc.querySelectorAll("library_effects effect");return this.scene.metadata=new e(this.xmlDoc).parse(),this.parseLib("visual_scene",r),this.parseLib("library_geometries"),this.parseLib("library_materials",n),this.parseLib("library_images"),this.xmlDoc=null,new s(this.position,this.scene)},h.prototype.parseLib=function(t,e){var s=this.xmlDoc.getElementsByTagName(t),l=[];s&&s.length&&(l=s[0].childNodes);for(var h=0;h0&&(p.matrix.copy(t.screenProjection),p.matrix.multiplyMatrix(this.imageTransform),r.loadModelviewProjection(i,p.matrix),t.pickingMode||(this.texCoordMatrix.setToIdentity(),this.activeTexture&&this.texCoordMatrix.multiplyByTextureTransform(this.activeTexture),r.loadTextureMatrix(i,this.texCoordMatrix),this.activeTexture&&this.activeTexture!=p.currentTexture&&(e=this.activeTexture.bind(t),r.loadTextureEnabled(i,e),p.currentTexture=this.activeTexture)),this.activeAttributes.depthTest||i.disable(i.DEPTH_TEST,!1),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.activeAttributes.depthTest||i.disable(i.DEPTH_TEST,!0)),this.currentVisibility<1&&this.markerImageSource){var s=t.gpuResourceCache.resourceForKey(this.markerImageSource);if(!s)return void t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.markerImageSource);var a=this.markerImageScale,l=o.fromIdentity();if(l.setTranslation(this.screenPoint[0]-a*s.imageWidth/2,this.screenPoint[1]-a*s.imageWidth/2,this.screenPoint[2]),l.setScale(s.imageWidth*a,s.imageHeight*a,1),p.matrix.copy(t.screenProjection),p.matrix.multiplyMatrix(l),r.loadModelviewProjection(i,p.matrix),!t.pickingMode){r.loadOpacity(i,this.layer.opacity*(1-this.currentVisibility));var h=o.fromIdentity();h.multiplyByTextureTransform(s),r.loadTextureMatrix(i,h),s!=p.currentTexture&&(e=s.bind(t),r.loadTextureEnabled(i,e),p.currentTexture=s)}this.activeAttributes.depthTest||i.disable(i.DEPTH_TEST,!1),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.activeAttributes.depthTest||i.enable(i.DEPTH_TEST,!0)}},p}),i("shapes/ScreenText",["../error/ArgumentError","../util/Logger","../util/Offset","../shapes/Text"],function(t,e,i,r){"use strict";var n=function(i,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Text","constructor","missingOffset"));r.call(this,n),this.screenOffset=i,this.altitudeMode=null};return n.prototype=Object.create(r.prototype),n.prototype.render=function(t){this.lastFrameTime!=t.timestamp&&r.prototype.render.call(this,t)},n.prototype.computeScreenPointAndEyeDistance=function(t){var e=t.currentGlContext,i=this.screenOffset.offsetForSize(e.drawingBufferWidth,e.drawingBufferHeight);return this.screenPoint[0]=i[0],this.screenPoint[1]=i[1],this.screenPoint[2]=0,this.eyeDistance=0,!0},n}),i("layer/CoordinatesDisplayLayer",["../error/ArgumentError","../util/Color","../util/Font","../layer/Layer","../util/Logger","../util/Offset","../geom/Position","../shapes/ScreenImage","../shapes/ScreenText","../shapes/TextAttributes","../geom/Vec2"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(i){function s(t){p.handleUIEvent(t)}function u(t,e){p.handleRedraw(e)}if(!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"ViewControlsLayer","constructor","missingWorldWindow"));r.call(this,"Coordinates"),this.wwd=i,this.pickEnabled=!1,this.eventType=null,this.clientX=null,this.clientY=null,this.terrainPosition=null,this.latText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.latText.attributes=new h(null),this.latText.attributes.color=e.YELLOW,this.lonText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.lonText.attributes=new h(null),this.lonText.attributes.color=e.YELLOW,this.elevText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.elevText.attributes=new h(null),this.elevText.attributes.color=e.YELLOW,this.eyeText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.eyeText.attributes=new h(null),this.eyeText.attributes.color=e.YELLOW;var c=new o(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),d=WorldWind.configuration.baseUrl+"images/crosshair.png";this.crosshairImage=new a(c,d);var p=this ;window.PointerEvent?(i.addEventListener("pointerdown",s),i.addEventListener("pointermove",s),i.addEventListener("pointerleave",s)):(i.addEventListener("mousedown",s),i.addEventListener("mousemove",s),i.addEventListener("mouseleave",s),i.addEventListener("touchstart",s),i.addEventListener("touchmove",s)),this.wwd.redrawCallbacks.push(u)};return c.prototype=Object.create(r.prototype),c.prototype.doRender=function(t){var e,i,r,n,s,a=this.terrainPosition,l=t.eyePosition,h=t.currentGlContext.canvas.clientWidth;h>650?(e=h/2-50,i=5,r=WorldWind.OFFSET_PIXELS,n=0):h>400?(e=60,i=5,r=WorldWind.OFFSET_INSET_PIXELS,n=1):(e=60,i=5,r=WorldWind.OFFSET_INSET_PIXELS,n=1,s=!0),this.latText.text=a?this.formatLatitude(a.latitude):null,this.latText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.latText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.latText.render(t),e+=70,this.lonText.text=a?this.formatLongitude(a.longitude):null,this.lonText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.lonText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.lonText.render(t),t.globe.is2D()||(e+=70,this.elevText.text=a?this.formatAltitude(a.altitude,"m"):null,this.elevText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.elevText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.elevText.render(t)),s||(e+=40,this.eyeText.text="Eye "+this.formatAltitude(l.altitude,l.altitude<1e3?"m":"km"),this.eyeText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.eyeText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,0,WorldWind.OFFSET_FRACTION,n),this.eyeText.render(t)),"touch"==this.eventType&&this.crosshairImage.render(t),this.inCurrentFrame=!0},c.prototype.handleUIEvent=function(t){-1!=t.type.indexOf("pointer")?this.eventType=t.pointerType:-1!=t.type.indexOf("mouse")?this.eventType="mouse":-1!=t.type.indexOf("touch")&&(this.eventType="touch"),-1!=t.type.indexOf("leave")?(this.clientX=null,this.clientY=null):(this.clientX=t.clientX,this.clientY=t.clientY),this.wwd.redraw()},c.prototype.handleRedraw=function(t){if(t==WorldWind.BEFORE_REDRAW){var e,i;("mouse"==this.eventType||"pen"==this.eventType)&&this.clientX&&this.clientY?(e=this.wwd.canvasCoordinates(this.clientX,this.clientY),e[0]>=0&&e[0]=0&&e[1]i?-1:ethis.interpretDistance},e.prototype.shouldRecognize=function(){return 1<2e3&&(this.frameTimeAverage=this.frameTimeCumulative/this.frameCount,this.frameRateAverage=1e3*this.frameCount/(t-this.frameTimeBase),this.frameTimeMin=this.frameTimeExtremes[0],this.frameTimeMax=this.frameTimeExtremes[1],this.frameCount=0,this.frameTimeCumulative=0,this.frameTimeBase=t,this.frameTimeExtremes=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY])},t.prototype.incrementRenderedTileCount=function(t){this.renderedTileCount+=t},t.prototype.setTerrainTileCount=function(t){this.terrainTileCount=t},t.prototype.incrementImageTileCount=function(t){this.imageTileCount=t},t.prototype.incrementTileUpdateCount=function(t){this.tileUpdateCount+=t},t.prototype.incrementTextureLoadCount=function(t){this.textureLoadCount+=t},t.prototype.incrementVboLoadCount=function(t){this.vboLoadCount+=t},t}),i("render/FramebufferTexture",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(t,e){"use strict";var i=function(i,r,n,o){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"FramebufferTexture","constructor","missingGlContext"));if(r<0||n<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"FramebufferTexture","constructor","The framebuffer width or height is less than zero."));this.width=r,this.height=n,this.depth=o,this.size=r*n*4+(o?r*n*2:0),this.framebufferId=i.createFramebuffer(),i.bindFramebuffer(i.FRAMEBUFFER,this.framebufferId),this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,r,n,0,i.RGBA,i.UNSIGNED_BYTE,null),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.texture,0),this.depthBuffer=null,o&&(this.depthBuffer=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,this.depthBuffer),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_COMPONENT16,r,n),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,this.depthBuffer));var s=i.checkFramebufferStatus(i.FRAMEBUFFER);s!=i.FRAMEBUFFER_COMPLETE&&(e.logMessage(e.LEVEL_WARNING,"FramebufferTexture","constructor","Error creating framebuffer: "+s),this.framebufferId=null,this.texture=null,this.depthBuffer=null),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindRenderbuffer(i.RENDERBUFFER,null),i.bindTexture(i.TEXTURE_2D,null)};return i.prototype.bind=function(t){return this.texture&&t.currentGlContext.bindTexture(gl.TEXTURE_2D,this.texture),!!this.texture},i}),i("render/FramebufferTile",["../error/ArgumentError","../render/FramebufferTexture","../util/Logger","../geom/Matrix","../geom/Rectangle","../render/TextureTile"],function(t,e,i,r,n,o){"use strict";var s=function(e,n,s,a,l){if(!l||l.length<1)throw new t(i.logMessage(i.LEVEL_SEVERE,"FramebufferTile","constructor","The specified cache name is null, undefined or zero length."));o.call(this,e,n,s,a),this.gpuCacheKey=l,this.textureTransform=r.fromIdentity().setToUnitYFlip(),this.mustClear=!0};return s.prototype=Object.create(o.prototype),s.prototype.clearFramebuffer=function(t){this.mustClear=!0},s.prototype.bindFramebuffer=function(t){var e=t.gpuResourceCache.resourceForKey(this.gpuCacheKey);return e||(e=this.createFramebuffer(t)),t.bindFramebuffer(e),this.mustClear&&(this.doClearFramebuffer(t),this.mustClear=!1),!0},s.prototype.createFramebuffer=function(t){var i=new e(t.currentGlContext,this.tileWidth,this.tileHeight,!1);return t.gpuResourceCache.putResource(this.gpuCacheKey,i,i.size),i},s.prototype.doClearFramebuffer=function(t){var e=t.currentGlContext;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},s.prototype.applyInternalTransform=function(t,e){e.multiplyMatrix(this.textureTransform)},s}),i("render/FramebufferTileController",["../error/ArgumentError","../render/FramebufferTile","../util/LevelSet","../geom/Location","../util/Logger","../cache/MemoryCache","../geom/Sector","../util/Tile"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(){this.tileWidth=256,this.tileHeight=256,this.detailControl=1.75,this.levels=new i(s.FULL_SPHERE,new r(45,45),16,this.tileWidth,this.tileHeight),this.topLevelTiles=[],this.currentTiles=[],this.currentTimestamp=null,this.currentGlobeStateKey=null,this.tileCache=new o(5e5,4e5),this.key="FramebufferTileController "+ ++l.keyPool};return l.keyPool=0,l.prototype.selectTiles=function(e,i){if(!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"FramebufferTileController","selectTiles","missingSector"));this.assembleTiles(e);for(var r=[],o=0,s=this.currentTiles.length;o=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},l}),i("globe/ElevationImage",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(t,e,i){"use strict";var r=function(i,r,n,o){if(!i||i.length<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","constructor","The specified image path is null, undefined or zero length."));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","constructor","missingSector"));this.sector=r,this.imagePath=i,this.imageWidth=n,this.imageHeight=o,this.size=this.imageWidth*this.imageHeight};return r.prototype.pixel=function(t,e){return t<0||t>=this.imageWidth?0:e<0||e>=this.imageHeight?0:(e=this.imageHeight-e-1,this.imageData[t+e*this.imageWidth])},r.prototype.elevationAtLocation=function(t,e){var r=this.sector.maxLatitude,n=this.sector.minLongitude,o=this.sector.deltaLatitude(),s=this.sector.deltaLongitude(),a=(this.imageWidth-1)*(e-n)/s,l=(this.imageHeight-1)*(r-t)/o,h=Math.floor(i.clamp(a,0,this.imageWidth-1)),u=Math.floor(i.clamp(h+1,0,this.imageWidth-1)),c=Math.floor(i.clamp(l,0,this.imageHeight-1)),d=Math.floor(i.clamp(c+1,0,this.imageHeight-1)),p=this.imageData,f=p[h+c*this.imageWidth],g=p[u+c*this.imageWidth],m=p[h+d*this.imageWidth],E=p[u+d*this.imageWidth],y=a-h,_=l-c;return(1-y)*(1-_)*f+y*(1-_)*g+(1-y)*_*m+y*_*E},r.prototype.elevationsForGrid=function(r,n,o,s){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","missingSector"));if(n<1||o<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","The specified number of sample points is less than 1."));if(!s)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","missingResult"));var a,l,h,u,c=this.sector.minLatitude,d=this.sector.maxLatitude,p=this.sector.minLongitude,f=this.sector.maxLongitude,g=d-c,m=f-p,E=r.minLatitude,y=r.maxLatitude,_=r.minLongitude,v=r.maxLongitude,S=(y-E)/(n>1?n-1:1),b=(v-_)/(o>1?o-1:1),T=0,L=this.imageData;for(u=0,a=E;u=c&&a<=d){var w=(this.imageHeight-1)*(d-a)/g,R=Math.floor(i.clamp(w,0,this.imageHeight-1)),x=Math.floor(i.clamp(R+1,0,this.imageHeight-1)),M=w-R;for(h=0,l=_;h=p&&l<=f){var C=(this.imageWidth-1)*(l-p)/m,A=Math.floor(i.clamp(C,0,this.imageWidth-1)),P=Math.floor(i.clamp(A+1,0,this.imageWidth-1)),I=C-A,O=L[A+R*this.imageWidth],N=L[P+R*this.imageWidth],D=L[A+x*this.imageWidth],k=L[P+x*this.imageWidth];s[T]=(1-I)*(1-M)*O+I*(1-M)*N+(1-I)*M*D+I*M*k}T++}}else T+=o},r.prototype.minAndMaxElevationsForSector=function(t){var e=[];if(t)if(t.contains(this.sector))e[0]>this.minElevation&&(e[0]=this.minElevation),e[1]v&&(m=v),Em&&(e[0]=m),e[1]0){this.minElevation=Number.MAX_VALUE,this.maxElevation=-this.minElevation;for(var t=this.imageData,e=this.imageWidth*this.imageHeight,i=0;ir&&(this.minElevation=r),this.maxElevationo&&(l=o),a=n.maxElevation,h=0;u--){if((i=this.tileCache.entryForKey(u+"."+s+"."+a))&&(l=i.image()))return l.elevationAtLocation(t,e);s=Math.floor(s/2),a=Math.floor(a/2)}return 0},c.prototype.pointElevationsForGrid=function(t,e,i,r,n){var o,s=0;if(this.assembleTiles(r,t,!0),0===this.currentTiles.length)return 0;this.currentTiles.sort(function(t,e){return t.level.levelNumber-e.level.levelNumber});for(var a=0,l=this.currentTiles.length;a1?e-1:1),m=t.deltaLongitude()/(i>1?i-1:1),E=0;for(h=0,o=c;h=0;T--)if(o=this.levels.level(T),s=Math.round(360*o.tileWidth/o.tileDelta.longitude),a=Math.round(180*o.tileHeight/o.tileDelta.latitude),l=1/(2*a),h=1-l,c=0,d=a-1,p=s*u.fract(t),f=a*u.clamp(e,l,h),g=u.mod(Math.floor(p-.5),s),m=u.mod(g+1,s),E=u.clamp(Math.floor(f-.5),c,d),y=u.clamp(E+1,c,d),_=u.fract(p-.5),v=u.fract(f-.5),S=T==i||0==T,this.lookupPixels(g,m,E,y,o,S,b))return void(r[n]=(1-_)*(1-v)*b[0]+_*(1-v)*b[1]+(1-_)*v*b[2]+_*v*b[3])},c.prototype.lookupPixels=function(t,e,i,r,n,o,s){var a,l,h,u,c=n.levelNumber,d=n.tileWidth,p=n.tileHeight,f=Math.floor(i/p),g=Math.floor(r/p),m=Math.floor(t/d),E=Math.floor(e/d);return f==g&&f==this.cachedRow&&m==E&&m==this.cachedCol?a=l=h=u=this.cachedImage:f==g&&m==E?(a=this.lookupImage(c,f,m,o),l=h=u=a,this.cachedRow=f,this.cachedCol=m,this.cachedImage=a):(a=this.lookupImage(c,f,m,o),l=this.lookupImage(c,f,E,o),h=this.lookupImage(c,g,m,o),u=this.lookupImage(c,g,E,o)),!!(a&&l&&h&&u)&&(s[0]=a.pixel(t%d,i%p),s[1]=l.pixel(e%d,i%p),s[2]=h.pixel(t%d,r%p),s[3]=u.pixel(e%d,r%p),!0)},c.prototype.lookupImage=function(t,e,i,r){var n=this.tileForLevel(t,e,i),o=n.image();return null==o&&r&&this.retrieveTileImage(n),o},c.prototype.createTile=function(t,e,i,r){var o=this.cachePath+"/"+e.levelNumber+"/"+i+"/"+i+"_"+r+".bil";return new n(t,e,i,r,o,this.imageCache)},c.prototype.assembleTiles=function(t,e,i){if(this.currentTiles=[],this.currentSector.copy(e),this.currentSector.intersection(this.coverageSector),!this.currentSector.isEmpty())for(var r=t.tileDelta.latitude,n=t.tileDelta.longitude,o=h.computeRow(r,this.currentSector.minLatitude),s=h.computeLastRow(r,this.currentSector.maxLatitude),a=h.computeColumn(n,this.currentSector.minLongitude),l=h.computeLastColumn(n,this.currentSector.maxLongitude),u=o;u<=s;u++)for(var c=a;c<=l;c++)this.addTileOrAncestor(t,u,c,i)},c.prototype.addTileOrAncestor=function(t,e,i,r){var n=this.tileForLevel(t.levelNumber,e,i);this.isTileImageInMemory(n)?this.addToCurrentTiles(n):(r&&this.retrieveTileImage(n),t.isFirstLevel()?this.currentTiles.push(n):this.addAncestor(t,e,i,r))},c.prototype.addAncestor=function(t,e,i,r){for(var n=null,o=Math.floor(e/2),s=Math.floor(i/2),a=t.levelNumber-1;a>=0;a--){if(n=this.tileForLevel(a,o,s),this.isTileImageInMemory(n))return void this.addToCurrentTiles(n);o=Math.floor(o/2),s=Math.floor(s/2)}this.addToCurrentTiles(n),r&&this.retrieveTileImage(n)},c.prototype.addToCurrentTiles=function(t){this.currentTiles.push(t)},c.prototype.tileForLevel=function(t,e,i){var r=t+"."+e+"."+i,n=this.tileCache.entryForKey(r);if(n)return n;var o=this.levels.level(t),s=h.computeSector(o,e,i);return n=this.createTile(s,o,e,i),this.tileCache.putEntry(r,n,n.size()),n},c.prototype.isTileImageInMemory=function(t){return this.imageCache.containsKey(t.imagePath)},c.prototype.resourceUrlForTile=function(t){return this.urlBuilder.urlForTile(t,this.retrievalImageFormat)},c.prototype.retrieveTileImage=function(t){if(this.currentRetrievals.indexOf(t.imagePath)<0){var e=this.resourceUrlForTile(t,this.retrievalImageFormat),i=new XMLHttpRequest,r=this;if(!e)return;i.open("GET",e,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){if(4===i.readyState){r.removeFromCurrentRetrievals(t.imagePath);var n=i.getResponseHeader("content-type");if(200===i.status)if(n===r.retrievalImageFormat||"text/plain"===n||"application/octet-stream"===n){s.log(s.LEVEL_INFO,"Elevations retrieval succeeded: "+e),r.loadElevationImage(t,i),r.absentResourceList.unmarkResourceAbsent(t.imagePath);var o=document.createEvent("Event");o.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(o)}else"text/xml"===n?(r.absentResourceList.markResourceAbsent(t.imagePath),s.log(s.LEVEL_WARNING,"Elevations retrieval failed ("+i.statusText+"): "+e+".\n "+String.fromCharCode.apply(null,new Uint8Array(i.response)))):(r.absentResourceList.markResourceAbsent(t.imagePath),s.log(s.LEVEL_WARNING,"Elevations retrieval failed: "+e+". Unexpected content type "+n));else r.absentResourceList.markResourceAbsent(t.imagePath),s.log(s.LEVEL_WARNING,"Elevations retrieval failed ("+i.statusText+"): "+e)}},i.onerror=function(){r.removeFromCurrentRetrievals(t.imagePath),r.absentResourceList.markResourceAbsent(t.imagePath),s.log(s.LEVEL_WARNING,"Elevations retrieval failed: "+e)},i.ontimeout=function(){r.removeFromCurrentRetrievals(t.imagePath),r.absentResourceList.markResourceAbsent(t.imagePath),s.log(s.LEVEL_WARNING,"Elevations retrieval timed out: "+e)},i.send(null),this.currentRetrievals.push(t.imagePath)}},c.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},c.prototype.loadElevationImage=function(t,e){var i=new r(t.imagePath,t.sector,t.tileWidth,t.tileHeight);"application/bil16"==this.retrievalImageFormat?(i.imageData=new Int16Array(e.response),i.size=2*i.imageData.length):"application/bil32"==this.retrievalImageFormat&&(i.imageData=new Float32Array(e.response),i.size=4*i.imageData.length),i.imageData&&(i.findMinAndMaxElevation(),this.imageCache.putEntry(t.imagePath,i,i.size),this.timestamp=Date.now())},c}),i("projections/GeographicProjection",["../error/ArgumentError","../util/Logger","../geom/Sector","../error/UnsupportedOperationError"],function(t,e,i,r){"use strict";var n=function(t,e,i){this.displayName=t||"Geographic Projection",this.continuous=e,this.projectionLimits=i,this.is2D=!0};return n.prototype.geographicToCartesian=function(t,i,n,o,s,a){throw new r(e.logMessage(e.LEVEL_SEVERE,"GeographicProjection","geographicToCartesian","abstractInvocation"))},n.prototype.geographicToCartesianGrid=function(t,i,n,o,s,a,l,h){throw new r(e.logMessage(e.LEVEL_SEVERE,"GeographicProjection","geographicToCartesianGrid","abstractInvocation"))},n.prototype.cartesianToGeographic=function(t,i,n,o,s,a){throw new r(e.logMessage(e.LEVEL_SEVERE,"GeographicProjection","cartesianToGeographic","abstractInvocation"))},n.prototype.northTangentAtLocation=function(i,r,n,o){if(!o)throw new t(e.logMessage(e.LEVEL_SEVERE,"ProjectionEquirectangular","northTangentAtLocation","missingResult"));return o[0]=0,o[1]=1,o[2]=0,o},n.prototype.northTangentAtPoint=function(i,r,n,o,s,a){if(!a)throw new t(e.logMessage(e.LEVEL_SEVERE,"ProjectionEquirectangular","northTangentAtPoint","missingResult"));return a[0]=0,a[1]=1,a[2]=0,a},n.prototype.surfaceNormalAtPoint=function(i,r,n,o,s){if(!s)throw new t(e.logMessage(e.LEVEL_SEVERE,"GeographicProjection","surfaceNormalAtPoint","missingResult"));return s[0]=0,s[1]=0,s[2]=1,s},n}),i("projections/ProjectionWgs84",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Position","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(){i.call(this,"WGS84",!1,null),this.is2D=!1,this.scratchPosition=new n(0,0,0)};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{stateKey:{get:function(){return"projection wgs84 "}}}),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionWgs84","geographicToCartesian","missingGlobe"));var h=Math.cos(n*t.DEGREES_TO_RADIANS),u=Math.sin(n*t.DEGREES_TO_RADIANS),c=Math.cos(o*t.DEGREES_TO_RADIANS),d=Math.sin(o*t.DEGREES_TO_RADIANS),p=i.equatorialRadius/Math.sqrt(1-i.eccentricitySquared*u*u);return l[0]=(p+s)*h*d,l[1]=(p*(1-i.eccentricitySquared)+s)*u,l[2]=(p+s)*h*c,l},a.prototype.geographicToCartesianGrid=function(i,n,s,a,l,h,u,c){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionWgs84","geographicToCartesianGrid","missingGlobe"));var d,p,f,g,m,E,y,_,v=n.minLatitude*t.DEGREES_TO_RADIANS,S=n.maxLatitude*t.DEGREES_TO_RADIANS,b=n.minLongitude*t.DEGREES_TO_RADIANS,T=n.maxLongitude*t.DEGREES_TO_RADIANS,L=(S-v)/(s>1?s-1:1),w=(T-b)/(a>1?a-1:1),R=h||new o(0,0,0),x=0,M=0,C=new Float64Array(a),A=new Float64Array(a);for(p=0,g=b;p0||0!=D?(V>0?(p=Math.sqrt(V),f=Math.sqrt(O*N*D),V>10*I?(g=s.cbrt((p+f)*(p+f)),d=k+.5*g+2*k*k/g):d=k+.5*s.cbrt((p+f)*(p+f))+.5*s.cbrt((p-f)*(p-f))):(p=Math.sqrt(-V),f=Math.sqrt(-8*k*k*k),g=Math.sqrt(O*N*D),m=2*Math.atan2(g,p+f)/3,d=-4*k*Math.sin(m)*Math.cos(Math.PI/6+m)),E=Math.sqrt(d*d+O*D),y=I*(d+E-D)/(2*E),_=(d+E)/(Math.sqrt(y*y+d+E)+y),v=_*C/(_+I),S=Math.sqrt(v*v+x*x),u=(_+I-1)*S/_, c=2*Math.atan2(x,S+v)):(p=Math.sqrt(1-I),f=Math.sqrt(I-N),b=Math.sqrt(I),u=-A*p*f/b,c=f/(b*f+p*Math.sqrt(N))),L=Math.sqrt(2),T=(L-1)*R1)&&(l=.5*l+.5,h=.5*h+.5,u=.5*u+.5,l=l*d.width+d.x,h=h*d.height+d.y,i[0]=l,i[1]=h,i[2]=u,!0))},h.prototype.projectWithDepth=function(e,i,n){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","projectWithDepth","missingPoint"));if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","projectWithDepth","missingResult"));var o=e[0],s=e[1],a=e[2],h=this.modelview,u=h[0]*o+h[1]*s+h[2]*a+h[3],c=h[4]*o+h[5]*s+h[6]*a+h[7],d=h[8]*o+h[9]*s+h[10]*a+h[11],p=h[12]*o+h[13]*s+h[14]*a+h[15],f=this.projection,g=f[0]*u+f[1]*c+f[2]*d+f[3]*p,m=f[4]*u+f[5]*c+f[6]*d+f[7]*p,E=f[8]*u+f[9]*c+f[10]*d+f[11]*p,y=f[12]*u+f[13]*c+f[14]*d+f[15]*p,_=this.viewport;return 0!==y&&(g/=y,m/=y,!((E/=y)<-1||E>1)&&(E=f[8]*u+f[9]*c+f[10]*d*(1+i)+f[11]*p,E/=y,E=l.clamp(E,-1,1),g=.5*g+.5,m=.5*m+.5,E=.5*E+.5,g=g*_.width+_.x,m=m*_.height+_.y,n[0]=g,n[1]=m,n[2]=E,!0))},h.prototype.unProject=function(e,i){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","unProject","missingPoint"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","unProject","missingResult"));var n=e[0],o=e[1],s=e[2],a=this.viewport;if(n=(n-a.x)/a.width,o=(o-a.y)/a.height,n=2*n-1,o=2*o-1,(s=2*s-1)<-1||s>1)return!1;var l=this.modelviewProjectionInv,h=l[0]*n+l[1]*o+l[2]*s+l[3],u=l[4]*n+l[5]*o+l[6]*s+l[7],c=l[8]*n+l[9]*o+l[10]*s+l[11],d=l[12]*n+l[13]*o+l[14]*s+l[15];return 0!==d&&(i[0]=h/d,i[1]=u/d,i[2]=c/d,!0)},h.prototype.convertPointToWindow=function(e,i){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToWindow","missingPoint"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToWindow","missingResult"));return i[0]=e[0],i[1]=this.viewport.height-e[1],i},h.prototype.convertPointToViewport=function(e,i){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToViewport","missingPoint"));if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","convertPointToViewport","missingResult"));return i[0]=e[0],i[1]=this.viewport.height-e[1],i},h.prototype.rayFromScreenPoint=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"NavigatorState","rayFromScreenPoint","missingPoint"));var n=this.convertPointToViewport(e,new a(0,0,0)),o=new a(0,0,0),s=new a(0,0,0);if(!this.unProject(n,o))return null;if(n[2]=1,!this.unProject(n,s))return null;var l=new a(this.eyePoint[0],this.eyePoint[1],this.eyePoint[2]),h=new a(s[0],s[1],s[2]);return h.subtract(o),h.normalize(),new i(l,h)},h.prototype.pixelSizeAtDistance=function(t){return this.pixelSizeScale*t+this.pixelSizeOffset},h}),i("globe/Terrain",["../error/ArgumentError","../util/Logger","../geom/Vec3"],function(t,e,i){"use strict";var r=function(t,e,i,r){this.globe=t,this.verticalExaggeration=r,this.sector=i.sector,this.tessellator=e,this.surfaceGeometry=i.tileArray,this.stateKey=t.stateKey+" ve "+r.toString()};return r.scratchPoint=new i(0,0,0),r.prototype.surfacePoint=function(i,n,o,s){if(!s)throw new t(e.logMessage(e.LEVEL_SEVERE,"Terrain","surfacePoint","missingResult"));for(var a=0,l=this.surfaceGeometry.length;af?(n[0]=c[0]+p*(c[3]-c[0])+f*(c[6]-c[0]),n[1]=c[1]+p*(c[4]-c[1])+f*(c[7]-c[1]),n[2]=c[2]+p*(c[5]-c[2])+f*(c[8]-c[2])):(n[0]=c[9]+(1-p)*(c[6]-c[9])+(1-f)*(c[3]-c[9]),n[1]=c[10]+(1-p)*(c[7]-c[10])+(1-f)*(c[4]-c[10]),n[2]=c[11]+(1-p)*(c[8]-c[11])+(1-f)*(c[5]-c[11])),n[0]+=this.referencePoint[0],n[1]+=this.referencePoint[1],n[2]+=this.referencePoint[2],n},n.prototype.update=function(t){r.prototype.update.call(this,t);var e=t.globe.elevationTimestamp();this._elevationTimestamp!=e&&(this._elevationTimestamp=e,this._stateKey=null)},n.prototype.computeStateKey=function(){var t=[];return t.push(this._elevationTimestamp),t.push(this.neighborMap[WorldWind.NORTH]?this.neighborMap[WorldWind.NORTH].compare(this.level):0),t.push(this.neighborMap[WorldWind.SOUTH]?this.neighborMap[WorldWind.SOUTH].compare(this.level):0),t.push(this.neighborMap[WorldWind.EAST]?this.neighborMap[WorldWind.EAST].compare(this.level):0),t.push(this.neighborMap[WorldWind.WEST]?this.neighborMap[WorldWind.WEST].compare(this.level):0),t.join(".")},n}),i("globe/TerrainTileList",["../error/ArgumentError","../util/Logger","../geom/Sector"],function(t,e,i){"use strict";var r=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"TerrainTileList","TerrainTileList","missingTessellator"));this.tessellator=i,this.sector=null,this.tileArray=[]};return Object.defineProperties(r.prototype,{length:{get:function(){return this.tileArray.length}}}),r.prototype.addTile=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"TerrainTileList","addTile","missingTile"));-1==this.tileArray.indexOf(r)&&(this.tileArray.push(r),this.sector?this.sector.union(r.sector):(this.sector=new i(0,0,0,0),this.sector.copy(r.sector)))},r.prototype.removeAllTiles=function(){this.tileArray=[],this.sector=null},r}),i("globe/Tessellator",["../error/ArgumentError","../shaders/BasicProgram","../globe/Globe","../shaders/GpuProgram","../util/Level","../util/LevelSet","../geom/Location","../util/Logger","../geom/Matrix","../cache/MemoryCache","../navigate/NavigatorState","../error/NotYetImplementedError","../pick/PickedObject","../geom/Position","../geom/Rectangle","../geom/Sector","../globe/Terrain","../globe/TerrainTile","../globe/TerrainTileList","../util/Tile","../util/WWMath","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S){"use strict";var b=function(){this.numRowsTilesInTopLevel=4,this.numColumnsTilesInTopLevel=8,this.maximumSubdivisionDepth=15,this.tileWidth=32,this.tileHeight=32,this.detailControl=40,this.levels=new o(g.FULL_SPHERE,new s(180/this.numRowsTilesInTopLevel,360/this.numColumnsTilesInTopLevel),this.maximumSubdivisionDepth,this.tileWidth,this.tileHeight),this.topLevelTiles={},this.currentTiles=new y(this),this.tileCache=new h(5e6,4e6),this.elevationTimestamp=void 0,this.lastModelViewProjection=void 0,this.vertexPointLocation=-1,this.vertexTexCoordLocation=-1,this.texCoords=null,this.texCoordVboCacheKey="global_tex_coords",this.indices=null,this.indicesVboCacheKey="global_indices",this.baseIndices=null,this.baseIndicesOffset=null,this.numBaseIndices=null,this.indicesNorth=null,this.indicesNorthOffset=null,this.numIndicesNorth=null,this.indicesSouth=null,this.indicesSouthOffset=null,this.numIndicesSouth=null,this.indicesWest=null,this.indicesWestOffset=null,this.numIndicesWest=null,this.indicesEast=null,this.indicesEastOffset=null,this.numIndicesEast=null,this.indicesLoresNorth=null,this.indicesLoresNorthOffset=null,this.numIndicesLoresNorth=null,this.indicesLoresSouth=null,this.indicesLoresSouthOffset=null,this.numIndicesLoresSouth=null,this.indicesLoresWest=null,this.indicesLoresWestOffset=null,this.numIndicesLoresWest=null,this.indicesLoresEast=null,this.indicesLoresEastOffset=null,this.numIndicesLoresEast=null,this.outlineIndicesOffset=null,this.numOutlineIndices=null,this.wireframeIndicesOffset=null,this.numWireframeIndices=null,this.scratchMatrix=l.fromIdentity(),this.scratchElevations=null,this.scratchPrevElevations=null,this.corners={},this.tiles=[]};return b.prototype.tessellate=function(e){if(!e)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","tessellate","missingDC"));var i=e.globe.elevationTimestamp();if(this.lastGlobeStateKey===e.globeStateKey&&this.lastVerticalExaggeration===e.verticalExaggeration&&this.elevationTimestamp===i&&this.lastModelViewProjection&&e.navigatorState.modelviewProjection.equals(this.lastModelViewProjection))return this.lastTerrain;var r=e.navigatorState;this.lastModelViewProjection=r.modelviewProjection,this.lastGlobeStateKey=e.globeStateKey,this.elevationTimestamp=i,this.lastVerticalExaggeration=e.verticalExaggeration,this.currentTiles.removeAllTiles(),this.topLevelTiles[e.globeStateKey]&&0!=this.topLevelTiles[e.globeStateKey].length||this.createTopLevelTiles(e),this.corners={},this.tiles=[];for(var n=0,o=this.topLevelTiles[e.globeStateKey].length;n=0){var n=r.resourceForKey(this.texCoordVboCacheKey);i.bindBuffer(i.ARRAY_BUFFER,n),i.vertexAttribPointer(this.vertexTexCoordLocation,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(this.vertexTexCoordLocation)}var o=r.resourceForKey(this.indicesVboCacheKey);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,o)},b.prototype.endRendering=function(t){var e=t.currentGlContext;e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.vertexPointLocation>=0&&e.disableVertexAttribArray(this.vertexPointLocation),this.vertexTexCoordLocation>=0&&e.disableVertexAttribArray(this.vertexTexCoordLocation)},b.prototype.beginRenderingTile=function(e,i){if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","beginRenderingTile","missingTile"));var r=e.currentGlContext,n=e.gpuResourceCache;this.scratchMatrix.setToMultiply(e.navigatorState.modelviewProjection,i.transformationMatrix),e.currentProgram.loadModelviewProjection(r,this.scratchMatrix);var o=e.globeStateKey+i.tileKey,s=n.resourceForKey(o);s?i.pointsVboStateKey!=i.pointsStateKey?(r.bindBuffer(r.ARRAY_BUFFER,s),r.bufferSubData(r.ARRAY_BUFFER,0,i.points),i.pointsVboStateKey=i.pointsStateKey):e.currentGlContext.bindBuffer(r.ARRAY_BUFFER,s):(s=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,s),r.bufferData(r.ARRAY_BUFFER,i.points,r.STATIC_DRAW),e.frameStatistics.incrementVboLoadCount(1),n.putResource(o,s,4*i.points.length),i.pointsVboStateKey=i.pointsStateKey),r.vertexAttribPointer(this.vertexPointLocation,3,r.FLOAT,!1,0,0)},b.prototype.endRenderingTile=function(t,e){},b.prototype.renderTile=function(e,i){if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","renderTile","missingTile"));var r=e.currentGlContext,n=r.TRIANGLE_STRIP;r.drawElements(n,this.numBaseIndices,r.UNSIGNED_SHORT,2*this.baseIndicesOffset);var o,s=i.level;o=i.neighborLevel(WorldWind.NORTH),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresNorth,r.UNSIGNED_SHORT,2*this.indicesLoresNorthOffset):r.drawElements(n,this.numIndicesNorth,r.UNSIGNED_SHORT,2*this.indicesNorthOffset),o=i.neighborLevel(WorldWind.SOUTH),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresSouth,r.UNSIGNED_SHORT,2*this.indicesLoresSouthOffset):r.drawElements(n,this.numIndicesSouth,r.UNSIGNED_SHORT,2*this.indicesSouthOffset),o=i.neighborLevel(WorldWind.WEST),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresWest,r.UNSIGNED_SHORT,2*this.indicesLoresWestOffset):r.drawElements(n,this.numIndicesWest,r.UNSIGNED_SHORT,2*this.indicesWestOffset),o=i.neighborLevel(WorldWind.EAST),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresEast,r.UNSIGNED_SHORT,2*this.indicesLoresEastOffset):r.drawElements(n,this.numIndicesEast,r.UNSIGNED_SHORT,2*this.indicesEastOffset)},b.prototype.renderWireframeTile=function(e,i){if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","renderWireframeTile","missingTile"));var r=e.currentGlContext;this.vertexTexCoordLocation>=0&&r.disableVertexAttribArray(this.vertexTexCoordLocation),r.drawElements(r.LINES,this.numWireframeIndices,r.UNSIGNED_SHORT,2*this.wireframeIndicesOffset)},b.prototype.renderTileOutline=function(e,i){if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","renderTileOutline","missingTile"));var r=e.currentGlContext;this.vertexTexCoordLocation>=0&&r.disableVertexAttribArray(this.vertexTexCoordLocation),r.drawElements(r.LINE_LOOP,this.numOutlineIndices,r.UNSIGNED_SHORT,2*this.outlineIndicesOffset)},b.prototype.pick=function(e,i,r){if(!e)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","pick","missingDc"));if(!i)throw new t(a.logMessage(a.LEVEL_SEVERE,"Tessellator","pick","missingList"));for(var n=null,o=r||this,s=new p(0,0,0),l=[],h=0,u=i.length;ha&&(s=a,o=r)}return i[o]},b.prototype.computeIntersections=function(t,e,i){var r,n,o=e.level,s=e.points,a=i.length;t.origin.subtract(e.referencePoint),this.buildSharedGeometry(e),n=this.baseIndices,v.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.SOUTH),n=r&&r.compare(o)<0?this.indicesLoresSouth:this.indicesSouth,v.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.WEST),n=r&&r.compare(o)<0?this.indicesLoresWest:this.indicesWest,v.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.EAST),n=r&&r.compare(o)<0?this.indicesLoresEast:this.indicesEast,v.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.NORTH),n=r&&r.compare(o)<0?this.indicesLoresNorth:this.indicesNorth,v.computeTriStripIntersections(t,s,n,i),t.origin.add(e.referencePoint);for(var l=a,h=i.length;l0){for(this.tiles=[],this.corners={},i=0,r=f.length;i=0?this.tiles[u].level:null),t.setNeighborLevel(WorldWind.SOUTH,c>=0?this.tiles[c].level:null),t.setNeighborLevel(WorldWind.EAST,d>=0?this.tiles[d].level:null),t.setNeighborLevel(WorldWind.WEST,p>=0?this.tiles[p].level:null)},b.prototype.isTileVisible=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&e.extent.intersectsFrustum(t.navigatorState.frustumInModelCoordinates)},b.prototype.tileMeetsRenderCriteria=function(t,e){var i=this.detailControl;return(e.sector.minLatitude>=75||e.sector.maxLatitude<=-75)&&(i*=2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},b.prototype.regenerateTileGeometryIfNeeded=function(t,e){var i=t.globeStateKey+e.stateKey+t.verticalExaggeration;e.points&&e.pointsStateKey==i||(this.regenerateTileGeometry(t,e),e.pointsStateKey=i)},b.prototype.regenerateTileGeometry=function(t,e){var i=e.tileHeight+1,r=e.tileWidth+1,n=e.referencePoint,o=this.scratchElevations;o||(o=new Float64Array(i*r),this.scratchElevations=o),e.points||(e.points=new Float32Array(i*r*3)),S.fillArray(o,0),t.globe.elevationsForGrid(e.sector,i,r,e.texelSize,o),this.mustAlignNeighborElevations(t,e)&&this.alignNeighborElevations(t,e,o),S.multiplyArray(o,t.verticalExaggeration),t.globe.computePointsForGrid(e.sector,i,r,o,n,e.points),e.transformationMatrix.setTranslation(n[0],n[1],n[2])},b.prototype.mustAlignNeighborElevations=function(t,e){var i=e.level,r=e.neighborLevel(WorldWind.NORTH),n=e.neighborLevel(WorldWind.SOUTH),o=e.neighborLevel(WorldWind.EAST),s=e.neighborLevel(WorldWind.WEST);return r&&r.compare(i)<0||n&&n.compare(i)<0||o&&o.compare(i)<0||s&&s.compare(i)<0},b.prototype.alignNeighborElevations=function(t,e,i){var r,n,o,s,a=e.tileHeight+1,l=e.tileWidth+1,h=e.level,u=Math.floor(a/2)+1,c=Math.floor(l/2)+1,d=h.previousLevel(),p=this.scratchPrevElevations;if(p||(p=new Float64Array(u*c),this.scratchPrevElevations=p),S.fillArray(p,0),t.globe.elevationsForGrid(e.sector,u,c,d.texelSize,p),(r=e.neighborLevel(WorldWind.NORTH))&&r.compare(h)<0)for(o=(a-1)*l,s=(u-1)*c,n=0;n0;l-=1)i=l+h*n,s[a++]=i,s[a++]=i-n;for(l=0,i=l+h*n,s[a++]=i,this.indicesNorthOffset=s.length-o,this.indicesNorth=new Uint16Array(s.slice(this.indicesNorthOffset)),this.numIndicesNorth=o,o=2*n-2,h=0,l=0,i=l+h*n,s[a++]=i,l=1;l0;h-=1)i=l+h*n,s[a++]=i,s[a++]=i+1;for(h=0,i=l+h*n,s[a++]=i,this.indicesWestOffset=s.length-o,this.indicesWest=new Uint16Array(s.slice(this.indicesWestOffset)),this.numIndicesWest=o,o=2*r-2,l=n-1,h=0,i=l+h*n,s[a++]=i,h=1;h0;l-=1)i=(l+1&-2)+h*n,s[a++]=i,i=l+(h-1)*n,s[a++]=i;for(l=0,i=l+h*n,s[a++]=i,this.indicesLoresNorthOffset=s.length-o,this.indicesLoresNorth=new Uint16Array(s.slice(this.indicesLoresNorthOffset)),this.numIndicesLoresNorth=o,o=2*n-2,h=0,l=0,i=l+h*n,s[a++]=i,l=1;l0;h-=1)i=l+(h+1&-2)*n,s[a++]=i,i=l+1+h*n,s[a++]=i;for(h=0,i=l+h*n,s[a++]=i,this.indicesLoresWestOffset=s.length-o,this.indicesLoresWest=new Uint16Array(s.slice(this.indicesLoresWestOffset)),this.numIndicesLoresWest=o,o=2*r-2,l=n-1,h=0,i=l+h*n,s[a++]=i,h=1;h=0;i-=1)n=i+r*s,l[h]=n,h+=1;for(i=0,r=o-1;r>=0;r-=1)n=i+r*s,l[h]=n,h+=1;return this.numOutlineIndices=a,l},b.prototype.cacheSharedGeometryVBOs=function(t){var e=t.currentGlContext,i=t.gpuResourceCache,r=i.resourceForKey(this.texCoordVboCacheKey);r||(r=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,this.texCoords,e.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),i.putResource(this.texCoordVboCacheKey,r,4*this.texCoords.length/2));var n=i.resourceForKey(this.indicesVboCacheKey);n||(n=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),i.putResource(this.indicesVboCacheKey,n,2*this.indices.length))},b}),i("globe/Globe",["../geom/Angle","../error/ArgumentError","../geom/BoundingBox","../globe/ElevationModel","../geom/Line","../geom/Location","../util/Logger","../geom/Position","../projections/ProjectionWgs84","../geom/Sector","../globe/Tessellator","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t,i){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","constructor","Elevation model is null or undefined."));this.elevationModel=t,this.equatorialRadius=6378137,this.polarRadius=6356752.3,this.eccentricitySquared=.00669437999013,this.tessellator=new u,this._projection=i||new l,this._offset=0,this.offsetVector=new c(0,0,0),this.id=++p.idPool,this._stateKey="globe "+this.id.toString()+" "};return p.idPool=0,Object.defineProperties(p.prototype,{stateKey:{get:function(){return this._stateKey+this.elevationModel.stateKey+"offset "+this.offset.toString()+" "+this.projection.stateKey}},continuous:{get:function(){return this.projection.continuous}},projection:{get:function(){return this._projection},set:function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","projection","missingProjection"));this.projection!=t&&(this.tessellator=new u),this._projection=t}},projectionLimits:{get:function(){return this._projection.projectionLimits}},offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.offsetVector[0]=2*t*Math.PI*this.equatorialRadius}}}),p.prototype.is2D=function(){return this.projection.is2D}, p.prototype.computePointFromPosition=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointFromPosition","missingResult"));return this.projection.geographicToCartesian(this,t,i,r,this.offsetVector,n)},p.prototype.computePointFromLocation=function(t,i,r){if(!r)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointFromLocation","missingResult"));return this.computePointFromPosition(t,i,0,r)},p.prototype.computePointsForGrid=function(t,i,r,n,o,a){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointsFromPositions","missingSector"));if(i<1||r<1)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointsFromPositions","Number of latitude or longitude locations is less than one."));var l=i*r;if(!n||n.length180&&(n.longitude-=360)),n},p.prototype.radiusAt=function(e,i){var r=Math.sin(e*t.DEGREES_TO_RADIANS);return this.equatorialRadius/Math.sqrt(1-this.eccentricitySquared*r*r)*Math.sqrt(1+(this.eccentricitySquared*this.eccentricitySquared-2*this.eccentricitySquared)*r*r)},p.prototype.surfaceNormalAtLocation=function(i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","surfaceNormalAtLocation","missingResult"));if(this.is2D())return n[0]=0,n[1]=0,n[2]=1,n;var o=Math.cos(i*t.DEGREES_TO_RADIANS),a=Math.cos(r*t.DEGREES_TO_RADIANS),l=Math.sin(i*t.DEGREES_TO_RADIANS),h=Math.sin(r*t.DEGREES_TO_RADIANS),u=this.equatorialRadius*this.equatorialRadius,c=this.polarRadius*this.polarRadius;return n[0]=o*h/u,n[1]=(1-this.eccentricitySquared)*l/c,n[2]=o*a/u,n.normalize()},p.prototype.surfaceNormalAtPoint=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","surfaceNormalAtPoint","missingResult"));if(this.projection.surfaceNormalAtPoint)return this.projection.surfaceNormalAtPoint(this,t,i,r,n);if(this.is2D())return n[0]=0,n[1]=0,n[2]=1,n;var o=this.equatorialRadius*this.equatorialRadius,a=this.polarRadius*this.polarRadius;return n[0]=t/o,n[1]=i/a,n[2]=r/o,n.normalize()},p.prototype.northTangentAtLocation=function(t,i,r){if(!r)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","northTangentAtLocation","missingResult"));return this.projection.northTangentAtLocation(this,t,i,r)},p.prototype.northTangentAtPoint=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","northTangentAtPoint","missingResult"));return this.projection.northTangentAtPoint(this,t,i,r,this.offsetVector,n)},p.prototype.intersectsFrustum=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectsFrustum","missingFrustum"));if(this.is2D()){var r=new i;return r.setToSector(h.FULL_SPHERE,this,this.elevationModel.minElevation,this.elevationModel.maxElevation),r.intersectsFrustum(t)}return!(t.far.distance<=this.equatorialRadius)&&(!(t.left.distance<=this.equatorialRadius)&&(!(t.right.distance<=this.equatorialRadius)&&(!(t.top.distance<=this.equatorialRadius)&&(!(t.bottom.distance<=this.equatorialRadius)&&!(t.near.distance<=this.equatorialRadius)))))},p.prototype.intersectsLine=function(t,i){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectWithRay","missingLine"));if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectsLine","missingResult"));var r,n=t.direction[0],o=t.direction[1],a=t.direction[2],l=t.origin[0],h=t.origin[1],u=t.origin[2];if(this.is2D())return(0!=a||0==u)&&(!((r=-u/a)<0)&&(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0));var c,d,p,f,g=this.equatorialRadius,m=g*g,E=g/this.polarRadius,y=E*E;return c=n*n+y*o*o+a*a,d=2*(l*n+y*h*o+u*a),p=l*l+y*h*h+u*u-m,!((f=d*d-4*c*p)<0)&&((r=(-d-Math.sqrt(f))/(2*c))>0?(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0):(r=(-d+Math.sqrt(f))/(2*c))>0&&(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0))},p.prototype.elevationTimestamp=function(){return this.elevationModel.timestamp},p.prototype.minElevation=function(){return this.elevationModel.minElevation},p.prototype.maxElevation=function(){return this.elevationModel.maxElevation},p.prototype.minAndMaxElevationsForSector=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","minAndMaxElevationsForSector","missingSector"));return this.elevationModel.minAndMaxElevationsForSector(t)},p.prototype.elevationAtLocation=function(t,e){return this.elevationModel.elevationAtLocation(t,e)},p.prototype.elevationsForGrid=function(t,i,r,n,o){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","elevationsForSector","missingSector"));if(i<=0||r<=0)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","elevationsForSector","numLat or numLon is less than 1"));if(!o||o.length=i)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","constructor","Specified cache low-water value is undefined, negative or not less than the capacity."));this.entries=new n(i,o),this.cacheKeyPool=0,this.currentRetrievals={},this.absentResourceList=new t(3,6e4)};return Object.defineProperties(s.prototype,{capacity:{get:function(){return this.entries.capacity}},lowWater:{get:function(){return this.entries.lowWater}},usedCapacity:{get:function(){return this.entries.usedCapacity}},freeCapacity:{get:function(){return this.entries.freeCapacity}}}),s.prototype.generateCacheKey=function(){return"GpuResourceCache "+ ++this.cacheKeyPool},s.prototype.putResource=function(t,n,o){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","missingKey."));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","missingResource."));if(!o||o<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","The specified resource size is undefined or less than 1."));var s={resource:n};this.entries.putEntry(t instanceof i?t.key:t,s,o)},s.prototype.resourceForKey=function(t){var e=t instanceof i?this.entries.entryForKey(t.key):this.entries.entryForKey(t);return e?e.resource:null},s.prototype.containsResource=function(t){return this.entries.containsKey(t instanceof i?t.key:t)},s.prototype.removeResource=function(t){this.entries.removeEntry(t instanceof i?t.key:t)},s.prototype.clear=function(){this.entries.clear(!1)},s.prototype.retrieveTexture=function(t,e,n){if(!e)return null;if(e instanceof i){var s=new o(t,e.image,n);return this.putResource(e.key,s,s.size),s}if(this.currentRetrievals[e]||this.absentResourceList.isResourceAbsent(e))return null;var a=this,l=new Image;return l.onload=function(){r.log(r.LEVEL_INFO,"Image retrieval succeeded: "+e);var i=new o(t,l,n);a.putResource(e,i,i.size),delete a.currentRetrievals[e],a.absentResourceList.unmarkResourceAbsent(e);var s=document.createEvent("Event");s.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(s)},l.onerror=function(){delete a.currentRetrievals[e],a.absentResourceList.markResourceAbsent(e),r.log(r.LEVEL_WARNING,"Image retrieval failed: "+e)},this.currentRetrievals[e]=e,l.crossOrigin="anonymous",l.src=e,null},s}),i("pick/PickedObjectList",[],function(){"use strict";var t=function(){this.objects=[]};return t.prototype.hasNonTerrainObjects=function(){return this.objects.length>1||1===this.objects.length&&null==this.terrainObject()},t.prototype.terrainObject=function(){for(var t=0,e=this.objects.length;t1)for(var e=0;e0?this.objects[0]:null},t}),i("render/ScreenCreditController",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Font","../util/Logger","../geom/Matrix","../util/Offset","../pick/PickedObject","../render/Renderable","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(){this.imageUrls=[],this.stringCredits=[],this.imageCreditSize=64,this.margin=5,this.opacity=.5,this.creditFont=new r(14)};return c.scratchMatrix=o.fromIdentity(),c.imageTransform=o.fromIdentity(),c.texCoordMatrix=o.fromIdentity(),c.prototype.clear=function(){this.imageUrls=[],this.stringCredits=[]},c.prototype.addImageCredit=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenCreditController","addImageCredit","missingUrl"));-1===this.imageUrls.indexOf(e)&&this.imageUrls.push(e)},c.prototype.addStringCredit=function(e,r){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenCreditController","addStringCredit","missingText"));if(!r)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenCreditController","addStringCredit","missingColor"));-1===this.stringCredits.indexOf(e)&&this.stringCredits.push({text:e,color:r||i.WHITE})},c.prototype.drawCredits=function(t){if((0!==this.imageUrls.length||0!==this.stringCredits.length)&&!t.pickingMode&&t.timestamp!=this.lastFrameTimestamp){this.lastFrameTimestamp=t.timestamp,this.beginDrawingCredits(t);for(var e,i=t.navigatorState.viewport.width-(this.margin+this.imageCreditSize),r=0,n=0;n0&&(i-=this.margin+this.imageCreditSize,r=u.max(e,r));for(var o=r+this.margin,s=0;s=s?this.imageCreditSize/o:this.imageCreditSize/s,c.imageTransform.setTranslation(r,n,0),c.imageTransform.setScale(a*o,a*s,1),h=t.currentGlContext,u=t.currentProgram,c.scratchMatrix.copy(t.screenProjection),c.scratchMatrix.multiplyMatrix(c.imageTransform),u.loadModelviewProjection(h,c.scratchMatrix),u.loadTextureEnabled(h,!0),u.loadColor(h,i.WHITE),u.loadOpacity(h,this.opacity),c.texCoordMatrix.setToIdentity(),c.texCoordMatrix.multiplyByTextureTransform(l),u.loadTextureMatrix(h,c.texCoordMatrix),l.bind(t)&&h.drawArrays(h.TRIANGLE_STRIP,0,4),s):(t.gpuResourceCache.retrieveTexture(t.currentGlContext,e),0)},c.prototype.drawStringCredit=function(t,e,i){var r,n,o,s,a,l,h;return s=e.text+this.creditFont.toString(),o=t.gpuResourceCache.resourceForKey(s),o||(o=t.textSupport.createTexture(t,e.text,this.creditFont,!1),t.gpuResourceCache.putResource(s,o,o.size)),r=o.imageWidth,n=o.imageHeight,h=t.navigatorState.viewport.width-(r+this.margin),c.imageTransform.setTranslation(h,i,0),c.imageTransform.setScale(r,n,1),a=t.currentGlContext,l=t.currentProgram,c.scratchMatrix.copy(t.screenProjection),c.scratchMatrix.multiplyMatrix(c.imageTransform),l.loadModelviewProjection(a,c.scratchMatrix),l.loadTextureEnabled(a,!0),l.loadColor(a,e.color),l.loadOpacity(a,this.opacity),c.texCoordMatrix.setToIdentity(),c.texCoordMatrix.multiplyByTextureTransform(o),l.loadTextureMatrix(a,c.texCoordMatrix),o.bind(t)&&a.drawArrays(a.TRIANGLE_STRIP,0,4),!0},c}),i("util/HashMap",[],function(){"use strict";var t=function(){this._entries=Object.create(null)};return t.prototype.get=function(t){return this._entries[t]},t.prototype.set=function(t,e){this._entries[t]=e},t.prototype.remove=function(t){delete this._entries[t]},t.prototype.contains=function(t){return t in this._entries},t.reIndex=function(e,i,r){var n=new t;for(var o in e._entries){var s=parseInt(o);s>=i&&(s+=r);var a=e.get(o);a.index=s,n.set(s,a)}return n},t}),i("util/PolygonSplitter",["./HashMap","../geom/Location","../geom/Position","./WWMath"],function(t,e,i,r){"use strict";return{addedIndex:-1,poleIndexOffset:-1,splitContours:function(t,e){for(var i=!1,r=0,n=t.length;r1&&(i=!0),e.push(o)}return i},splitContour:function(i){var r=new t,n=[],o=[],s=[],a=[],l=-1,h=this.findIntersectionAndPole(i,n,o,r);return 0===o.length?(s.push(n),a.push(r),this.formatContourOutput(s,h,l,a)):(o.length>2&&o.sort(function(t,e){return e.latitude-t.latitude}),h!==e.poles.NONE&&(n=this.handleOnePole(n,o,r,h),r=this.reindexIntersections(o,r,this.poleIndexOffset)),0===o.length?(s.push(n),a.push(r),l=0,this.formatContourOutput(s,h,l,a)):(this.linkIntersections(o,r),l=this.makePolygons(n,o,r,s,a),this.formatContourOutput(s,h,l,a)))},findIntersectionAndPole:function(t,i,n,o){var s=!1,a=90,l=-90;this.addedIndex=-1;for(var h=0,u=t.length;h0?e.poles.NORTH:i<0?e.poles.SOUTH:Math.abs(i)>=Math.abs(t)?e.poles.NORTH:e.poles.SOUTH},handleOnePole:function(t,i,r,n){var o;if(n===e.poles.NORTH)var s=i.shift(),a=90;else n===e.poles.SOUTH&&(s=i.pop(),a=-90);var l=r.get(s.indexEnd),h=r.get(s.indexStart);l.forPole=!0,h.forPole=!0,this.poleIndexOffset=s.indexStart,o=t.slice(0,s.indexEnd+1);var u=this.createPoint(a,t[l.index].longitude,t[l.index].altitude),c=this.createPoint(a,t[h.index].longitude,t[h.index].altitude);return o.push(u,c),o=o.concat(t.slice(this.poleIndexOffset))},linkIntersections:function(t,e){for(var i=0;i=r&&(e[n].indexEnd+=2),e[n].indexStart>=r&&(e[n].indexStart+=2);return i},makePolygons:function(e,i,r,n,o){for(var s=-1,a=0;aDate.now()},g.prototype.createShapeDataObject=function(){return{}},g.prototype.resetExpiration=function(t){t.expiryTime=Date.now()+this.expirationInterval+1e3*Math.random()},g.prototype.establishCurrentData=function(t){this.currentData=this.shapeDataCache.entryForKey(t.globeStateKey),this.currentData||(this.currentData=this.createShapeDataObject(),this.resetExpiration(this.currentData),this.shapeDataCache.putEntry(t.globeStateKey,this.currentData,1)),this.currentData.isExpired=!this.isShapeDataCurrent(t,this.currentData)},g.prototype.render=function(t){this.enabled&&(this.layer=t.currentLayer,this.prepareBoundaries(t),this.establishCurrentData(t),!this.currentData.isExpired&&this.currentData.extent||(this.computeExtent(t),this.currentData.verticalExaggeration=t.verticalExaggeration,this.resetExpiration(this.currentData)),this.currentData&&this.currentData.extent&&!this.intersectsFrustum(t)||t.surfaceShapeTileBuilder.insertSurfaceShape(this))},g.prototype.interpolateLocations=function(t){var e,i,r,n=t[0],o=n,s=!0,a=!0,l=0,h=!0;for(this._locations=[n],i=1,r=t.length;i2&&(h=!1),h&&this.interpolateEdge(e,o,this._locations),this._locations.push(o),e=o;this._isInteriorInhibited||e.latitude==n.latitude&&e.longitude==n.longitude||(this.interpolateEdge(e,n,this._locations),this._locations.push(n))},g.prototype.interpolateEdge=function(t,e,i){var r,o,s=n.greatCircleDistance(t,e),a=Math.round(this._maximumNumEdgeIntervals*s/Math.PI);if(a>0){r=1/a,o=t;for(var l=this.throttledStep(r,o);l<1;l+=this.throttledStep(r,o))o=new n(0,0),n.interpolateAlongPath(this._pathType,l,t,e,o),180===t.longitude&&180===e.longitude?o.longitude=180:-180===t.longitude&&-180===e.longitude&&(o.longitude=-180),i.push(o)}},g.prototype.throttledStep=function(t,i){var r=Math.cos(i.latitude*e.DEGREES_TO_RADIANS);r*=r;var n=this._polarThrottle/(1+this._polarThrottle);return t*(1-n+n*r)},g.prototype.prepareBoundaries=function(t){if(!this.boundariesArePrepared){this.computeBoundaries(t);var e=this.formatBoundaries();this.normalizeAngles(e),e=this.interpolateBoundaries(e);var i=[],r=h.splitContours(e,i);this.contours=i,this.crossesAntiMeridian=r,this.prepareGeometry(t,i),this.prepareSectors(),this.boundariesArePrepared=!0}},g.prototype.formatBoundaries=function(){var t=[];return this._boundaries.length?(null!=this._boundaries[0].latitude?t.push(this._boundaries):t=this._boundaries,t):t},g.prototype.resetBoundaries=function(){this.boundariesArePrepared=!1,this.shapeDataCache.clear(!1)},g.prototype.normalizeAngles=function(t){for(var i=0,r=t.length;i180)&&(a.longitude=e.normalizedDegreesLongitude(a.longitude)),(a.latitude<-90||a.latitude>90)&&(a.latitude=e.normalizedDegreesLatitude(a.latitude))}},g.prototype.interpolateBoundaries=function(t){for(var e=[],i=0,r=t.length;i0?this._sectors:(this.prepareBoundaries(t),this._sectors)},g.prototype.computeExtent=function(t){if(!this._sectors||0===this._sectors.length)return null;if(!this.currentData)return null;this.currentData.extent||(this.currentData.extent=new r);var e;if(1===this._sectors.length)e=this._sectors[0].computeBoundingPoints(t.globe,t.verticalExaggeration),this.currentData.extent.setToVec3Points(e);else{for(var i=[],n=0;n0?(e.union(a),t.union(a)):a.minLongitude<0?e.union(a):t.union(a)}var l=Math.min(t.minLatitude,e.minLatitude),h=Math.max(t.maxLatitude,t.maxLatitude);this._sector=new c(l,h,-180,180),this._sectors=[t,e]},g.prototype.sectorsNotOverAntiMeridian=function(){this._sector=new c(90,-90,180,-180);for(var t=0,e=this.contours.length;t1?h===l?this.outlineForPole(c,d,r):this.outlineForSplit(c,d,r):a.pole!==n.poles.NONE&&1===u?this.outlineForPole(c,d,r):a.pole===n.poles.NONE&&u>1?this.outlineForSplit(c,d,r):a.pole===n.poles.NONE&&1===u&&r.push(c)}this._interiorGeometry=i,this._outlineGeometry=r},g.prototype.outlineForPole=function(t,e,i){this.containsPole=!0;for(var r=[],n=0,o=0,s=t.length;o0;if(a||h){if(t.pickingMode&&!this.pickColor&&(this.pickColor=t.uniquePickColor()),t.pickingMode)var u=this.pickColor.toHexString();if(this.crossesAntiMeridian||this.containsPole?(a&&(this.draw(this._interiorGeometry,e,i,r,n,o),e.fillStyle=t.pickingMode?u:s.interiorColor.toRGBAString(),e.fill()),h&&(this.draw(this._outlineGeometry,e,i,r,n,o),e.lineWidth=s.outlineWidth,e.strokeStyle=t.pickingMode?u:s.outlineColor.toRGBAString(),e.stroke())):(this.draw(this._interiorGeometry,e,i,r,n,o),a&&(e.fillStyle=t.pickingMode?u:s.interiorColor.toRGBAString(),e.fill()),h&&(e.lineWidth=s.outlineWidth,e.strokeStyle=t.pickingMode?u:s.outlineColor.toRGBAString(),e.stroke())),t.pickingMode){var c=new l(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(c)}}},g.prototype.draw=function(t,e,i,r,n,o){e.beginPath();for(var s=0,a=t.length;s0},a.prototype.getShapes=function(){return this.surfaceShapes}, a.prototype.setShapes=function(t){this.surfaceShapes=t},a.prototype.getSector=function(){return this.sector},a.prototype.addSurfaceShape=function(t){this.surfaceShapes.push(t),this.surfaceShapeStateKeys.push(t.stateKey)},a.prototype.needsUpdate=function(t){var e,i;if(this.surfaceShapes.length!=this.asRenderedSurfaceShapeStateKeys.length)return!0;for(e=0,i=this.surfaceShapes.length;e= 0.0 && coord.x <= 1.0 && coord.y >= 0.0 && coord.y <= 1.0;\n}\nvoid main(void) {\nfloat mask = float(isInsideTextureImage(texMaskCoord));if (modulateColor) {\n gl_FragColor = color * mask * floor(texture2D(texSampler, texSamplerCoord).a + 0.5);\n} else {\n gl_FragColor = texture2D(texSampler, texSamplerCoord) * mask * opacity;\n}\n}"),this.vertexPointLocation=this.attributeLocation(t,"vertexPoint"),this.vertexTexCoordLocation=this.attributeLocation(t,"vertexTexCoord"),this.mvpMatrixLocation=this.uniformLocation(t,"mvpMatrix"),this.colorLocation=this.uniformLocation(t,"color"),this.modulateColorLocation=this.uniformLocation(t,"modulateColor"),this.texSamplerMatrixLocation=this.uniformLocation(t,"texSamplerMatrix"),this.texMaskMatrixLocation=this.uniformLocation(t,"texMaskMatrix"),this.texSamplerLocation=this.uniformLocation(t,"texSampler"),this.opacityLocation=this.uniformLocation(t,"opacity"),this.vertexPointLocation=-1};return n.key="WorldWindGpuSurfaceTileRenderingProgram",n.prototype=Object.create(i.prototype),n.prototype.loadModelviewProjection=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"SurfaceTileRendererProgram","loadModelviewProjection","missingMatrix"));this.loadUniformMatrix(e,i,this.mvpMatrixLocation)},n.prototype.loadTexSamplerMatrix=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"SurfaceTileRendererProgram","loadTexSamplerMatrix","missingMatrix"));this.loadUniformMatrix(e,i,this.texSamplerMatrixLocation)},n.prototype.loadTexMaskMatrix=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"SurfaceTileRendererProgram","loadTexMaskMatrix","missingMatrix"));this.loadUniformMatrix(e,i,this.texMaskMatrixLocation)},n.prototype.loadTexSampler=function(t,e){t.uniform1i(this.texSamplerLocation,e-WebGLRenderingContext.TEXTURE0)},n.prototype.loadOpacity=function(t,e){t.uniform1f(this.opacityLocation,e)},n.prototype.loadColor=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"SurfaceTileRendererProgram","loadColor","missingColor"));this.loadUniformColor(e,i,this.colorLocation)},n.prototype.loadModulateColor=function(t,e){t.uniform1i(this.modulateColorLocation,e?1:0)},n}),i("render/SurfaceTileRenderer",["../error/ArgumentError","../util/Logger","../geom/Matrix","../shapes/SurfaceShapeTile","../shaders/SurfaceTileRendererProgram"],function(t,e,i,r,n){"use strict";var o=function(){this.texMaskMatrix=i.fromIdentity(),this.texSamplerMatrix=i.fromIdentity(),this.isSurfaceShapeTileRendering=!1};return o.prototype.renderTiles=function(i,n,o,s){if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceTileRenderer","renderTiles","Specified surface tiles array is null or undefined."));if(!(n.length<1)){var a,l,h,u,c=i.terrain,d=i.currentGlContext,p=0,f=1;if(c){this.isSurfaceShapeTileRendering=n[0]instanceof r,o*=i.surfaceOpacity,a=this.beginRendering(i,o),c.beginRendering(i);try{for(var g=0,m=c.surfaceGeometry.length;g0?h:1,d=u>0?u:1,p=a/d,f=s/c,g=-(l.minLongitude-o.minLongitude)/d,m=-(l.minLatitude-o.minLatitude)/c;this.texMaskMatrix.set(p,0,0,g,0,f,0,m,0,0,1,0,0,0,0,1),this.texSamplerMatrix.setToUnitYFlip(),i.applyInternalTransform(t,this.texSamplerMatrix),this.texSamplerMatrix.multiplyMatrix(this.texMaskMatrix),n.loadTexSamplerMatrix(r,this.texSamplerMatrix),n.loadTexMaskMatrix(r,this.texMaskMatrix)},o}),i("render/TextSupport",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Logger","../geom/Matrix","../render/Texture","../geom/Vec2"],function(t,e,i,r,n,o,s){"use strict";var a=function(){this.canvas2D=document.createElement("canvas"),this.ctx2D=this.canvas2D.getContext("2d"),this.lineSpacing=.15,this.strokeStyle="rgba(0, 0, 0, 0.5)",this.strokeWidth=4};return a.prototype.textSize=function(t,e,i){if(0===t.length)return new s(0,0);this.ctx2D.font=e.fontString;for(var r=t.split("\n"),n=r.length*(e.size*(1+this.lineSpacing)),o=0,a=0;a0&&(l=l.substring(0,l.length-1)),l+="..."),l},a.prototype.wrapLine=function(t,e,i){var r="",n=t.trim();if(this.textSize(n,i,0)[0]>e){for(var o="",s=0,a=n.indexOf(" ",s+1);s0?this.surfaceRenderables[this.surfaceRenderables.length-1]:null},R.prototype.popSurfaceRenderable=function(){return this.surfaceRenderables.length>0?this.surfaceRenderables.pop():null},R.prototype.reverseSurfaceRenderables=function(){this.surfaceRenderables.reverse()},R.prototype.addOrderedRenderable=function(t,e){if(t){var i={orderedRenderable:t,insertionOrder:this.orderedRenderablesCounter++,eyeDistance:e||t.eyeDistance,globeStateKey:this.globeStateKey};this.globe.continuous&&(i.globeOffset=this.globe.offset),0===i.eyeDistance?this.screenRenderables.push(i):this.orderedRenderables.push(i)}},R.prototype.addOrderedRenderableToBack=function(t){if(t){var e={orderedRenderable:t,insertionOrder:this.orderedRenderablesCounter++,eyeDistance:Number.MAX_VALUE,globeStateKey:this.globeStateKey};this.globe.continuous&&(e.globeOffset=this.globe.offset),this.orderedRenderables.push(e)}},R.prototype.peekOrderedRenderable=function(){return this.orderedRenderables.length>0?this.orderedRenderables[this.orderedRenderables.length-1].orderedRenderable:null},R.prototype.popOrderedRenderable=function(){if(this.orderedRenderables.length>0){var t=this.orderedRenderables.pop();return this.globeStateKey=t.globeStateKey,this.globe.continuous&&(this.globe.offset=t.globeOffset),t.orderedRenderable}return null},R.prototype.nextScreenRenderable=function(){if(this.screenRenderables.length>0){var t=this.screenRenderables.shift();return this.globeStateKey=t.globeStateKey,this.globe.continuous&&(this.globe.offset=t.globeOffset),t.orderedRenderable}return null},R.prototype.sortOrderedRenderables=function(){this.orderedRenderables.sort(function(t,e){var i=t.eyeDistance,r=e.eyeDistance;if(ir)return 1;var n=t.insertionOrder,o=e.insertionOrder;return n>o?-1:nP.x+P.width||N>P.y+P.height)&&(A.x=w.clamp(I,P.x,P.x+P.width),A.y=w.clamp(N,P.y,P.y+P.height),A.width=w.clamp(O,P.x,P.x+P.width)-A.x,A.height=w.clamp(D,P.y,P.y+P.height)-A.y,this.pickRectangle=A,C[0]=A.x,C[1]=A.y,C[2]=0,this.navigatorState.unProject(C,t=new L(0,0,0)),C[0]=A.x,C[1]=A.y,C[2]=1,this.navigatorState.unProject(C,e=new L(0,0,0)),C[0]=A.x+A.width,C[1]=A.y,C[2]=0,this.navigatorState.unProject(C,i=new L(0,0,0)),C[0]=A.x+A.width,C[1]=A.y,C[2]=1,this.navigatorState.unProject(C,r=new L(0,0,0)),C[0]=A.x,C[1]=A.y+A.height,C[2]=0,this.navigatorState.unProject(C,n=new L(0,0,0)),C[0]=A.x,C[1]=A.y+A.height,C[2]=1,this.navigatorState.unProject(C,s=new L(0,0,0)),C[0]=A.x+A.width,C[1]=A.y+A.height,C[2]=0,this.navigatorState.unProject(C,a=new L(0,0,0)),C[0]=A.x+A.width,C[1]=A.y+A.height,C[2]=1,this.navigatorState.unProject(C,l=new L(0,0,0)),R=new L(s[0]-t[0],s[1]-t[1],s[2]-t[2]),M.set(n[0]-e[0],n[1]-e[1],n[2]-e[2]),h=R.cross(M),E=new f(h[0],h[1],h[2],-h.dot(t)),E.normalize(),R=new L(a[0]-r[0],a[1]-r[1],a[2]-r[2]),M.set(l[0]-i[0],l[1]-i[1],l[2]-i[2]),u=R.cross(M),y=new f(u[0],u[1],u[2],-u.dot(i)),y.normalize(),R=new L(s[0]-a[0],s[1]-a[1],s[2]-a[2]),M.set(l[0]-n[0],l[1]-n[1],l[2]-n[2]),c=R.cross(M),_=new f(c[0],c[1],c[2],-c.dot(n)),_.normalize(),R=new L(r[0]-t[0],r[1]-t[1],r[2]-t[2]),M.set(e[0]-i[0],e[1]-i[1],e[2]-i[2]),d=R.cross(M),v=new f(d[0],d[1],d[2],-d.dot(i)),v.normalize(),R=new L(n[0]-i[0],n[1]-i[1],n[2]-i[2]),M.set(a[0]-t[0],a[1]-t[1],a[2]-t[2]),p=R.cross(M),S=new f(p[0],p[1],p[2],-p.dot(t)),S.normalize(),R=new L(l[0]-e[0],l[1]-e[1],l[2]-e[2]),M.set(s[0]-r[0],s[1]-r[1],s[2]-r[2]),g=R.cross(M),b=new f(g[0],g[1],g[2],-g.dot(e)),b.normalize(),this.pickFrustum=new o(E,y,v,_,S,b),!0)},R.prototype.isSmall=function(t,e){if(!t)return!1;var i=this.navigatorState.eyePoint.distanceTo(t.center),r=this.navigatorState.pixelSizeAtDistance(i);return 2*t.radiusDate.now()},l.prototype.determineActiveAttributes=function(t){this.highlighted&&this._highlightAttributes?this.activeAttributes=this.highlightAttributes:this.activeAttributes=this._attributes},l.prototype.isWithinProjectionLimits=function(t){return!0},l.prototype.applyMvpMatrix=function(t){this.scratchMatrix.copy(t.navigatorState.modelviewProjection),this.scratchMatrix.multiplyMatrix(this.currentData.transformationMatrix),t.currentProgram.loadModelviewProjection(t.currentGlContext,this.scratchMatrix)},l.prototype.applyMvpMatrixForOutline=function(t){this.scratchMatrix.copy(t.navigatorState.projection),this.scratchMatrix.offsetProjectionDepth(-.001),this.scratchMatrix.multiplyMatrix(t.navigatorState.modelview),this.scratchMatrix.multiplyMatrix(this.currentData.transformationMatrix),t.currentProgram.loadModelviewProjection(t.currentGlContext,this.scratchMatrix)},l}),i("shapes/AbstractMesh",["../shapes/AbstractShape","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../util/ImageSource","../geom/Line","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){"use strict";var m=function(e){t.call(this,e),this.pickTransparentImagePixels=!0,this._altitudeScale=1};return m.prototype=Object.create(t.prototype),Object.defineProperties(m.prototype,{altitudeScale:{get:function(){return this._altitudeScale},set:function(t){this._altitudeScale=t,this.reset()}}}),m.prototype.mustGenerateGeometry=function(t){return!this.currentData.meshPoints||(this.currentData.drawInterior!==this.activeAttributes.drawInterior||(!(!this.activeAttributes.applyLighting||this.currentData.normals)||this.altitudeMode!==WorldWind.ABSOLUTE&&this.currentData.isExpired))},m.prototype.doMakeOrderedRenderable=function(t){if(!this.activeAttributes.drawInterior&&!this.activeAttributes.drawOutline)return null;if(!this.mustGenerateGeometry(t))return this;var e=this.currentData,i=e.referencePoint;return t.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude*this._altitudeScale,this._altitudeMode,i),e.transformationMatrix.setToTranslation(i[0],i[1],i[2]),e.meshPoints=this.computeMeshPoints(t,e),e.refreshVertexBuffer=!0,this.activeAttributes.imageSource&&!this.texCoords&&(this.texCoords=this.computeTexCoords(),this.texCoords&&(e.refreshTexCoordBuffer=!0)),this.meshIndices||(this.meshIndices=this.computeMeshIndices(),e.refreshMeshIndices=!0),this.meshOutlineIndices||(this.meshOutlineIndices=this.computeOutlineIndices(),this.meshOutlineIndices&&(e.refreshOutlineIndices=!0)),this.activeAttributes.applyLighting&&this.computeNormals(e),e.drawInterior=this.activeAttributes.drawInterior,this.resetExpiration(e),e.extent||(e.extent=new r),e.extent.setToPoints(e.meshPoints),e.extent.translate(e.referencePoint),this},m.prototype.computeMeshPoints=function(t,e){throw new UnsupportedOperationError(l.logMessage(l.LEVEL_SEVERE,"AbstractMesh","computeMeshPoints","abstractInvocation"))},m.prototype.computeTexCoords=function(){return null},m.prototype.computeMeshIndices=function(t){throw new UnsupportedOperationError(l.logMessage(l.LEVEL_SEVERE,"AbstractMesh","computeMeshIndices","abstractInvocation"))},m.prototype.computeOutlineIndices=function(t){},m.prototype.computeNormals=function(t){for(var e,i=new Float32Array(t.meshPoints.length),r=this.meshIndices,n=t.meshPoints,o=[],s=[new f(0,0,0),new f(0,0,0),new f(0,0,0)],a=0;a=1||t.pickingMode),s.loadColor(o,t.pickingMode?n:r),s.loadOpacity(o,t.pickingMode?i>0?1:0:i),!l||t.pickingMode&&this.pickTransparentImagePixels||(this.activeTexture=t.gpuResourceCache.resourceForKey(this.activeAttributes.imageSource),this.activeTexture||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.activeAttributes.imageSource)),this.activeTexture&&this.activeTexture.bind(t)&&(a.texCoordsVboCacheKey||(a.texCoordsVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.texCoordsVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.texCoordsVboCacheKey,e,4*this.texCoords.length),a.refreshTexCoordBuffer=!0),o.bindBuffer(o.ARRAY_BUFFER,e),a.refreshTexCoordBuffer&&(o.bufferData(o.ARRAY_BUFFER,this.texCoords,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshTexCoordBuffer=!1),o.enableVertexAttribArray(s.vertexTexCoordLocation),o.vertexAttribPointer(s.vertexTexCoordLocation,2,o.FLOAT,!1,0,0),this.scratchMatrix.setToIdentity(),this.scratchMatrix.multiplyByTextureTransform(this.activeTexture),s.loadTextureEnabled(o,!0),s.loadTextureUnit(o,o.TEXTURE0),s.loadTextureMatrix(o,this.scratchMatrix),s.loadModulateColor(o,t.pickingMode))),h&&(s.loadApplyLighting(o,!0),a.normalsVboCacheKey||(a.normalsVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.normalsVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.normalsVboCacheKey,e,4*a.normals.length),a.refreshNormalsBuffer=!0),o.bindBuffer(o.ARRAY_BUFFER,e),a.refreshNormalsBuffer&&(o.bufferData(o.ARRAY_BUFFER,a.normals,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshNormalsBuffer=!1),o.enableVertexAttribArray(s.normalVectorLocation),o.vertexAttribPointer(s.normalVectorLocation,3,o.FLOAT,!1,0,0)),o.drawElements(o.TRIANGLES,this.meshIndices.length,o.UNSIGNED_SHORT,0),l&&o.disableVertexAttribArray(s.vertexTexCoordLocation),h&&(s.loadApplyLighting(o,!1),o.disableVertexAttribArray(s.normalVectorLocation))}if(this.activeAttributes.drawOutline&&this.meshOutlineIndices&&(s.loadTextureEnabled(o,!1),o.disableVertexAttribArray(s.vertexTexCoordLocation),this.applyMvpMatrixForOutline(t),r=this.activeAttributes.outlineColor,i=r.alpha*t.currentLayer.opacity,o.depthMask(i>=1||t.pickingMode),s.loadColor(o,t.pickingMode?n:r),s.loadOpacity(o,t.pickingMode?1:i),o.lineWidth(this.activeAttributes.outlineWidth),a.outlineIndicesVboCacheKey||(a.outlineIndicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.outlineIndicesVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.outlineIndicesVboCacheKey,e,2*this.meshOutlineIndices.length),a.refreshOutlineIndices=!0),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,e),a.refreshOutlineIndices&&(o.bufferData(o.ELEMENT_ARRAY_BUFFER,this.meshOutlineIndices,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshOutlineIndices=!1),o.drawElements(o.LINE_STRIP,this.meshOutlineIndices.length,o.UNSIGNED_SHORT,0)),t.pickingMode){var c=this.computePickPosition(t),d=new u(n,this.pickDelegate?this.pickDelegate:this,c,t.currentLayer,!1);t.resolvePick(d)}},m.prototype.computePickPosition=function(t){var e=this.currentData,i=t.navigatorState.rayFromScreenPoint(t.pickPoint),r=new f(i.origin[0],i.origin[1],i.origin[2]).subtract(e.referencePoint),n=new s(r,i.direction),o=[];if(g.computeIndexedTrianglesIntersection(n,e.meshPoints,this.meshIndices,o)){var a=o[0];if(o.length>1)for(var l=a.distanceToSquared(t.navigatorState.eyePoint),h=1;h65536)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","constructor","Too many positions. Must be fewer than 65536. Try using multiple meshes."));for(var n=i[0].length,o=1;o=0;e--)t.push(this._positions[this.numRows-1][e]);for(i=this.numRows-2;i>0;i--)t.push(this._positions[i][0]);return new d(t,null)},g.prototype.computeMeshPoints=function(t,e){for(var i,r,n=Number.MAX_VALUE,o=t.navigatorState.eyePoint,s=new Float32Array(this.numRows*this.numColumns*3),a=new f(0,0,0),l=0,h=0;h=(this.numRows-1)*this.numColumns;i--)t[e++]=i;for(r=this.numRows-2;r>=0;r--)t[e++]=r*this.numColumns;return t},g}),i("shapes/GeographicText",["../error/ArgumentError","../util/Logger","../shapes/Text","../geom/Vec3"],function(t,e,i,r){"use strict";var n=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Text","constructor","missingPosition"));i.call(this,n),this.position=r,this.declutterGroup=1};return n.placePoint=new r(0,0,0),n.prototype=Object.create(i.prototype),n.prototype.clone=function(){var t=new n(this.position,this.text);return t.copy(this),t.pickDelegate=this.pickDelegate?this.pickDelegate:this,t},n.prototype.render=function(t){t.globe.projectionLimits&&!t.globe.projectionLimits.containsLocation(this.position.latitude,this.position.longitude)||i.prototype.render.call(this,t)},n.prototype.computeScreenPointAndEyeDistance=function(t){return t.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,n.placePoint),!!t.navigatorState.frustumInModelCoordinates.containsPoint(n.placePoint)&&(this.eyeDistance=this.alwaysOnTop?0:t.navigatorState.eyePoint.distanceTo(n.placePoint),!!t.navigatorState.projectWithDepth(n.placePoint,this.depthOffset,this.screenPoint))},n}),i("formats/geojson/GeoJSONConstants",[],function(){"use strict";var t=function(){};return t.FIELD_TYPE="type",t.FIELD_CRS="crs",t.FIELD_NAME="name",t.FIELD_BBOX="bbox",t.FIELD_COORDINATES="coordinates",t.FIELD_GEOMETRIES="geometries",t.FIELD_GEOMETRY="geometry",t.FIELD_PROPERTIES="properties",t.FIELD_FEATURES="features",t.FIELD_ID="id",t.TYPE_POINT="Point",t.TYPE_MULTI_POINT="MultiPoint",t.TYPE_LINE_STRING="LineString",t.TYPE_MULTI_LINE_STRING="MultiLineString",t.TYPE_POLYGON="Polygon",t.TYPE_MULTI_POLYGON="MultiPolygon",t.TYPE_GEOMETRY_COLLECTION="GeometryCollection",t.TYPE_FEATURE="Feature",t.TYPE_FEATURE_COLLECTION="FeatureCollection",t.FIELD_CRS_NAME="name",t.FIELD_CRS_LINK="link",t.WGS84_CRS="urn:ogc:def:crs:OGC:1.3:CRS84",t.EPSG4326_CRS="EPSG:4326",t}),i("formats/geojson/GeoJSONGeometry",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(t,e,i){"use strict";var r=function(e,r,n){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometry","constructor","missingCoordinates"));if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometry","constructor","missingType"));this._coordinates=e,this._type=r,this._bbox=n||null};return Object.defineProperties(r.prototype,{coordinates:{get:function(){return this._coordinates}},type:{get:function(){return this._type}},bbox:{get:function(){return this._bbox}}}),r.prototype.isPointType=function(){return this.type===e.TYPE_POINT},r.prototype.isMultiPointType=function(){return this.type===e.TYPE_MULTI_POINT},r.prototype.isLineStringType=function(){return this.type===e.TYPE_LINE_STRING},r.prototype.isMultiLineStringType=function(){return this.type===e.TYPE_MULTI_LINE_STRING},r.prototype.isPolygonType=function(){return this.type===e.TYPE_POLYGON},r.prototype.isMultiPolygonType=function(){return this.type===e.TYPE_MULTI_POLYGON},r}),i("formats/geojson/GeoJSONGeometryCollection",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(t,e,i){"use strict";var r=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryCollection","constructor","missingGeometries"));if("[object Array]"!==Object.prototype.toString.call(e))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryCollection","constructor","invalidGeometries"));this._geometries=e,this._bbox=r};return Object.defineProperties(r.prototype,{geometries:{get:function(){return this._geometries}},bbox:{get:function(){return this._bbox}}}),r}),i("formats/geojson/GeoJSONGeometryLineString",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","missingCoordinates"));if(r.length<2||r[0].length<2)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","invalidNumberOfCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r[0])||"[object Number]"!==Object.prototype.toString.call(r[0][0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","invalidCoordinatesType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("formats/geojson/GeoJSONGeometryMultiLineString",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiLineString","constructor","missingCoordinates"));if(r[0].length<2||r[0][0].length<2)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiLineString","constructor","invalidNumberOfCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r[0])||"[object Array]"!==Object.prototype.toString.call(r[0][0])||"[object Number]"!==Object.prototype.toString.call(r[0][0][0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiLineString","constructor","invalidCoordinatesType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryLineString","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("formats/geojson/GeoJSONGeometryMultiPoint",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiPoint","constructor","missingCoordinates"));if(r[0].length<2)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiPoint","constructor","invalidNumberOfCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r[0])||"[object Number]"!==Object.prototype.toString.call(r[0][0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiPoint","constructor","invalidCoordinatesType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("formats/geojson/GeoJSONGeometryMultiPolygon",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryMultiPolygon","constructor","missingCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r[0])||"[object Array]"!==Object.prototype.toString.call(r[0][0])||"[object Array]"!==Object.prototype.toString.call(r[0][0][0])||"[object Number]"!==Object.prototype.toString.call(r[0][0][0][0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidCoordinatesType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("formats/geojson/GeoJSONGeometryPoint",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","missingCoordinates"));if(r.length<2)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","invalidNumberOfCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r)||"[object Number]"!==Object.prototype.toString.call(r[0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","invalidCoordinatesType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPoint","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("formats/geojson/GeoJSONGeometryPolygon",["../../error/ArgumentError","./GeoJSONGeometry","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","missingCoordinates"));if(r[0].length<2||r[0][0].length<2)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidNumberOfCoordinates"));if("[object Array]"!==Object.prototype.toString.call(r[0])||"[object Array]"!==Object.prototype.toString.call(r[0][0])||"[object Number]"!==Object.prototype.toString.call(r[0][0][0]))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidCoordinatesType"));if(r[0][0]!==r[0][r.length-1])throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","invalidLinearRing"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONGeometryPolygon","constructor","missingType"));e.call(this,r,n,o)};return r.prototype=Object.create(e.prototype),r}),i("util/proj4-src",[],function(){"use strict";function t(t,e){if(t[e])return t[e];for(var i,r=Object.keys(t),n=e.toLowerCase().replace(Ge,""),o=-1;++o0?90:-90),t.lat_ts=t.lat1)}function l(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?l[t]=We(arguments[1]):l[t]=He(arguments[1]):l[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){Array.isArray(t)?l.apply(e,t):l(t)});if("string"==typeof t){if(t in l)return l[t]}else"EPSG"in t?l["EPSG:"+t.EPSG]=t:"ESRI"in t?l["ESRI:"+t.ESRI]=t:"IAU2000"in t?l["IAU2000:"+t.IAU2000]=t:console.log(t);return}}function h(t){return"string"==typeof t}function u(t){return t in l}function c(t){return Xe.some(function(e){return t.indexOf(e)>-1})}function d(t){return"+"===t[0]}function p(t){return h(t)?u(t)?l[t]:c(t)?He(t):d(t)?We(t):void 0:t}function f(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Ze(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function g(t){var e=t.x,i=t.y;if(i*Ne>90&&i*Ne<-90&&e*Ne>180&&e*Ne<-180)return null;var r,n;if(Math.abs(Math.abs(i)-Me)<=Ie)return null;if(this.sphere)r=this.x0+this.a*this.k0*$e(e-this.long0),n=this.y0+this.a*this.k0*Math.log(Math.tan(De+.5*i));else{var o=Math.sin(i),s=ti(this.e,i,o);r=this.x0+this.a*this.k0*$e(e-this.long0),n=this.y0-this.a*this.k0*Math.log(s)}return t.x=r,t.y=n,t}function m(t){var e,i,r=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=Me-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var o=Math.exp(-n/(this.a*this.k0));if(-9999===(i=ei(this.e,o)))return null}return e=$e(this.long0+r/(this.a*this.k0)),t.x=e,t.y=i,t}function E(){}function y(t){return t}function _(t,e){var i=li.length;return t.names?(li[i]=t,t.names.forEach(function(t){ai[t.toLowerCase()]=i}),this):(console.log(e),!0)}function v(t){if(!t)return!1;var e=t.toLowerCase() ;return void 0!==ai[e]&&li[ai[e]]?li[ai[e]]:void 0}function S(){si.forEach(_)}function b(t,e,i,r){var n=t*t,o=e*e,s=(n-o)/n,a=0;return r?(t*=1-s*(Ce+s*(Ae+s*Pe)),n=t*t,s=0):a=Math.sqrt(s),{es:s,e:a,ep2:(n-o)/o}}function T(e,i,r,n,o){if(!e){var s=t(ui,n);s||(s=ci),e=s.a,i=s.b,r=s.rf}return r&&!i&&(i=(1-1/r)*e),(0===r||Math.abs(e-i)3&&(0===s.datum_params[3]&&0===s.datum_params[4]&&0===s.datum_params[5]&&0===s.datum_params[6]||(s.datum_type=Le,s.datum_params[3]*=xe,s.datum_params[4]*=xe,s.datum_params[5]*=xe,s.datum_params[6]=s.datum_params[6]/1e6+1))),s.a=i,s.b=r,s.es=n,s.ep2=o,s}function w(e,i){if(!(this instanceof w))return new w(e);i=i||function(t){if(t)throw t};var r=p(e);if("object"!=typeof r)return void i(e);var n=w.projections.get(r.projName);if(!n)return void i(e);if(r.datumCode&&"none"!==r.datumCode){var o=t(di,r.datumCode);o&&(r.datum_params=o.towgs84?o.towgs84.split(","):null,r.ellps=o.ellipse,r.datumName=o.datumName?o.datumName:r.datumCode)}r.k0=r.k0||1,r.axis=r.axis||"enu",r.ellps=r.ellps||"wgs84";var s=T(r.a,r.b,r.rf,r.ellps,r.sphere),a=b(s.a,s.b,s.rf,r.R_A),l=r.datum||L(r.datumCode,r.datum_params,s.a,s.b,a.es,a.ep2);Je(this,r),Je(this,n),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=a.es,this.e=a.e,this.ep2=a.ep2,this.datum=l,this.init(),i(null,this)}function R(t,e){return t.datum_type===e.datum_type&&(!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===Te?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==Le||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]))}function x(t,e,i){var r,n,o,s,a=t.x,l=t.y,h=t.z?t.z:0;if(l<-Me&&l>-1.001*Me)l=-Me;else if(l>Me&&l<1.001*Me)l=Me;else if(l<-Me||l>Me)return null;return a>Math.PI&&(a-=2*Math.PI),n=Math.sin(l),s=Math.cos(l),o=n*n,r=i/Math.sqrt(1-e*o),{x:(r+h)*s*Math.cos(a),y:(r+h)*s*Math.sin(a),z:(r*(1-e)+h)*n}}function M(t,e,i,r){var n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v=t.x,S=t.y,b=t.z?t.z:0;if(n=Math.sqrt(v*v+S*S),o=Math.sqrt(v*v+S*S+b*b),n/i<1e-12){if(E=0,o/i<1e-12)return y=Me,_=-r,{x:t.x,y:t.y,z:t.z}}else E=Math.atan2(S,v);s=b/o,a=n/o,l=1/Math.sqrt(1-e*(2-e)*a*a),c=a*(1-e)*l,d=s*l,m=0;do{m++,u=i/Math.sqrt(1-e*d*d),_=n*c+b*d-u*(1-e*d*d),h=e*u/(u+_),l=1/Math.sqrt(1-h*(2-h)*a*a),p=a*(1-h)*l,f=s*l,g=f*c-p*d,c=p,d=f}while(g*g>1e-24&&m<30);return y=Math.atan(f/Math.abs(p)),{x:E,y:y,z:_}}function C(t,e,i){if(e===Te)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(e===Le){var r=i[0],n=i[1],o=i[2],s=i[3],a=i[4],l=i[5],h=i[6];return{x:h*(t.x-l*t.y+a*t.z)+r,y:h*(l*t.x+t.y-s*t.z)+n,z:h*(-a*t.x+s*t.y+t.z)+o}}}function A(t,e,i){if(e===Te)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(e===Le){var r=i[0],n=i[1],o=i[2],s=i[3],a=i[4],l=i[5],h=i[6],u=(t.x-r)/h,c=(t.y-n)/h,d=(t.z-o)/h;return{x:u+l*c-a*d,y:-l*u+c+s*d,z:a*u-s*c+d}}}function P(t){return t===Te||t===Le}function I(t,e){return(t.datum.datum_type===Te||t.datum.datum_type===Le)&&"WGS84"!==e.datumCode||(e.datum.datum_type===Te||e.datum.datum_type===Le)&&"WGS84"!==t.datumCode}function O(t,e,i){var r;return Array.isArray(i)&&(i=gi(i)),t.datum&&e.datum&&I(t,e)&&(r=new w("WGS84"),i=O(t,r,i),t=r),"enu"!==t.axis&&(i=fi(t,!1,i)),"longlat"===t.projName?i={x:i.x*Oe,y:i.y*Oe}:(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter}),i=t.inverse(i)),t.from_greenwich&&(i.x+=t.from_greenwich),i=pi(t.datum,e.datum,i),e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y}),"longlat"===e.projName?i={x:i.x*Ne,y:i.y*Ne}:(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter})),"enu"!==e.axis?fi(e,!0,i):i}function N(t,e,i){var r;return Array.isArray(i)?(r=O(t,e,i),3===i.length?[r.x,r.y,r.z]:[r.x,r.y]):O(t,e,i)}function D(t){return t instanceof w?t:t.oProj?t.oProj:w(t)}function k(t,e,i){t=D(t);var r,n=!1;return void 0===e?(e=t,t=mi,n=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,e=t,t=mi,n=!0),e=D(e),i?N(t,e,i):(r={forward:function(i){return N(t,e,i)},inverse:function(i){return N(e,t,i)}},n&&(r.oProj=e),r)}function V(t,e){return e=e||5,z(U({lat:t[1],lon:t[0]}),e)}function F(t){var e=K(X(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function G(t){var e=K(X(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function W(t){return t*(Math.PI/180)}function B(t){return t/Math.PI*180}function U(t){var e,i,r,n,o,s,a,l,h,u=t.lat,c=t.lon,d=6378137,p=W(u),f=W(c);h=Math.floor((c+180)/6)+1,180===c&&(h=60),u>=56&&u<64&&c>=3&&c<12&&(h=32),u>=72&&u<84&&(c>=0&&c<9?h=31:c>=9&&c<21?h=33:c>=21&&c<33?h=35:c>=33&&c<42&&(h=37)),e=6*(h-1)-180+3,l=W(e),i=.006739496752268451,r=d/Math.sqrt(1-.00669438*Math.sin(p)*Math.sin(p)),n=Math.tan(p)*Math.tan(p),o=i*Math.cos(p)*Math.cos(p),s=Math.cos(p)*(f-l),a=d*(.9983242984503243*p-.002514607064228144*Math.sin(2*p)+2639046602129982e-21*Math.sin(4*p)-3.418046101696858e-9*Math.sin(6*p));var g=.9996*r*(s+(1-n+o)*s*s*s/6+(5-18*n+n*n+72*o-58*i)*s*s*s*s*s/120)+5e5,m=.9996*(a+r*Math.tan(p)*(s*s/2+(5-n+9*o+4*o*o)*s*s*s*s/24+(61-58*n+n*n+600*o-330*i)*s*s*s*s*s*s/720));return u<0&&(m+=1e7),{northing:Math.round(m),easting:Math.round(g),zoneNumber:h,zoneLetter:j(u)}}function K(t){var e=t.northing,i=t.easting,r=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var o,s,a,l,h,u,c,d,p,f,g=6378137,m=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),E=i-5e5,y=e;r<"N"&&(y-=1e7),d=6*(n-1)-180+3,o=.006739496752268451,c=y/.9996,p=c/6367449.145945056,f=p+(3*m/2-27*m*m*m/32)*Math.sin(2*p)+(21*m*m/16-55*m*m*m*m/32)*Math.sin(4*p)+151*m*m*m/96*Math.sin(6*p),s=g/Math.sqrt(1-.00669438*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),l=o*Math.cos(f)*Math.cos(f),h=.99330562*g/Math.pow(1-.00669438*Math.sin(f)*Math.sin(f),1.5),u=E/(.9996*s);var _=f-s*Math.tan(f)/h*(u*u/2-(5+3*a+10*l-4*l*l-9*o)*u*u*u*u/24+(61+90*a+298*l+45*a*a-252*o-3*l*l)*u*u*u*u*u*u/720);_=B(_);var v=(u-(1+2*a+l)*u*u*u/6+(5-2*l+28*a-3*l*l+8*o+24*a*a)*u*u*u*u*u/120)/Math.cos(f);v=d+B(v);var S;if(t.accuracy){var b=K({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});S={top:b.lat,right:b.lon,bottom:_,left:v}}else S={lat:_,lon:v};return S}function j(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function z(t,e){var i="00000"+t.easting,r="00000"+t.northing;return t.zoneNumber+t.zoneLetter+q(t.easting,t.northing,t.zoneNumber)+i.substr(i.length-5,e)+r.substr(r.length-5,e)}function q(t,e,i){var r=Y(i);return H(Math.floor(t/1e5),Math.floor(e/1e5)%20,r)}function Y(t){var e=t%Ei;return 0===e&&(e=Ei),e}function H(t,e,i){var r=i-1,n=yi.charCodeAt(r),o=_i.charCodeAt(r),s=n+t-1,a=o+e,l=!1;return s>Li&&(s=s-Li+vi-1,l=!0),(s===Si||nSi||(s>Si||nbi||(s>bi||nLi&&(s=s-Li+vi-1),a>Ti?(a=a-Ti+vi-1,l=!0):l=!1,(a===Si||oSi||(a>Si||obi||(a>bi||oTi&&(a=a-Ti+vi-1),String.fromCharCode(s)+String.fromCharCode(a)}function X(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,r=null,n="",o=0;!/[A-Z]/.test(e=t.charAt(o));){if(o>=2)throw"MGRSPoint bad conversion from: "+t;n+=e,o++}var s=parseInt(n,10);if(0===o||o+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(o++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;r=t.substring(o,o+=2);for(var l=Y(s),h=J(r.charAt(0),l),u=Z(r.charAt(1),l);u0&&(d=1e5/Math.pow(10,E),p=t.substring(o,o+E),y=parseFloat(p)*d,f=t.substring(o+E),_=parseFloat(f)*d),g=y+h,m=_+u,{easting:g,northing:m,zoneLetter:a,zoneNumber:s,accuracy:d}}function J(t,e){for(var i=yi.charCodeAt(e-1),r=1e5,n=!1;i!==t.charCodeAt(0);){if(i++,i===Si&&i++,i===bi&&i++,i>Li){if(n)throw"Bad character: "+t;i=vi,n=!0}r+=1e5}return r}function Z(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=_i.charCodeAt(e-1),r=0,n=!1;i!==t.charCodeAt(0);){if(i++,i===Si&&i++,i===bi&&i++,i>Ti){if(n)throw"Bad character: "+t;i=vi,n=!0}r+=1e5}return r}function Q(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function $(t,e,i){if(!(this instanceof $))return new $(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var r=t.split(",");this.x=parseFloat(r[0],10),this.y=parseFloat(r[1],10),this.z=parseFloat(r[2],10)||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}function tt(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=xi(this.es),this.ml0=Mi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function et(t){var e,i,r,n=t.x,o=t.y,s=$e(n-this.long0),a=Math.sin(o),l=Math.cos(o);if(this.es){var h=l*s,u=Math.pow(h,2),c=this.ep2*Math.pow(l,2),d=Math.pow(c,2),p=Math.abs(l)>Ie?Math.tan(o):0,f=Math.pow(p,2),g=Math.pow(f,2);e=1-this.es*Math.pow(a,2),h/=Math.sqrt(e);var m=Mi(o,a,l,this.en);i=this.a*(this.k0*h*(1+u/6*(1-f+c+u/20*(5-18*f+g+14*c-58*f*c+u/42*(61+179*g-g*f-479*f)))))+this.x0,r=this.a*(this.k0*(m-this.ml0+a*s*h/2*(1+u/12*(5-f+9*c+4*d+u/30*(61+g-58*f+270*c-330*f*c+u/56*(1385+543*g-g*f-3111*f))))))+this.y0}else{var E=l*Math.sin(s);if(Math.abs(Math.abs(E)-1)=1){if(E-1>Ie)return 93;r=0}else r=Math.acos(r);o<0&&(r=-r),r=this.a*this.k0*(r-this.lat0)+this.y0}return t.x=i,t.y=r,t}function it(t){var e,i,r,n,o=(t.x-this.x0)*(1/this.a),s=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+s/this.k0,i=Ci(e,this.es,this.en),Math.abs(i)Ie?Math.tan(i):0,u=this.ep2*Math.pow(l,2),c=Math.pow(u,2),d=Math.pow(h,2),p=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var f=o*Math.sqrt(e)/this.k0,g=Math.pow(f,2);e*=h,r=i-e*g/(1-this.es)*.5*(1-g/12*(5+3*d-9*u*d+u-4*c-g/30*(61+90*d-252*u*d+45*p+46*u-g/56*(1385+3633*d+4095*p+1574*p*d)))),n=$e(this.long0+f*(1-g/6*(1+2*d+u-g/20*(5+28*d+24*p+8*u*d+6*u-g/42*(61+662*d+1320*p+720*p*d))))/l)}else r=Me*Qe(s),n=0;else{var m=Math.exp(o/this.k0),E=.5*(m-1/m),y=this.lat0+s/this.k0,_=Math.cos(y);e=Math.sqrt((1-Math.pow(_,2))/(1+Math.pow(E,2))),r=Math.asin(e),s<0&&(r=-r),n=0===E&&0===_?0:$e(Math.atan2(E,_)+this.long0)}return t.x=n,t.y=r,t}function rt(){if(void 0===this.es||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(.25+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=-.03233083094085698*i,this.gtu[5]=.6650675310896665*i;var r=ki(this.cbg,this.lat0);this.Zb=-this.Qn*(r+Vi(this.gtu,2*r))}function nt(t){var e=$e(t.x-this.long0),i=t.y;i=ki(this.cbg,i);var r=Math.sin(i),n=Math.cos(i),o=Math.sin(e),s=Math.cos(e);i=Math.atan2(r,s*n),e=Math.atan2(o*n,Oi(r,n*s)),e=Di(Math.tan(e));var a=Gi(this.gtu,2*i,2*e);i+=a[0],e+=a[1];var l,h;return Math.abs(e)<=2.623395162778?(l=this.a*(this.Qn*e)+this.x0,h=this.a*(this.Qn*i+this.Zb)+this.y0):(l=1/0,h=1/0),t.x=l,t.y=h,t}function ot(t){var e=(t.x-this.x0)*(1/this.a),i=(t.y-this.y0)*(1/this.a);i=(i-this.Zb)/this.Qn,e/=this.Qn;var r,n;if(Math.abs(e)<=2.623395162778){var o=Gi(this.utg,2*i,2*e);i+=o[0],e+=o[1],e=Math.atan(Ii(e));var s=Math.sin(i),a=Math.cos(i),l=Math.sin(e),h=Math.cos(e);i=Math.atan2(s*h,Oi(l,h*a)),e=Math.atan2(l,h*a),r=$e(e+this.long0),n=ki(this.cgb,i)}else r=1/0,n=1/0;return t.x=r,t.y=n,t}function st(){var t=Ui(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*Oe,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Bi.init.apply(this),this.forward=Bi.forward,this.inverse=Bi.inverse}function at(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+De)/(Math.pow(Math.tan(.5*this.lat0+De),this.C)*zi(this.e*t,this.ratexp))}function lt(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+De),this.C)*zi(this.e*Math.sin(i),this.ratexp))-Me,t.x=this.C*e,t}function ht(t){for(var e=t.x/this.C,i=t.y,r=Math.pow(Math.tan(.5*i+De)/this.K,1/this.C),n=qi;n>0&&(i=2*Math.atan(r*zi(this.e*Math.sin(t.y),-.5*this.e))-Me,!(Math.abs(i-t.y)<1e-14));--n)t.y=i;return n?(t.x=e,t.y=i,t):null}function ut(){Hi.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function ct(t){var e,i,r,n;return t.x=$e(t.x-this.long0),Hi.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),r=Math.cos(t.x),n=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*r),t.x=n*i*Math.sin(t.x),t.y=n*(this.cosc0*e-this.sinc0*i*r),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function dt(t){var e,i,r,n,o;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,o=Math.sqrt(t.x*t.x+t.y*t.y)){var s=2*Math.atan2(o,this.R2);e=Math.sin(s),i=Math.cos(s),n=Math.asin(i*this.sinc0+t.y*e*this.cosc0/o),r=Math.atan2(t.x*e,o*this.cosc0*i-t.y*this.sinc0*e)}else n=this.phic0,r=0;return t.x=r,t.y=n,Hi.inverse.apply(this,[t]),t.x=$e(t.x+this.long0),t}function pt(t,e,i){return e*=i,Math.tan(.5*(Me+t))*Math.pow((1-e)/(1+e),.5*i)}function ft(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Ie&&(this.k0=.5*(1+Qe(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=Ie&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Ie&&(this.k0=.5*this.cons*Ze(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/ti(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Ze(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-Me,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function gt(t){var e,i,r,n,o,s,a=t.x,l=t.y,h=Math.sin(l),u=Math.cos(l),c=$e(a-this.long0);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=Ie&&Math.abs(l+this.lat0)<=Ie?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(c)),t.x=this.a*e*u*Math.sin(c)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*u*Math.cos(c))+this.y0,t):(i=2*Math.atan(this.ssfn_(l,h,this.e))-Me,n=Math.cos(i),r=Math.sin(i),Math.abs(this.coslat0)<=Ie?(o=ti(this.e,l*this.con,this.con*h),s=2*this.a*this.k0*o/this.cons,t.x=this.x0+s*Math.sin(a-this.long0),t.y=this.y0-this.con*s*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)0?this.long0+Math.atan2(t.x,-1*t.y):this.long0+Math.atan2(t.x,t.y):this.long0+Math.atan2(t.x*Math.sin(a),s*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a))),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=Ie){if(s<=Ie)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,r=s*this.cons/(2*this.a*this.k0),i=this.con*ei(this.e,r),e=this.con*$e(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else n=2*Math.atan(s*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,s<=Ie?o=this.X0:(o=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/s),e=$e(this.long0+Math.atan2(t.x*Math.sin(n),s*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)))),i=-1*ei(this.e,Math.tan(.5*(Me+o)));return t.x=e,t.y=i,t}function Et(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,r=this.rf,n=1/r,o=2*n-Math.pow(n,2),s=this.e=Math.sqrt(o);this.R=this.k0*i*Math.sqrt(1-o)/(1-o*Math.pow(e,2)),this.alpha=Math.sqrt(1+o/(1-o)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+s*e)/(1-s*e));this.K=a-this.alpha*l+this.alpha*s/2*h}function yt(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),r=-this.alpha*(e+i)+this.K,n=2*(Math.atan(Math.exp(r))-Math.PI/4),o=this.alpha*(t.x-this.lambda0),s=Math.atan(Math.sin(o)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(o))),a=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(o));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*s+this.x0,t}function _t(t){for(var e=t.x-this.x0,i=t.y-this.y0,r=e/this.R,n=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),o=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(r)),s=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(n))),a=this.lambda0+s/this.alpha,l=0,h=o,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+o/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=h,t}function vt(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var t=Math.sin(this.lat0),e=Math.cos(this.lat0),i=this.e*t;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(e,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-i*i);var r=ti(this.e,this.lat0,t),n=this.bl/e*Math.sqrt((1-this.es)/(1-i*i));n*n<1&&(n=1);var o,s;if(isNaN(this.longc)){var a=ti(this.e,this.lat1,Math.sin(this.lat1)),l=ti(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(n+Math.sqrt(n*n-1))*Math.pow(r,this.bl):this.el=(n-Math.sqrt(n*n-1))*Math.pow(r,this.bl);var h=Math.pow(a,this.bl),u=Math.pow(l,this.bl);o=this.el/h,s=.5*(o-1/o);var c=(this.el*this.el-u*h)/(this.el*this.el+u*h),d=(u-h)/(u+h),p=$e(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(c*Math.tan(.5*this.bl*p)/d)/this.bl,this.long0=$e(this.long0);var f=$e(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*f)/s),this.alpha=Math.asin(n*Math.sin(this.gamma0))}else o=this.lat0>=0?n+Math.sqrt(n*n-1):n-Math.sqrt(n*n-1),this.el=o*Math.pow(r,this.bl),s=.5*(o-1/o),this.gamma0=Math.asin(Math.sin(this.alpha)/n),this.long0=this.longc-Math.asin(s*Math.tan(this.gamma0))/this.bl;this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(n*n-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(n*n-1),Math.cos(this.alpha))}function St(t){var e,i,r,n=t.x,o=t.y,s=$e(n-this.long0);if(Math.abs(Math.abs(o)-Me)<=Ie)r=o>0?-1:1,i=this.al/this.bl*Math.log(Math.tan(De+r*this.gamma0*.5)),e=-1*r*Me*this.al/this.bl;else{var a=ti(this.e,o,Math.sin(o)),l=this.el/Math.pow(a,this.bl),h=.5*(l-1/l),u=.5*(l+1/l),c=Math.sin(this.bl*s),d=(h*Math.sin(this.gamma0)-c*Math.cos(this.gamma0))/u;i=Math.abs(Math.abs(d)-1)<=Ie?Number.POSITIVE_INFINITY:.5*this.al*Math.log((1-d)/(1+d))/this.bl,e=Math.abs(Math.cos(this.bl*s))<=Ie?this.al*this.bl*s:this.al*Math.atan2(h*Math.cos(this.gamma0)+c*Math.sin(this.gamma0),Math.cos(this.bl*s))/this.bl}return this.no_rot?(t.x=this.x0+e,t.y=this.y0+i):(e-=this.uc,t.x=this.x0+i*Math.cos(this.alpha)+e*Math.sin(this.alpha),t.y=this.y0+e*Math.cos(this.alpha)-i*Math.sin(this.alpha)),t}function bt(t){var e,i;this.no_rot?(i=t.y-this.y0,e=t.x-this.x0):(i=(t.x-this.x0)*Math.cos(this.alpha)-(t.y-this.y0)*Math.sin(this.alpha),e=(t.y-this.y0)*Math.cos(this.alpha)+(t.x-this.x0)*Math.sin(this.alpha),e+=this.uc);var r=Math.exp(-1*this.bl*i/this.al),n=.5*(r-1/r),o=.5*(r+1/r),s=Math.sin(this.bl*e/this.al),a=(s*Math.cos(this.gamma0)+n*Math.sin(this.gamma0))/o,l=Math.pow(this.el/Math.sqrt((1+a)/(1-a)),1/this.bl);return Math.abs(a-1)Ie?this.ns=Math.log(r/a)/Math.log(n/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=r/(this.ns*Math.pow(n,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Lt(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=Ie&&(i=Qe(i)*(Me-2*Ie));var r,n,o=Math.abs(Math.abs(i)-Me);if(o>Ie)r=ti(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(r,this.ns);else{if((o=i*this.ns)<=0)return null;n=0}var s=this.ns*$e(e-this.long0);return t.x=this.k0*(n*Math.sin(s))+this.x0,t.y=this.k0*(this.rh-n*Math.cos(s))+this.y0,t}function wt(t){var e,i,r,n,o,s=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(s*s+a*a),i=1):(e=-Math.sqrt(s*s+a*a),i=-1);var l=0;if(0!==e&&(l=Math.atan2(i*s,i*a)),0!==e||this.ns>0){if(i=1/this.ns,r=Math.pow(e/(this.a*this.f0),i),-9999===(n=ei(this.e,r)))return null}else n=-Me;return o=$e(l/this.ns+this.long0),t.x=o,t.y=n,t}function Rt(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function xt(t){var e,i,r,n,o,s,a,l=t.x,h=t.y,u=$e(l-this.long0);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),r=-u*this.alfa,n=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(r)),o=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(n)),s=this.n*o,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n),t.y=a*Math.cos(s)/1,t.x=a*Math.sin(s)/1,this.czech||(t.y*=-1,t.x*=-1),t}function Mt(t){var e,i,r,n,o,s,a,l,h=t.x;t.x=t.y,t.y=h,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),o=Math.atan2(t.y,t.x),n=o/Math.sin(this.s0),r=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(n)),i=Math.asin(Math.cos(r)*Math.sin(n)/Math.cos(e)),t.x=this.long0-i/this.alfa,a=e,l=0;var u=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-t.y)<1e-10&&(l=1),a=t.y,u+=1}while(0===l&&u<15);return u>=15?null:t}function Ct(){this.sphere||(this.e0=lr(this.es),this.e1=hr(this.es),this.e2=ur(this.es),this.e3=cr(this.es),this.ml0=this.a*ar(this.e0,this.e1,this.e2,this.e3,this.lat0))}function At(t){var e,i,r=t.x,n=t.y;if(r=$e(r-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(n)*Math.sin(r)),i=this.a*(Math.atan2(Math.tan(n),Math.cos(r))-this.lat0);else{var o=Math.sin(n),s=Math.cos(n),a=dr(this.a,this.e,o),l=Math.tan(n)*Math.tan(n),h=r*Math.cos(n),u=h*h,c=this.es*s*s/(1-this.es),d=this.a*ar(this.e0,this.e1,this.e2,this.e3,n);e=a*h*(1-u*l*(1/6-(8-l+8*c)*u/120)),i=d-this.ml0+a*o/s*u*(.5+(5-l+6*c)*u/24)}return t.x=e+this.x0,t.y=i+this.y0,t}function Pt(t){t.x-=this.x0,t.y-=this.y0;var e,i,r=t.x/this.a,n=t.y/this.a;if(this.sphere){var o=n+this.lat0;e=Math.asin(Math.sin(o)*Math.cos(r)),i=Math.atan2(Math.tan(r),Math.cos(o))}else{var s=this.ml0/this.a+n,a=fr(s,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-Me)<=Ie)return t.x=this.long0,t.y=Me,n<0&&(t.y*=-1),t;var l=dr(this.a,this.e,Math.sin(a)),h=l*l*l/this.a/this.a*(1-this.es),u=Math.pow(Math.tan(a),2),c=r*this.a/l,d=c*c;e=a-l*Math.tan(a)/h*c*c*(.5-(1+3*u)*c*c/24),i=c*(1-d*(u/3+(1+3*u)*u*d/15))/Math.cos(a)}return t.x=$e(i+this.long0),t.y=pr(e),t}function It(){var t=Math.abs(this.lat0);if(Math.abs(t-Me)0){var e;switch(this.qp=Er(this.e,1),this.mmf=.5/(1-this.es),this.apa=Dt(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Er(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Ot(t){var e,i,r,n,o,s,a,l,h,u,c=t.x,d=t.y;if(c=$e(c-this.long0),this.sphere){if(o=Math.sin(d),u=Math.cos(d),r=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+u*r:1+this.sinph0*o+this.cosph0*u*r)<=Ie)return null;i=Math.sqrt(2/i),e=i*u*Math.sin(c),i*=this.mode===this.EQUIT?o:this.cosph0*o-this.sinph0*u*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),Math.abs(d+this.phi0)=0?(e=(h=Math.sqrt(s))*n,i=r*(this.mode===this.S_POLE?h:-h)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t}function Nt(t){t.x-=this.x0,t.y-=this.y0;var e,i,r,n,o,s,a,l=t.x/this.a,h=t.y/this.a;if(this.sphere){var u,c=0,d=0;if(u=Math.sqrt(l*l+h*h),(i=.5*u)>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(d=Math.sin(i),c=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(u)<=Ie?0:Math.asin(h*d/u),l*=d,h=c*u;break;case this.OBLIQ:i=Math.abs(u)<=Ie?this.phi0:Math.asin(c*this.sinph0+h*d*this.cosph0/u),l*=d*this.cosph0,h=(c-Math.sin(i)*this.sinph0)*u;break;case this.N_POLE:h=-h,i=Me-i;break;case this.S_POLE:i-=Me}e=0!==h||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(l,h):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(l/=this.dd,h*=this.dd,(s=Math.sqrt(l*l+h*h))Ie?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Ft(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var r=Er(this.e3,this.sin_phi,this.cos_phi),n=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,o=this.ns0*$e(e-this.long0),s=n*Math.sin(o)+this.x0,a=this.rh-n*Math.cos(o)+this.y0;return t.x=s,t.y=a,t}function Gt(t){var e,i,r,n,o,s;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1),n=0,0!==e&&(n=Math.atan2(r*t.x,r*t.y)),r=e*this.ns0/this.a,this.sphere?s=Math.asin((this.c-r*r)/(2*this.ns0)):(i=(this.c-r*r)/this.ns0,s=this.phi1z(this.e3,i)),o=$e(n/this.ns0+this.long0),t.x=o,t.y=s,t}function Wt(t,e){var i,r,n,o,s,a=Rr(.5*e);if(t0||Math.abs(s)<=Ie?(a=this.x0+this.a*o*i*Math.sin(r)/s,l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*i*n)/s):(a=this.x0+this.infinity_dist*i*Math.sin(r),l=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=l,t}function Kt(t){var e,i,r,n,o,s;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(n=Math.atan2(e,this.rc),i=Math.sin(n),r=Math.cos(n),s=Rr(r*this.sin_p14+t.y*i*this.cos_p14/e),o=Math.atan2(t.x*i,e*this.cos_p14*r-t.y*this.sin_p14*i),o=$e(this.long0+o)):(s=this.phic0,o=0),t.x=o,t.y=s,t}function jt(){this.sphere||(this.k0=Ze(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function zt(t){var e,i,r=t.x,n=t.y,o=$e(r-this.long0);if(this.sphere)e=this.x0+this.a*o*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var s=Er(this.e,Math.sin(n));e=this.x0+this.a*this.k0*o,i=this.y0+this.a*s*.5/this.k0}return t.x=e,t.y=i,t}function qt(t){t.x-=this.x0,t.y-=this.y0;var e,i;return this.sphere?(e=$e(this.long0+t.x/this.a/Math.cos(this.lat_ts)),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=Pr(this.e,2*t.y*this.k0/this.a),e=$e(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=i,t}function Yt(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function Ht(t){var e=t.x,i=t.y,r=$e(e-this.long0),n=pr(i-this.lat0);return t.x=this.x0+this.a*r*this.rc,t.y=this.y0+this.a*n,t}function Xt(t){var e=t.x,i=t.y;return t.x=$e(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=pr(this.lat0+(i-this.y0)/this.a),t}function Jt(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=lr(this.es),this.e1=hr(this.es),this.e2=ur(this.es),this.e3=cr(this.es),this.ml0=this.a*ar(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Zt(t){var e,i,r,n=t.x,o=t.y,s=$e(n-this.long0);if(r=s*Math.sin(o),this.sphere)Math.abs(o)<=Ie?(e=this.a*s,i=-1*this.a*this.lat0):(e=this.a*Math.sin(r)/Math.tan(o),i=this.a*(pr(o-this.lat0)+(1-Math.cos(r))/Math.tan(o)));else if(Math.abs(o)<=Ie)e=this.a*s,i=-1*this.ml0;else{var a=dr(this.a,this.e,Math.sin(o))/Math.tan(o);e=a*Math.sin(r),i=this.a*ar(this.e0,this.e1,this.e2,this.e3,o)-this.ml0+a*(1-Math.cos(r))}return t.x=e+this.x0,t.y=i+this.y0,t}function Qt(t){var e,i,r,n,o,s,a,l,h;if(r=t.x-this.x0,n=t.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=Ie)e=$e(r/this.a+this.long0),i=0;else{s=this.lat0+n/this.a,a=r*r/this.a/this.a+s*s,l=s;var u;for(o=kr;o;--o)if(u=Math.tan(l),h=-1*(s*(l*u+1)-l-.5*(l*l+a)*u)/((l-s)/u-1),l+=h,Math.abs(h)<=Ie){i=l;break}e=$e(this.long0+Math.asin(r*Math.tan(l)/this.a)/Math.sin(i))}else if(Math.abs(n+this.ml0)<=Ie)i=0,e=$e(this.long0+r/this.a);else{s=(this.ml0+n)/this.a,a=r*r/this.a/this.a+s*s,l=s;var c,d,p,f,g;for(o=kr;o;--o)if(g=this.e*Math.sin(l),c=Math.sqrt(1-g*g)*Math.tan(l),d=this.a*ar(this.e0,this.e1,this.e2,this.e3,l),p=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),f=d/this.a,h=(s*(c*f+1)-f-.5*c*(f*f+a))/(this.es*Math.sin(2*l)*(f*f+a-2*s*f)/(4*c)+(s-f)*(c*p-2/Math.sin(2*l))-p),l-=h,Math.abs(h)<=Ie){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=$e(this.long0+Math.asin(r*c/this.a)/Math.sin(i))}return t.x=e,t.y=i,t}function $t(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function te(t){var e,i=t.x,r=t.y,n=r-this.lat0,o=i-this.long0,s=n/xe*1e-5,a=o,l=1,h=0;for(e=1;e<=10;e++)l*=s,h+=this.A[e]*l;var u,c,d=h,p=a,f=1,g=0,m=0,E=0;for(e=1;e<=6;e++)u=f*d-g*p,c=g*d+f*p,f=u,g=c,m=m+this.B_re[e]*f-this.B_im[e]*g,E=E+this.B_im[e]*f+this.B_re[e]*g;return t.x=E*this.a+this.x0,t.y=m*this.a+this.y0,t}function ee(t){var e,i,r,n=t.x,o=t.y,s=n-this.x0,a=o-this.y0,l=a/this.a,h=s/this.a,u=1,c=0,d=0,p=0;for(e=1;e<=6;e++)i=u*l-c*h,r=c*l+u*h,u=i,c=r,d=d+this.C_re[e]*u-this.C_im[e]*c,p=p+this.C_im[e]*u+this.C_re[e]*c;for(var f=0;f.999999999999&&(i=.999999999999),e=Math.asin(i);var r=$e(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var n=Math.asin(i);return t.x=r,t.y=n,t}function ce(){Math.abs(this.lat1+this.lat2)=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var o=0;if(0!==i&&(o=Math.atan2(e*t.x,e*t.y)),this.sphere)return n=$e(this.long0+o/this.ns),r=pr(this.g-i/this.a),t.x=n,t.y=r,t;var s=this.g-i/this.a;return r=fr(s,this.e0,this.e1,this.e2,this.e3),n=$e(this.long0+o/this.ns),t.x=n,t.y=r,t}function fe(){this.R=this.a}function ge(t){var e,i,r=t.x,n=t.y,o=$e(r-this.long0);Math.abs(n)<=Ie&&(e=this.x0+this.R*o,i=this.y0);var s=Rr(2*Math.abs(n/Math.PI));(Math.abs(o)<=Ie||Math.abs(Math.abs(n)-Me)<=Ie)&&(e=this.x0,i=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*s):this.y0+Math.PI*this.R*-Math.tan(.5*s));var a=.5*Math.abs(Math.PI/o-o/Math.PI),l=a*a,h=Math.sin(s),u=Math.cos(s),c=u/(h+u-1),d=c*c,p=c*(2/h-1),f=p*p,g=Math.PI*this.R*(a*(c-f)+Math.sqrt(l*(c-f)*(c-f)-(f+l)*(d-f)))/(f+l);o<0&&(g=-g),e=this.x0+g;var m=l+c;return g=Math.PI*this.R*(p*m-a*Math.sqrt((f+l)*(l+1)-m*m))/(f+l),i=n>=0?this.y0+g:this.y0-g,t.x=e,t.y=i,t}function me(t){var e,i,r,n,o,s,a,l,h,u,c,d,p;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,r=t.x/c,n=t.y/c,o=r*r+n*n,s=-Math.abs(n)*(1+o),a=s-2*n*n+r*r,l=-2*s+1+2*n*n+o*o,p=n*n/l+(2*a*a*a/l/l/l-9*s*a/l/l)/27,h=(s-a*a/3/l)/l,u=2*Math.sqrt(-h/3),c=3*p/h/u,Math.abs(c)>1&&(c=c>=0?1:-1),d=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI:-(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI,e=Math.abs(r)2*Me*this.a)return;return i=e/this.a,r=Math.sin(i),n=Math.cos(i),o=this.long0,Math.abs(e)<=Ie?s=this.lat0:(s=Rr(n*this.sin_p12+t.y*r*this.cos_p12/e),a=Math.abs(this.lat0)-Me,o=$e(Math.abs(a)<=Ie?this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y):this.long0+Math.atan2(t.x*r,e*this.cos_p12*n-t.y*this.sin_p12*r))),t.x=o,t.y=s,t}return l=lr(this.es),h=hr(this.es),u=ur(this.es),c=cr(this.es),Math.abs(this.sin_p12-1)<=Ie?(d=this.a*ar(l,h,u,c,Me),e=Math.sqrt(t.x*t.x+t.y*t.y),p=d-e,s=fr(p/this.a,l,h,u,c),o=$e(this.long0+Math.atan2(t.x,-1*t.y)),t.x=o,t.y=s,t):Math.abs(this.sin_p12+1)<=Ie?(d=this.a*ar(l,h,u,c,Me),e=Math.sqrt(t.x*t.x+t.y*t.y),p=e-d,s=fr(p/this.a,l,h,u,c),o=$e(this.long0+Math.atan2(t.x,t.y)),t.x=o,t.y=s,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),m=Math.atan2(t.x,t.y),f=dr(this.a,this.e,this.sin_p12),E=Math.cos(m),y=this.e*this.cos_p12*E,_=-y*y/(1-this.es),v=3*this.es*(1-_)*this.sin_p12*this.cos_p12*E/(1-this.es),S=e/f,b=S-_*(1+_)*Math.pow(S,3)/6-v*(1+3*_)*Math.pow(S,4)/24,T=1-_*b*b/2-S*b*b*b/6,g=Math.asin(this.sin_p12*Math.cos(b)+this.cos_p12*Math.sin(b)*E),o=$e(this.long0+Math.asin(Math.sin(m)*Math.sin(b)/Math.cos(g))),s=Math.atan((1-this.es*T*this.sin_p12/Math.sin(g))*Math.tan(g)/(1-this.es)),t.x=o,t.y=s,t)}function ve(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Se(t){var e,i,r,n,o,s,a,l,h=t.x,u=t.y;return r=$e(h-this.long0),e=Math.sin(u),i=Math.cos(u),n=Math.cos(r),s=this.sin_p14*e+this.cos_p14*i*n,o=1,(s>0||Math.abs(s)<=Ie)&&(a=this.a*o*i*Math.sin(r),l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=l,t}function be(t){var e,i,r,n,o,s,a;return t.x-=this.x0,t.y-=this.y0,e=Math.sqrt(t.x*t.x+t.y*t.y),i=Rr(e/this.a),r=Math.sin(i),n=Math.cos(i),s=this.long0,Math.abs(e)<=Ie?(a=this.lat0,t.x=s,t.y=a,t):(a=Rr(n*this.sin_p14+t.y*r*this.cos_p14/e),o=Math.abs(this.lat0)-Me,Math.abs(o)<=Ie?(s=$e(this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y)),t.x=s,t.y=a,t):(s=$e(this.long0+Math.atan2(t.x*r,e*this.cos_p14*n-t.y*this.sin_p14*r)),t.x=s,t.y=a,t))}var Te=1,Le=2,we=4,Re=5,xe=484813681109536e-20,Me=Math.PI/2,Ce=.16666666666666666,Ae=.04722222222222222,Pe=.022156084656084655,Ie=void 0===Number.EPSILON?1e-10:Number.EPSILON,Oe=.017453292519943295,Ne=57.29577951308232,De=Math.PI/4,ke=2*Math.PI,Ve={};Ve.greenwich=0,Ve.lisbon=-9.131906111111,Ve.paris=2.337229166667,Ve.bogota=-74.080916666667,Ve.madrid=-3.687938888889,Ve.rome=12.452333333333,Ve.bern=7.439583333333,Ve.jakarta=106.807719444444,Ve.ferro=-17.666666666667,Ve.brussels=4.367975,Ve.stockholm=18.058277777778,Ve.athens=23.7163375,Ve.oslo=10.722916666667;var Fe={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},Ge=/[\s_\-\/\(\)]/g,We=function(e){var i,r,n,o={},s=e.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),a={proj:"projName",datum:"datumCode",rf:function(t){o.rf=parseFloat(t)},lat_0:function(t){o.lat0=t*Oe},lat_1:function(t){o.lat1=t*Oe},lat_2:function(t){o.lat2=t*Oe},lat_ts:function(t){o.lat_ts=t*Oe},lon_0:function(t){o.long0=t*Oe},lon_1:function(t){o.long1=t*Oe},lon_2:function(t){o.long2=t*Oe},alpha:function(t){o.alpha=parseFloat(t)*Oe},lonc:function(t){o.longc=t*Oe},x_0:function(t){o.x0=parseFloat(t)},y_0:function(t){o.y0=parseFloat(t)},k_0:function(t){o.k0=parseFloat(t)},k:function(t){o.k0=parseFloat(t)},a:function(t){o.a=parseFloat(t)},b:function(t){o.b=parseFloat(t)},r_a:function(){o.R_A=!0},zone:function(t){o.zone=parseInt(t,10)},south:function(){o.utmSouth=!0},towgs84:function(t){o.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){o.to_meter=parseFloat(t)},units:function(e){o.units=e;var i=t(Fe,e);i&&(o.to_meter=i.to_meter)},from_greenwich:function(t){o.from_greenwich=t*Oe},pm:function(e){var i=t(Ve,e);o.from_greenwich=(i||parseFloat(e))*Oe},nadgrids:function(t){"@null"===t?o.datumCode="none":o.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&-1!==e.indexOf(t.substr(0,1))&&-1!==e.indexOf(t.substr(1,1))&&-1!==e.indexOf(t.substr(2,1))&&(o.axis=t)}};for(i in s)r=s[i],i in a?(n=a[i],"function"==typeof n?n(r):o[n]=r):o[i]=r;return"string"==typeof o.datumCode&&"WGS84"!==o.datumCode&&(o.datumCode=o.datumCode.toLowerCase()),o},Be=1,Ue=/\s/,Ke=/[A-Za-z]/,je=/[A-Za-z84]/,ze=/[,\]]/,qe=/[\d\.E\-\+]/;e.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;Ue.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case Be:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},e.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(ze.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},e.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=Be)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=Be,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},e.prototype.number=function(t){if(qe.test(t))return void(this.word+=t);if(ze.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)},e.prototype.quoted=function(t){if('"'===t)return void(this.state=5);this.word+=t},e.prototype.keyword=function(t){if(je.test(t))return void(this.word+=t);if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=Be)}if(ze.test(t))return void this.afterItem(t);throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place)},e.prototype.neutral=function(t){if(Ke.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(qe.test(t))return this.word=t,void(this.state=3);if(ze.test(t))return void this.afterItem(t);throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place)},e.prototype.output=function(){for(;this.place2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e},mi=w("WGS84"),Ei=6,yi="AJSAJS",_i="AFAFAF",vi=65,Si=73,bi=79,Ti=86,Li=90,wi={forward:V,inverse:F,toPoint:G};$.fromMGRS=function(t){return new $(G(t))},$.prototype.toMGRS=function(t){return V([this.x,this.y],t)};var Ri=.01068115234375,xi=function(t){var e=[];e[0]=1-t*(.25+t*(.046875+t*(.01953125+t*Ri))),e[1]=t*(.75-t*(.046875+t*(.01953125+t*Ri)));var i=t*t;return e[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,e[3]=i*(.3645833333333333-.005696614583333333*t),e[4]=i*t*.3076171875,e},Mi=function(t,e,i,r){return i*=e,e*=e,r[0]*t-i*(r[1]+e*(r[2]+e*(r[3]+e*r[4])))},Ci=function(t,e,i){for(var r=1/(1-e),n=t,o=20;o;--o){var s=Math.sin(n),a=1-e*s*s;if(a=(Mi(n,s,Math.cos(n),i)-t)*(a*Math.sqrt(a))*r,n-=a,Math.abs(a)=0;)i=r*o-s+t[n],s=o,o=i;return e+i*Math.sin(2*e)},Vi=function(t,e){for(var i,r=2*Math.cos(e),n=t.length-1,o=t[n],s=0;--n>=0;)i=r*o-s+t[n],s=o,o=i;return Math.sin(e)*i},Fi=function(t){var e=Math.exp(t);return e=(e+1/e)/2},Gi=function(t,e,i){for(var r,n,o=Math.sin(e),s=Math.cos(e),a=Ii(i),l=Fi(i),h=2*s*l,u=-2*o*a,c=t.length-1,d=t[c],p=0,f=0,g=0;--c>=0;)r=f,n=p,f=d,p=g,d=h*f-r-u*p+t[c],g=u*f-n+h*p;return h=o*l,u=s*a,[h*d-u*g,h*g+u*d]},Wi=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Bi={init:rt,forward:nt,inverse:ot,names:Wi},Ui=function(t,e){if(void 0===t){if((t=Math.floor(30*($e(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t},Ki=["Universal Transverse Mercator System","utm"],ji={init:st,names:Ki,dependsOn:"etmerc"},zi=function(t,e){return Math.pow((1-t)/(1+t),e)},qi=20,Yi=["gauss"],Hi={init:at,forward:lt,inverse:ht,names:Yi},Xi=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative"],Ji={init:ut,forward:ct,inverse:dt,names:Xi},Zi=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Qi={init:ft,forward:gt,inverse:mt,names:Zi,ssfn_:pt},$i=["somerc"],tr={init:Et,forward:yt,inverse:_t,names:$i},er=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],ir={init:vt,forward:St,inverse:bt,names:er},rr=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],nr={init:Tt,forward:Lt,inverse:wt,names:rr},or=["Krovak","krovak"],sr={init:Rt,forward:xt,inverse:Mt,names:or},ar=function(t,e,i,r,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-r*Math.sin(6*n)},lr=function(t){return 1-.25*t*(1+t/16*(3+1.25*t))},hr=function(t){return.375*t*(1+.25*t*(1+.46875*t))},ur=function(t){return.05859375*t*t*(1+.75*t)},cr=function(t){return t*t*t*(35/3072)},dr=function(t,e,i){var r=e*i;return t/Math.sqrt(1-r*r)},pr=function(t){return Math.abs(t)1e-7?(i=t*e,(1-t*t)*(e/(1-i*i)-.5/t*Math.log((1-i)/(1+i)))):2*e},yr=.3333333333333333,_r=.17222222222222222,vr=.10257936507936508,Sr=.06388888888888888,br=.0664021164021164,Tr=.016415012942191543,Lr=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],wr={init:It,forward:Ot,inverse:Nt,names:Lr,S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4},Rr=function(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)},xr=["Albers_Conic_Equal_Area","Albers","aea"],Mr={init:Vt,forward:Ft,inverse:Gt,names:xr,phi1z:Wt},Cr=["gnom"],Ar={init:Bt,forward:Ut,inverse:Kt,names:Cr},Pr=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*Me:Me;for(var r,n,o,s,a=Math.asin(.5*e),l=0;l<30;l++)if(n=Math.sin(a),o=Math.cos(a),s=t*n,r=Math.pow(1-s*s,2)/(2*o)*(e/(1-t*t)-n/(1-s*s)+.5/t*Math.log((1-s)/(1+s))),a+=r,Math.abs(r)<=1e-10)return a;return NaN},Ir=["cea"],Or={init:jt,forward:zt,inverse:qt,names:Ir},Nr=["Equirectangular","Equidistant_Cylindrical","eqc"],Dr={init:Yt,forward:Ht,inverse:Xt,names:Nr},kr=20,Vr=["Polyconic","poly"],Fr={init:Jt,forward:Zt,inverse:Qt,names:Vr},Gr=["New_Zealand_Map_Grid","nzmg"],Wr={init:$t,forward:te,inverse:ee,names:Gr},Br=["Miller_Cylindrical","mill"],Ur={init:ie,forward:re,inverse:ne,names:Br},Kr=20,jr=["Sinusoidal","sinu"],zr={init:oe,forward:se,inverse:ae,names:jr},qr=["Mollweide","moll"],Yr={init:le,forward:he,inverse:ue,names:qr},Hr=["Equidistant_Conic","eqdc"],Xr={init:ce,forward:de,inverse:pe,names:Hr},Jr=["Van_der_Grinten_I","VanDerGrinten","vandg"],Zr={init:fe,forward:ge,inverse:me,names:Jr},Qr=["Azimuthal_Equidistant","aeqd"],$r={init:Ee,forward:ye,inverse:_e,names:Qr},tn=["ortho"],en={init:ve,forward:Se,inverse:be,names:tn};return k.defaultDatum="WGS84",k.Proj=w,k.WGS84=new k.Proj("WGS84"),k.Point=$,k.toPoint=gi,k.defs=l,k.transform=O,k.mgrs=wi,k.version="2.4.3",function(t){t.Proj.projections.add(Pi),t.Proj.projections.add(Bi), t.Proj.projections.add(ji),t.Proj.projections.add(Ji),t.Proj.projections.add(Qi),t.Proj.projections.add(tr),t.Proj.projections.add(ir),t.Proj.projections.add(nr),t.Proj.projections.add(sr),t.Proj.projections.add(mr),t.Proj.projections.add(wr),t.Proj.projections.add(Mr),t.Proj.projections.add(Ar),t.Proj.projections.add(Or),t.Proj.projections.add(Dr),t.Proj.projections.add(Fr),t.Proj.projections.add(Wr),t.Proj.projections.add(Ur),t.Proj.projections.add(zr),t.Proj.projections.add(Yr),t.Proj.projections.add(Xr),t.Proj.projections.add(Zr),t.Proj.projections.add($r),t.Proj.projections.add(en)}(k),k}),i("formats/geojson/GeoJSONCRS",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger","../../util/proj4-src"],function(t,e,i,r){"use strict";var n=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONCRS","constructor","missingType"));if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONCRS","constructor","missingProperties"));this._type=e,this._properties=r,this._projectionString=null};return Object.defineProperties(n.prototype,{type:{get:function(){return this._type}},properties:{get:function(){return this._properties}},projectionString:{get:function(){return this._projectionString}}}),n.prototype.isDefault=function(){return!(!this.isNamed()||this._projectionString!==e.EPSG4326_CRS&&this._projectionString!==e.WGS84_CRS)},n.prototype.isNamed=function(){return this._type===e.FIELD_CRS_NAME},n.prototype.isLinked=function(){return this._type===e.FIELD_CRS_LINK},n.prototype.isCRSSupported=function(){try{r(this._projectionString,e.EPSG4326_CRS)}catch(t){return i.log(i.LEVEL_WARNING,"Unknown GeoJSON coordinate reference system ("+t+"): "+this._properties.name),!1}return!0},n.prototype.getLinkedCRSString=function(t,e){var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="text",r.onreadystatechange=function(){4===r.readyState&&(200===r.status?(this._projectionString=r.response,e()):i.log(i.LEVEL_WARNING,"GeoJSON Linked CRS retrieval failed ("+r.statusText+"): "+t))}.bind(this),r.onerror=function(){i.log(i.LEVEL_WARNING,"GeoJSON Linked CRS retrieval failed: "+t)},r.ontimeout=function(){i.log(i.LEVEL_WARNING,"GeoJSON Linked CRS retrieval timed out: "+t)},r.send(null)},n.prototype.setCRSString=function(t){this.isNamed()?(this._projectionString=this._properties.name,t()):this.isLinked()&&this.getLinkedCRSString(this._properties.href,t)},n}),i("formats/geojson/GeoJSONFeature",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(t,e,i){"use strict";var r=function(r,n,o,s){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONFeature","constructor","missingGeometry"));if(!r[e.FIELD_TYPE])throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONFeature","constructor","missingFeatureGeometryType"));if(!n)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONFeature","constructor","missingProperties"));this._geometry=r,this._properties=n,this._id=o,this._bbox=s};return Object.defineProperties(r.prototype,{geometry:{get:function(){return this._geometry}},properties:{get:function(){return this._properties}},id:{get:function(){return this._id}},bbox:{get:function(){return this._bbox}}}),r}),i("formats/geojson/GeoJSONFeatureCollection",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(t,e,i){"use strict";var r=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONFeatureCollection","constructor","missingFeatures"));if("[object Array]"!==Object.prototype.toString.call(e))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONFeatureCollection","constructor","invalidFeatures"));this._features=e,this._bbox=r};return Object.defineProperties(r.prototype,{features:{get:function(){return this._features}},bbox:{get:function(){return this._bbox}}}),r}),i("shapes/PlacemarkAttributes",["../util/Color","../util/Font","../util/Offset","../shapes/ShapeAttributes","../shapes/TextAttributes"],function(t,e,i,r,n){"use strict";var o=function(e){this._imageColor=e?e._imageColor:new t(1,1,1,1),this._imageOffset=e?e._imageOffset:new i(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),this._imageScale=e?e._imageScale:1,this._imageSource=e?e._imageSource:null,this._depthTest=!e||e._depthTest,this._labelAttributes=e?e._labelAttributes:new n(null),this._drawLeaderLine=!!e&&e._drawLeaderLine,this._leaderLineAttributes=e?e._leaderLineAttributes:new r(null),this.stateKeyInvalid=!0};return o.prototype.computeStateKey=function(){return"ic "+this._imageColor.toHexString(!0)+" io "+this._imageOffset.toString()+" is "+this._imageScale+" ip "+this._imageSource+" dt "+this._depthTest+" la "+this._labelAttributes.stateKey+" dll "+this._drawLeaderLine+" lla "+this._leaderLineAttributes.stateKey},Object.defineProperties(o.prototype,{stateKey:{get:function(){return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey(),this.stateKeyInvalid=!1),this._stateKey}},imageColor:{get:function(){return this._imageColor},set:function(t){this._imageColor=t,this.stateKeyInvalid=!0}},imageOffset:{get:function(){return this._imageOffset},set:function(t){this._imageOffset=t,this.stateKeyInvalid=!0}},imageScale:{get:function(){return this._imageScale},set:function(t){this._imageScale=t,this.stateKeyInvalid=!0}},imageSource:{get:function(){return this._imageSource},set:function(t){this._imageSource=t,this.stateKeyInvalid=!0}},depthTest:{get:function(){return this._depthTest},set:function(t){this._depthTest=t,this.stateKeyInvalid=!0}},labelAttributes:{get:function(){return this._labelAttributes},set:function(t){this._labelAttributes=t,this.stateKeyInvalid=!0}},drawLeaderLine:{get:function(){return this._drawLeaderLine},set:function(t){this._drawLeaderLine=t,this.stateKeyInvalid=!0}},leaderLineAttributes:{get:function(){return this._leaderLineAttributes},set:function(t){this._leaderLineAttributes=t,this.stateKeyInvalid=!0}}}),o}),i("shapes/Placemark",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Font","../util/Logger","../geom/Matrix","../pick/PickedObject","../shapes/PlacemarkAttributes","../render/Renderable","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c){"use strict";var d=function(e,i,r){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"Placemark","constructor","missingPosition"));l.call(this),this.attributes=r||new a(null),this.highlightAttributes=null,this.highlighted=!1,this.position=e,this.eyeDistanceScaling=i,this.eyeDistanceScalingThreshold=1e6,this.eyeDistanceScalingLabelThreshold=1.5*this.eyeDistanceScalingThreshold,this.label=null,this.altitudeMode=WorldWind.ABSOLUTE,this.alwaysOnTop=!1,this.enableLeaderLinePicking=!1,this.updateImage=!0,this.declutterGroup=2,this.targetVisibility=1,this.currentVisibility=1,this.imageRotation=0,this.imageTilt=0,this.imageRotationReference=WorldWind.RELATIVE_TO_SCREEN,this.imageTiltReference=WorldWind.RELATIVE_TO_SCREEN,this.activeAttributes=null,this.activeTexture=null,this.labelTexture=null,this.placePoint=new u(0,0,0),this.groundPoint=new u(0,0,0),this.imageTransform=o.fromIdentity(),this.labelTransform=o.fromIdentity(),this.texCoordMatrix=o.fromIdentity(),this.imageBounds=null,this.layer=null,this.depthOffset=-.003};return d.screenPoint=new u(0,0,0),d.matrix=o.fromIdentity(),d.scratchPoint=new u(0,0,0),d.prototype=Object.create(l.prototype),Object.defineProperties(d.prototype,{screenBounds:{get:function(){return this.labelBounds}}}),d.prototype.copy=function(t){return this.position=t.position,this.attributes=t.attributes,this.highlightAttributes=t.highlightAttributes,this.highlighted=t.highlighted,this.enabled=t.enabled,this.label=t.label,this.altitudeMode=t.altitudeMode,this.pickDelegate=t.pickDelegate,this.alwaysOnTop=t.alwaysOnTop,this.depthOffset=t.depthOffset,this.targetVisibility=t.targetVisibility,this.currentVisibility=t.currentVisibility,this.imageRotation=t.imageRotation,this.imageTilt=t.imageTilt,this.imageRotationReference=t.imageRotationReference,this.imageTiltReference=t.imageTiltReference,this},d.prototype.clone=function(){var t=new d(this.position);return t.copy(this),t.pickDelegate=this.pickDelegate?this.pickDelegate:this,t},d.prototype.render=function(t){if(this.enabled&&t.accumulateOrderedRenderables&&(!t.globe.projectionLimits||t.globe.projectionLimits.containsLocation(this.position.latitude,this.position.longitude))){var e;if(this.lastFrameTime!==t.timestamp)e=this.makeOrderedRenderable(t);else{e=this.clone().makeOrderedRenderable(t)}e&&e.isVisible(t)&&(e.layer=t.currentLayer,this.lastFrameTime=t.timestamp,t.addOrderedRenderable(e))}},d.prototype.renderOrdered=function(t){if(this.drawOrderedPlacemark(t),t.pickingMode){var e=new s(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,this.position,this.layer,!1);t.pickPoint&&this.mustDrawLabel()&&this.labelBounds.containsPoint(t.navigatorState.convertPointToViewport(t.pickPoint,d.scratchPoint))&&(e.labelPicked=!0),t.resolvePick(e)}},d.prototype.makeOrderedRenderable=function(t){var e,i,r,n;if(this.determineActiveAttributes(t),!this.activeAttributes)return null;if(t.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,this.placePoint),this.eyeDistance=this.alwaysOnTop?0:t.navigatorState.eyePoint.distanceTo(this.placePoint),this.mustDrawLeaderLine(t)&&t.surfacePointForMode(this.position.latitude,this.position.longitude,0,this.altitudeMode,this.groundPoint),!t.navigatorState.projectWithDepth(this.placePoint,this.depthOffset,d.screenPoint))return null;var o=this.eyeDistanceScaling?Math.max(0,Math.min(1,this.eyeDistanceScalingThreshold/this.eyeDistance)):1;if(this.activeTexture?(e=this.activeTexture.originalImageWidth,i=this.activeTexture.originalImageHeight,r=this.activeAttributes.imageScale*o,n=this.activeAttributes.imageOffset.offsetForSize(e,i),this.imageTransform.setTranslation(d.screenPoint[0]-n[0]*r,d.screenPoint[1]-n[1]*r,d.screenPoint[2]),this.imageTransform.setScale(e*r,i*r,1)):(r=this.activeAttributes.imageScale*o,n=this.activeAttributes.imageOffset.offsetForSize(r,r),this.imageTransform.setTranslation(d.screenPoint[0]-n[0],d.screenPoint[1]-n[1],d.screenPoint[2]),this.imageTransform.setScale(r,r,1)),this.imageBounds=c.boundingRectForUnitQuad(this.imageTransform),this.mustDrawLabel()){var s=this.activeAttributes.labelAttributes.font,a=this.label+s.toString();this.labelTexture=t.gpuResourceCache.resourceForKey(a),this.labelTexture||(this.labelTexture=t.textSupport.createTexture(t,this.label,s,!0),t.gpuResourceCache.putResource(a,this.labelTexture,this.labelTexture.size)),e=this.labelTexture.imageWidth,i=this.labelTexture.imageHeight,r=this.activeAttributes.labelAttributes.scale*o,n=this.activeAttributes.labelAttributes.offset.offsetForSize(e,i),this.labelTransform.setTranslation(d.screenPoint[0]-n[0]*r,d.screenPoint[1]-n[1]*r,d.screenPoint[2]),this.labelTransform.setScale(e*r,i*r,1),this.labelBounds=c.boundingRectForUnitQuad(this.labelTransform)}return this},d.prototype.determineActiveAttributes=function(t){this.highlighted&&this.highlightAttributes?this.activeAttributes=this.highlightAttributes:this.activeAttributes=this.attributes,this.activeAttributes&&this.activeAttributes.imageSource&&(this.activeTexture=t.gpuResourceCache.resourceForKey(this.activeAttributes.imageSource),this.activeTexture&&!this.updateImage||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.activeAttributes.imageSource),this.updateImage=!1))},d.prototype.isVisible=function(t){return t.pickingMode?t.pickRectangle&&(this.imageBounds.intersects(t.pickRectangle)||this.mustDrawLabel()&&this.labelBounds.intersects(t.pickRectangle)||this.mustDrawLeaderLine(t)&&t.pickFrustum.intersectsSegment(this.groundPoint,this.placePoint)):this.imageBounds.intersects(t.navigatorState.viewport)||this.mustDrawLabel()&&this.labelBounds.intersects(t.navigatorState.viewport)||this.mustDrawLeaderLine(t)&&t.navigatorState.frustumInModelCoordinates.intersectsSegment(this.groundPoint,this.placePoint)},d.prototype.drawOrderedPlacemark=function(t){this.beginDrawing(t);try{this.doDrawOrderedPlacemark(t),t.pickingMode||this.drawBatchOrderedPlacemarks(t)}finally{this.endDrawing(t)}},d.prototype.drawBatchOrderedPlacemarks=function(t){for(var e;(e=t.peekOrderedRenderable())&&e.doDrawOrderedPlacemark;){t.popOrderedRenderable();try{e.doDrawOrderedPlacemark(t)}catch(t){n.logMessage(n.LEVEL_WARNING,"Placemark","drawBatchOrderedPlacemarks","Error occurred while rendering placemark using batching: "+t.message)}}},d.prototype.beginDrawing=function(t){var i,r=t.currentGlContext;t.findAndBindProgram(e),i=t.currentProgram,r.bindBuffer(r.ARRAY_BUFFER,t.unitQuadBuffer()),r.vertexAttribPointer(i.vertexTexCoordLocation,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i.vertexPointLocation),r.enableVertexAttribArray(i.vertexTexCoordLocation),i.loadTextureUnit(r,r.TEXTURE0),i.loadModulateColor(r,t.pickingMode)},d.prototype.endDrawing=function(t){var e=t.currentGlContext,i=t.currentProgram;e.disableVertexAttribArray(i.vertexPointLocation),e.disableVertexAttribArray(i.vertexTexCoordLocation),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindTexture(e.TEXTURE_2D,null)},d.prototype.doDrawOrderedPlacemark=function(t){var e,i=t.currentGlContext,r=t.currentProgram,n=!0;if(t.pickingMode&&(this.pickColor=t.uniquePickColor()),this.eyeDistanceScaling&&this.eyeDistance>this.eyeDistanceScalingLabelThreshold&&(this.targetVisibility=0),!t.pickingMode&&this.mustDrawLabel()&&this.currentVisibility!=this.targetVisibility){var o=(t.timestamp-t.previousRedrawTimestamp)/t.fadeTime;this.currentVisibility0&&(r.loadOpacity(i,t.pickingMode?1:this.layer.opacity*this.currentVisibility),d.matrix.copy(t.screenProjection),d.matrix.multiplyMatrix(this.labelTransform),r.loadModelviewProjection(i,d.matrix),!t.pickingMode&&this.labelTexture?(this.texCoordMatrix.setToIdentity(),this.texCoordMatrix.multiplyByTextureTransform(this.labelTexture),r.loadTextureMatrix(i,this.texCoordMatrix),r.loadColor(i,this.activeAttributes.labelAttributes.color),e=this.labelTexture.bind(t),r.loadTextureEnabled(i,e)):(r.loadTextureEnabled(i,!1),r.loadColor(i,this.pickColor)),this.activeAttributes.labelAttributes.depthTest?n||(n=!0,i.enable(i.DEPTH_TEST)):(n=!1,i.disable(i.DEPTH_TEST)),i.drawArrays(i.TRIANGLE_STRIP,0,4)),n||i.enable(i.DEPTH_TEST)},d.prototype.mustDrawLabel=function(){return this.label&&this.label.length>0&&this.activeAttributes.labelAttributes},d.prototype.mustDrawLeaderLine=function(t){return this.activeAttributes.drawLeaderLine&&this.activeAttributes.leaderLineAttributes&&(!t.pickingMode||this.enableLeaderLinePicking)},d}),i("shapes/Polygon",["../shapes/AbstractShape","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../util/ImageSource","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolygon","../geom/Vec2","../geom/Vec3","../util/libtess"],function(t,e,i,n,o,s,a,l,h,u,c,d,p,f,g,m){"use strict";var E=function(i,r){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Polygon","constructor","missingBoundaries"));t.call(this,r),i.length>0&&i[0].latitude&&(i=[i],this._boundariesSpecifiedSimply=!0),this._boundaries=i,this._textureCoordinates=null,this.referencePosition=this.determineReferencePosition(this._boundaries),this._extrude=!1,this.scratchPoint=new g(0,0,0)};return E.prototype=Object.create(t.prototype),Object.defineProperties(E.prototype,{boundaries:{get:function(){return this._boundariesSpecifiedSimply?this._boundaries[0]:this._boundaries},set:function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"Polygon","boundaries","missingBoundaries"));t.length>0&&t[0].latitude&&(t=[t],this._boundariesSpecifiedSimply=!0),this._boundaries=t,this.referencePosition=this.determineReferencePosition(this._boundaries),this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(t){this._textureCoordinates=t,this.reset()}},extrude:{get:function(){return this._extrude},set:function(t){this._extrude=t,this.reset()}}}),E.prototype.determineReferencePosition=function(t){return t.length>0&&t[0].length>2?t[0][0]:null},E.prototype.mustGenerateGeometry=function(t){return!this.currentData.boundaryPoints||(this.currentData.drawInterior!==this.activeAttributes.drawInterior||this.altitudeMode!==WorldWind.ABSOLUTE&&this.currentData.isExpired)},E.prototype.hasCapTexture=function(){return this.textureCoordinates&&this.capImageSource()},E.prototype.capImageSource=function(){return this.activeAttributes.imageSource?"string"==typeof this.activeAttributes.imageSource||this.activeAttributes.imageSource instanceof s?this.activeAttributes.imageSource:Array.isArray(this.activeAttributes.imageSource)&&this.activeAttributes.imageSource[0]&&("string"==typeof this.activeAttributes.imageSource[0]||this.activeAttributes.imageSource instanceof s)?this.activeAttributes.imageSource[0]:null:null},E.prototype.hasSideTextures=function(){return this.activeAttributes.imageSource&&Array.isArray(this.activeAttributes.imageSource)&&this.activeAttributes.imageSource.length>1},E.prototype.sideImageSource=function(t){if(0===t||2===this.activeAttributes.imageSource.length)return this.activeAttributes.imageSource[1];var e=this.activeAttributes.imageSource.length-1;return t=Math.min(t+1,e),this.activeAttributes.imageSource[t]},E.prototype.createSurfaceShape=function(){return new p(this.boundaries,null)},E.prototype.doMakeOrderedRenderable=function(t){if(!this.referencePosition)return null;if(!this.activeAttributes.drawInterior&&!this.activeAttributes.drawOutline)return null;if(!this.mustGenerateGeometry(t))return this;var e=this.currentData,i=e.referencePoint;t.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude,this._altitudeMode,i),e.transformationMatrix.setToTranslation(i[0],i[1],i[2]);for(var r=[],o=0;o0&&(o+=i[s]*e[s][n]);r[n]=o}return r}),this.polygonTessellator.gluTessCallback(r.gluEnum.GLU_TESS_ERROR,function(t){s=t,l.logMessage(l.LEVEL_WARNING,"Polygon","tessellatePolygon","Tessellation error "+t+".")})),n=g.computeBufferNormal(e[0],a),n||(n=new g(0,0,0),t.globe.surfaceNormalAtLocation(this.referencePosition.latitude,this.referencePosition.longitude,n)),this.polygonTessellator.gluTessNormal(n[0],n[1],n[2]),this.currentData.capNormal=n,this.polygonTessellator.gluTessBeginPolygon(o);for(var u=0;u0&&this.drawCap(t,e),this._extrude&&this.activeAttributes.drawInterior&&this.drawSides(t,e),this.activeAttributes.drawOutline&&this.drawOutline(t,e),i.refreshBuffers=!1,t.pickingMode){var r=new u(e,this.pickDelegate?this.pickDelegate:this,null,t.currentLayer,!1);t.resolvePick(r)}},E.prototype.drawCap=function(t,e){var i,r,n,o,s,a=t.currentGlContext,l=t.currentProgram,h=this.currentData,u=h.refreshBuffers,c=!!this.hasCapTexture(),d=this.activeAttributes.applyLighting,p=h.capTriangles.length/(c?5:3);l.loadTextureEnabled(a,!1),this.applyMvpMatrix(t),h.capVboCacheKey||(h.capVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(h.capVboCacheKey),i||(i=a.createBuffer(),t.gpuResourceCache.putResource(h.capVboCacheKey,i,4*h.capTriangles.length),u=!0),a.bindBuffer(a.ARRAY_BUFFER,i),u&&(s=d?this.makeCapBufferWithNormals():h.capTriangles,a.bufferData(a.ARRAY_BUFFER,s,a.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)),n=this.activeAttributes.interiorColor,r=n.alpha*t.currentLayer.opacity,a.depthMask(r>=1||t.pickingMode),l.loadColor(a,t.pickingMode?e:n),l.loadOpacity(a,t.pickingMode?r>0?1:0:r),o=12+(c?8:0)+(d?12:0),c&&!t.pickingMode&&(this.activeTexture=t.gpuResourceCache.resourceForKey(this.capImageSource()),this.activeTexture||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.capImageSource())),this.activeTexture&&this.activeTexture.bind(t)&&(a.enableVertexAttribArray(l.vertexTexCoordLocation),a.vertexAttribPointer(l.vertexTexCoordLocation,2,a.FLOAT,!1,o,12),this.scratchMatrix.setToIdentity(),this.scratchMatrix.multiplyByTextureTransform(this.activeTexture),l.loadTextureEnabled(a,!0),l.loadTextureUnit(a,a.TEXTURE0),l.loadTextureMatrix(a,this.scratchMatrix),l.loadModulateColor(a,t.pickingMode))),d&&!t.pickingMode&&(l.loadApplyLighting(a,!0),a.enableVertexAttribArray(l.normalVectorLocation),a.vertexAttribPointer(l.normalVectorLocation,3,a.FLOAT,!1,o,o-12)),a.vertexAttribPointer(l.vertexPointLocation,3,a.FLOAT,!1,o,0),a.drawArrays(a.TRIANGLES,0,p)},E.prototype.makeCapBufferWithNormals=function(){for(var t=this.currentData,e=t.capNormal,i=this.hasCapTexture()?5:3,r=i+3,n=t.capTriangles.length/i,o=t.capTriangles,s=new Float32Array(n*r),a=0,l=0;l=1||t.pickingMode),h.loadColor(l,t.pickingMode?e:n),h.loadOpacity(l,t.pickingMode?r>0?1:0:r),d&&!t.pickingMode){this.activeTexture=t.gpuResourceCache.resourceForKey(this.capImageSource()),this.activeTexture||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.capImageSource())),p?(h.loadApplyLighting(l,!0),l.enableVertexAttribArray(h.normalVectorLocation)):h.loadApplyLighting(l,!1);for(var E=0;E=1||t.pickingMode),h.loadColor(l,t.pickingMode?e:o),h.loadOpacity(l,t.pickingMode?1:n),l.lineWidth(this.activeAttributes.outlineWidth),this._extrude?(s=24,a=i/2):(s=12,a=i),l.vertexAttribPointer(h.vertexPointLocation,3,l.FLOAT,!1,s,0),l.drawArrays(l.LINE_STRIP,0,a),this.mustDrawVerticals(t)&&(l.vertexAttribPointer(h.vertexPointLocation,3,l.FLOAT,!1,0,0),l.drawArrays(l.LINES,0,i-2))},E.prototype.beginDrawing=function(t){var e=t.currentGlContext;this.activeAttributes.drawInterior&&e.disable(e.CULL_FACE),t.findAndBindProgram(i),e.enableVertexAttribArray(t.currentProgram.vertexPointLocation),!t.pickMode&&this.activeAttributes.applyLighting&&t.currentProgram.loadModelviewInverse(e,t.navigatorState.modelviewNormalTransform)},E.prototype.endDrawing=function(t){var e=t.currentGlContext;e.disableVertexAttribArray(t.currentProgram.vertexPointLocation),e.disableVertexAttribArray(t.currentProgram.normalVectorLocation),e.depthMask(!0),e.lineWidth(1),e.enable(e.CULL_FACE)},E}),i("shapes/SurfacePolyline",["../error/ArgumentError","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r){"use strict";var n=function(i,o){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfacePolyline","constructor","The specified locations array is null or undefined."));r.call(this,o),this._boundaries=i,this._stateId=n.stateId++,this._isInteriorInhibited=!0};return n.prototype=Object.create(r.prototype),Object.defineProperties(n.prototype,{boundaries:{get:function(){return this._boundaries}, set:function(i){if(!Array.isArray(i))throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfacePolyline","set boundaries","The specified value is not an array."));this.resetBoundaries(),this._boundaries=i,this._stateId=n.stateId++,this.stateKeyInvalid=!0}}}),n.stateId=Number.MIN_SAFE_INTEGER,n.staticStateKey=function(t){return r.staticStateKey(t)+" pl "+t._stateId},n.prototype.computeStateKey=function(){return n.staticStateKey(this)},n.prototype.computeBoundaries=function(t){},n}),i("formats/geojson/GeoJSONParser",["../../error/ArgumentError","../../util/Color","./GeoJSONConstants","./GeoJSONCRS","./GeoJSONFeature","./GeoJSONFeatureCollection","./GeoJSONGeometry","./GeoJSONGeometryCollection","./GeoJSONGeometryLineString","./GeoJSONGeometryMultiLineString","./GeoJSONGeometryMultiPoint","./GeoJSONGeometryMultiPolygon","./GeoJSONGeometryPoint","./GeoJSONGeometryPolygon","../../geom/Location","../../util/Logger","../../shapes/Placemark","../../shapes/PlacemarkAttributes","../../shapes/Polygon","../../geom/Position","../../util/proj4-src","../../layer/RenderableLayer","../../shapes/ShapeAttributes","../../shapes/SurfacePolygon","../../shapes/SurfacePolyline"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E,y,_,v,S,b,T,L){"use strict";var w=function(e){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","constructor","missingDataSource"));this._dataSource=e,this._geoJSONObject=null,this._geoJSONType=null,this._crs=null,this._layer=null,this._parserCompletionCallback=null,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this.defaultPlacemarkAttributes=new E(null),this.defaultShapeAttributes=new b(null),this.setProj4jsAliases()};return Object.defineProperties(w.prototype,{dataSource:{get:function(){return this._dataSource}},geoJSONObject:{get:function(){return this._geoJSONObject}},geoJSONType:{get:function(){return this._geoJSONType}},crs:{get:function(){return this._crs}},layer:{get:function(){return this._layer}},parserCompletionCallback:{get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}}}),w.prototype.load=function(t,e,i){t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this._layer=i||new S,this.isDataSourceJson()?this.parse(this.dataSource):this.requestUrl(this.dataSource)},w.prototype.defaultShapeConfigurationCallback=function(t,e){var i={},r=e.name||e.Name||e.NAME;return r&&(i.name=r),t.isPointType()||t.isMultiPointType()?i.attributes=this.defaultPlacemarkAttributes:t.isLineStringType()||t.isMultiLineStringType()?i.attributes=this.defaultShapeAttributes:(t.isPolygonType()||t.isMultiPolygonType())&&(i.attributes=this.defaultShapeAttributes),i},w.prototype.requestUrl=function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="text",e.onreadystatechange=function(){4===e.readyState&&(200===e.status?this.parse(e.response):g.log(g.LEVEL_WARNING,"GeoJSON retrieval failed ("+e.statusText+"): "+t))}.bind(this),e.onerror=function(){g.log(g.LEVEL_WARNING,"GeoJSON retrieval failed: "+t)},e.ontimeout=function(){g.log(g.LEVEL_WARNING,"GeoJSON retrieval timed out: "+t)},e.send(null)},w.prototype.parse=function(e){try{this._geoJSONObject=JSON.parse(e)}catch(t){g.logMessage(g.LEVEL_SEVERE,"GeoJSON","parse","invalidGeoJSONObject")}finally{if(this.geoJSONObject){if("[object Array]"===Object.prototype.toString.call(this.geoJSONObject))throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","parse","invalidGeoJSONObjectLength"));if(!this.geoJSONObject.hasOwnProperty(i.FIELD_TYPE))throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","parse","missingGeoJSONType"));this.setGeoJSONType(),this.setGeoJSONCRS(),this._parserCompletionCallback&&"function"==typeof this._parserCompletionCallback&&this._parserCompletionCallback(this.layer)}}},w.prototype.setGeoJSONCRS=function(){if(this.geoJSONObject[i.FIELD_CRS]){this._crs=new r(this.geoJSONObject[i.FIELD_CRS][i.FIELD_TYPE],this.geoJSONObject[i.FIELD_CRS][i.FIELD_PROPERTIES]);var t=function(){this.addRenderablesForGeoJSON(this.layer)}.bind(this);this.crs.setCRSString(t)}else this.addRenderablesForGeoJSON(this.layer)},w.prototype.addRenderablesForGeoJSON=function(e){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeoJSON","missingLayer"));switch(this.geoJSONType){case i.TYPE_FEATURE:var r=new n(this.geoJSONObject[i.FIELD_GEOMETRY],this.geoJSONObject[i.FIELD_PROPERTIES],this.geoJSONObject[i.FIELD_ID],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForFeature(e,r);break;case i.TYPE_FEATURE_COLLECTION:var s=new o(this.geoJSONObject[i.FIELD_FEATURES],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForFeatureCollection(e,s);break;case i.TYPE_GEOMETRY_COLLECTION:var l=new a(this.geoJSONObject[i.FIELD_GEOMETRIES],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForGeometryCollection(e,l,null);break;default:this.addRenderablesForGeometry(e,this.geoJSONObject,null)}},w.prototype.addRenderablesForGeometry=function(e,r,n){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometry","missingLayer"));if(!r)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometry","missingGeometry"));switch(r[i.FIELD_TYPE]){case i.TYPE_POINT:var o=new d(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForPoint(e,o,n||null);break;case i.TYPE_MULTI_POINT:var s=new u(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiPoint(e,s,n||null);break;case i.TYPE_LINE_STRING:var a=new l(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForLineString(e,a,n||null);break;case i.TYPE_MULTI_LINE_STRING:var f=new h(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiLineString(e,f,n||null);break;case i.TYPE_POLYGON:var m=new p(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForPolygon(e,m,n||null);break;case i.TYPE_MULTI_POLYGON:var E=new c(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiPolygon(e,E,n||null)}},w.prototype.addRenderablesForPoint=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForPoint","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForPoint","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported()){var o=i.coordinates[0],s=i.coordinates[1],a=i.coordinates[2]?i.coordinates[2]:0,l=this.getReprojectedIfRequired(s,o,this.crs),h=new _(l[1],l[0],a),u=new m(h,!1,n&&n.attributes?n.attributes:null);u.altitudeMode=WorldWind.RELATIVE_TO_GROUND,n&&n.name&&(u.label=n.name),n.highlightAttributes&&(u.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(u.pickDelegate=n.pickDelegate),n&&n.userProperties&&(u.userProperties=n.userProperties),e.addRenderable(u)}},w.prototype.addRenderablesForMultiPoint=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPoint","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPoint","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported())for(var o=0,s=i.coordinates.length;o0)for(var o=0;o>>8:i.getUint32(r,o)>>>8;if(n<=4)return s?i.getInt32(r,o):i.getUint32(r,o);if(n<=8)return i.getFloat64(r,o);throw new t(e.logMessage(e.LEVEL_SEVERE,"GeoTiffReader","getBytes","tooManyBytesRequested"))},getSampleBytes:function(t,r,n,o,s){var a;switch(o){case i.SampleFormat.UNSIGNED:a=this.getBytes(t,r,n,s,!1);break;case i.SampleFormat.SIGNED:a=this.getBytes(t,r,n,s,!0);break;case i.SampleFormat.IEEE_FLOAT:3==n?a=t.getFloat32(r,s)>>>8:4==n?a=t.getFloat32(r,s):8==n?a=t.getFloat64(r,s):e.log(e.LEVEL_WARNING,"Do not attempt to parse the data not handled: "+n);break;case i.SampleFormat.UNDEFINED:default:a=this.getBytes(t,r,n,s,!1)}return a},canvasToTiffImage:function(t){var e=new Image;return e.src=t.toDataURL(),e},getRGBAFillValue:function(t,e,i,r){return void 0===r&&(r=1),"rgba("+t+", "+e+", "+i+", "+r+")"},getTagValueAsString:function(t,e){for(var i in t)if(t[i]===e)return i},clampColorSample:function(t,e){var i=Math.pow(2,8-e);return Math.floor(t*i+(i-1))},clampColorSampleForElevation:function(t,e,i){var r=255/(i-e);return Math.round(r*(t-e))},getMinMaxGeotiffSamples:function(t,e){for(var i=1/0,r=-1/0,n=0;nr&&(r=t[n][o][s]),t[n][o][s]>>8*(4-s):this.valueOffset,e.push(o);else for(var a=0;a=8)if(this.type===n.Type.RATIONAL||this.type===n.Type.SRATIONAL)e.push(i.getBytes(this.geoTiffData,this.valueOffset+l,4,this.isLittleEndian)),e.push(i.getBytes(this.geoTiffData,this.valueOffset+l+4,4,this.isLittleEndian));else{if(this.type!==n.Type.DOUBLE)throw new t(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","parse","invalidTypeOfIFD"));e.push(i.getBytes(this.geoTiffData,this.valueOffset+l,8,this.isLittleEndian))}else e.push(i.getBytes(this.geoTiffData,this.valueOffset+l,s,this.isLittleEndian))}return this.type===n.Type.ASCII?(e.forEach(function(t,e,i){0===t?i.splice(e,1):i[e]=String.fromCharCode(t)}),e.join("")):e},o}),i("formats/geotiff/GeoTiffReader",["../../error/AbstractError","../../error/ArgumentError","./GeoTiffConstants","./GeoTiffKeyEntry","./GeoTiffMetadata","./GeoTiffUtil","../../geom/Location","../../geom/Sector","../../util/Logger","../../util/proj4-src","./TiffConstants","./TiffIFDEntry","../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","constructor","missingUrl"));this._url=t,this._isLittleEndian=!1,this._imageFileDirectories=[],this._geoTiffData=null,this._metadata=new n};return Object.defineProperties(p.prototype,{url:{get:function(){return this._url}},isLittleEndian:{get:function(){return this._isLittleEndian}},imageFileDirectories:{get:function(){return this._imageFileDirectories}},geoTiffData:{get:function(){return this._geoTiffData}},metadata:{get:function(){return this._metadata}}}),p.prototype.requestUrl=function(t,e){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status){var r=i.response;r&&(this.parse(r),e())}else l.log(l.LEVEL_WARNING,"GeoTiff retrieval failed ("+i.statusText+"): "+t)}.bind(this),i.onerror=function(){l.log(l.LEVEL_WARNING,"GeoTiff retrieval failed: "+t)},i.ontimeout=function(){l.log(l.LEVEL_WARNING,"GeoTiff retrieval timed out: "+t)},i.send(null)},p.prototype.parse=function(e){if(this._geoTiffData=new DataView(e),this.getEndianness(),!this.isTiffFileType())throw new t(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","parse","invalidTiffFileType"));var i=o.getBytes(this.geoTiffData,4,4,this.isLittleEndian);this.parseImageFileDirectory(i),this.getMetadataFromImageFileDirectory(),this.parseGeoKeys(),this.setBBox()},p.prototype.getEndianness=function(){var e=o.getBytes(this.geoTiffData,0,2,this.isLittleEndian);if(18761===e)this._isLittleEndian=!0;else{if(19789!==e)throw new t(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","getEndianness","invalidByteOrderValue"));this._isLittleEndian=!1}},p.prototype.isTiffFileType=function(){return 42===o.getBytes(this.geoTiffData,2,2,this.isLittleEndian)},p.prototype.isGeoTiff=function(){return!!this.getIFDByTag(i.Tag.GEO_KEY_DIRECTORY)},p.prototype.readAsImage=function(t){this.requestUrl(this.url,function(){var e=this.metadata.bitsPerSample,i=this.metadata.samplesPerPixel,r=this.metadata.photometricInterpretation,n=this.metadata.imageLength,o=this.metadata.imageWidth;if(this.metadata.colorMap)var s=this.metadata.colorMap,a=Math.pow(2,e[0]);var l=document.createElement("canvas");l.width=o,l.height=n;var h=l.getContext("2d");if(this.metadata.stripOffsets){var u=this.parseStrips(!1);if(this.metadata.rowsPerStrip)var c=this.metadata.rowsPerStrip;else var c=n;for(var d=u.length,p=0,f=n%c,g=0===f?c:f,m=0;m=0&&x<=127?L=x+1:x>=-127&&x<=-1?w=1-x:T=!0}else{for(var M=o.getBytes(this.geoTiffData,n+c,1,this.isLittleEndian),C=0;C6&&0===c);else if(16===d){var p=t,f=i;t=p*a[0]+f*a[1]+a[3],i=p*a[4]+f*a[5]+a[7],r=[t,i]}else c<3||u<6?r=[t,i]:(t=(t-n[0])*o[0]+n[3],i=(i-n[1])*(-1*o[1])+n[4],r=[t,i]);return h.defs([["EPSG:26771","+proj=tmerc +lat_0=36.66666666666666 +lon_0=-88.33333333333333 +k=0.9999749999999999 +x_0=152400.3048006096 +y_0=0 +ellps=clrk66 +datum=NAD27 +to_meter=0.3048006096012192 +no_defs "],["EPSG:32633","+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"]]),this.metadata.projectedCSType&&(r=h("EPSG:"+this.metadata.projectedCSType,"EPSG:4326",r)),new s(r[1],r[0])},p.prototype.setBBox=function(){var t=this.geoTiffImageToPCS(0,0),e=this.geoTiffImageToPCS(this.metadata.imageWidth,0),i=this.geoTiffImageToPCS(0,this.metadata.imageLength);this.geoTiffImageToPCS(this.metadata.imageWidth,this.metadata.imageLength);this.metadata.bbox=new a(i.latitude,t.latitude,t.longitude,e.longitude)},p.prototype.getMetadataFromImageFileDirectory=function(){for(var t=0;t1?s-1:1),T=(S-v)/(a>1?a-1:1),L=h||new n(0,0,0),w=u?u[0]:0,R=0,x=0;for(d=0,f=y;dthis.startPosition.altitude?(s=Math.max(0,this.maxAltitude-this.startPosition.altitude),s+=Math.abs(this.targetPosition.altitude-this.maxAltitude)):s=Math.abs(this.targetPosition.altitude-this.startPosition.altitude);var d=Math.max(l,s/this.wwd.globe.equatorialRadius);if(0!==d){d<2*c&&(a=Math.min(d/c*this.travelTime,this.travelTime)),a=Math.max(1,a),this.panVelocity=l/a,this.rangeVelocity=s/a;var p=this,f=function(){if(p.cancelled)return void(p.completionCallback&&p.completionCallback(p));p.update()?setTimeout(f,p.animationFrequency):p.completionCallback&&p.completionCallback(p)};setTimeout(f,this.animationFrequency)}},n.prototype.update=function(){var t=new i(this.wwd.navigator.lookAtLocation.latitude,this.wwd.navigator.lookAtLocation.longitude,this.wwd.navigator.range),e=this.updateRange(t);return e=this.updateLocation(t)||e,this.wwd.redraw(),e},n.prototype.updateRange=function(t){var e,i,r=!1;return this.maxAltitudeReachedTime?(i=Date.now()-this.maxAltitudeReachedTime,this.maxAltitude>this.targetPosition.altitude?(e=this.maxAltitude-this.rangeVelocity*i,e=Math.max(e,this.targetPosition.altitude)):(e=this.maxAltitude+this.rangeVelocity*i,e=Math.min(e,this.targetPosition.altitude)),this.wwd.navigator.range=e,r=Math.abs(this.wwd.navigator.range-this.targetPosition.altitude)>1):(i=Date.now()-this.startTime,e=Math.min(this.startPosition.altitude+this.rangeVelocity*i,this.maxAltitude),Math.abs(this.wwd.navigator.range-e)<1&&(this.maxAltitudeReachedTime=Date.now()),this.wwd.navigator.range=e,r=!0),r},n.prototype.updateLocation=function(e){var i=Date.now()-this.startTime,r=t.greatCircleDistance(this.startPosition,e),n=t.greatCircleDistance(e,this.targetPosition),o=t.greatCircleAzimuth(e,this.targetPosition),s=this.panVelocity*i,a=Math.min(s-r,n),l=t.greatCircleLocation(e,o,a,new t(0,0)),h=!1;return this.wwd.navigator.lookAtLocation.latitude=l.latitude,this.wwd.navigator.lookAtLocation.longitude=l.longitude,a<1/this.wwd.globe.equatorialRadius&&(h=!0),!h},n}),i("util/HighlightController",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";return function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"HighlightController","constructor","missingWorldWindow"));this.worldWindow=i;var r=[],n=function(t){for(var e=t.clientX,n=t.clientY,o=r.length>0,s=0;s0&&(o=!0),a.objects.length>0)for(var l=0;l1;)try{"array"===o||"nodebuffer"===o?r.push(String.fromCharCode.apply(null,t.slice(s,Math.min(s+i,n)))):r.push(String.fromCharCode.apply(null,t.subarray(s,Math.min(s+i,n)))),s+=i}catch(t){i=Math.floor(i/2)}return r.join("")}function s(t,e){for(var i=0;i>2,a=(3&i)<<4|n>>4,l=(15&n)<<2|o>>6,h=63&o,isNaN(n)?l=h=64:isNaN(o)&&(h=64),u=u+r.charAt(s)+r.charAt(a)+r.charAt(l)+r.charAt(h);return u},e.decode=function(t,e){var i,n,o,s,a,l,h,u="",c=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");c>4,n=(15&a)<<4|l>>2,o=(3&l)<<6|h,u+=String.fromCharCode(i),64!=l&&(u+=String.fromCharCode(n)),64!=h&&(u+=String.fromCharCode(o));return u}},function(t,e,i){var r=i(2),n=i(0),o=i(37),s=i(14),a=i(15),l=i(3),h=i(5),u=i(16),c=i(7),d=i(17),p=i(38),f=i(39),g=function(t){if(t._data instanceof u&&(t._data=t._data.getContent(),t.options.binary=!0,t.options.base64=!1,"uint8array"===n.getTypeOf(t._data))){var e=t._data;t._data=new Uint8Array(e.length),0!==e.length&&t._data.set(e,0)}return t._data},m=function(t){var e=g(t);return"string"===n.getTypeOf(e)?!t.options.binary&&r.nodebuffer?c(e,"utf-8"):t.asBinary():e},E=function(t){var e=g(this);return null===e||void 0===e?"":(this.options.base64&&(e=l.decode(e)),e=t&&this.options.binary?C.utf8decode(e):n.transformTo("string",e),t||this.options.binary||(e=n.transformTo("string",C.utf8encode(e))),e)},y=function(t,e,i){this.name=t,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=e,this.options=i,this._initialMetadata={dir:i.dir,date:i.date}};y.prototype={asText:function(){return E.call(this,!0)},asBinary:function(){return E.call(this,!1)},asNodeBuffer:function(){var t=m(this);return n.transformTo("nodebuffer",t)},asUint8Array:function(){var t=m(this);return n.transformTo("uint8array",t)},asArrayBuffer:function(){return this.asUint8Array().buffer}};var _=function(t,e){var i,r="";for(i=0;i>>=8;return r},v=function(t){return t=t||{},!0!==t.base64||null!==t.binary&&void 0!==t.binary||(t.binary=!0),t=n.extend(t,a),t.date=t.date||new Date,null!==t.compression&&(t.compression=t.compression.toUpperCase()),t},S=function(t,e,i){var r,o=n.getTypeOf(e);if(i=v(i),"string"==typeof i.unixPermissions&&(i.unixPermissions=parseInt(i.unixPermissions,8)),i.unixPermissions&&16384&i.unixPermissions&&(i.dir=!0),i.dosPermissions&&16&i.dosPermissions&&(i.dir=!0),i.dir&&(t=T(t)),i.createFolders&&(r=b(t))&&L.call(this,r,!0),i.dir||null===e||void 0===e)i.base64=!1,i.binary=!1,e=null,o=null;else if("string"===o)i.binary&&!i.base64&&!0!==i.optimizedBinaryString&&(e=n.string2binary(e));else{if(i.base64=!1,i.binary=!0,!(o||e instanceof u))throw new Error("The data of '"+t+"' is in an unsupported format !");"arraybuffer"===o&&(e=n.transformTo("uint8array",e))}var s=new y(t,e,i);return this.files[t]=s,s},b=function(t){"/"==t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return e>0?t.substring(0,e):""},T=function(t){return"/"!=t.slice(-1)&&(t+="/"),t},L=function(t,e){return e=void 0!==e&&e,t=T(t),this.files[t]||S.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]},w=function(t,e,i){var r,s=new u;return t._data instanceof u?(s.uncompressedSize=t._data.uncompressedSize,s.crc32=t._data.crc32,0===s.uncompressedSize||t.dir?(e=h.STORE,s.compressedContent="",s.crc32=0):t._data.compressionMethod===e.magic?s.compressedContent=t._data.getCompressedContent():(r=t._data.getContent(),s.compressedContent=e.compress(n.transformTo(e.compressInputType,r),i))):(r=m(t),r&&0!==r.length&&!t.dir||(e=h.STORE,r=""),s.uncompressedSize=r.length,s.crc32=o(r),s.compressedContent=e.compress(n.transformTo(e.compressInputType,r),i)),s.compressedSize=s.compressedContent.length,s.compressionMethod=e.magic,s},R=function(t,e){var i=t;return t||(i=e?16893:33204),(65535&i)<<16},x=function(t,e){return 63&(t||0)},M=function(t,e,i,r,a,l){var h,u,c,p,f=(i.compressedContent,l!==d.utf8encode),g=n.transformTo("string",l(e.name)),m=n.transformTo("string",d.utf8encode(e.name)),E=e.comment||"",y=n.transformTo("string",l(E)),v=n.transformTo("string",d.utf8encode(E)),S=m.length!==e.name.length,b=v.length!==E.length,T=e.options,L="",w="",M="";c=e._initialMetadata.dir!==e.dir?e.dir:T.dir,p=e._initialMetadata.date!==e.date?e.date:T.date;var C=0,A=0;c&&(C|=16),"UNIX"===a?(A=798,C|=R(e.unixPermissions,c)):(A=20,C|=x(e.dosPermissions)),h=p.getHours(),h<<=6,h|=p.getMinutes(),h<<=5,h|=p.getSeconds()/2,u=p.getFullYear()-1980,u<<=4,u|=p.getMonth()+1,u<<=5,u|=p.getDate(),S&&(w=_(1,1)+_(o(g),4)+m,L+="up"+_(w.length,2)+w),b&&(M=_(1,1)+_(this.crc32(y),4)+v,L+="uc"+_(M.length,2)+M);var P="";return P+="\n\0",P+=f||!S&&!b?"\0\0":"\0\b",P+=i.compressionMethod,P+=_(h,2),P+=_(u,2),P+=_(i.crc32,4),P+=_(i.compressedSize,4),P+=_(i.uncompressedSize,4),P+=_(g.length,2),P+=_(L.length,2),{fileRecord:s.LOCAL_FILE_HEADER+P+g+L,dirRecord:s.CENTRAL_FILE_HEADER+_(A,2)+P+_(y.length,2)+"\0\0\0\0"+_(C,4)+_(r,4)+g+L+y,compressedObject:i}},C={load:function(t,e){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(t){var e,i,r,o,s=[];for(e in this.files)this.files.hasOwnProperty(e)&&(r=this.files[e],o=new y(r.name,r._data,n.extend(r.options)),i=e.slice(this.root.length,e.length),e.slice(0,this.root.length)===this.root&&t(i,o)&&s.push(o));return s},file:function(t,e,i){if(1===arguments.length){if(n.isRegExp(t)){var r=t;return this.filter(function(t,e){return!e.dir&&r.test(t)})}return this.filter(function(e,i){return!i.dir&&e===t})[0]||null}return t=this.root+t,S.call(this,t,e,i),this},folder:function(t){if(!t)return this;if(n.isRegExp(t))return this.filter(function(e,i){return i.dir&&t.test(e)});var e=this.root+t,i=L.call(this,e),r=this.clone();return r.root=i.name,r},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!=t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var i=this.filter(function(e,i){return i.name.slice(0,t.length)===t}),r=0;r=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),o.alloc(+t)}function m(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return Y(t).length;default:if(r)return j(t).length;e=(""+e).toLowerCase(),r=!0}}function E(t,e,i){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if(i>>>=0,e>>>=0,i<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,i);case"utf8":case"utf-8":return M(this,e,i);case"ascii":return A(this,e,i);case"latin1":case"binary":return P(this,e,i);case"base64":return x(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function _(t,e,i,r,n){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:v(t,e,i,r,n);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):v(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}function v(t,e,i,r,n){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,l=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,i/=2}var h;if(n){var u=-1;for(h=i;ha&&(i=a-l),h=i;h>=0;h--){for(var c=!0,d=0;dn&&(r=n):r=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1;if(n+a<=i){var l,h,u,c;switch(a){case 1:o<128&&(s=o);break;case 2:l=t[n+1],128==(192&l)&&(c=(31&o)<<6|63&l)>127&&(s=c);break;case 3:l=t[n+1],h=t[n+2],128==(192&l)&&128==(192&h)&&(c=(15&o)<<12|(63&l)<<6|63&h)>2047&&(c<55296||c>57343)&&(s=c);break;case 4:l=t[n+1],h=t[n+2],u=t[n+3],128==(192&l)&&128==(192&h)&&128==(192&u)&&(c=(15&o)<<18|(63&l)<<12|(63&h)<<6|63&u)>65535&&c<1114112&&(s=c)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),n+=a}return C(r)}function C(t){var e=t.length;if(e<=$)return String.fromCharCode.apply(String,t);for(var i="",r=0;rr)&&(i=r);for(var n="",o=e;oi)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,i,r,n,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function k(t,e,i,r){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-i,2);n>>8*(r?n:1-n)}function V(t,e,i,r){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-i,4);n>>8*(r?n:3-n)&255}function F(t,e,i,r,n,o){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function G(t,e,i,r,n){return n||F(t,e,i,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,i,r,23,4),i+4}function W(t,e,i,r,n){return n||F(t,e,i,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,i,r,52,8),i+8}function B(t){if(t=U(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function U(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function K(t){return t<16?"0"+t.toString(16):t.toString(16)}function j(t,e){e=e||1/0;for(var i,r=t.length,n=null,o=[],s=0;s55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&o.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function z(t){for(var e=[],i=0;i>8,n=i%256,o.push(n),o.push(r);return o}function Y(t){return J.toByteArray(B(t))}function H(t,e,i,r){for(var n=0;n=e.length||n>=t.length);++n)e[n+i]=t[n];return n}function X(t){return t!==t}var J=i(24),Z=i(25),Q=i(26);e.Buffer=o,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=r(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,i){return s(null,t,e,i)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,i){return l(null,t,e,i)},o.allocUnsafe=function(t){return h(null,t)},o.allocUnsafeSlow=function(t){return h(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,n=0,s=Math.min(i,r);n0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),""},o.prototype.compare=function(t,e,i,r,n){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||i>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&e>=i)return 0;if(r>=n)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,r>>>=0,n>>>=0,this===t)return 0;for(var s=n-r,a=i-e,l=Math.min(s,a),h=this.slice(r,n),u=t.slice(e,i),c=0;cn)&&(i=n),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return S(this,t,e,i);case"utf8":case"utf-8":return b(this,t,e,i);case"ascii":return T(this,t,e,i);case"latin1":case"binary":return L(this,t,e,i);case"base64":return w(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;o.prototype.slice=function(t,e){var i=this.length;t=~~t,e=void 0===e?i:~~e,t<0?(t+=i)<0&&(t=0):t>i&&(t=i),e<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)r+=this[t+--e]*n;return r},o.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||N(t,e,this.length);for(var r=this[t],n=1,o=0;++o=n&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||N(t,e,this.length);for(var r=e,n=1,o=this[t+--r];r>0&&(n*=256);)o+=this[t+--r]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},o.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},o.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),Z.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),Z.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),Z.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),Z.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,i,r){if(t=+t,e|=0,i|=0,!r){D(this,t,e,i,Math.pow(2,8*i)-1,0)}var n=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+n]=t/o&255;return e+i},o.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):V(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):V(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);D(this,t,e,i,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+i},o.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);D(this,t,e,i,n-1,-n)}var o=i-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i},o.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):V(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):V(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,i){return G(this,t,e,!0,i)},o.prototype.writeFloatBE=function(t,e,i){return G(this,t,e,!1,i)},o.prototype.writeDoubleLE=function(t,e,i){return W(this,t,e,!0,i)},o.prototype.writeDoubleBE=function(t,e,i){return W(this,t,e,!1,i)},o.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--n)t[n+e]=this[n+i];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,i=void 0===i?this.length:i>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s>>16&65535|0,s=0;0!==i;){s=i>2e3?2e3:i,i-=s;do{n=n+e[r++]|0,o=o+n|0}while(--s);n%=65521,o%=65521}return n|o<<16|0}t.exports=r},function(t,e,i){function r(t,e,i,r){var o=n,s=r+i;t^=-1;for(var a=r;a>>8^o[255&(t^e[a])];return-1^t}var n=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();t.exports=r},function(t,e,i){function r(t,e){if(e<65537&&(t.subarray&&s||!t.subarray&&o))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var i="",r=0;r=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;a[254]=a[254]=1,e.string2buf=function(t){var e,i,r,o,s,a=t.length,l=0;for(o=0;o>>6,e[s++]=128|63&i):i<65536?(e[s++]=224|i>>>12,e[s++]=128|i>>>6&63,e[s++]=128|63&i):(e[s++]=240|i>>>18,e[s++]=128|i>>>12&63,e[s++]=128|i>>>6&63,e[s++]=128|63&i);return e},e.buf2binstring=function(t){return r(t,t.length)},e.binstring2buf=function(t){for(var e=new n.Buf8(t.length),i=0,r=e.length;i4)h[n++]=65533,i+=s-1;else{for(o&=2===s?31:3===s?15:7;s>1&&i1?h[n++]=65533:o<65536?h[n++]=o:(o-=65536,h[n++]=55296|o>>10&1023,h[n++]=56320|1023&o)}return r(h,n)},e.utf8border=function(t,e){var i;for(e=e||t.length,e>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+a[t[i]]>e?i:e}},function(t,e,i){function r(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=r},function(t,e,i){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e,i){e.LOCAL_FILE_HEADER="PK",e.CENTRAL_FILE_HEADER="PK",e.CENTRAL_DIRECTORY_END="PK",e.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",e.ZIP64_CENTRAL_DIRECTORY_END="PK",e.DATA_DESCRIPTOR="PK\b"},function(t,e,i){e.base64=!1,e.binary=!1,e.dir=!1,e.createFolders=!1,e.date=null,e.compression=null,e.compressionOptions=null,e.comment=null,e.unixPermissions=null,e.dosPermissions=null},function(t,e,i){function r(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}r.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},t.exports=r},function(t,e,i){for(var r=i(0),n=i(2),o=i(7),s=new Array(256),a=0;a<256;a++)s[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;s[254]=s[254]=1;var l=function(t){var e,i,r,o,s,a=t.length,l=0;for(o=0;o>>6,e[s++]=128|63&i):i<65536?(e[s++]=224|i>>>12,e[s++]=128|i>>>6&63,e[s++]=128|63&i):(e[s++]=240|i>>>18,e[s++]=128|i>>>12&63,e[s++]=128|i>>>6&63,e[s++]=128|63&i);return e},h=function(t,e){var i;for(e=e||t.length,e>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+s[t[i]]>e?i:e},u=function(t){var e,i,n,o,a=t.length,l=new Array(2*a);for(i=0,e=0;e4)l[i++]=65533,e+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&e1?l[i++]=65533:n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|1023&n)}return l.length!==i&&(l.subarray?l=l.subarray(0,i):l.length=i),r.applyFromCharCode(l)};e.utf8encode=function(t){return n.nodebuffer?o(t,"utf-8"):l(t)},e.utf8decode=function(t){if(n.nodebuffer)return r.transformTo("nodebuffer",t).toString("utf-8");t=r.transformTo(n.uint8array?"uint8array":"array",t);for(var e=[],i=0,o=t.length;i=this.index;e--)i=(i<<8)+this.byteAt(e);return this.index+=t,i},readString:function(t){return n.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1)}},t.exports=r},function(t,e,i){function r(t){t&&(this.data=t,this.length=this.data.length,this.index=0,this.zero=0)}var n=i(21);r.prototype=new n,r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){function r(t){if(t){this.data=t,this.length=this.data.length,this.index=0,this.zero=0;for(var e=0;e=0;--o)if(this.data[o]===e&&this.data[o+1]===i&&this.data[o+2]===r&&this.data[o+3]===n)return o-this.zero;return-1},r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){function r(t,e){if(!(this instanceof r))return new r(t,e);this.files={},this.comment=null,this.root="",t&&this.load(t,e),this.clone=function(){var t=new r;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}var n=i(3);r.prototype=i(4),r.prototype.load=i(40),r.support=i(2),r.defaults=i(15),r.utils=i(44),r.base64={encode:function(t){return n.encode(t)},decode:function(t){return n.decode(t)}},r.compressions=i(5),t.exports=r},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){function r(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function n(t){return 3*t.length/4-r(t)}function o(t){var e,i,n,o,s,a=t.length;o=r(t),s=new c(3*a/4-o),i=o>0?a-4:a;var l=0;for(e=0;e>16&255,s[l++]=n>>8&255,s[l++]=255&n;return 2===o?(n=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,s[l++]=255&n):1===o&&(n=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,s[l++]=n>>8&255,s[l++]=255&n),s}function s(t){return h[t>>18&63]+h[t>>12&63]+h[t>>6&63]+h[63&t]}function a(t,e,i){for(var r,n=[],o=e;ol?l:s+16383));return 1===r?(e=t[i-1],n+=h[e>>2],n+=h[e<<4&63],n+="=="):2===r&&(e=(t[i-2]<<8)+t[i-1],n+=h[e>>10],n+=h[e>>4&63],n+=h[e<<2&63],n+="="),o.push(n),o.join("")}e.byteLength=n,e.toByteArray=o,e.fromByteArray=l;for(var h=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,f=d.length;p>1,u=-7,c=i?n-1:0,d=i?-1:1,p=t[e+c];for(c+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+t[e+c],c+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+c],c+=d,u-=8);if(0===o)o=1-h;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=h}return(p?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,i,r,n,o){var s,a,l,h=8*o-n-1,u=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),e+=s+c>=1?d/l:d*Math.pow(2,1-c),e*l>=2&&(s++,l/=2),s+c>=u?(a=0,s=u):s+c>=1?(a=(e*l-1)*Math.pow(2,n),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;t[i+p]=255&a,p+=f,a/=256,n-=8);for(s=s<0;t[i+p]=255&s,p+=f,s/=256,h-=8);t[i+p-f]|=128*g}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=i(28);e.uncompressInputType=r?"uint8array":"array",e.compressInputType=r?"uint8array":"array",e.magic="\b\0",e.compress=function(t,e){return n.deflateRaw(t,{level:e.level||-1})},e.uncompress=function(t){return n.inflateRaw(t)}},function(t,e,i){var r=i(1).assign,n=i(29),o=i(32),s=i(13),a={};r(a,n,o,s),t.exports=a},function(t,e,i){function r(t){if(!(this instanceof r))return new r(t);this.options=l.assign({level:f,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==p)throw new Error(u[i]);if(e.header&&a.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(n="string"==typeof e.dictionary?h.string2buf(e.dictionary):"[object ArrayBuffer]"===d.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(i=a.deflateSetDictionary(this.strm,n))!==p)throw new Error(u[i]);this._dict_set=!0}}function n(t,e){var i=new r(e);if(i.push(t,!0),i.err)throw i.msg||u[i.err];return i.result}function o(t,e){return e=e||{},e.raw=!0,n(t,e)}function s(t,e){return e=e||{},e.gzip=!0,n(t,e)}var a=i(30),l=i(1),h=i(11),u=i(6),c=i(12),d=Object.prototype.toString,p=0,f=-1,g=0,m=8;r.prototype.push=function(t,e){var i,r,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;r=e===~~e?e:!0===e?4:0,"string"==typeof t?n.input=h.string2buf(t):"[object ArrayBuffer]"===d.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new l.Buf8(o),n.next_out=0,n.avail_out=o),1!==(i=a.deflate(n,r))&&i!==p)return this.onEnd(i),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(h.buf2binstring(l.shrinkBuf(n.output,n.next_out))):this.onData(l.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==i);return 4===r?(i=a.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===p):2!==r||(this.onEnd(p),n.avail_out=0,!0)},r.prototype.onData=function(t){this.chunks.push(t)},r.prototype.onEnd=function(t){t===p&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=l.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=r,e.deflate=n,e.deflateRaw=o,e.gzip=s},function(t,e,i){function r(t,e){return t.msg=N[e],e}function n(t){return(t<<1)-(t>4?9:0)}function o(t){for(var e=t.length;--e>=0;)t[e]=0}function s(t){var e=t.state,i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(A.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function a(t,e){P._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,s(t.strm)}function l(t,e){t.pending_buf[t.pending++]=e}function h(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function u(t,e,i,r){var n=t.avail_in;return n>r&&(n=r),0===n?0:(t.avail_in-=n,A.arraySet(e,t.input,t.next_in,n,i),1===t.state.wrap?t.adler=I(t.adler,e,n,i):2===t.state.wrap&&(t.adler=O(t.adler,e,n,i)),t.next_in+=n,t.total_in+=n,n)}function c(t,e){var i,r,n=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match,l=t.strstart>t.w_size-ht?t.strstart-(t.w_size-ht):0,h=t.window,u=t.w_mask,c=t.prev,d=t.strstart+lt,p=h[o+s-1],f=h[o+s];t.prev_length>=t.good_match&&(n>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+s]===f&&h[i+s-1]===p&&h[i]===h[o]&&h[++i]===h[o+1]){o+=2,i++;do{}while(h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&os){if(t.match_start=e,s=r,r>=a)break;p=h[o+s-1],f=h[o+s]}}}while((e=c[e&u])>l&&0!=--n);return s<=t.lookahead?s:t.lookahead}function d(t){var e,i,r,n,o,s=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-ht)){A.arraySet(t.window,t.window,s,s,0),t.match_start-=s,t.strstart-=s,t.block_start-=s,i=t.hash_size,e=i;do{r=t.head[--e],t.head[e]=r>=s?r-s:0}while(--i);i=s,e=i;do{r=t.prev[--e],t.prev[e]=r>=s?r-s:0}while(--i);n+=s}if(0===t.strm.avail_in)break;if(i=u(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=at)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(d(t),0===t.lookahead&&e===D)return yt;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,a(t,!1),0===t.strm.avail_out))return yt;if(t.strstart-t.block_start>=t.w_size-ht&&(a(t,!1),0===t.strm.avail_out))return yt}return t.insert=0,e===F?(a(t,!0),0===t.strm.avail_out?vt:St):(t.strstart>t.block_start&&(a(t,!1),t.strm.avail_out),yt)}function f(t,e){for(var i,r;;){if(t.lookahead=at&&(t.ins_h=(t.ins_h<=at)if(r=P._tr_tally(t,t.strstart-t.match_start,t.match_length-at),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=at){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=at&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=at-1)),t.prev_length>=at&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-at,r=P._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-at),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<=at&&t.strstart>0&&(n=t.strstart-1,(r=s[n])===s[++n]&&r===s[++n]&&r===s[++n])){o=t.strstart+lt;do{}while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=at?(i=P._tr_tally(t,1,t.match_length-at),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=P._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(a(t,!1),0===t.strm.avail_out))return yt}return t.insert=0,e===F?(a(t,!0),0===t.strm.avail_out?vt:St):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?yt:_t}function E(t,e){for(var i;;){if(0===t.lookahead&&(d(t),0===t.lookahead)){if(e===D)return yt;break}if(t.match_length=0,i=P._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(a(t,!1),0===t.strm.avail_out))return yt}return t.insert=0,e===F?(a(t,!0),0===t.strm.avail_out?vt:St):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?yt:_t}function y(t,e,i,r,n){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=n}function _(t){t.window_size=2*t.w_size,o(t.head),t.max_lazy_match=C[t.level].max_lazy,t.good_match=C[t.level].good_length,t.nice_match=C[t.level].nice_length,t.max_chain_length=C[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=at-1,t.match_available=0,t.ins_h=0}function v(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Q,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new A.Buf16(2*ot),this.dyn_dtree=new A.Buf16(2*(2*rt+1)),this.bl_tree=new A.Buf16(2*(2*nt+1)),o(this.dyn_ltree),o(this.dyn_dtree),o(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new A.Buf16(st+1),this.heap=new A.Buf16(2*it+1),o(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new A.Buf16(2*it+1),o(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function S(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=Z,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?ct:mt,t.adler=2===e.wrap?0:1,e.last_flush=D,P._tr_init(e),W):r(t,U)}function b(t){var e=S(t);return e===W&&_(t.state),e}function T(t,e){return t&&t.state?2!==t.state.wrap?U:(t.state.gzhead=e,W):U}function L(t,e,i,n,o,s){if(!t)return U;var a=1;if(e===z&&(e=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),o<1||o>$||i!==Q||n<8||n>15||e<0||e>9||s<0||s>X)return r(t,U);8===n&&(n=9);var l=new v;return t.state=l,l.strm=t,l.wrap=a,l.gzhead=null,l.w_bits=n,l.w_size=1<G||e<0)return t?r(t,U):U;if(a=t.state,!t.output||!t.input&&0!==t.avail_in||a.status===Et&&e!==F)return r(t,0===t.avail_out?j:U);if(a.strm=t,i=a.last_flush,a.last_flush=e,a.status===ct)if(2===a.wrap)t.adler=0,l(a,31),l(a,139),l(a,8),a.gzhead?(l(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),l(a,255&a.gzhead.time),l(a,a.gzhead.time>>8&255),l(a,a.gzhead.time>>16&255),l(a,a.gzhead.time>>24&255),l(a,9===a.level?2:a.strategy>=Y||a.level<2?4:0),l(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(l(a,255&a.gzhead.extra.length),l(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=O(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=dt):(l(a,0),l(a,0),l(a,0),l(a,0),l(a,0),l(a,9===a.level?2:a.strategy>=Y||a.level<2?4:0),l(a,bt),a.status=mt);else{var d=Q+(a.w_bits-8<<4)<<8,p=-1;p=a.strategy>=Y||a.level<2?0:a.level<6?1:6===a.level?2:3,d|=p<<6,0!==a.strstart&&(d|=ut),d+=31-d%31,a.status=mt,h(a,d),0!==a.strstart&&(h(a,t.adler>>>16),h(a,65535&t.adler)),t.adler=1}if(a.status===dt)if(a.gzhead.extra){for(u=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>u&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),s(t),u=a.pending,a.pending!==a.pending_buf_size));)l(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>u&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=pt)}else a.status=pt;if(a.status===pt)if(a.gzhead.name){u=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>u&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),s(t),u=a.pending,a.pending===a.pending_buf_size)){c=1;break}c=a.gzindexu&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),0===c&&(a.gzindex=0,a.status=ft)}else a.status=ft;if(a.status===ft)if(a.gzhead.comment){u=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>u&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),s(t),u=a.pending,a.pending===a.pending_buf_size)){c=1;break}c=a.gzindexu&&(t.adler=O(t.adler,a.pending_buf,a.pending-u,u)),0===c&&(a.status=gt)}else a.status=gt;if(a.status===gt&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&s(t),a.pending+2<=a.pending_buf_size&&(l(a,255&t.adler),l(a,t.adler>>8&255),t.adler=0,a.status=mt)):a.status=mt),0!==a.pending){if(s(t),0===t.avail_out)return a.last_flush=-1,W}else if(0===t.avail_in&&n(e)<=n(i)&&e!==F)return r(t,j);if(a.status===Et&&0!==t.avail_in)return r(t,j);if(0!==t.avail_in||0!==a.lookahead||e!==D&&a.status!==Et){var f=a.strategy===Y?E(a,e):a.strategy===H?m(a,e):C[a.level].func(a,e);if(f!==vt&&f!==St||(a.status=Et),f===yt||f===vt)return 0===t.avail_out&&(a.last_flush=-1),W;if(f===_t&&(e===k?P._tr_align(a):e!==G&&(P._tr_stored_block(a,0,0,!1),e===V&&(o(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),s(t),0===t.avail_out))return a.last_flush=-1,W}return e!==F?W:a.wrap<=0?B:(2===a.wrap?(l(a,255&t.adler),l(a,t.adler>>8&255),l(a,t.adler>>16&255),l(a,t.adler>>24&255),l(a,255&t.total_in),l(a,t.total_in>>8&255),l(a,t.total_in>>16&255),l(a,t.total_in>>24&255)):(h(a,t.adler>>>16),h(a,65535&t.adler)),s(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?W:B)}function x(t){var e;return t&&t.state?(e=t.state.status)!==ct&&e!==dt&&e!==pt&&e!==ft&&e!==gt&&e!==mt&&e!==Et?r(t,U):(t.state=null,e===mt?r(t,K):W):U}function M(t,e){var i,r,n,s,a,l,h,u,c=e.length ;if(!t||!t.state)return U;if(i=t.state,2===(s=i.wrap)||1===s&&i.status!==ct||i.lookahead)return U;for(1===s&&(t.adler=I(t.adler,e,c,0)),i.wrap=0,c>=i.w_size&&(0===s&&(o(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new A.Buf8(i.w_size),A.arraySet(u,e,c-i.w_size,i.w_size,0),e=u,c=i.w_size),a=t.avail_in,l=t.next_in,h=t.input,t.avail_in=c,t.next_in=0,t.input=e,d(i);i.lookahead>=at;){r=i.strstart,n=i.lookahead-(at-1);do{i.ins_h=(i.ins_h<=0;)t[e]=0}function n(t,e,i,r,n){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=t&&t.length}function o(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function s(t){return t<256?ot[t]:ot[256+(t>>>7)]}function a(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function l(t,e,i){t.bi_valid>Y-i?(t.bi_buf|=e<>Y-t.bi_valid,t.bi_valid+=i-Y):(t.bi_buf|=e<>>=1,i<<=1}while(--e>0);return i>>>1}function c(t){16===t.bi_valid?(a(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}function d(t,e){var i,r,n,o,s,a,l=e.dyn_tree,h=e.max_code,u=e.stat_desc.static_tree,c=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,f=e.stat_desc.max_length,g=0;for(o=0;o<=q;o++)t.bl_count[o]=0;for(l[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;if&&(o=f,g++),l[2*r+1]=o,r>h||(t.bl_count[o]++,s=0,r>=p&&(s=d[r-p]),a=l[2*r],t.opt_len+=a*(o+s),c&&(t.static_len+=a*(u[2*r+1]+s)));if(0!==g){do{for(o=f-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[f]--,g-=2}while(g>0);for(o=f;0!==o;o--)for(r=t.bl_count[o];0!==r;)(n=t.heap[--i])>h||(l[2*n+1]!==o&&(t.opt_len+=(o-l[2*n+1])*l[2*n],l[2*n+1]=o),r--)}}function p(t,e,i){var r,n,o=new Array(q+1),s=0;for(r=1;r<=q;r++)o[r]=s=s+i[r-1]<<1;for(n=0;n<=e;n++){var a=t[2*n+1];0!==a&&(t[2*n]=u(o[a]++,a))}}function f(){var t,e,i,r,o,s=new Array(q+1);for(i=0,r=0;r>=7;r8?a(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function E(t,e,i,r){m(t),r&&(a(t,i),a(t,~i)),I.arraySet(t.pending_buf,t.window,e,i,t.pending),t.pending+=i}function y(t,e,i,r){var n=2*e,o=2*i;return t[n]>1;i>=1;i--)_(t,o,i);n=l;do{i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],_(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,o[2*n]=o[2*i]+o[2*r],t.depth[n]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,o[2*i+1]=o[2*r+1]=n,t.heap[1]=n++,_(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],d(t,e),p(o,h,t.bl_count)}function b(t,e,i){var r,n,o=-1,s=e[1],a=0,l=7,h=4;for(0===s&&(l=138,h=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)n=s,s=e[2*(r+1)+1],++a=3&&0===t.bl_tree[2*it[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}function w(t,e,i,r){var n;for(l(t,e-257,5),l(t,i-1,5),l(t,r-4,4),n=0;n>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return N;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return D;for(e=32;e0?(t.strm.data_type===k&&(t.strm.data_type=R(t)),S(t,t.l_desc),S(t,t.d_desc),s=L(t),n=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==e?M(t,e,i,r):t.strategy===O||o===n?(l(t,(F<<1)+(r?1:0),3),v(t,rt,nt)):(l(t,(G<<1)+(r?1:0),3),w(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),v(t,t.dyn_ltree,t.dyn_dtree)),g(t),r&&m(t)}function P(t,e,i){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(st[i]+B+1)]++,t.dyn_dtree[2*s(e)]++),t.last_lit===t.lit_bufsize-1}var I=i(1),O=4,N=0,D=1,k=2,V=0,F=1,G=2,W=29,B=256,U=B+1+W,K=30,j=19,z=2*U+1,q=15,Y=16,H=7,X=256,J=16,Z=17,Q=18,$=[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],tt=[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],et=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],it=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],rt=new Array(2*(U+2));r(rt);var nt=new Array(2*K);r(nt);var ot=new Array(512);r(ot);var st=new Array(256);r(st);var at=new Array(W);r(at);var lt=new Array(K);r(lt);var ht,ut,ct,dt=!1;e._tr_init=x,e._tr_stored_block=M,e._tr_flush_block=A,e._tr_tally=P,e._tr_align=C},function(t,e,i){function r(t){if(!(this instanceof r))return new r(t);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=s.inflateInit2(this.strm,e.windowBits);if(i!==h.Z_OK)throw new Error(u[i]);this.header=new d,s.inflateGetHeader(this.strm,this.header)}function n(t,e){var i=new r(e);if(i.push(t,!0),i.err)throw i.msg||u[i.err];return i.result}function o(t,e){return e=e||{},e.raw=!0,n(t,e)}var s=i(33),a=i(1),l=i(11),h=i(13),u=i(6),c=i(12),d=i(36),p=Object.prototype.toString;r.prototype.push=function(t,e){var i,r,n,o,u,c,d=this.strm,f=this.options.chunkSize,g=this.options.dictionary,m=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?h.Z_FINISH:h.Z_NO_FLUSH,"string"==typeof t?d.input=l.binstring2buf(t):"[object ArrayBuffer]"===p.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new a.Buf8(f),d.next_out=0,d.avail_out=f),i=s.inflate(d,h.Z_NO_FLUSH),i===h.Z_NEED_DICT&&g&&(c="string"==typeof g?l.string2buf(g):"[object ArrayBuffer]"===p.call(g)?new Uint8Array(g):g,i=s.inflateSetDictionary(this.strm,c)),i===h.Z_BUF_ERROR&&!0===m&&(i=h.Z_OK,m=!1),i!==h.Z_STREAM_END&&i!==h.Z_OK)return this.onEnd(i),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&i!==h.Z_STREAM_END&&(0!==d.avail_in||r!==h.Z_FINISH&&r!==h.Z_SYNC_FLUSH)||("string"===this.options.to?(n=l.utf8border(d.output,d.next_out),o=d.next_out-n,u=l.buf2string(d.output,n),d.next_out=o,d.avail_out=f-o,o&&a.arraySet(d.output,d.output,n,o,0),this.onData(u)):this.onData(a.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.avail_out)&&i!==h.Z_STREAM_END);return i===h.Z_STREAM_END&&(r=h.Z_FINISH),r===h.Z_FINISH?(i=s.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===h.Z_OK):r!==h.Z_SYNC_FLUSH||(this.onEnd(h.Z_OK),d.avail_out=0,!0)},r.prototype.onData=function(t){this.chunks.push(t)},r.prototype.onEnd=function(t){t===h.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=r,e.inflate=n,e.inflateRaw=o,e.ungzip=n},function(t,e,i){function r(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function n(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new y.Buf16(320),this.work=new y.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=V,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new y.Buf32(gt),e.distcode=e.distdyn=new y.Buf32(mt),e.sane=1,e.back=-1,C):I}function s(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,o(t)):I}function a(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?I:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,s(t))):I}function l(t,e){var i,r;return t?(r=new n,t.state=r,r.window=null,i=a(t,e),i!==C&&(t.state=null),i):I}function h(t){return l(t,Et)}function u(t){if(yt){var e;for(m=new y.Buf32(512),E=new y.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(b(L,t.lens,0,288,m,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;b(w,t.lens,0,32,E,0,t.work,{bits:5}),yt=!1}t.lencode=m,t.lenbits=9,t.distcode=E,t.distbits=5}function c(t,e,i,r){var n,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(y.arraySet(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n=o.wsize-o.wnext,n>r&&(n=r),y.arraySet(o.window,e,i-r,n,o.wnext),r-=n,r?(y.arraySet(o.window,e,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,i.check=v(i.check,xt,2,0),d=0,p=0,i.mode=F;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&d)<<8)+(d>>8))%31){t.msg="incorrect header check",i.mode=dt;break}if((15&d)!==k){t.msg="unknown compression method",i.mode=dt;break}if(d>>>=4,p-=4,bt=8+(15&d),0===i.wbits)i.wbits=bt;else if(bt>i.wbits){t.msg="invalid window size",i.mode=dt;break}i.dmax=1<>8&1),512&i.flags&&(xt[0]=255&d,xt[1]=d>>>8&255,i.check=v(i.check,xt,2,0)),d=0,p=0,i.mode=G;case G:for(;p<32;){if(0===l)break t;l--,d+=n[s++]<>>8&255,xt[2]=d>>>16&255,xt[3]=d>>>24&255,i.check=v(i.check,xt,4,0)),d=0,p=0,i.mode=W;case W:for(;p<16;){if(0===l)break t;l--,d+=n[s++]<>8),512&i.flags&&(xt[0]=255&d,xt[1]=d>>>8&255,i.check=v(i.check,xt,2,0)),d=0,p=0,i.mode=B;case B:if(1024&i.flags){for(;p<16;){if(0===l)break t;l--,d+=n[s++]<>>8&255,i.check=v(i.check,xt,2,0)),d=0,p=0}else i.head&&(i.head.extra=null);i.mode=U;case U:if(1024&i.flags&&(m=i.length,m>l&&(m=l),m&&(i.head&&(bt=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),y.arraySet(i.head.extra,n,s,m,bt)),512&i.flags&&(i.check=v(i.check,n,m,s)),l-=m,s+=m,i.length-=m),i.length))break t;i.length=0,i.mode=K;case K:if(2048&i.flags){if(0===l)break t;m=0;do{bt=n[s+m++],i.head&&bt&&i.length<65536&&(i.head.name+=String.fromCharCode(bt))}while(bt&&m>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=H;break;case q:for(;p<32;){if(0===l)break t;l--,d+=n[s++]<>>=7&p,p-=7&p,i.mode=ht;break}for(;p<3;){if(0===l)break t;l--,d+=n[s++]<>>=1,p-=1,3&d){case 0:i.mode=J;break;case 1:if(u(i),i.mode=it,e===M){d>>>=2,p-=2;break t}break;case 2:i.mode=$;break;case 3:t.msg="invalid block type",i.mode=dt}d>>>=2,p-=2;break;case J:for(d>>>=7&p,p-=7&p;p<32;){if(0===l)break t;l--,d+=n[s++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=dt;break}if(i.length=65535&d,d=0,p=0,i.mode=Z,e===M)break t;case Z:i.mode=Q;case Q:if(m=i.length){if(m>l&&(m=l),m>h&&(m=h),0===m)break t;y.arraySet(o,n,s,m,a),l-=m,s+=m,h-=m,a+=m,i.length-=m;break}i.mode=H;break;case $:for(;p<14;){if(0===l)break t;l--,d+=n[s++]<>>=5,p-=5,i.ndist=1+(31&d),d>>>=5,p-=5,i.ncode=4+(15&d),d>>>=4,p-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=dt;break}i.have=0,i.mode=tt;case tt:for(;i.have>>=3,p-=3}for(;i.have<19;)i.lens[Mt[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,Lt={bits:i.lenbits},Tt=b(T,i.lens,0,19,i.lencode,0,i.work,Lt),i.lenbits=Lt.bits,Tt){t.msg="invalid code lengths set",i.mode=dt;break}i.have=0,i.mode=et;case et:for(;i.have>>24,Et=Rt>>>16&255,yt=65535&Rt,!(mt<=p);){if(0===l)break t;l--,d+=n[s++]<>>=mt,p-=mt,i.lens[i.have++]=yt;else{if(16===yt){for(wt=mt+2;p>>=mt,p-=mt,0===i.have){t.msg="invalid bit length repeat",i.mode=dt;break}bt=i.lens[i.have-1],m=3+(3&d),d>>>=2,p-=2}else if(17===yt){for(wt=mt+3;p>>=mt,p-=mt,bt=0,m=3+(7&d),d>>>=3,p-=3}else{for(wt=mt+7;p>>=mt,p-=mt,bt=0,m=11+(127&d),d>>>=7,p-=7}if(i.have+m>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=dt;break}for(;m--;)i.lens[i.have++]=bt}}if(i.mode===dt)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=dt;break}if(i.lenbits=9,Lt={bits:i.lenbits},Tt=b(L,i.lens,0,i.nlen,i.lencode,0,i.work,Lt),i.lenbits=Lt.bits,Tt){t.msg="invalid literal/lengths set",i.mode=dt;break}if(i.distbits=6,i.distcode=i.distdyn,Lt={bits:i.distbits},Tt=b(w,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Lt),i.distbits=Lt.bits,Tt){t.msg="invalid distances set",i.mode=dt;break}if(i.mode=it,e===M)break t;case it:i.mode=rt;case rt:if(l>=6&&h>=258){t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=l,i.hold=d,i.bits=p,S(t,g),a=t.next_out,o=t.output,h=t.avail_out,s=t.next_in,n=t.input,l=t.avail_in,d=i.hold,p=i.bits,i.mode===H&&(i.back=-1);break}for(i.back=0;Rt=i.lencode[d&(1<>>24,Et=Rt>>>16&255,yt=65535&Rt,!(mt<=p);){if(0===l)break t;l--,d+=n[s++]<>_t)],mt=Rt>>>24,Et=Rt>>>16&255,yt=65535&Rt,!(_t+mt<=p);){if(0===l)break t;l--,d+=n[s++]<>>=_t,p-=_t,i.back+=_t}if(d>>>=mt,p-=mt,i.back+=mt,i.length=yt,0===Et){i.mode=lt;break}if(32&Et){i.back=-1,i.mode=H;break}if(64&Et){t.msg="invalid literal/length code",i.mode=dt;break}i.extra=15&Et,i.mode=nt;case nt:if(i.extra){for(wt=i.extra;p>>=i.extra,p-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=ot;case ot:for(;Rt=i.distcode[d&(1<>>24,Et=Rt>>>16&255,yt=65535&Rt,!(mt<=p);){if(0===l)break t;l--,d+=n[s++]<>_t)],mt=Rt>>>24,Et=Rt>>>16&255,yt=65535&Rt,!(_t+mt<=p);){if(0===l)break t;l--,d+=n[s++]<>>=_t,p-=_t,i.back+=_t}if(d>>>=mt,p-=mt,i.back+=mt,64&Et){t.msg="invalid distance code",i.mode=dt;break}i.offset=yt,i.extra=15&Et,i.mode=st;case st:if(i.extra){for(wt=i.extra;p>>=i.extra,p-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=dt;break}i.mode=at;case at:if(0===h)break t;if(m=g-h,i.offset>m){if((m=i.offset-m)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=dt;break}m>i.wnext?(m-=i.wnext,E=i.wsize-m):E=i.wnext-m,m>i.length&&(m=i.length),gt=i.window}else gt=o,E=a-i.offset,m=i.length;m>h&&(m=h),h-=m,i.length-=m;do{o[a++]=gt[E++]}while(--m);0===i.length&&(i.mode=rt);break;case lt:if(0===h)break t;o[a++]=i.length,h--,i.mode=rt;break;case ht:if(i.wrap){for(;p<32;){if(0===l)break t;l--,d|=n[s++]<>>24,p>>>=v,f-=v,0===(v=_>>>16&255))R[o++]=65535&_;else{if(!(16&v)){if(0==(64&v)){_=g[(65535&_)+(p&(1<>>=v,f-=v),f<15&&(p+=w[r++]<>>24,p>>>=v,f-=v,!(16&(v=_>>>16&255))){if(0==(64&v)){_=m[(65535&_)+(p&(1<l){t.msg="invalid distance too far back",i.mode=30;break t}if(p>>>=v,f-=v,v=o-s,b>v){if((v=b-v)>u&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(T=0,L=d,0===c){if(T+=h-v,v2;)R[o++]=L[T++],R[o++]=L[T++],R[o++]=L[T++],S-=3;S&&(R[o++]=L[T++],S>1&&(R[o++]=L[T++]))}else{T=o-b;do{R[o++]=R[T++],R[o++]=R[T++],R[o++]=R[T++],S-=3}while(S>2);S&&(R[o++]=R[T++],S>1&&(R[o++]=R[T++]))}break}}break}}while(r>3,r-=S,f-=S<<3,p&=(1<=1&&0===D[R];R--);if(x>R&&(x=R),0===R)return h[u++]=20971520,h[u++]=20971520,d.bits=1,0;for(w=1;w0&&(0===t||1!==R))return-1;for(k[1]=0,T=1;T<15;T++)k[T+1]=k[T]+D[T];for(L=0;L852||2===t&&P>592)return 1;for(;;){_=T-C,c[L]y?(v=V[F+c[L]],S=O[N+c[L]]):(v=96,S=0),p=1<>C)+f]=_<<24|v<<16|S|0}while(0!==f);for(p=1<>=1;if(0!==p?(I&=p-1,I+=p):I=0,L++,0==--D[T]){if(T===R)break;T=e[i+c[L]]}if(T>x&&(I&m)!==g){for(0===C&&(C=x),E+=w,M=T-C,A=1<852||2===t&&P>592)return 1;g=I&m,h[g]=x<<24|M<<16|E-u|0}}return 0!==I&&(h[E+I]=T-C<<24|64<<16|0),d.bits=x,0}},function(t,e,i){function r(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=r},function(t,e,i){var r=i(0),n=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];t.exports=function(t,e){if(void 0===t||!t.length)return 0;var i="string"!==r.getTypeOf(t);void 0===e&&(e=0);var o=0,s=0,a=0;e^=-1;for(var l=0,h=t.length;l>>8^o;return-1^e}},function(t,e,i){var r=i(0),n=function(){this.data=[]};n.prototype={append:function(t){t=r.transformTo("string",t),this.data.push(t)},finalize:function(){return this.data.join("")}},t.exports=n},function(t,e,i){var r=i(0),n=function(t){this.data=new Uint8Array(t),this.index=0};n.prototype={append:function(t){0!==t.length&&(t=r.transformTo("uint8array",t),this.data.set(t,this.index),this.index+=t.length)},finalize:function(){return this.data}},t.exports=n},function(t,e,i){var r=i(3),n=i(17),o=i(0),s=i(41);t.exports=function(t,e){var i,a,l,h;for(e=o.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:n.utf8decode}),e.base64&&(t=r.decode(t)),a=new s(t,e),i=a.files,l=0;l1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t0)this.isSignature(e,h.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(t){var e=l.getTypeOf(t);if(l.checkSupport(e),"string"!==e||c.uint8array)if("nodebuffer"===e)this.reader=new o(t);else if(c.uint8array)this.reader=new s(l.transformTo("uint8array",t));else{if(!c.array)throw new Error("Unexpected error: unsupported type '"+e+"'");this.reader=new a(l.transformTo("array",t))}else this.reader=new n(t,this.loadOptions.optimizedBinaryString)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=r},function(t,e,i){function r(t){this.data=t,this.length=this.data.length,this.index=0,this.zero=0}var n=i(20);r.prototype=new n,r.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){function r(t,e){this.options=t,this.loadOptions=e}var n=i(18),o=i(0),s=i(16),a=i(4),l=i(2);r.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},prepareCompressedContent:function(t,e,i){return function(){var r=t.index;t.setIndex(e);var n=t.readData(i);return t.setIndex(r),n}},prepareContent:function(t,e,i,r,n){return function(){var t=o.transformTo(r.uncompressInputType,this.getCompressedContent()),e=r.uncompress(t);if(e.length!==n)throw new Error("Bug : uncompressed data size mismatch");return e}},readLocalPart:function(t){var e,i;if(t.skip(22),this.fileNameLength=t.readInt(2),i=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(i),-1==this.compressedSize||-1==this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize == -1 || uncompressedSize == -1)");if(null===(e=o.findCompression(this.compressionMethod)))throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");if(this.decompressed=new s,this.decompressed.compressedSize=this.compressedSize,this.decompressed.uncompressedSize=this.uncompressedSize,this.decompressed.crc32=this.crc32,this.decompressed.compressionMethod=this.compressionMethod,this.decompressed.getCompressedContent=this.prepareCompressedContent(t,t.index,this.compressedSize,e),this.decompressed.getContent=this.prepareContent(t,t.index,this.compressedSize,e,this.uncompressedSize),this.loadOptions.checkCRC32&&(this.decompressed=o.transformTo("string",this.decompressed.getContent()),a.crc32(this.decompressed)!==this.crc32))throw new Error("Corrupted zip : CRC32 mismatch")},readCentralPart:function(t){if(this.versionMadeBy=t.readInt(2),this.versionNeeded=t.readInt(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4),this.fileNameLength=t.readInt(2),this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");this.fileName=t.readData(this.fileNameLength),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0===t&&(this.dosPermissions=63&this.externalFileAttributes),3===t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=new n(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(t){var e,i,r,n=t.index;for(this.extraFields=this.extraFields||{};t.indexi.kmlMinAltitude)&&(!i.kmlMaxAltitude||e.eyePosition.altituder||e.to>r))return!1}return!0},h.prototype.getStyle=function(t,e){if(!this._pStyle){var i=this;new l(function(t,r){window.setTimeout(function(){e.styleResolver.handleRemoteStyle(i.kmlStyleUrl,i.kmlStyleSelector,t,r)},0)}).then(function(e){i._pStyle=e,t.redrawRequested=!0})}}, h.prototype.getTagNames=function(){return["NetworkLink","Placemark","PhotoOverlay","ScreenOverlay","GroundOverlay","Folder","Document"]},h}),i("formats/kml/features/KmlContainer",["./KmlFeature"],function(t){"use strict";var e=function(e){t.call(this,e)};return e.prototype=Object.create(t.prototype),Object.defineProperties(e.prototype,{kmlShapes:{get:function(){return this._factory.all(this).filter(function(t){return t.isFeature})}}}),e.prototype.render=function(e,i){t.prototype.render.call(this,e,i);var r=this;this.kmlShapes.forEach(function(t){t.render(e,{lastStyle:i.lastStyle,lastVisibility:r.enabled,currentTimeInterval:i.currentTimeInterval,regionInvisible:i.regionInvisible,fileCache:i.fileCache,styleResolver:i.styleResolver,listener:i.listener,activeEvents:i.activeEvents})})},e.prototype.getTagNames=function(){return["Folder","Document"]},e}),i("formats/kml/controls/KmlControls",["../../../util/Logger"],function(t){"use strict";var e=function(){};return e.prototype.hook=function(){t.logMessage(t.LEVEL_WARNING,"KmlControls","hook","Every KML controls should override hook method.")},e}),i("formats/kml/util/Schema",["./../KmlElements","../KmlObject"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["Schema"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/features/KmlDocument",["./KmlContainer","../KmlElements","./KmlFeature","../util/Schema"],function(t,e,i,r){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),Object.defineProperties(n.prototype,{kmlSchemas:{get:function(){return this._factory.all(this).filter(function(t){return t instanceof r})}}}),n.prototype.getTagNames=function(){return["Document"]},e.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/features/KmlFolder",["./KmlContainer","./../KmlElements"],function(t,e){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),i.prototype.getTagNames=function(){return["Folder"]},e.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/geom/KmlGeometry",["../KmlObject"],function(t){"use strict";var e=function(e){t.call(this,e),this._renderable=null};return e.prototype=Object.create(t.prototype),e.prototype.render=function(e,i){t.prototype.render.call(this,e,i),this.enabled=i.lastVisibility},e.prototype.getTagNames=e.getTagNames=function(){return["Point","LinearRing","LineString","MultiGeometry","Polygon"]},e}),i("formats/kml/KmlLatLonBox",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlNorth:{get:function(){return this._factory.specific(this,{name:"north",transformer:i.number})}},kmlSouth:{get:function(){return this._factory.specific(this,{name:"south",transformer:i.number})}},kmlEast:{get:function(){return this._factory.specific(this,{name:"east",transformer:i.number})}},kmlWest:{get:function(){return this._factory.specific(this,{name:"west",transformer:i.number})}},kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["LatLonBox"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlLatLonQuad",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlCoordinates:{get:function(){return this._factory.specific(this,{name:"coordinates",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["gx:LatLonQuad"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlOverlay",["./KmlFeature","./../KmlIcon","../util/NodeTransformers"],function(t,e,i){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlColor:{get:function(){return this._factory.specific(this,{name:"color",transformer:i.string})}},kmlDrawOrder:{get:function(){return this._factory.specific(this,{name:"drawOrder",transformer:i.string})}},kmlIcon:{get:function(){return this._factory.any(this,{name:e.prototype.getTagNames()})}}}),r.prototype.getTagNames=function(){return["PhotoOverlay","ScreenOverlay","GroundOverlay"]},r}),i("formats/kml/features/KmlGroundOverlay",["./../KmlElements","./KmlFeature","../KmlLatLonBox","../KmlLatLonQuad","./KmlOverlay","../util/NodeTransformers","../../../geom/Sector","../../../shapes/SurfaceImage"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(t){this.isGroundOverlay=!0,n.call(this,t)};return l.prototype=Object.create(n.prototype),Object.defineProperties(l.prototype,{kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:o.string})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:o.string})}},kmlLatLonBox:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}},kmlLatLonQuad:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}}}),l.prototype.render=function(t,i){e.prototype.render.call(this,t,i),!this._renderable&&this.enabled&&this.kmlIcon&&this.kmlLatLonBox&&(this._renderable=new a(new s(this.kmlLatLonBox.kmlSouth,this.kmlLatLonBox.kmlNorth,this.kmlLatLonBox.kmlWest,this.kmlLatLonBox.kmlEast),this.kmlIcon.kmlHref),t.redrawRequested=!0),this._renderable&&this._renderable.render(t)},l.prototype.getTagNames=function(){return["GroundOverlay"]},t.addKey(l.prototype.getTagNames()[0],l),l}),i("shapes/Path",["../shapes/AbstractShape","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolyline","../geom/Vec2","../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p){"use strict";var f=function(i,r){if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Path","constructor","missingPositions"));t.call(this,r),this._positions=i,this._pathType=WorldWind.GREAT_CIRCLE,this._terrainConformance=10,this._numSubSegments=10,this.referencePosition=this.determineReferencePosition(this._positions),this.scratchPoint=new p(0,0,0)};return f.prototype=Object.create(t.prototype),Object.defineProperties(f.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Path","constructor","missingPositions"));this._positions=t,this.referencePosition=this.determineReferencePosition(this._positions),this.reset()}},followTerrain:{get:function(){return this._followTerrain},set:function(t){this._followTerrain=t,this.reset()}},terrainConformance:{get:function(){return this._terrainConformance},set:function(t){this._terrainConformance=t,this.reset()}},numSubSegments:{get:function(){return this._numSubSegments},set:function(t){this._numSubSegments=t>=0?t:0,this.reset()}},pathType:{get:function(){return this._pathType},set:function(t){this._pathType=t,this.reset()}},extrude:{get:function(){return this._extrude},set:function(t){this._extrude=t,this.reset()}}}),f.prototype.determineReferencePosition=function(t){return t.length>0?t[0]:null},f.prototype.mustGenerateGeometry=function(t){return!this.currentData.tessellatedPoints||(this.currentData.drawInterior!==this.activeAttributes.drawInterior||this.currentData.drawVerticals!==this.activeAttributes.drawVerticals||(!this.followTerrain&&this.currentData.numSubSegments!==this.numSubSegments||(!(!this.followTerrain||this.currentData.terrainConformance===this.terrainConformance)||this.altitudeMode!==WorldWind.ABSOLUTE&&this.currentData.isExpired)))},f.prototype.createSurfaceShape=function(){return new c(this.positions,null)},f.prototype.doMakeOrderedRenderable=function(t){if(!this.referencePosition)return null;if(!this.mustGenerateGeometry(t))return this;var e=this.currentData.referencePoint;t.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude,this._altitudeMode,e),this.currentData.transformationMatrix.setToTranslation(e[0],e[1],e[2]);var i=this.makeTessellatedPositions(t);if(i.length<2)return null;var n=this.computeRenderedPath(t,i);return this.currentData.tessellatedPoints=n,this.currentData.drawInterior=this.activeAttributes.drawInterior,this.currentData.drawVerticals=this.activeAttributes.drawVerticals,this.currentData.numSubSegments=this.numSubSegments,this.currentData.terrainConformance=this.terrainConformance,this.resetExpiration(this.currentData),this.currentData.fillVbo=!0,this.currentData.extent||(this.currentData.extent=new r),this.currentData.extent.setToPoints(n),this.currentData.extent.translate(this.currentData.referencePoint),this},f.prototype.makeTessellatedPositions=function(t){var e,i,r,n=[],o=t.navigatorState,s=this.mustDrawVerticals(t),a=new p(0,0,0),l=new p(0,0,0),h=this._positions[0];s&&(this.currentData.verticalIndices=new Int16Array(2*this.positions.length),this.currentData.verticalIndices[0]=0,this.currentData.verticalIndices[1]=1),n.push(h),t.surfacePointForMode(h.latitude,h.longitude,h.altitude,this._altitudeMode,a);for(var u=1,c=this._positions.length;u0?1:0:i),a.vertexAttribPointer(h.vertexPointLocation,3,a.FLOAT,!1,0,0),a.drawArrays(a.TRIANGLE_STRIP,0,c)),this.activeAttributes.drawOutline&&((this.mustDrawVerticals(t)&&this.mustDrawInterior(t)||this.altitudeMode===WorldWind.CLAMP_TO_GROUND)&&this.applyMvpMatrixForOutline(t),r=this.activeAttributes.outlineColor,i=r.alpha*t.currentLayer.opacity,i<1&&!t.pickingMode&&a.depthMask(!1),h.loadColor(a,t.pickingMode?n:r),h.loadOpacity(a,t.pickingMode?1:i),a.lineWidth(this.activeAttributes.outlineWidth),this.currentData.pointBufferHasExtrusionPoints?(o=24,s=c/2):(o=12,s=c),a.vertexAttribPointer(h.vertexPointLocation,3,a.FLOAT,!1,o,0),a.drawArrays(a.LINE_STRIP,0,s),this.mustDrawVerticals(t)&&(u.verticalIndicesVboCacheKey||(u.verticalIndicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(u.verticalIndicesVboCacheKey),e||(e=a.createBuffer(),t.gpuResourceCache.putResource(u.verticalIndicesVboCacheKey,e,4*u.verticalIndices.length),u.fillVbo=!0),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,e),u.fillVbo&&(a.bufferData(a.ELEMENT_ARRAY_BUFFER,u.verticalIndices,a.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)),a.vertexAttribPointer(h.vertexPointLocation,3,a.FLOAT,!1,0,0),a.drawElements(a.LINES,u.verticalIndices.length,a.UNSIGNED_SHORT,0))),u.fillVbo=!1,t.pickingMode){var d=new l(n,this.pickDelegate?this.pickDelegate:this,null,t.currentLayer,!1);t.resolvePick(d)}},f.prototype.beginDrawing=function(t){var e=t.currentGlContext;this.mustDrawInterior(t)&&e.disable(e.CULL_FACE),t.findAndBindProgram(i),e.enableVertexAttribArray(t.currentProgram.vertexPointLocation)},f.prototype.endDrawing=function(t){var e=t.currentGlContext;e.disableVertexAttribArray(t.currentProgram.vertexPointLocation),e.depthMask(!0),e.lineWidth(1),e.enable(e.CULL_FACE)},f}),i("formats/kml/geom/KmlLineString",["../../../util/Color","../KmlElements","./KmlGeometry","../styles/KmlStyle","../../../geom/Location","../util/NodeTransformers","../../../shapes/Path","../../../geom/Position","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolyline","../../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(t){i.call(this,t),this._style=null};return c.prototype=Object.create(i.prototype),Object.defineProperties(c.prototype,{kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:o.boolean})||!1}},kmlTessellate:{get:function(){return this._factory.specific(this,{name:"tessellate",transformer:o.boolean})||!1}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:o.string})||WorldWind.ABSOLUTE}},kmlPositions:{get:function(){return this._factory.specific(this,{name:"coordinates",transformer:o.positions})}},kmlCenter:{get:function(){var t=this.kmlPositions,e=0,i=0,r=0;return t.forEach(function(t){e+=t.latitude,i+=t.longitude,r+=t.altitude}),new a(e/this.kmlPositions.length,i/this.kmlPositions.length,r/this.kmlPositions.length)}}}),c.prototype.createPath=function(t){this.kmlAltitudeMode==WorldWind.CLAMP_TO_GROUND?this._renderable=new h(this.prepareLocations(),this.prepareAttributes(t.normal)):this._renderable=new s(this.prepareLocations(),this.prepareAttributes(t.normal)),t.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(t.highlight)),this.moveValidProperties()},c.prototype.render=function(t,e){i.prototype.render.call(this,t,e),e.lastStyle&&!this._renderable&&(this.createPath(e.lastStyle),t.redrawRequested=!0),this._renderable&&(this._renderable.enabled=this.enabled,this._renderable.render(t))},c.prototype.prepareAttributes=function(t){var e=t&&t.generate()||{};return e._applyLighting=!0,e._drawOutline=!0,e._drawInterior=!0,e._drawVerticals=this.kmlExtrude||!1,e._outlineStippleFactor=0,e._outlineStipplePattern=61680,e._enableLighting=!0,new l(r.shapeAttributes(e))},c.prototype.prepareLocations=function(){return this.kmlPositions},c.prototype.moveValidProperties=function(){this._renderable.extrude=this.kmlExtrude||!1,this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.ABSOLUTE,this._renderable.tesselate=this.kmlTesselate||!1},c.prototype.equals=function(t){return!!t&&(u.arrayEquals(t.kmlPositions,this.kmlPositions)&&t.kmlExtrude==this.kmlExtrude&&t.kmlTessellate==this.kmlTessellate&&t.kmlAltitudeMode==this.kmlAltitudeMode)},c.prototype.getTagNames=function(){return["LineString"]},e.addKey(c.prototype.getTagNames()[0],c),c}),i("formats/kml/geom/KmlLinearRing",["./KmlLineString","../KmlElements"],function(t,e){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),i.prototype.getTagNames=function(){return["LinearRing"]},e.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/KmlLocation",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:i.string})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:i.string})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["Location"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlLookAt",["./KmlAbstractView","./KmlElements","./util/NodeTransformers","../../geom/Position"],function(t,e,i,r){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),Object.defineProperties(n.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:i.number})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:i.number})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:i.number})}},kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:i.number})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:i.number})}},kmlRange:{get:function(){return this._factory.specific(this,{name:"range",transformer:i.number})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:i.string})}}}),n.prototype.update=function(t){if(t.wwd){var e=this.kmlAltitude||4e3;t.wwd.goTo(new r(this.kmlLatitude,this.kmlLongitude,e))}},n.prototype.getTagNames=function(){return["LookAt"]},e.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/geom/KmlMultiGeometry",["./../KmlElements","./KmlGeometry","../../../geom/Position"],function(t,e,i){"use strict";var r=function(t){e.call(this,t),this._style=t.style};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlShapes:{get:function(){return this._factory.all(this)}},kmlCenter:{get:function(){var t=this.kmlShapes.map(function(t){return t.kmlCenter}),e=0,r=0,n=0;return t.forEach(function(t){e+=t.latitude,r+=t.longitude,n+=t.altitude}),new i(e/t.length,r/t.length,n/t.length)}}}),r.prototype.render=function(t,i){e.prototype.render.call(this,t,i),this.kmlShapes.forEach(function(e){e.render(t,i)})},r.prototype.getTagNames=function(){return["MultiGeometry"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlNetworkLink",["./../KmlElements","./KmlFeature","../KmlFile","../KmlLink","../util/NodeTransformers","../util/RefreshListener"],function(t,e,i,r,n,o){"use strict";var s=function(t){e.call(this,t),this.isFeature=!0,this.resolvedFile=null,this.displayed=!1,this.isDownloading=!1};return s.prototype=Object.create(e.prototype),Object.defineProperties(s.prototype,{kmlRefreshVisibility:{get:function(){return this._factory.specific(this,{name:"refreshVisibility",transformer:n.boolean})}},kmlFlyToView:{get:function(){return this._factory.specific(this,{name:"flyToView",transformer:n.boolean})}},kmlLink:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}}}),s.prototype.getTagNames=function(){return["NetworkLink"]},s.prototype.render=function(t,r){if(e.prototype.render.call(this,t,r),r.lastVisibility||this.displayed){if(!this.isDownloading&&!this.resolvedFile){this.isDownloading=!0;var n=this;new i(n.buildUrl()).then(function(t){n.resolvedFile=t,n.isDownloading=!1,n.fireEvent(r)})}this.resolvedFile&&!this.displayed&&(this.resolvedFile.render(t,r),this.handleRefresh(r))}},s.prototype.buildUrl=function(){return this.kmlLink.kmlHref},s.prototype.handleRefresh=function(t){var e=t.activeEvents;if(e=e.filter(function(t){return"refreshNetworkLinkEvent"==t.type}),e.length>0){var r=this;new i(r.buildUrl()).then(function(e){r.resolvedFile=e,r.fireEvent(t)})}},s.prototype.fireEvent=function(t){var e=0;if("onInterval"==this.kmlLink.kmlRefreshMode)e=1e3*this.kmlLink.kmlRefreshInterval;else{if("onExpire"!=this.kmlLink.kmlRefreshMode)return;if(!this.resolvedFile)return;e=this.resolvedFile.getExpired()}t.listener.addEvent(new o.Event("refreshNetworkLinkEvent",e,null))},t.addKey(s.prototype.getTagNames()[0],s),s}),i("formats/kml/KmlOrientation",["./KmlElements","./KmlObject","./util/NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:i.number})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:i.number})}},kmlRoll:{get:function(){return this._factory.specific(this,{name:"roll",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["Orientation"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/geom/KmlPoint",["../../../util/Color","../KmlElements","./KmlGeometry","../../../geom/Location","../util/NodeTransformers","../../../shapes/Polygon","../../../geom/Position"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){i.call(this,t),this._shape=null};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{kmlPosition:{get:function(){var t=this._factory.specific(this,{name:"coordinates",transformer:n.string}).split(",");return new s(t[1],t[0],t[2]||0)}},kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:n.boolean})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:n.string})}},kmlCenter:{get:function(){return this.kmlPosition}}}),a.prototype.getTagNames=function(){return["Point"]},e.addKey(a.prototype.getTagNames()[0],a),a}),i("formats/kml/util/ViewVolume",["../KmlElements","../KmlObject","./NodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlLeftFov:{get:function(){return this._factory.specific(this,{name:"leftFov",transformer:i.number})}},kmlRightFov:{get:function(){return this._factory.specific(this,{name:"rightFov",transformer:i.number})}},kmlBottomFov:{get:function(){return this._factory.specific(this,{name:"bottomFov",transformer:i.number})}},kmlTopFov:{get:function(){return this._factory.specific(this,{name:"topFov",transformer:i.number})}},kmlNear:{get:function(){return this._factory.specific(this,{name:"near",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["ViewVolume"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlPhotoOverlay",["../util/ImagePyramid","./../KmlElements","./KmlOverlay","../geom/KmlPoint","../util/NodeTransformers","../util/ViewVolume"],function(t,e,i,r,n,o){"use strict";var s=function(t){i.call(this,t)};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:n.string})}},kmlShape:{get:function(){return this._factory.specific(this,{name:"shape",transformer:n.string})}},kmlPoint:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}},kmlViewVolume:{get:function(){return this._factory.any(this,{name:o.prototype.getTagNames()})}},kmlImagePyramid:{get:function(){return this._factory.any(this,{name:t.prototype.getTagNames()})}}}),s.prototype.getTagNames=function(){return["PhotoOverlay"]},e.addKey(s.prototype.getTagNames[0],s),s}),i("formats/kml/features/KmlPlacemark",["./../KmlElements","./KmlFeature","../geom/KmlGeometry","../styles/KmlStyle","../KmlTimeSpan","../KmlTimeStamp","../../../shapes/PlacemarkAttributes","../../../shapes/Placemark","../../../util/Color","../../../shapes/ShapeAttributes","../../../shapes/TextAttributes","../../../util/Offset","../../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t){e.call(this,t)};return p.prototype=Object.create(e.prototype),Object.defineProperties(p.prototype,{kmlGeometry:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}}}),p.prototype.render=function(t,i){e.prototype.render.call(this,t,i),i=d.clone(i),i.lastStyle&&!this._renderable&&this.kmlGeometry&&(this._renderable=new a(this.kmlGeometry.kmlCenter,!1,this.prepareAttributes(i.lastStyle.normal)),i.lastStyle.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(i.lastStyle.highlight)),this.moveValidProperties(),t.redrawRequested=!0),this._renderable&&this.kmlGeometry&&(this.kmlGeometry.render(t,i),this._renderable.render(t))},p.prototype.prepareAttributes=function(t){var e=t&&t.generate()||{normal:{},highlight:{}},i=new s(r.placemarkAttributes(e));return i.imageOffset=new c(WorldWind.OFFSET_FRACTION,.3,WorldWind.OFFSET_FRACTION,0),i.imageColor=l.WHITE,i.labelAttributes=new u(r.textAttributes({_offset:new c(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,1),_color:l.YELLOW})),i.drawLeaderLine=!0,i.leaderLineAttributes=new h(r.shapeAttributes({outlineColor:l.RED})),i},p.prototype.moveValidProperties=function(){this._renderable.label=this.kmlName||"",this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.RELATIVE_TO_GROUND,this._renderable.enableLeaderLinePicking=!0},p.prototype.getTagNames=function(){return["Placemark"]},t.addKey(p.prototype.getTagNames()[0],p),p}),i("formats/kml/geom/KmlPolygon",["../../../util/Color","../KmlElements","./KmlGeometry","./KmlLinearRing","../styles/KmlStyle","../../../geom/Location","../util/NodeTransformers","../../../shapes/Polygon","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolygon"],function(t,e,i,r,n,o,s,a,l,h){"use strict";var u=function(t){i.call(this,t),this.initialized=!1};return u.prototype=Object.create(i.prototype),Object.defineProperties(u.prototype,{kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:s.boolean})}},kmlTessellate:{get:function(){return this._factory.specific(this,{name:"tessellate",transformer:s.boolean})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:s.string})}},kmlOuterBoundary:{get:function(){return this._factory.specific(this,{name:"outerBoundaryIs",transformer:s.linearRing})}},kmlInnerBoundary:{get:function(){return this._factory.specific(this,{name:"innerBoundaryIs",transformer:s.linearRing})}},kmlCenter:{get:function(){return this.kmlOuterBoundary.kmlCenter}}}),u.prototype.createPolygon=function(t){this.kmlAltitudeMode==WorldWind.CLAMP_TO_GROUND?this._renderable=new h(this.prepareLocations(),this.prepareAttributes(t.normal)):this._renderable=new a(this.prepareLocations(),this.prepareAttributes(t.normal)),t.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(t.highlight)),this.moveValidProperties()},u.prototype.render=function(t,e){i.prototype.render.call(this,t,e),e.lastStyle&&!this._renderable&&(this.createPolygon(e.lastStyle),t.redrawRequested=!0),this._renderable&&(this._renderable.enabled=this.enabled,this._renderable.render(t))},u.prototype.moveValidProperties=function(){this._renderable.extrude=this.kmlExtrude||!0,this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.CLAMP_TO_GROUND},u.prototype.prepareAttributes=function(t){var e=t&&t.generate()||{};return e._drawVerticals=this.kmlExtrude||!1,e._applyLighting=!0,e._depthTest=!0,e._outlineStippleFactor=0,e._outlineStipplePattern=61680,e._enableLighting=!0,new l(n.shapeAttributes(e))},u.prototype.prepareLocations=function(){var t=[];return null!=this.kmlInnerBoundary?(t[0]=this.kmlInnerBoundary.kmlPositions,t[1]=this.kmlOuterBoundary.kmlPositions):t=this.kmlOuterBoundary.kmlPositions,t},u.prototype.getStyle=function(){return this._style},u.prototype.getTagNames=function(){return["Polygon"]},e.addKey(u.prototype.getTagNames()[0],u),u}),i("formats/kml/features/KmlScreenOverlay",["./../KmlElements","./KmlFeature","./KmlOverlay","../util/NodeTransformers","../../../util/Offset","../../../shapes/ScreenImage","../../../util/WWUtil"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){i.call(this,t),console.log("Create Screen Overlay",this)};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:r.number})}},kmlOverlayXYx:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("x"),attribute:"kmlOverlayXYx"})}},kmlOverlayXYy:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("y"),attribute:"kmlOverlayXYy"})}},kmlOverlayXYxunits:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("xunits"),attribute:"kmlOverlayXYxunits"})}},kmlOverlayXYyunits:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("yunits"),attribute:"kmlOverlayXYyunits"})}},kmlScreenXYx:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("x"),attribute:"kmlScreenXYx"})}},kmlScreenXYy:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("y"),attribute:"kmlScreenXYy"})}},kmlScreenXYxunits:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("xunits"),attribute:"kmlScreenXYxunits"})}},kmlScreenXYyunits:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("yunits"),attribute:"kmlScreenXYyunits"})}},kmlRotationXYx:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("x"),attribute:"kmlRotationXYx"})}},kmlRotationXYy:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("y"),attribute:"kmlRotationXYy"})}},kmlRotationXYxunits:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("xunits"),attribute:"kmlRotationXYxunits"})}},kmlRotationXYyunits:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("yunits"),attribute:"kmlRotationXYyunits"})}}, kmlSizex:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("x"),attribute:"kmlSizex"})}},kmlSizey:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("y"),attribute:"kmlSizey"})}},kmlSizexunits:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("xunits"),attribute:"kmlSizexunits"})}},kmlSizeyunits:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("yunits"),attribute:"kmlSizeyunits"})}}}),a.prototype.render=function(t,i){e.prototype.render.call(this,t,i),this._renderable||this.kmlIcon&&(this._renderable=new o(new n(this.kmlScreenXYxunits,this.kmlScreenXYx,this.kmlScreenXYyunits,this.kmlScreenXYy),this.kmlIcon.kmlHref),this._renderable.imageOffset=new n(this.kmlOverlayXYxunits,this.kmlOverlayXYx,this.kmlOverlayXYyunits,this.kmlOverlayXYy),t.redrawRequested=!0),this._renderable&&this._renderable.render(t)},a.prototype.getTagNames=function(){return["ScreenOverlay"]},t.addKey(a.prototype.getTagNames()[0],a),a}),i("formats/kml/features/KmlTour",["./../KmlElements","./KmlFeature"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["gx:Tour"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/geom/KmlTrack",["./../KmlElements","./KmlGeometry"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["gx:Track"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/controls/KmlTreeVisibility",["../../../util/WWUtil","./KmlControls"],function(t,e){"use strict";var i=function(t,i){e.apply(this),this._visualElementId=t,this._wwd=i};return i.prototype=Object.create(e.prototype),i.prototype.hook=function(t,e){e.isFeature&&this.createControls(t)},i.prototype.createControls=function(e){function i(){o=!o,h.updateDescendants(e,o)}function r(){e.kmlAbstractView&&e.kmlAbstractView.update({wwd:h._wwd})}var n=e.kmlName||e.id||t.guid(),o=e.enabled||!0===e.kmlVisibility,s=document.createElement("div"),a=document.createElement("input");a.setAttribute("type","checkbox"),o&&a.setAttribute("checked","checked"),a.addEventListener("click",i,!0),s.appendChild(a);var l=document.createElement("span");l.appendChild(document.createTextNode(n)),l.addEventListener("click",r,!0),s.appendChild(l),document.getElementById(this._visualElementId).appendChild(s);var h=this},i.prototype.updateDescendants=function(t,e){t.controlledVisibility=e,this._wwd.redraw()},i}),i("layer/LandsatRestLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../geom/Sector","../layer/TiledImageLayer","../util/LevelRowColumnUrlBuilder","../util/WWUtil"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,a){var l=s.urlPath(t+"/"+i);n.call(this,r.FULL_SPHERE,new e(36,36),10,"image/png",l,512,512),this.displayName=a,this.pickEnabled=!1,this.urlBuilder=new o(t,i)};return a.prototype=Object.create(n.prototype),a}),i("util/measure/LengthMeasurer",["../../error/ArgumentError","../../geom/Location","../Logger","./MeasurerUtils","../../geom/Position","../../geom/Vec3"],function(t,e,i,r,n,o){var s=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"LengthMeasurer","constructor","missingWorldWindow"));this.wwd=e,this.DEFAULT_MIN_SEGMENT_LENGTH=30,this._maxSegmentLength=1e5,this._lengthTerrainSamplingSteps=128,this.subdividedPositions=null};return Object.defineProperties(s.prototype,{maxSegmentLength:{get:function(){return this._maxSegmentLength},set:function(t){this._maxSegmentLength=t}},lengthTerrainSamplingSteps:{get:function(){return this._lengthTerrainSamplingSteps},set:function(t){this._lengthTerrainSamplingSteps=t}}}),s.prototype.getLength=function(t,e,i){return i=i||WorldWind.GREAT_CIRCLE,this.subdividedPositions=null,this.computeLength(t,e,i)},s.prototype.getPathLength=function(t){return this.subdividedPositions=null,this.computeLength(t.positions,t.followTerrain,t.pathType)},s.prototype.getGeographicDistance=function(t,i){if(t instanceof WorldWind.Path)var r=t.positions,n=t.pathType;else Array.isArray(t)&&(r=t,n=i||WorldWind.GREAT_CIRCLE);if(!r||r.length<2)return-1;var o=e.greatCircleDistance;n===WorldWind.RHUMB_LINE?o=e.rhumbDistance:n===WorldWind.LINEAR&&(o=e.linearDistance);for(var s=0,a=0,l=r.length-1;a0&&(h=a.perspectiveNearDistance(m.width,m.height,l),this.nearDistance>h&&(this.nearDistance=h)),this.nearDistance<1&&(this.nearDistance=1),y.setToPerspectiveProjection(m.width,m.height,this.nearDistance,this.farDistance),new r(o,y,m,this.heading,this.tilt)},l}),i("gesture/PanRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.minNumberOfTouches=1,this.maxNumberOfTouches=Number.MAX_VALUE,this.interpretDistance=20};return e.prototype=Object.create(t.prototype),e.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.touchMove=function(t){this.state==WorldWind.POSSIBLE?this.shouldInterpret()&&(this.shouldRecognize()?this.state=WorldWind.BEGAN:this.state=WorldWind.FAILED):this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CHANGED)},e.prototype.touchEnd=function(t){0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},e.prototype.touchCancel=function(t){0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CANCELLED))},e.prototype.prepareToRecognize=function(){this.translationX=0,this.translationY=0},e.prototype.shouldInterpret=function(){var t=this.translationX,e=this.translationY;return Math.sqrt(t*t+e*e)>this.interpretDistance},e.prototype.shouldRecognize=function(){var t=this.touchCount;return 0!=t&&t>=this.minNumberOfTouches&&t<=this.maxNumberOfTouches},e}),i("gesture/PinchRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this._scale=1,this._offsetScale=1,this.referenceDistance=0,this.interpretThreshold=20,this.weight=.4,this.pinchTouches=[]};return e.prototype=Object.create(t.prototype),Object.defineProperties(e.prototype,{scale:{get:function(){return this._scale*this._offsetScale}}}),e.prototype.reset=function(){t.prototype.reset.call(this),this._scale=1,this._offsetScale=1,this.referenceDistance=0,this.pinchTouches=[]},e.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.touchStart=function(t){this.pinchTouches.length<2&&2==this.pinchTouches.push(t)&&(this.referenceDistance=this.currentPinchDistance(),this._offsetScale*=this._scale,this._scale=1)},e.prototype.touchMove=function(t){if(2==this.pinchTouches.length)if(this.state==WorldWind.POSSIBLE)this.shouldRecognize()&&(this.state=WorldWind.BEGAN);else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED){var e=this.currentPinchDistance(),i=Math.abs(e/this.referenceDistance),r=this.weight;this._scale=this._scale*(1-r)+i*r,this.state=WorldWind.CHANGED}},e.prototype.touchEnd=function(t){var e=this.pinchTouches.indexOf(t);-1!=e&&this.pinchTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},e.prototype.touchCancel=function(t){var e=this.pinchTouches.indexOf(t);-1!=e&&this.pinchTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CANCELLED))},e.prototype.prepareToRecognize=function(){this.referenceDistance=this.currentPinchDistance(),this._scale=1},e.prototype.shouldRecognize=function(){var t=this.currentPinchDistance();return Math.abs(t-this.referenceDistance)>this.interpretThreshold},e.prototype.currentPinchDistance=function(){var t=this.pinchTouches[0],e=this.pinchTouches[1],i=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(i*i+r*r)},e}),i("gesture/RotationRecognizer",["../geom/Angle","../gesture/GestureRecognizer"],function(t,e){"use strict";var i=function(t,i){e.call(this,t,i),this._rotation=0,this._offsetRotation=0,this.referenceAngle=0,this.interpretThreshold=20,this.weight=.4,this.rotationTouches=[]};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.prototype,{rotation:{get:function(){return this._rotation+this._offsetRotation}}}),i.prototype.reset=function(){e.prototype.reset.call(this),this._rotation=0,this._offsetRotation=0,this.referenceAngle=0,this.rotationTouches=[]},i.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},i.prototype.touchStart=function(t){this.rotationTouches.length<2&&2==this.rotationTouches.push(t)&&(this.referenceAngle=this.currentTouchAngle(),this._offsetRotation+=this._rotation,this._rotation=0)},i.prototype.touchMove=function(e){if(2==this.rotationTouches.length)if(this.state==WorldWind.POSSIBLE)this.shouldRecognize()&&(this.state=WorldWind.BEGAN);else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED){var i=this.currentTouchAngle(),r=t.normalizedDegrees(i-this.referenceAngle),n=this.weight;this._rotation=this._rotation*(1-n)+r*n,this.state=WorldWind.CHANGED}},i.prototype.touchEnd=function(t){var e=this.rotationTouches.indexOf(t);-1!=e&&this.rotationTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},i.prototype.touchCancel=function(t){var e=this.rotationTouches.indexOf(t);-1!=e&&(this.rotationTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CANCELLED)))},i.prototype.prepareToRecognize=function(){this.referenceAngle=this.currentTouchAngle(),this._rotation=0},i.prototype.shouldRecognize=function(){var e=this.currentTouchAngle(),i=t.normalizedDegrees(e-this.referenceAngle);return Math.abs(i)>this.interpretThreshold},i.prototype.currentTouchAngle=function(){var e=this.rotationTouches[0],i=this.rotationTouches[1],r=e.clientX-i.clientX,n=e.clientY-i.clientY;return Math.atan2(n,r)*t.RADIANS_TO_DEGREES},i}),i("gesture/TiltRecognizer",["../gesture/PanRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.maxTouchDistance=250,this.maxTouchDivergence=50};return e.LEFT=1,e.RIGHT=2,e.UP=4,e.DOWN=8,e.prototype=Object.create(t.prototype),e.prototype.shouldInterpret=function(){for(var t=0,e=this.touchCount;tthis.interpretDistance)return!0}return!1},e.prototype.shouldRecognize=function(){if(this.touchCount<2)return!1;var t=this.touch(0),i=this.touch(1),r=t.clientX-i.clientX,n=t.clientY-i.clientY;if(Math.sqrt(r*r+n*n)>this.maxTouchDistance)return!1;var o=t.translationX-i.translationX,s=t.translationY-i.translationY;if(Math.sqrt(o*o+s*s)>this.maxTouchDivergence)return!1;var a=e.UP|e.DOWN;return 0!=(this.touchDirection(t)&a&this.touchDirection(i)&a)},e.prototype.touchDirection=function(t){var i=t.translationX,r=t.translationY,n=0;return Math.abs(i)>Math.abs(r)?(n|=i<0?e.LEFT:0,n|=i>0?e.RIGHT:0):(n|=r<0?e.UP:0,n|=r>0?e.DOWN:0),n},e}),i("navigate/LookAtNavigator",["../geom/Angle","../gesture/DragRecognizer","../geom/Frustum","../gesture/GestureRecognizer","../geom/Line","../geom/Location","../util/Logger","../geom/Matrix","../navigate/Navigator","../gesture/PanRecognizer","../gesture/PinchRecognizer","../geom/Position","../gesture/RotationRecognizer","../gesture/TiltRecognizer","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m){"use strict";var E=function(t){function i(t){t.preventDefault()}l.call(this,t),t.addEventListener("mousedown",i),t.addEventListener("touchstart",i),t.addEventListener("contextmenu",i),t.addEventListener("wheel",i),window.PointerEvent&&t.canvas.style.setProperty("touch-action","none"),this.lookAtLocation=new o(30,-110),this.range=1e7,this.enable2DLimits=!0;var r=this;this.primaryDragRecognizer=new e(t,function(t){r.handlePanOrDrag(t)}),this.secondaryDragRecognizer=new e(t,function(t){r.handleSecondaryDrag(t)}),this.secondaryDragRecognizer.button=2,this.panRecognizer=new h(t,function(t){r.handlePanOrDrag(t)}),this.pinchRecognizer=new u(t,function(t){r.handlePinch(t)}),this.rotationRecognizer=new d(t,function(t){r.handleRotation(t)}),this.tiltRecognizer=new p(t,function(t){r.handleTilt(t)}),t.addEventListener("wheel",function(t){r.handleWheelEvent(t)}),this.panRecognizer.recognizeSimultaneouslyWith(this.pinchRecognizer),this.panRecognizer.recognizeSimultaneouslyWith(this.rotationRecognizer),this.pinchRecognizer.recognizeSimultaneouslyWith(this.rotationRecognizer),this.panRecognizer.requireRecognizerToFail(this.tiltRecognizer),this.pinchRecognizer.requireRecognizerToFail(this.tiltRecognizer),this.rotationRecognizer.requireRecognizerToFail(this.tiltRecognizer),this.beginPoint=new f(0,0),this.lastPoint=new f(0,0),this.beginHeading=0,this.beginTilt=0,this.beginRange=0,this.lastRotation=0};return E.prototype=Object.create(l.prototype),E.prototype.currentState=function(){this.applyLimits();var t=this.worldWindow.globe,e=new c(this.lookAtLocation.latitude,this.lookAtLocation.longitude,0),i=a.fromIdentity();return i.multiplyByLookAtModelview(e,this.range,this.heading,this.tilt,this.roll,t),this.currentStateForModelview(i)},E.prototype.handlePanOrDrag=function(t){this.worldWindow.globe.is2D()?this.handlePanOrDrag2D(t):this.handlePanOrDrag3D(t)},E.prototype.handlePanOrDrag3D=function(e){var i=e.state,r=e.translationX,n=e.translationY;if(i==WorldWind.BEGAN)this.lastPoint.set(0,0);else if(i==WorldWind.CHANGED){var o=this.worldWindow.canvas,s=this.worldWindow.globe,a=m.max(s.equatorialRadius,s.polarRadius),l=m.max(1,this.range),h=m.perspectivePixelSize(o.clientWidth,o.clientHeight,l),u=(n-this.lastPoint[1])*h,c=-(r-this.lastPoint[0])*h,d=u/a*t.RADIANS_TO_DEGREES,p=c/a*t.RADIANS_TO_DEGREES,f=Math.sin(this.heading*t.DEGREES_TO_RADIANS),g=Math.cos(this.heading*t.DEGREES_TO_RADIANS);this.lookAtLocation.latitude+=d*g-p*f,this.lookAtLocation.longitude+=d*f+p*g,this.lastPoint.set(r,n),this.applyLimits(),this.worldWindow.redraw()}},E.prototype.handlePanOrDrag2D=function(t){var e=t.state,i=t.clientX,r=t.clientY,n=t.translationX,o=t.translationY;if(e==WorldWind.BEGAN)this.beginPoint.set(i,r),this.lastPoint.set(i,r);else if(e==WorldWind.CHANGED){var s=this.lastPoint[0],l=this.lastPoint[1],h=this.beginPoint[0]+n,u=this.beginPoint[1]+o;this.lastPoint.set(h,u);var c=this.currentState(),d=this.worldWindow.globe,p=c.rayFromScreenPoint(this.worldWindow.canvasCoordinates(s,l)),f=new g(0,0,0),m=new g(0,0,0),E=new g(0,0,0);if(!d.intersectsLine(p,f))return;if(p=c.rayFromScreenPoint(this.worldWindow.canvasCoordinates(h,u)),!d.intersectsLine(p,m))return;var y=a.fromIdentity();if(y.copy(c.modelview),y.multiplyByTranslation(m[0]-f[0],m[1]-f[1],m[2]-f[2]),y.extractEyePoint(p.origin),y.extractForwardVector(p.direction),!d.intersectsLine(p,E))return;var _=y.extractViewingParameters(E,this.roll,d,{});this.lookAtLocation.copy(_.origin),this.range=_.range,this.heading=_.heading,this.tilt=_.tilt,this.roll=_.roll,this.applyLimits(),this.worldWindow.redraw()}},E.prototype.handleSecondaryDrag=function(t){var e=t.state,i=t.translationX,r=t.translationY;if(e==WorldWind.BEGAN)this.beginHeading=this.heading,this.beginTilt=this.tilt;else if(e==WorldWind.CHANGED){var n=180*i/this.worldWindow.canvas.clientWidth,o=90*r/this.worldWindow.canvas.clientHeight;this.heading=this.beginHeading+n,this.tilt=this.beginTilt+o,this.applyLimits(),this.worldWindow.redraw()}},E.prototype.handlePinch=function(t){var e=t.state,i=t.scale;e==WorldWind.BEGAN?this.beginRange=this.range:e==WorldWind.CHANGED&&0!=i&&(this.range=this.beginRange/i,this.applyLimits(),this.worldWindow.redraw())},E.prototype.handleRotation=function(t){var e=t.state,i=t.rotation;e==WorldWind.BEGAN?this.lastRotation=0:e==WorldWind.CHANGED&&(this.heading-=i-this.lastRotation,this.lastRotation=i,this.applyLimits(),this.worldWindow.redraw())},E.prototype.handleTilt=function(t){var e=t.state,i=t.translationY;if(e==WorldWind.BEGAN)this.beginTilt=this.tilt;else if(e==WorldWind.CHANGED){var r=-90*i/this.worldWindow.canvas.clientHeight;this.tilt=this.beginTilt+r,this.applyLimits(),this.worldWindow.redraw()}},E.prototype.handleWheelEvent=function(t){var e;t.deltaMode==WheelEvent.DOM_DELTA_PIXEL?e=t.deltaY:t.deltaMode==WheelEvent.DOM_DELTA_LINE?e=40*t.deltaY:t.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(e=400*t.deltaY);var i=1+e/1e3;this.range*=i,this.applyLimits(),this.worldWindow.redraw()},E.prototype.applyLimits=function(){if(this.lookAtLocation.latitude=m.clamp(this.lookAtLocation.latitude,-90,90),this.lookAtLocation.longitude=t.normalizedDegreesLongitude(this.lookAtLocation.longitude),this.range=m.clamp(this.range,1,Number.MAX_VALUE),this.heading=t.normalizedDegrees(this.heading),this.tilt=m.clamp(this.tilt,0,90),this.roll=t.normalizedDegrees(this.roll),this.worldWindow.globe.is2D()&&this.enable2DLimits){var e=2*Math.PI*this.worldWindow.globe.equatorialRadius;this.range=m.clamp(this.range,1,e),this.tilt=0}},E}),i("cache/MemoryCacheListener",["../util/Logger","../error/UnsupportedOperationError"],function(t,e){"use strict";var i=function(){};return i.prototype.entryRemoved=function(i,r){throw new e(t.logMessage(t.LEVEL_SEVERE,"MemoryCacheListener","entryRemoved","abstractInvocation"))},i.prototype.removalError=function(i,r,n){throw new e(t.logMessage(t.LEVEL_SEVERE,"MemoryCacheListener","removalError","abstractInvocation"))},i}),i("util/NominatimGeocoder",["../util/Logger"],function(t){"use strict";var e=function(){this.service="https://open.mapquestapi.com/nominatim/v1/search/"};return e.prototype.lookup=function(t,e,i){var r=this.service+t.replace(" ","%20")+"?format=json",n=new XMLHttpRequest,o=this;r+="&key="+(i||"lUvVRchXGGDh5Xwk3oidrXeIDAAevOUS"),n.open("GET",r,!0),n.onreadystatechange=function(){if(4===n.readyState&&200===n.status){var t=JSON.parse(n.responseText);e(o,t)}},n.send(null)},e}),i("layer/OpenStreetMapImageLayer",["../geom/Angle","../util/Color","../geom/Location","../geom/Sector","../layer/MercatorTiledImageLayer"],function(t,e,i,r,n){"use strict";var o=function(t){this.imageSize=256,t=t||"Open Street Map",n.call(this,new r(-85.05,85.05,-180,180),new i(85.05,180),19,"image/png",t,this.imageSize,this.imageSize),this.displayName=t,this.pickEnabled=!1,this.destCanvas=document.createElement("canvas"),this.destContext=this.destCanvas.getContext("2d"),this.urlBuilder={urlForTile:function(t,e){return"https://otile1.mqcdn.com/tiles/1.0.0/osm/"+(t.level.levelNumber+1)+"/"+t.column+"/"+t.row+".png"}}};return o.prototype=Object.create(n.prototype),o.prototype.doRender=function(t){n.prototype.doRender.call(this,t),this.inCurrentFrame&&(t.screenCreditController.addStringCredit("©OpenStreetMap",e.DARK_GRAY),t.screenCreditController.addStringCredit("Tiles Courtesy of MapQuest",e.DARK_GRAY))},o.prototype.createTopLevelTiles=function(t){this.topLevelTiles=[],this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),0,0)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),0,1)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),1,0)),this.topLevelTiles.push(this.createTile(null,this.levels.firstLevel(),1,1))},o.prototype.mapSizeForLevel=function(t){return 256<1?s-1:1),T=(S-v)/(a>1?a-1:1),L=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,w=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,R=this.north?1:-1,x=h||new Vec3(0,0,0),M=0,C=0;for(d=0,f=y;dMath.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},s.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},s.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},s}),i("projections/ProjectionMercator",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(){i.call(this,"Mercator",!0,new n(-78,78,-180,180))};return a.prototype=Object.create(i.prototype),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingResult"));n>this.projectionLimits.maxLatitude&&(n=this.projectionLimits.maxLatitude),n1?a-1:1),M=(R-w)/(l>1?l-1:1),C=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,A=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,P=u||new o(0,0,0),I=c?c[0]:0,O=0,N=0;for(p=0,g=T;p1?o-1:1),b=(v-_)/(s>1?s-1:1),T=this.north?-1:1,L=l||new Vec3(0,0,0),w=Math.PI/2,R=0,x=0,M=new Float64Array(s),C=new Float64Array(s);for(d=0,f=_;dMath.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},n.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},n.prototype.northTangentAtPoint=function(t,i,n,o,s,a){ if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},n}),i("projections/ProjectionUPS",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){this.north=!("South"===t);var e=this.north?new n(0,90,-180,180):new n(-90,0,-180,180);i.call(this,"Uniform Polar Stereographic",!1,e),this._pole=t,this.displayName=this.north?"North UPS":"South UPS",this._stateKey="projection ups "+this._pole+" "};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(0,90,-180,180):new n(-90,0,-180,180),this._stateKey="projection ups "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&-90===n)l[0]=0,l[1]=0,l[2]=s;else{var h,u,c,d=this.north?1:-1,p=n*t.DEGREES_TO_RADIANS,f=o*t.DEGREES_TO_RADIANS,g=Math.sqrt(i.eccentricitySquared),m=Math.sqrt(Math.pow(1+g,1+g)*Math.pow(1-g,1-g));(this.north&&p<0||!this.north&&p>0)&&(p=0),h=Math.sin(p*d),u=Math.sqrt((1-h)/(1+h)*Math.pow((1+g*h)/(1-g*h),g)),c=2*i.equatorialRadius*.994*u/m,l[0]=c*Math.sin(f),l[1]=-c*Math.cos(f)*d,l[2]=s}return l},a.prototype.geographicToCartesianGrid=function(i,n,a,l,h,u,c,d){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingSector"));if(!h||h.length1?a-1:1),x=(w-L)/(l>1?l-1:1),M=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,C=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,A=Math.sqrt(i.eccentricitySquared),P=Math.sqrt(Math.pow(1+A,1+A)*Math.pow(1-A,1-A)),I=this.north?1:-1,O=u||new o(0,0,0),N=0,D=0;for(p=0,g=b;p "+d.toString()+" ["+t+"]")}}},o}),i("formats/shapefile/DBaseFile",["../../error/ArgumentError","../../util/ByteBuffer","../../formats/shapefile/DBaseField","../../formats/shapefile/DBaseRecord","../../util/Logger"],function(t,e,i,r,n){"use strict";var o=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"DBaseFile","constructor","missingUrl"));this.url=e,this.header=null,this.fields=null,this.buffer=null,this.boolean=!0,this.numRecordsRead=0,this._completionCallback=null};return o.prototype.getLastModificationDate=function(){return this.header.lastModificationDate},o.prototype.getNumberOfRecords=function(){return this.header.numberOfRecords},o.prototype.getHeaderLength=function(){return this.header.headerLength},o.prototype.getRecordLength=function(){return this.header.recordLength},o.prototype.getNumberOfFields=function(){return(this.header.headerLength-1-o.FIXED_HEADER_LENGTH)/o.FIELD_DESCRIPTOR_LENGTH},o.prototype.getFields=function(){return this.fields},o.prototype.hasNext=function(){return this.numRecordsRead=this.getNumberOfRecords()?null:this.readNextRecord(this._buffer,++this.numRecordsRead)},o.prototype.load=function(t){this._completionCallback=t,this.requestUrl(this.url)},o.prototype.requestUrl=function(t){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){4===i.readyState&&(200===i.status?(this._buffer=new e(i.response),this.parse(),this._completionCallback&&this._completionCallback(this)):(n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed ("+i.statusText+"): "+t),this._completionCallback&&this._completionCallback(this)))}.bind(this),i.onerror=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed: "+t),this._completionCallback&&this._completionCallback(this)},i.ontimeout=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval timed out: "+t),this._completionCallback&&this._completionCallback(this)},i.send(null)},o.prototype.parse=function(){this.header=this.readHeader(this._buffer),this.fields=this.readFieldDescriptors(this._buffer,this.getNumberOfFields())},o.prototype.readHeader=function(t){var i=t.position;t.order(e.LITTLE_ENDIAN);var r=t.getByte();if(r>5)throw new Error("???");var n=t.getByte(),s=t.getByte(),a=t.getByte(),l=t.getInt32(),h=t.getInt16(),u=t.getInt16(),c={year:1900+n,month:s-1,day:a},d={fileCode:r,lastModificationDate:c,numberOfRecords:l,headerLength:h,recordLength:u};return t.seek(i+o.FIXED_HEADER_LENGTH),d},o.prototype.readFieldDescriptors=function(t,e){for(var r=t.position,n=[],s=0;s=0&&t0&&this._numberOfPoints>0)for(var e=this._buffer.getInt32Array(this.numberOfParts),i=0;i=8*this.numberOfPoints)if(t){this._mValues=this._buffer.getDoubleArray(1);var e=this._mValues[0];this._mRange=[e,e]}else this._mRange=this._buffer.getDoubleArray(2),this._mValues=this._buffer.getDoubleArray(this.numberOfPoints)},s.normalizeLocations=function(e){for(var i=0,r=e.length;i90&&(n=t.normalizedDegreesLatitude(i[1]),i[1]=90,r=!0,i[0]>n&&(i[0]=n)),(i[2]<-180||i[3]>180)&&(i[2]=-180,i[3]=180,r=!0),{coords:i,isNormalized:r}},L.prototype.readProjectedBoundingRectangle=function(t){throw new a(s.log(s.LEVEL_SEVERE,"Shapefile.readProjectedBoundingRectangle() not yet implemented"))},L.prototype.readBoundingRectangleCoordinates=function(t){ var e=t.getDouble(),i=t.getDouble(),r=t.getDouble();return[i,t.getDouble(),e,r]},L.prototype.readRecord=function(t){var e=this.createRecord(t);if(null!=e&&null!=this.attributeFile&&this.attributeFile.hasNext()){var i=this.attributeFile.nextRecord();e.setAttributes(i)}return e},L.prototype.createRecord=function(t){return this.isNullType()?this.createNull(t):this.isPointType()?this.createPoint(t):this.isMultiPointType()?this.createMultiPoint(t):this.isPolygonType()?this.createPolygon(t):this.isPolylineType()?this.createPolyline(t):null},L.prototype.createNull=function(t){return new y(this,t)},L.prototype.createPoint=function(t){return new _(this,t)},L.prototype.createMultiPoint=function(t){return new E(this,t)},L.prototype.createPolyline=function(t){return new S(this,t)},L.prototype.createPolygon=function(t){return new v(this,t)},L.prototype.getShapeType=function(t){switch(t){case 0:return L.NULL;case 1:return L.POINT;case 3:return L.POLYLINE;case 5:return L.POLYGON;case 8:return L.MULTI_POINT;case 11:return L.POINT_Z;case 13:return L.POLYLINE_Z;case 15:return L.POLYGON_Z;case 18:return L.MULTI_POINT_Z;case 21:return L.POINT_M;case 23:return L.POLYLINE_M;case 25:return L.POLYGON_M;case 28:return L.MULTI_POINT_M;default:return null}},L.prototype.isMeasureType=function(){return L.measureTypes.hasOwnProperty(this._shapeType)},L.prototype.isZType=function(){return L.zTypes.hasOwnProperty(this._shapeType)},L.prototype.isNullType=function(){return this._shapeType===L.NULL},L.prototype.isPointType=function(){return L.pointTypes.hasOwnProperty(this._shapeType)},L.prototype.isMultiPointType=function(){return L.multiPointTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolylineType=function(){return L.polylineTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolygonType=function(){return L.polygonTypes.hasOwnProperty(this._shapeType)},L.NULL="null",L.POINT="point",L.MULTI_POINT="multiPoint",L.POLYLINE="polyline",L.POLYGON="polygon",L.POINT_M=L.POINT+"M",L.MULTI_POINT_M=L.MULTI_POINT+"M",L.POLYLINE_M=L.POLYLINE+"M",L.POLYGON_M=L.POLYGON+"M",L.POINT_Z=L.POINT+"Z",L.MULTI_POINT_Z=L.MULTI_POINT+"Z",L.POLYLINE_Z=L.POLYLINE+"Z",L.POLYGON_Z=L.POLYGON+"Z",L.SHAPE_MULTI_PATCH="multiPatch",L.measureTypes={pointM:L.POINT_M,pointZ:L.POINT_Z,multiPointM:L.MULTI_POINT_M,multiPointZ:L.MULTI_POINT_Z,polylineM:L.POLYLINE_M,polylineZ:L.POLYLINE_Z,polygonM:L.POLYGON_M,polygonZ:L.POLYGON_Z},L.zTypes={pointZ:L.POINT_Z,multiPointZ:L.MULTI_POINT_Z,polylineZ:L.POLYLINE_Z,polygonZ:L.POLYGON_Z},L.pointTypes={point:L.POINT,pointZ:L.POINT_Z,pointM:L.POINT_M},L.multiPointTypes={multiPoint:L.MULTI_POINT,multiPointZ:L.MULTI_POINT_Z,multiPointM:L.MULTI_POINT_M},L.polylineTypes={polyline:L.POLYLINE,polylineZ:L.POLYLINE_Z,polylineM:L.POLYLINE_M},L.polygonTypes={polygon:L.POLYGON,polygonZ:L.POLYGON_Z,polygonM:L.POLYGON_M},L.FILE_CODE=9994,L}),i("layer/ShowTessellationLayer",["../shaders/BasicProgram","../layer/Layer"],function(t,e){"use strict";var i=function(){e.call(this,"Show Tessellation"),this.enableTerrainGeometry=!0,this.enableTerrainExtent=!1};return i.prototype=Object.create(e.prototype),i.prototype.doRender=function(t){try{this.beginRendering(t),this.enableTerrainGeometry&&this.drawTerrainGeometry(t),this.enableTerrainExtent&&this.drawTerrainExtent(t)}finally{this.endRendering(t)}},i.prototype.beginRendering=function(t){t.currentGlContext.depthMask(!1)},i.prototype.endRendering=function(t){t.currentGlContext.depthMask(!0)},i.prototype.drawTerrainGeometry=function(e){if(e.terrain&&e.terrain.tessellator){var i,r,n=e.currentGlContext,o=e.terrain,s=o.tessellator,a=o.surfaceGeometry;try{i=e.findAndBindProgram(t),s.beginRendering(e);for(var l=0,h=a.length;lthis._MAX_GL_POINT_SIZE&&e.log(e.LEVEL_WARNING,"StarFieldLayer - sunSize is to big, max size allowed is: "+this._MAX_GL_POINT_SIZE);var s=n.getAsCelestialLocation(this.time||new Date);this._sunBufferView[0]=s.declination,this._sunBufferView[1]=s.rightAscension,this._sunBufferView[2]=Math.min(this.sunSize,this._MAX_GL_POINT_SIZE),this._sunBufferView[3]=1,this._sunPositionsCacheKey||(this._sunPositionsCacheKey=o.generateCacheKey());var a=o.resourceForKey(this._sunPositionsCacheKey);a?(i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferSubData(i.ARRAY_BUFFER,0,this._sunBufferView)):(a=i.createBuffer(),o.putResource(this._sunPositionsCacheKey,a,4*this._sunBufferView.length),i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferData(i.ARRAY_BUFFER,this._sunBufferView,i.DYNAMIC_DRAW)),t.frameStatistics.incrementVboLoadCount(1),i.vertexAttribPointer(0,4,i.FLOAT,!1,0,0),r.loadTextureEnabled(i,!0),t.gpuResourceCache.resourceForKey(this._sunImageSource).bind(t),i.drawArrays(i.POINTS,0,1)},o.prototype.endRendering=function(t){var e=t.currentGlContext;e.depthMask(!0),e.disableVertexAttribArray(0)},o.prototype.fetchStarData=function(){if(!this._loadStarted){this._loadStarted=!0;var t=this,i=new XMLHttpRequest;i.onload=function(){if(this.status>=200&&this.status<300)try{t._starData=JSON.parse(this.response),t.sendRedrawRequest()}catch(t){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to parse JSON for star data "+t.toString())}else e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data. Status: "+this.status+" "+this.statusText);t._loadStarted=!1},i.onerror=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data"),t._loadStarted=!1},i.ontimeout=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer fetch star data has timeout"),t._loadStarted=!1},i.open("GET",this._starDataSource,!0),i.send()}},o.prototype.createStarsGeometry=function(){var t=this.parseStarsMetadata(this._starData.metadata);if(-1===t.raIndex)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing ra field in star data."));if(-1===t.decIndex)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing dec field in star data."));if(-1===t.magIndex)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing vmag field in star data."));var i=this._starData.data,r=[];this._minMagnitude=Number.MAX_VALUE,this._maxMagnitude=Number.MIN_VALUE;for(var n=0,o=i.length;nthis.numberOfTouches?this.state=WorldWind.FAILED:1==this.touchCount?(e={touchCount:this.touchCount,clientX:this.clientX,clientY:this.clientY},this.taps.push(e),this.failAfterDelay(this.maxTapDuration)):(e=this.taps[this.taps.length-1],e.touchCount=this.touchCount,e.clientX=this.clientX,e.clientY=this.clientY)}},e.prototype.touchMove=function(t){if(this.state==WorldWind.POSSIBLE){var e=this.translationX,i=this.translationY;Math.sqrt(e*e+i*i)>this.maxTouchMovement&&(this.state=WorldWind.FAILED)}},e.prototype.touchEnd=function(t){if(this.state==WorldWind.POSSIBLE&&0==this.touchCount){var e=this.taps.length;this.taps[e-1].touchCount!=this.numberOfTouches?this.state=WorldWind.FAILED:e==this.numberOfTaps?(this.clientX=this.taps[0].clientX,this.clientY=this.taps[0].clientY,this.state=WorldWind.RECOGNIZED):this.failAfterDelay(this.maxTapInterval)}},e.prototype.touchCancel=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.failAfterDelay=function(t){var e=this;e.timeout&&window.clearTimeout(e.timeout),e.timeout=window.setTimeout(function(){e.timeout=null,e.state==WorldWind.POSSIBLE&&(e.state=WorldWind.FAILED)},t)},e.prototype.cancelFailAfterDelay=function(){var t=this;t.timeout&&(window.clearTimeout(t.timeout),t.timeout=null)},e}),i("layer/TectonicPlatesLayer",["../error/ArgumentError","../util/Color","../geom/Location","../util/Logger","../layer/RenderableLayer","../shapes/ShapeAttributes","../shapes/SurfacePolygon"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){n.call(this,"Tectonic Plates"),t?this._attributes=t:(this._attributes=new o(null),this._attributes.drawInterior=!1,this._attributes.drawOutline=!0,this._attributes.outlineColor=e.RED),this.loadPlateData()};return a.prototype=Object.create(n.prototype),Object.defineProperties(a.prototype,{attributes:{get:function(){return this._attributes},set:function(t){t&&this.renderables.map(function(e,i,r){e.attributes=t})}}}),a.prototype.loadPlateData=function(){var t=WorldWind.configuration.baseUrl+"images/TectonicPlates.json",e=new XMLHttpRequest;e.open("GET",t,!0),e.onreadystatechange=function(){4===e.readyState&&(200===e.status?this.parse(e.responseText):r.log(r.LEVEL_WARNING,"Tectonic plate data retrieval failed ("+e.statusText+"): "+t))}.bind(this),e.onerror=function(){r.log(r.LEVEL_WARNING,"Tectonic plate data retrieval failed: "+t)},e.ontimeout=function(){r.log(r.LEVEL_WARNING,"Tectonic plate data retrieval timed out: "+t)},e.send(null)},a.prototype.parse=function(t){var e=JSON.parse(t),r=this;e.features.map(function(t,e,n){var o=[];t.geometry.coordinates.map(function(t,e,r){o.push(new i(t[1],t[0]))});var a=new s(o,r._attributes);r.addRenderable(a)})},a}),i("util/TileFactory",["../util/Logger","../error/UnsupportedOperationError"],function(t,e){"use strict";var i=function(){};return i.prototype.createTile=function(i,r,n,o){throw new e(t.logMessage(t.LEVEL_SEVERE,"TileFactory","createTile","abstractInvocation"))},i}),i("shapes/TriangleMesh",["../shapes/AbstractMesh","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../util/ImageSource","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolygon","../geom/Vec2","../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f){"use strict";var g=function(i,r,n){if(!i)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","missingPositions"));if(i.length<1)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","missingPositions"));if(i.length>65536)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too many positions. Must be fewer than 65537. Use TriangleMesh.split to split the shape."));if(!r)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Indices array is null or undefined"));if(r.length<3)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too few indices."));t.call(this,n),this._positions=i,this._indices=r,this.referencePosition=this._positions[0]};return g.prototype=Object.create(t.prototype),Object.defineProperties(g.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","positions","missingPositions"));this._positions=t,this.referencePosition=this._positions[0],this.reset()}},indices:{get:function(){return this._indices},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","indices","Indices array is null or undefined"));this._indices=t,this.meshIndices=null,this.reset()}},outlineIndices:{get:function(){return this._outlineIndices},set:function(t){this._outlineIndices=t,this.meshOutlineIndices=null,this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(t){if(t&&t.length!=this._positions.length)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","textureCoordinates","Number of texture coordinates is inconsistent with the currently specified positions."));this._textureCoordinates=t,this.reset(),this.texCoords=null}}}),g.prototype.createSurfaceShape=function(){if(this._outlineIndices){for(var t=[],e=0;e65533&&l.length%3==0){if(s.length>0){var d={positions:s,indices:l};if(i&&(d.textureCoords=a),r){for(var p=[],f=0;f=e.screenOffset.x&&i<=e.screenOffset.x+e.size&&r>=e.screenOffset.y&&r<=e.screenOffset.y+e.size)return e;return null},h.prototype.determineOperation=function(t,e){var i=null;return e&&e instanceof s&&(e===this.panControl?i=this.handlePan:e===this.zoomInControl||e===this.zoomOutControl?i=this.handleZoom:e===this.headingLeftControl||e===this.headingRightControl?i=this.handleHeading:e===this.tiltUpControl||e===this.tiltDownControl?i=this.handleTilt:e===this.exaggerationUpControl||e===this.exaggerationDownControl?i=this.handleExaggeration:e!==this.fovNarrowControl&&e!==this.fovWideControl||(i=this.handleFov)),i},h.prototype.isCurrentTouch=function(t){for(var e=0;e0?n:"1.0.0",this.crs="EPSG:4326"};return i.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","The coverage format is null or undefined."));var o=r.sector,s=i.fixGetCoverageString(this.serviceAddress);return s.search(/service=wcs/i)<0&&(s+="service=WCS"),s+="&request=GetCoverage",s=s+"&version="+this.wcsVersion,s=s+"&coverage="+this.coverageName,s=s+"&format="+n,s=s+"&width="+r.tileWidth,s=s+"&height="+r.tileHeight,s=s+"&crs="+this.crs,s+="&bbox=",s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude,s=s.replace(" ","%20")},i.fixGetCoverageString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsTileUrlBuilder","fixGetCoverageString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/))<0&&(i+="&"),i},i}),i("ogc/wmts/OwsLanguageString",["../../error/ArgumentError","../../util/Logger"],function(t,e){"use strict";return function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"LanguageString","constructor","missingDomElement"));this.value=i.textContent,this.lang;var r=i.getAttribute("lang");r&&(this.lang=r)}}),i("ogc/wmts/OwsConstraint",["../../error/ArgumentError","../../util/Logger"],function(t,e){"use strict";return function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"OwsConstraint","constructor","missingDomElement"));this.name=i.getAttribute("name");for(var r=i.children||i.childNodes,n=0;n0&&""!=r[0]&&this.setOptions(r,null);var o=i[e]&&new i[e];o||(o=new n),r&&r.length>0&&""!=r[0]&&o.setOptions(r[0],o),this.add(o)}},n.prototype.rightParenthesis=function(t){t.rightParenthesis++,t.coordinates&&(this.addCoordinates(t.coordinates),t.coordinates=null)},n.prototype.leftParenthesis=function(t){t.leftParenthesis++},n.prototype.comma=function(t){t.coordinates?(this.addCoordinates(t.coordinates),t.coordinates=null):this.commaWithoutCoordinates(t)},n.prototype.commaWithoutCoordinates=function(t){},n.prototype.number=function(t,e){t.coordinates=t.coordinates||[],t.coordinates.push(e)},n.prototype.setOptions=function(t,e){"Z"==t?e.set3d():"M"==t?e.setLrs():"MZ"==t&&(e.set3d(),e.setLrs())},n.prototype.isFinished=function(){return this.options.leftParenthesis===this.options.rightParenthesis&&this.options.leftParenthesis>0},n}),i("formats/wkt/WktTokens",["./WktElements","./geom/WktObject","./WktType"],function(t,e,i){var r=function(t){this.sourceText=t};return r.prototype.objects=function(){var i,r=[];return this.tokenize(this.sourceText).forEach(function(n){if(i&&i.isFinished()||!i){var o=n.value,s=o.match("[M]?[Z]?$");s&&s.length>0&&""!=s[0]&&(o=o.substring(0,o.length-s.length)),i=t[o]&&new t[o],i||(i=new e),s&&s.length>0&&""!=s[0]&&i.setOptions(s[0],i),r.push(i)}else i.handleToken(n)}),r},r.prototype.tokenize=function(t){this.currentPosition=0;for(var e=[];this.currentPosition="a"&&t<="z"||t>="A"&&t<="Z"},r.prototype.isNumeric=function(t){return t>="0"&&t<="9"||"."==t||"-"==t},r.prototype.isWhiteSpace=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},r.prototype.readText=function(t){for(var e="";this.isAlpha(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,e},r.prototype.readNumeric=function(t){for(var e="";this.isNumeric(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,Number(e)},r}),i("formats/wkt/Wkt",["../../error/ArgumentError","../../util/Logger","./WktTokens"],function(t,e,i){var r=function(t){this.textRepresentation=t,this._parserCompletionCallback=this.defaultParserCompletionCallback,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this._layer=null};return Object.defineProperties(r.prototype,{parserCompletionCallback:{get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}},layer:{get:function(){return this._layer}}}),r.prototype.load=function(t,e,r){r&&(this._layer=r),t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this.parserCompletionCallback(this,new i(this.textRepresentation).objects())},r.prototype.defaultShapeConfigurationCallback=function(t){},r.prototype.defaultParserCompletionCallback=function(t,e){var i=t.shapeConfigurationCallback,r=[];e.forEach(function(t){t.shapes().forEach(function(e){var n=i(t);n&&n.attributes&&(e.attributes=n.attributes),n&&n.highlightAttributes&&(e.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(e.pickDelegate=n.pickDelegate),n&&n.userProperties&&(e.userProperties=n.userProperties),r.push(e)})}),t.layer&&t.layer.addRenderables(r)},r}),i("formats/wkt/geom/WktGeometryCollection",["../../../geom/Location","../../../geom/Position","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n){var o=function(){r.call(this,n.SupportedGeometries.GEOMETRY_COLLECTION),this.objects=[]};return o.prototype=Object.create(r.prototype),o.prototype.add=function(t){this.objects.push(t)},o.prototype.addCoordinates=function(i){var r=this.objects[this.objects.length-1];this._is3d?r.coordinates.push(new e(i[0],i[1],i[2]||0)):r.coordinates.push(new t(i[0],i[1]))},o.prototype.shapes=function(){var t=[];return this.objects.forEach(function(e){e.shapes().forEach(function(e){t.push(e)})}),t},i.GEOMETRYCOLLECTION=o,o}),i("formats/wkt/geom/WktLineString",["../../../shapes/Path","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolyline","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n,o){var s=function(){n.call(this,o.SupportedGeometries.LINE_STRING)};return s.prototype=Object.create(n.prototype),s.prototype.shapes=function(){return this._is3d?[new t(this.coordinates,new e(null))]:[new i(this.coordinates,new e(null))]},r.LINESTRING=s,s}),i("formats/wkt/geom/WktMultiLineString",["../../../shapes/Path","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolyline","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n,o){var s=function(){n.call(this,o.SupportedGeometries.MULTI_LINE_STRING),this.objectBoundaries=[]};return s.prototype=Object.create(n.prototype),s.prototype.commaWithoutCoordinates=function(){this.objectBoundaries.push(this.coordinates.slice()),this.coordinates=[]},s.prototype.shapes=function(){return this.commaWithoutCoordinates(),this._is3d?this.objectBoundaries.map(function(i){return new t(i,new e(null))}.bind(this)):this.objectBoundaries.map(function(t){return new i(t,new e(null))}.bind(this))},r.MULTILINESTRING=s,s}),i("formats/wkt/geom/WktPoint",["../../../shapes/Placemark","../../../shapes/PlacemarkAttributes","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n){var o=function(){r.call(this,n.SupportedGeometries.POINT)};return o.prototype=Object.create(r.prototype),o.prototype.shapes=function(){return[o.placemark(this.coordinates[0])]},o.placemark=function(i){var r=new e(null);r.imageScale=1,r.imageOffset=new WorldWind.Offset(WorldWind.OFFSET_FRACTION,.3,WorldWind.OFFSET_FRACTION,0),r.imageColor=WorldWind.Color.WHITE,r.labelAttributes.offset=new WorldWind.Offset(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,1),r.labelAttributes.color=WorldWind.Color.YELLOW,r.drawLeaderLine=!0,r.leaderLineAttributes.outlineColor=WorldWind.Color.RED,r.imageSource=WorldWind.configuration.baseUrl+"images/pushpins/castshadow-purple.png";var n=new t(i,!0,r);return n.altitudeMode=WorldWind.RELATIVE_TO_GROUND,n},i.POINT=o,o}), i("formats/wkt/geom/WktMultiPoint",["../../../shapes/Placemark","../../../shapes/PlacemarkAttributes","../WktElements","./WktObject","./WktPoint","../WktType"],function(t,e,i,r,n,o){var s=function(){r.call(this,o.SupportedGeometries.MULTI_POINT)};return s.prototype=Object.create(r.prototype),s.prototype.commaWithoutCoordinates=function(){},s.prototype.shapes=function(){return this.coordinates.map(function(t){return n.placemark(t)}.bind(this))},i.MULTIPOINT=s,s}),i("formats/wkt/geom/WktMultiPolygon",["../../../shapes/Polygon","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolygon","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n,o){var s=function(){n.call(this,o.SupportedGeometries.MULTI_POLYGON),this.objectBoundaries=[],this.currentIndex=0};return s.prototype=Object.create(n.prototype),s.prototype.rightParenthesis=function(t){n.prototype.rightParenthesis.call(this,t),t.tokens[t.tokens.length-1].type!=o.TokenType.RIGHT_PARENTHESIS?this.addBoundaries():t.tokens[t.tokens.length-1].type==o.TokenType.RIGHT_PARENTHESIS&&t.tokens[t.tokens.length-2].type!=o.TokenType.RIGHT_PARENTHESIS&&this.addObject()},s.prototype.addBoundaries=function(){this.objectBoundaries[this.currentIndex]||(this.objectBoundaries[this.currentIndex]=[]),this.objectBoundaries[this.currentIndex].push(this.coordinates.slice()),this.coordinates=[]},s.prototype.addObject=function(){this.currentIndex++},s.prototype.shapes=function(){return this._is3d?this.objectBoundaries.map(function(i){return new t(i,new e(null))}.bind(this)):this.objectBoundaries.map(function(t){return new i(t,new e(null))}.bind(this))},r.MULTIPOLYGON=s,s}),i("formats/wkt/geom/WktPolygon",["../../../shapes/Polygon","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolygon","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n,o){var s=function(){n.call(this,o.SupportedGeometries.POLYGON),this._renderable=null};return s.prototype=Object.create(n.prototype),s.prototype.commaWithoutCoordinates=function(){this.outerBoundaries=this.coordinates.slice(),this.coordinates=[]},s.prototype.shapes=function(){return this._is3d?this.outerBoundaries?[new t([this.outerBoundaries,this.coordinates],new e(null))]:[new t(this.coordinates,new e(null))]:this.outerBoundaries?[new i([this.outerBoundaries,this.coordinates],new e(null))]:[new i(this.coordinates,new e(null))]},r.POLYGON=s,s}),i("formats/wkt/geom/WktTriangle",["../../../shapes/Polygon","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolygon","../WktElements","./WktObject","../WktType"],function(t,e,i,r,n,o){var s=function(){n.call(this,o.SupportedGeometries.TRIANGLE),this._renderable=null};return s.prototype=Object.create(n.prototype),s.prototype.shapes=function(){return this._is3d?[new t(this.coordinates,new e(null))]:[new i(this.coordinates,new e(null))]},r.TRIANGLE=s,s}),i("ogc/wms/WmsLayerCapabilities",["../../error/ArgumentError","../../util/Logger"],function(t,e){"use strict";var i=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsLayerCapabilities","constructor","Layer element is null or undefined."));this.parent=r,this.layers,this.name,this.title,this.abstract,this.keywordList,this.identifiers,this.metadataUrls,this.dataUrls,this.featureListUrls,this.assembleLayer(i)};return Object.defineProperties(i.prototype,{capability:{get:function(){for(var t=this;t&&t instanceof i;)t=t.parent;return t}},queryable:{get:function(){return i.replace(this,"_queryable")}},cascaded:{get:function(){return i.replace(this,"_cascaded")}},opaque:{get:function(){return i.replace(this,"_opaque")}},noSubsets:{get:function(){return i.replace(this,"_noSubsets")}},fixedWidth:{get:function(){return i.replace(this,"_fixedWidth")}},fixedHeight:{get:function(){return i.replace(this,"_fixedHeight")}},styles:{get:function(){return i.accumulate(this,"_styles",[])}},crses:{get:function(){return i.accumulate(this,"_crses",[])}},srses:{get:function(){return i.accumulate(this,"_srses",[])}},geographicBoundingBox:{get:function(){return i.replace(this,"_geographicBoundingBox")}},latLonBoundingBox:{get:function(){return i.replace(this,"_latLonBoundingBox")}},boundingBoxes:{get:function(){return i.replace(this,"_boundingBoxes")}},dimensions:{get:function(){for(var t=[],e=this;e&&e instanceof i;)e._dimensions&&e._dimensions.length>0&&e._dimensions.forEach(function(e){var i=e.name,r=!0;t.forEach(function(t){t.name===i&&(r=!1)}),r&&t.push(e)}),e=e.parent;return t.length>0?t:void 0}},extents:{get:function(){for(var t=[],e=this;e&&e instanceof i;)e._extents&&e._extents.length>0&&e._extents.forEach(function(e){var i=e.name,r=!0;t.forEach(function(t){t.name===i&&(r=!1)}),r&&t.push(e)}),e=e.parent;return t.length>0?t:void 0}},attribution:{get:function(){return i.replace(this,"_attribution")}},authorityUrls:{get:function(){return i.accumulate(this,"_authorityUrls",[])}},minScaleDenominator:{get:function(){return i.replace(this,"_minScaleDenominator")}},maxScaleDenominator:{get:function(){return i.replace(this,"_maxScaleDenominator")}},scaleHint:{get:function(){return i.replace(this,"_scaleHint")}}}),i.prototype.style=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsLayerCapabilities","style","Style name is null or undefined."));var r=this.styles;if(!r)return null;for(var n,o=0,s=r.length;o0?r:null},i.replace=function(t,e){for(;t&&t instanceof i;){var r=t[e];if(r)return r;t=t.parent}},i.prototype.assembleLayer=function(t){var e,r;e=t.getAttribute("queryable"),e&&(this._queryable="1"===e||"true"===e),e=t.getAttribute("opaque"),e&&(this._opaque="1"===e||"true"===e),e=t.getAttribute("noSubsets"),e&&(this._noSubsets="1"===e||"true"===e),e=t.getAttribute("cascaded"),e&&(this._cascaded=parseInt("10")),e=t.getAttribute("fixedWidth"),e&&(this._fixedWidth=parseInt("10")),(e=t.getAttribute("fixedHeight"))&&(this._fixedHeight=parseInt("10"));var n=t.children||t.childNodes;for(r=0;r=0?i.format="image/png":s.indexOf("image/jpeg")>=0?i.format="image/jpeg":s.indexOf("image/tiff")>=0?i.format="image/tiff":s.indexOf("image/gif")>=0&&(i.format="image/gif"),i.service=o.getUrl;var l=t.crses;l||(l=t.srses),l&&(l.indexOf("EPSG:4326")>=0||l.indexOf("epsg:4326")>=0?i.coordinateSystem="EPSG:4326":(l.indexOf("CRS84")>=0||l.indexOf("CRS:84")>=0)&&(i.coordinateSystem="CRS:84"));var h=a.parseTimeDimensions(t);return h&&h.length>0&&(i.timeSequences=h),i},a.parseTimeDimensions=function(t){var e=t.extents||t.dimensions,i=null;if(e){i=[];for(var n=0;nMath.max(e*n,.5)},s.prototype.update=function(t){var e=t.globe.elevationTimestamp(),i=t.verticalExaggeration,r=t.globeStateKey;this.updateTimestamp==e&&this.updateVerticalExaggeration==i&&this.updateGlobeStateKey==r||(this.doUpdate(t),t.frameStatistics.incrementTileUpdateCount(1),this.updateTimestamp=e,this.updateVerticalExaggeration=i,this.updateGlobeStateKey=r)},s.prototype.doUpdate=function(t){var e=t.globe,r=t.verticalExaggeration,s=e.minAndMaxElevationsForSector(this.sector),a=s?s[0]*r:0,l=s?s[1]*r:0;a==l&&(a=l+10),this.extent||(this.extent=new i), this.extent.setToSector(this.sector,e,a,l),this.samplePoints||(this.sampleElevations=new Float64Array(9),this.samplePoints=new Float64Array(3*this.sampleElevations.length)),o.fillArray(this.sampleElevations,.5*(a+l)),e.computePointsForGrid(this.sector,3,3,this.sampleElevations,n.ZERO,this.samplePoints),this.referencePoint||(this.referencePoint=new n(0,0,0)),e.computePointFromPosition(this.sector.centroidLatitude(),this.sector.centroidLongitude(),0,this.referencePoint)},s.prototype.bind=function(t){var e=t.gpuResourceCache.resourceForKey(this.gpuCacheKey);return!(!e||!e.bind(t))||!!this.fallbackTile&&this.fallbackTile.bind(t)},s.prototype.applyInternalTransform=function(t,e){},s}),i("layer/WmtsLayer",["../util/AbsentResourceList","../error/ArgumentError","../util/Logger","../geom/Sector","../layer/Layer","../cache/MemoryCache","../render/Texture","../util/WmsUrlBuilder","../layer/WmtsLayerTile","../util/WWMath","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(s,a){if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No layer configuration specified."));if(n.call(this,"WMTS Layer"),this.layerIdentifier=s.identifier,this.styleIdentifier=s.style,this.timeString=a,this.imageFormat=s.format,this.resourceUrl=s.resourceUrl,this.serviceUrl=s.service,this.tileMatrixSet=s.tileMatrixSet,s.wgs84BoundingBox||s.boundingBox){if(s.wgs84BoundingBox)this.sector=s.wgs84BoundingBox.getSector();else if(this.tileMatrixSet.boundingBox&&c.isEpsg4326Crs(this.tileMatrixSet.boundingBox.crs))this.sector=new r(this.tileMatrixSet.boundingBox.lowerCorner[1],this.tileMatrixSet.boundingBox.upperCorner[1],this.tileMatrixSet.boundingBox.lowerCorner[0],this.tileMatrixSet.boundingBox.upperCorner[0]);else if(c.isEpsg4326Crs(this.tileMatrixSet.supportedCRS))throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No EPSG:4326 bounding box was specified in the layer or tile matrix set capabilities."))}else{if(!this.tileMatrixSet.boundingBox)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No bounding box was specified in the layer or tile matrix set capabilities."));this.sector=new r(s.tileMatrixSet.boundingBox.lowerCorner[1],s.tileMatrixSet.boundingBox.upperCorner[1],s.tileMatrixSet.boundingBox.lowerCorner[0],s.tileMatrixSet.boundingBox.upperCorner[0])}var l,h=s.tileMatrixSet.tileMatrix,u=[],d=[];h.forEach(function(t){u.push(t.matrixWidth),d.push(t.matrixHeight)}),0!==c.checkTileSubdivision(u)?(l=c.checkTileSubdivision(u),i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","Tile subdivision not supported for layer : "+s.identifier+". Display until level "+(l-1)),h.splice(l)):0!==c.checkTileSubdivision(d)&&(l=c.checkTileSubdivision(d),i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","Tile subdivision not supported for layer : "+s.identifier+". Display until level "+(l-1)),h.splice(l)),this.cachePath=(this.resourceUrl||this.serviceUrl)+this.layerIdentifier+this.styleIdentifier+this.tileMatrixSet.identifier,a&&(this.cachePath=this.cachePath+a),this.displayName=s.title,this.currentTiles=[],this.currentTilesInvalid=!0,this.tileCache=new o(500,400),this.currentRetrievals=[],this.absentResourceList=new t(3,5e4),this.pickEnabled=!1,this.detailControl=1.75};return c.checkTileSubdivision=function(t){if(t.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","checkTileSubdivision","Empty dimension array"));for(var r,n=0,o=0;++o=0?s.format="image/png":t.format.indexOf("image/jpeg")>=0?s.format="image/jpeg":t.format.indexOf("image/tiff")>=0?s.format="image/tiff":t.format.indexOf("image/gif")>=0?s.format="image/gif":s.format=t.format[0]),!s.format)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","formLayerConfiguration","Layer does not provide a supported image format."));if(t.resourceUrl&&t.resourceUrl.length>=1){for(var h=0;h0?s.title=t.titles[0].value:s.title=t.identifier,s},c.prototype=Object.create(n.prototype),c.prototype.doRender=function(t){t.terrain&&(!this.currentTilesInvalid&&this.lasTtMVP&&t.navigatorState.modelviewProjection.equals(this.lasTtMVP)&&t.globeStateKey==this.lastGlobeStateKey||(this.currentTilesInvalid=!1,this.assembleTiles(t)),this.lasTtMVP=t.navigatorState.modelviewProjection,this.lastGlobeStateKey=t.globeStateKey,this.currentTiles.length>0&&(t.surfaceTileRenderer.renderTiles(t,this.currentTiles,this.opacity),t.frameStatistics.incrementImageTileCount(this.currentTiles.length),this.inCurrentFrame=!0))},c.prototype.isLayerInView=function(t){return t.terrain&&t.terrain.sector&&t.terrain.sector.intersects(this.sector)},c.prototype.isTileVisible=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&e.extent.intersectsFrustum(t.navigatorState.frustumInModelCoordinates)},c.prototype.assembleTiles=function(t){this.currentTiles=[],this.topLevelTiles&&0!==this.topLevelTiles.length||this.createTopLevelTiles(t);for(var e=0,i=this.topLevelTiles.length;e=e.tileMatrix.matrixWidth&&(e.column=e.column-e.tileMatrix.matrixWidth),e.column<0&&(e.column=e.column+e.tileMatrix.matrixWidth),this.tileMeetsRenderingCriteria(t,e))return void this.addTile(t,e);var i=null;try{(this.isTileTextureInMemory(t,e)||0===e.tileMatrix.levelNumber)&&(i=this.currentAncestorTile,this.currentAncestorTile=e);for(var r=this.tileMatrixSet.tileMatrix[e.tileMatrix.levelNumber+1],n=e.subdivideToCache(r,this,this.tileCache),o=0,s=n.length;o=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.tileMatrix.levelNumber===this.tileMatrixSet.tileMatrix.length-1||!e.mustSubdivide(t,i)},c.prototype.retrieveTileImage=function(t,e){if(this.currentRetrievals.indexOf(e.imagePath)<0){if(this.absentResourceList.isResourceAbsent(e.imagePath))return;var r=this.resourceUrlForTile(e,this.imageFormat),n=new Image,o=e.imagePath,s=t.gpuResourceCache,a=t.currentGlContext.canvas,l=this;if(!r)return void(this.currentTilesInvalid=!0);n.onload=function(){i.log(i.LEVEL_INFO,"Image retrieval succeeded: "+r);var h=l.createTexture(t,e,n);if(l.removeFromCurrentRetrievals(o),h){s.putResource(o,h,h.size),l.currentTilesInvalid=!0,l.absentResourceList.unmarkResourceAbsent(o);var u=document.createEvent("Event");u.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),a.dispatchEvent(u)}},n.onerror=function(){l.removeFromCurrentRetrievals(o),l.absentResourceList.markResourceAbsent(o),i.log(i.LEVEL_WARNING,"Image retrieval failed: "+r)},this.currentRetrievals.push(o),n.crossOrigin="anonymous",n.src=r}},c.prototype.resourceUrlForTile=function(t,e){var i;return this.resourceUrl?(i=this.resourceUrl.replace("{Style}",this.styleIdentifier).replace("{TileMatrixSet}",this.tileMatrixSet.identifier).replace("{TileMatrix}",t.tileMatrix.identifier).replace("{TileCol}",t.column).replace("{TileRow}",t.row),this.timeString&&(i=i.replace("{Time}",this.timeString))):(i=this.serviceUrl+"service=WMTS&request=GetTile&version=1.0.0",i+="&Layer="+this.layerIdentifier,this.styleIdentifier&&(i+="&Style="+this.styleIdentifier),i+="&Format="+e,this.timeString&&(i+="&Time="+this.timeString),i+="&TileMatrixSet="+this.tileMatrixSet.identifier,i+="&TileMatrix="+t.tileMatrix.identifier,i+="&TileRow="+t.row,i+="&TileCol="+t.column),i},c.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},c.prototype.createTopLevelTiles=function(t){var e=this.tileMatrixSet.tileMatrix[0];this.topLevelTiles=[];for(var i=0;i=0&&t.indexOf("4326")>=0},c.isEpsg3857Crs=function(t){return t.indexOf("EPSG")>=0&&(t.indexOf("3857")>=0||t.indexOf("900913")>=0)},c.isOGCCrs84=function(t){return t.indexOf("OGC")>=0&&t.indexOf("CRS84")>=0},c}),i("WorldWindow",["./error/ArgumentError","./render/DrawContext","./globe/EarthElevationModel","./util/FrameStatistics","./globe/Globe","./globe/Globe2D","./util/GoToAnimator","./cache/GpuResourceCache","./util/Logger","./navigate/LookAtNavigator","./navigate/NavigatorState","./pick/PickedObjectList","./geom/Rectangle","./geom/Sector","./shapes/SurfaceShape","./shapes/SurfaceShapeTileBuilder","./globe/Terrain","./geom/Vec2"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,E){"use strict";var y=function(o,a){function u(t){m.handleContextLost(t)}function c(t){m.handleContextRestored(t)}function p(t){m.handleRedrawEvent(t)}if(!window.WebGLRenderingContext)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","constructor","The specified canvas does not support WebGL."));var f=document.getElementById(o);if(!f)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","constructor","The specified canvas name is not in the document."));var g=this.createContext(f);this.drawContext=new e(g),this.eventListeners={},this.redrawRequested=!0,this.redrawRequestId=null,this.canvas=f,this.depthBits=g.getParameter(g.DEPTH_BITS),this.viewport=new d(0,0,g.drawingBufferWidth,g.drawingBufferHeight),this.globe=new n(a||new i),this.layers=[],this.navigator=new h(this),this.verticalExaggeration=1,this.deepPicking=!1,this.subsurfaceMode=!1,this.surfaceOpacity=1,this.frameStatistics=new r,this.goToAnimator=new s(this),this._redrawCallbacks=[],this._orderedRenderingFilters=[function(t){m.declutter(t,1)},function(t){m.declutter(t,2)}],this.pixelScale=1;var m=this;this.canvas.addEventListener("webglcontextlost",u,!1),this.canvas.addEventListener("webglcontextrestored",c,!1),this.canvas.addEventListener(WorldWind.REDRAW_EVENT_TYPE,p,!1),window.addEventListener(WorldWind.REDRAW_EVENT_TYPE,p,!1),this.animationFrameLoop()};return Object.defineProperties(y.prototype,{orderedRenderingFilters:{get:function(){return this._orderedRenderingFilters}},redrawCallbacks:{get:function(){return this._redrawCallbacks}}}),y.prototype.canvasCoordinates=function(t,e){var i=this.canvas.getBoundingClientRect(),r=t-(i.left+this.canvas.clientLeft),n=e-(i.top+this.canvas.clientTop);return new E(r,n)},y.prototype.addEventListener=function(e,i){if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","addEventListener","missingType"));if(!i)throw new t(l.logMessage(l.LEVEL_SEVERE,"WorldWindow","addEventListener","missingListener"));var r=this,n=this.eventListeners[e];n||(n={listeners:[],callback:function(t){t.worldWindow=r;for(var e=0,i=n.listeners.length;e=0&&this.layers.splice(e,1)}},y.prototype.insertLayer=function(t,e){e&&this.layers.splice(t,0,e)},y.prototype.drawSurfaceRenderables=function(){var t,e=this.drawContext;for(e.reverseSurfaceRenderables();t=e.popSurfaceRenderable();)try{t.renderSurface(e)}catch(t){l.logMessage(l.LEVEL_WARNING,"WorldWindow","drawSurfaceRenderables","Error while rendering a surface renderable.\n"+t.message)}},y.prototype.drawOrderedRenderables=function(){var t,e=Date.now(),i=this.drawContext;if(i.sortOrderedRenderables(),this._orderedRenderingFilters)for(var r=0;r