!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ol=e():t.ol=e()}(window,function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=9)}([function(t,e,i){"use strict";t.exports=n,t.exports.default=n;var r=i(5);function n(t,e){if(!(this instanceof n))return new n(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function o(t,e,i){if(!i)return e.indexOf(t);for(var r=0;r=t.minX&&e.maxY>=t.minY}function y(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(t,e,i,n,o){for(var s,a=[e,i];a.length;)(i=a.pop())-(e=a.pop())<=n||(s=e+Math.ceil((i-e)/n/2)*n,r(t,s,e,i,o),a.push(e,s,s,i))}n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],r=this.toBBox;if(!g(t,e))return i;for(var n,o,s,a,h=[];e;){for(n=0,o=e.children.length;n=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(n,o,e)},_split:function(t,e){var i=t[e],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);var o=this._chooseSplitIndex(i,n,r),a=y(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,s(i,this.toBBox),s(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=y([t,e]),this.data.height=t.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var r,n,o,s,h,l,u,c;for(l=u=1/0,r=e;r<=i-e;r++)s=f(n=a(t,0,r,this.toBBox),o=a(t,r,i,this.toBBox)),h=p(n)+p(o),s=e;n--)o=t.children[n],h(u,t.leaf?s(o):o),p+=c(u);return p},_adjustParentBBoxes:function(t,e,i){for(var r=i;r>=0;r--)h(e[r],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():s(t[i],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}},function(t,e,i){"use strict";t.exports=n;var r=i(6);function n(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;function o(t){return t.type===n.Bytes?t.readVarint()+t.pos:t.pos+1}function s(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function a(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function h(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function m(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}n.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,o=this.pos;this.type=7&r,t(n,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=y(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=m(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=y(this.buf,this.pos)+4294967296*y(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=y(this.buf,this.pos)+4294967296*m(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,n,o=i.buf;if(n=o[i.pos++],r=(112&n)>>4,n<128)return s(t,r,e);if(n=o[i.pos++],r|=(127&n)<<3,n<128)return s(t,r,e);if(n=o[i.pos++],r|=(127&n)<<10,n<128)return s(t,r,e);if(n=o[i.pos++],r|=(127&n)<<17,n<128)return s(t,r,e);if(n=o[i.pos++],r|=(127&n)<<24,n<128)return s(t,r,e);if(n=o[i.pos++],r|=(1&n)<<31,n<128)return s(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,i){var r="",n=e;for(;n239?4:h>223?3:h>191?2:1;if(n+u>i)break;1===u?h<128&&(l=h):2===u?128==(192&(o=t[n+1]))&&(l=(31&h)<<6|63&o)<=127&&(l=null):3===u?(o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&((l=(15&h)<<12|(63&o)<<6|63&s)<=2047||l>=55296&&l<=57343)&&(l=null)):4===u&&(o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((l=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,u=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=u}return r}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var i=o(this);for(t=t||[];this.pos127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var i,r;t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var r,n,o=0;o55295&&r<57344){if(!n){r>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):n=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(t[i++]=239,t[i++]=191,t[i++]=189,n=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&a(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),r.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),r.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&a(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,i){this.writeTag(t,n.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){this.writeMessage(t,h,e)},writePackedSVarint:function(t,e){this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){this.writeMessage(t,c,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,p,e)},writePackedFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,f,e)},writePackedFixed64:function(t,e){this.writeMessage(t,_,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,g,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},function(t,e,i){var r=i(7);e.Processor=r},,,function(t,e,i){t.exports=function(){"use strict";function t(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function e(t,e){return te?1:0}return function(i,r,n,o,s){!function e(i,r,n,o,s){for(;o>n;){if(o-n>600){var a=o-n+1,h=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),p=.5*Math.sqrt(l*u*(a-u)/a)*(h-a/2<0?-1:1),c=Math.max(n,Math.floor(r-h*u/a+p)),d=Math.min(o,Math.floor(r+(a-h)*u/a+p));e(i,r,c,d,s)}var f=i[r],_=n,g=o;for(t(i,n,r),s(i[o],f)>0&&t(i,n,o);_0;)g--}0===s(i[n],f)?t(i,n,g):t(i,++g,o),g<=r&&(n=g+1),r<=g&&(o=g-1)}}(i,r,n||0,o||i.length-1,s||e)}}()},function(t,e){e.read=function(t,e,i,r,n){var o,s,a=8*n-r-1,h=(1<>1,u=-7,p=i?n-1:0,c=i?-1:1,d=t[e+p];for(p+=c,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=256*o+t[e+p],p+=c,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+p],p+=c,u-=8);if(0===o)o=1-l;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=l}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,i,r,n,o){var s,a,h,l=8*o-n-1,u=(1<>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,_=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*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+p>=1?c/h:c*Math.pow(2,1-p))*h>=2&&(s++,h/=2),s+p>=u?(a=0,s=u):s+p>=1?(a=(e*h-1)*Math.pow(2,n),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,n),s=0));n>=8;t[i+d]=255&a,d+=f,a/=256,n-=8);for(s=s<0;t[i+d]=255&s,d+=f,s/=256,l-=8);t[i+d-f]|=128*_}},function(t,e,i){var r=i(8).newImageData;function n(t){var e=!0;try{new ImageData(10,10)}catch(t){e=!1}function i(t,i,r){return e?new ImageData(t,i,r):{data:t,width:i,height:r}}return function(e){var r,n,o=e.buffers,s=e.meta,a=e.imageOps,h=e.width,l=e.height,u=o.length,p=o[0].byteLength;if(a){var c=new Array(u);for(n=0;nthis._maxQueueLength;)this._queue.shift().callback(null,null)},s.prototype._dispatch=function(){if(0===this._running&&this._queue.length>0){var t=this._job=this._queue.shift(),e=t.inputs[0].width,i=t.inputs[0].height,r=t.inputs.map(function(t){return t.data.buffer}),n=this._workers.length;if(this._running=n,1===n)this._workers[0].postMessage({buffers:r,meta:t.meta,imageOps:this._imageOps,width:e,height:i},r);else for(var o=t.inputs[0].data.length,s=4*Math.ceil(o/4/n),a=0;a0},e.prototype.removeEventListener=function(t,e){var i=this.listeners_[t];if(i){var r=i.indexOf(e);t in this.pendingRemovals_?(i[r]=I,++this.pendingRemovals_[t]):(i.splice(r,1),0===i.length&&delete this.listeners_[t])}},e}(C),M={CHANGE:"change",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",ERROR:"error",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",MOUSEDOWN:"mousedown",MOUSEMOVE:"mousemove",MOUSEOUT:"mouseout",MOUSEUP:"mouseup",MOUSEWHEEL:"mousewheel",MSPOINTERDOWN:"MSPointerDown",RESIZE:"resize",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend",WHEEL:"wheel"};var F=function(t){function e(){t.call(this),this.revision_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.changed=function(){++this.revision_,this.dispatchEvent(M.CHANGE)},e.prototype.getRevision=function(){return this.revision_},e.prototype.on=function(t,e){if(Array.isArray(t)){for(var i=t.length,r=new Array(i),n=0;n0;)this.pop()},e.prototype.extend=function(t){for(var e=0,i=t.length;ee?1:t=0}function z(t,e,i){var r,n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;if(i>0){for(r=1;r>>0,n=0;nn&&(h|=$.RIGHT),ao&&(h|=$.ABOVE),h===$.UNKNOWN&&(h=$.INTERSECTING),h}function ht(){return[1/0,1/0,-1/0,-1/0]}function lt(t,e,i,r,n){return n?(n[0]=t,n[1]=e,n[2]=i,n[3]=r,n):[t,e,i,r]}function ut(t){return lt(1/0,1/0,-1/0,-1/0,t)}function pt(t,e){var i=t[0],r=t[1];return lt(i,r,i,r,e)}function ct(t,e,i,r,n){return yt(ut(n),t,e,i,r)}function dt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ft(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function _t(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function gt(t,e){for(var i=0,r=e.length;ie[0]?r[0]=t[0]:r[0]=e[0],t[1]>e[1]?r[1]=t[1]:r[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function bt(t){return t[2]1?(i=n,r=o):h>0&&(i+=s*h,r+=a*h)}return Yt(t,e,i,r)}function Yt(t,e,i,r){var n=i-t,o=r-e;return n*n+o*o}function Bt(t){return 180*t/Math.PI}function Vt(t){return t*Math.PI/180}function Xt(t,e){var i=t%e;return i*e<0?i+e:i}function zt(t,e,i){return t+i*(e-t)} /** * @license * Latitude/longitude spherical geodesy formulae taken from * http://www.movable-type.co.uk/scripts/latlong.html * Licensed under CC-BY-3.0. */var Wt=6371008.8;function Kt(t,e,i){var r=i||Wt,n=Vt(t[1]),o=Vt(e[1]),s=(o-n)/2,a=Vt(e[0]-t[0])/2,h=Math.sin(s)*Math.sin(s)+Math.sin(a)*Math.sin(a)*Math.cos(n)*Math.cos(o);return 2*r*Math.atan2(Math.sqrt(h),Math.sqrt(1-h))}function Ht(t,e){for(var i=0,r=0,n=t.length;r1?i:2,o=e;void 0===o&&(o=n>2?t.slice():new Array(r));for(var s=re,a=0;as?h=s:h<-s&&(h=-s),o[a+1]=h}return o}function le(t,e,i){var r=t.length,n=i>1?i:2,o=e;void 0===o&&(o=n>2?t.slice():new Array(r));for(var s=0;s=2;--l)s[a+l]=e[a+l]}return s}}function we(t,e,i,r){var n=Ee(t),o=Ee(e);ge(n,o,Re(i)),ge(o,n,Re(r))}function Ie(t,e){if(t===e)return!0;var i=t.getUnits()===e.getUnits();return t.getCode()===e.getCode()?i:Le(t,e)===ve&&i}function Le(t,e){var i=ye(t.getCode(),e.getCode());return i||(i=me),i}function Oe(t,e){return Le(Ee(t),Ee(e))}function Pe(t,e,i){return Oe(e,i)(t,void 0,t.length)}function be(t,e,i){return Ft(t,Oe(e,i))}Te(ae),Te(de),function(t,e,i,r){t.forEach(function(t){e.forEach(function(e){ge(t,e,i),ge(e,t,r)})})}(de,ae,he,le);var Me=new Array(6);function Fe(t){return Ne(t,1,0,0,1,0,0)}function Ae(t,e){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],h=e[0],l=e[1],u=e[2],p=e[3],c=e[4],d=e[5];return t[0]=i*h+n*l,t[1]=r*h+o*l,t[2]=i*u+n*p,t[3]=r*u+o*p,t[4]=i*c+n*d+s,t[5]=r*c+o*d+a,t}function Ne(t,e,i,r,n,o,s){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t[4]=o,t[5]=s,t}function Ge(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function De(t,e){var i=e[0],r=e[1];return e[0]=t[0]*i+t[2]*r+t[4],e[1]=t[1]*i+t[3]*r+t[5],e}function ke(t,e){var i=Math.cos(e),r=Math.sin(e);return Ae(t,Ne(Me,i,r,-r,i,0,0))}function je(t,e,i){return Ae(t,Ne(Me,e,0,0,i,0,0))}function Ue(t,e,i){return Ae(t,Ne(Me,1,0,0,1,e,i))}function Ye(t,e,i,r,n,o,s,a){var h=Math.sin(o),l=Math.cos(o);return t[0]=r*l,t[1]=n*h,t[2]=-r*h,t[3]=n*l,t[4]=s*r*l-a*r*h+e,t[5]=s*n*h+a*n*l+i,t}function Be(t){var e=function(t){return t[0]*t[3]-t[1]*t[2]}(t);Y(0!==e,32);var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5];return t[0]=o/e,t[1]=-r/e,t[2]=-n/e,t[3]=i/e,t[4]=(n*a-o*s)/e,t[5]=-(i*a-r*s)/e,t}var Ve=[1,0,0,1,0,0],Xe=function(t){function e(){t.call(this),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryCache={},this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return r()},e.prototype.closestPointXY=function(t,e,i,n){return r()},e.prototype.containsXY=function(t,e){return!1},e.prototype.getClosestPoint=function(t,e){var i=e||[NaN,NaN];return this.closestPointXY(t[0],t[1],i,1/0),i},e.prototype.intersectsCoordinate=function(t){return this.containsXY(t[0],t[1])},e.prototype.computeExtent=function(t){return r()},e.prototype.getExtent=function(t){return this.extentRevision_!=this.getRevision()&&(this.extent_=this.computeExtent(this.extent_),this.extentRevision_=this.getRevision()),function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)},e.prototype.rotate=function(t,e){r()},e.prototype.scale=function(t,e,i){r()},e.prototype.simplify=function(t){return this.getSimplifiedGeometry(t*t)},e.prototype.getSimplifiedGeometry=function(t){return r()},e.prototype.getType=function(){return r()},e.prototype.applyTransform=function(t){r()},e.prototype.intersectsExtent=function(t){return r()},e.prototype.translate=function(t,e){r()},e.prototype.transform=function(t,e){var i=Ee(t),r=i.getUnits()==$t.TILE_PIXELS?function(t,r,n){var o=i.getExtent(),s=i.getWorldExtent(),a=Rt(s)/Rt(o);return Ye(Ve,s[0],s[3],a,-a,0,0,0),Gt(t,0,t.length,n,Ve,r),Oe(i,e)(t,r,n)}:Oe(i,e);return this.applyTransform(r),this},e}(D);function ze(t){var e;return t==At.XY?e=2:t==At.XYZ||t==At.XYM?e=3:t==At.XYZM&&(e=4),e}var We=function(t){function e(){t.call(this),this.layout=At.XY,this.stride=2,this.flatCoordinates=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeExtent=function(t){return ct(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)},e.prototype.getCoordinates=function(){return r()},e.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},e.prototype.getFlatCoordinates=function(){return this.flatCoordinates},e.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},e.prototype.getLayout=function(){return this.layout},e.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!=this.getRevision()&&(p(this.simplifiedGeometryCache),this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var e=t.toString();if(this.simplifiedGeometryCache.hasOwnProperty(e))return this.simplifiedGeometryCache[e];var i=this.getSimplifiedGeometryInternal(t);return i.getFlatCoordinates().length1)a=i;else{if(c>0){for(var d=0;dn&&(n=l),o=a,s=h}return n}function Je(t,e,i,r,n){for(var o=0,s=i.length;o0;){for(var p=l.pop(),c=l.pop(),d=0,f=t[c],_=t[c+1],g=t[p],y=t[p+1],v=c+r;vd&&(u=v,d=m)}d>n&&(h[(u-e)/r]=1,c+r0&&_>d)&&(f<0&&g0&&g>f)?(a=p,h=c):(o[s++]=a,o[s++]=h,l=a,u=h,a=p,h=c)}}return o[s++]=a,o[s++]=h,s}function ui(t,e,i,r,n,o,s,a){for(var h=0,l=i.length;ho&&(l-a)*(o-h)-(n-a)*(u-h)>0&&s++:u<=o&&(l-a)*(o-h)-(n-a)*(u-h)<0&&s--,a=l,h=u}return 0!==s}function _i(t,e,i,r,n,o){if(0===i.length)return!1;if(!fi(t,e,i[0],r,n,o))return!1;for(var s=1,a=i.length;sx&&_i(t,e,i,r,l=(u+p)/2,f)&&(m=l,x=E),u=p}return isNaN(m)&&(m=n[o]),s?(s.push(m,f,x),s):[m,f,x]}function yi(t,e,i,r,n){for(var o=[],s=0,a=i.length;s=n[0]&&o[2]<=n[2]||(o[1]>=n[1]&&o[3]<=n[3]||vi(t,e,i,r,function(t,e){return function(t,e,i){var r=!1,n=at(t,e),o=at(t,i);if(n===$.INTERSECTING||o===$.INTERSECTING)r=!0;else{var s,a,h=t[0],l=t[1],u=t[2],p=t[3],c=e[0],d=e[1],f=i[0],_=i[1],g=(_-d)/(f-c);o&$.ABOVE&&!(n&$.ABOVE)&&(r=(s=f-(_-p)/g)>=h&&s<=u),r||!(o&$.RIGHT)||n&$.RIGHT||(r=(a=_-(f-u)*g)>=l&&a<=p),r||!(o&$.BELOW)||n&$.BELOW||(r=(s=f-(_-l)/g)>=h&&s<=u),r||!(o&$.LEFT)||n&$.LEFT||(r=(a=_-(f-h)*g)>=l&&a<=p)}return r}(n,t,e)}))))}function xi(t,e,i,r,n){if(!function(t,e,i,r,n){return!!(mi(t,e,i,r,n)||fi(t,e,i,r,n[0],n[1])||fi(t,e,i,r,n[0],n[3])||fi(t,e,i,r,n[2],n[1])||fi(t,e,i,r,n[2],n[3]))}(t,e,i[0],r,n))return!1;if(1===i.length)return!0;for(var o=1,s=i.length;o0}function Ti(t,e,i,r,n){for(var o=void 0!==n&&n,s=0,a=i.length;se?r:new Array(1+e-n).join("0")+r}function Ki(t,e){for(var i=(""+t).split("."),r=(""+e).split("."),n=0;ns)return 1;if(s>o)return-1}return 0}function Hi(t,e){return t[0]+=e[0],t[1]+=e[1],t}function Zi(t,e){var i,r,n=t[0],o=t[1],s=e[0],a=e[1],h=s[0],l=s[1],u=a[0],p=a[1],c=u-h,d=p-l,f=0===c&&0===d?0:(c*(n-h)+d*(o-l))/(c*c+d*d||0);return f<=0?(i=h,r=l):f>=1?(i=u,r=p):(i=h+f*c,r=l+f*d),[i,r]}function qi(t,e,i){var r=Xt(e+180,360)-180,n=Math.abs(3600*r),o=i||0,s=Math.pow(10,o),a=Math.floor(n/3600),h=Math.floor((n-3600*a)/60),l=n-3600*a-60*h;return(l=Math.ceil(l*s)/s)>=60&&(l=0,h+=1),h>=60&&(h=0,a+=1),a+"° "+Wi(h,2)+"′ "+Wi(l,2,o)+"″"+(0==r?"":" "+t.charAt(r<0?1:0))}function Ji(t,e,i){return t?e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i)):""}function Qi(t,e){for(var i=!0,r=t.length-1;r>=0;--r)if(t[r]!=e[r]){i=!1;break}return i}function $i(t,e){var i=Math.cos(e),r=Math.sin(e),n=t[0]*i-t[1]*r,o=t[1]*i+t[0]*r;return t[0]=n,t[1]=o,t}function tr(t,e){return t[0]*=e,t[1]*=e,t}function er(t,e){var i=t[0]-e[0],r=t[1]-e[1];return i*i+r*r}function ir(t,e){return Math.sqrt(er(t,e))}function rr(t,e){return er(t,Zi(t,e))}function nr(t,e){return Ji(t,"{x}, {y}",e)}function or(t,e,i,r,n,o){var s=NaN,a=NaN,h=(i-e)/r;if(1===h)s=t[e],a=t[e+1];else if(2==h)s=(1-n)*t[e]+n*t[e+r],a=(1-n)*t[e+1]+n*t[e+r+1];else if(0!==h){for(var l=t[e],u=t[e+1],p=0,c=[0],d=e+r;d>1)],e))<0?s=r+1:(a=r,h=!n);return h?s:~s}(c,g);if(y<0){var v=(g-c[-y-2])/(c[-y-1]-c[-y-2]),m=e+(-y-2)*r;s=zt(t[m],t[m+r],v),a=zt(t[m+1],t[m+r+1],v)}else s=t[e+y*r],a=t[e+y*r+1]}return o?(o[0]=s,o[1]=a,o):[s,a]}function sr(t,e,i,r,n,o){if(i==e)return null;var s;if(n>1;n0&&g.length>0;)o=g.pop(),u=f.pop(),c=_.pop(),(h=o.toString())in y||(l.push(c[0],c[1]),y[h]=!0),s=g.pop(),p=f.pop(),d=_.pop(),Ut((n=e(r=t(a=(o+s)/2)))[0],n[1],c[0],c[1],d[0],d[1])=1024){var n=0;for(var o in t)0==(3&n++)&&(delete t[o],--e)}r=function(t){var e,i,r,n,o;cr.exec(t)&&(t=function(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var i=getComputedStyle(e).color;return document.body.removeChild(e),i}return""}(t));if(pr.exec(t)){var s,a=t.length-1;s=a<=4?1:2;var h=4===a||8===a;e=parseInt(t.substr(1+0*s,s),16),i=parseInt(t.substr(1+1*s,s),16),r=parseInt(t.substr(1+2*s,s),16),n=h?parseInt(t.substr(1+3*s,s),16):255,1==s&&(e=(e<<4)+e,i=(i<<4)+i,r=(r<<4)+r,h&&(n=(n<<4)+n)),o=[e,i,r,n/255]}else 0==t.indexOf("rgba(")?gr(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),gr(o)):Y(!1,14);return o}(i),t[i]=r,++e}return r}}();function _r(t){return Array.isArray(t)?t:fr(t)}function gr(t){return t[0]=kt(t[0]+.5|0,0,255),t[1]=kt(t[1]+.5|0,0,255),t[2]=kt(t[2]+.5|0,0,255),t[3]=kt(t[3],0,1),t}function yr(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var i=t[1];i!=(0|i)&&(i=i+.5|0);var r=t[2];return r!=(0|r)&&(r=r+.5|0),"rgba("+e+","+i+","+r+","+(void 0===t[3]?1:t[3])+")"}var vr=function(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.checksum_=void 0};vr.prototype.clone=function(){var t=this.getColor();return new vr({color:Array.isArray(t)?t.slice():t||void 0})},vr.prototype.getColor=function(){return this.color_},vr.prototype.setColor=function(t){this.color_=t,this.checksum_=void 0},vr.prototype.getChecksum=function(){if(void 0===this.checksum_){var t=this.color_;t?Array.isArray(t)||"string"==typeof t?this.checksum_="f"+dr(t):this.checksum_=o(this.color_):this.checksum_="f-"}return this.checksum_};var mr=vr,xr=function(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width,this.checksum_=void 0};xr.prototype.clone=function(){var t=this.getColor();return new xr({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},xr.prototype.getColor=function(){return this.color_},xr.prototype.getLineCap=function(){return this.lineCap_},xr.prototype.getLineDash=function(){return this.lineDash_},xr.prototype.getLineDashOffset=function(){return this.lineDashOffset_},xr.prototype.getLineJoin=function(){return this.lineJoin_},xr.prototype.getMiterLimit=function(){return this.miterLimit_},xr.prototype.getWidth=function(){return this.width_},xr.prototype.setColor=function(t){this.color_=t,this.checksum_=void 0},xr.prototype.setLineCap=function(t){this.lineCap_=t,this.checksum_=void 0},xr.prototype.setLineDash=function(t){this.lineDash_=t,this.checksum_=void 0},xr.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t,this.checksum_=void 0},xr.prototype.setLineJoin=function(t){this.lineJoin_=t,this.checksum_=void 0},xr.prototype.setMiterLimit=function(t){this.miterLimit_=t,this.checksum_=void 0},xr.prototype.setWidth=function(t){this.width_=t,this.checksum_=void 0},xr.prototype.getChecksum=function(){return void 0===this.checksum_&&(this.checksum_="s",this.color_?"string"==typeof this.color_?this.checksum_+=this.color_:this.checksum_+=o(this.color_):this.checksum_+="-",this.checksum_+=","+(void 0!==this.lineCap_?this.lineCap_.toString():"-")+","+(this.lineDash_?this.lineDash_.toString():"-")+","+(void 0!==this.lineDashOffset_?this.lineDashOffset_:"-")+","+(void 0!==this.lineJoin_?this.lineJoin_:"-")+","+(void 0!==this.miterLimit_?this.miterLimit_.toString():"-")+","+(void 0!==this.width_?this.width_.toString():"-")),this.checksum_};var Er=xr,Sr="point",Tr="line",Cr=function(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new mr({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:Sr,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding};Cr.prototype.clone=function(){return new Cr({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:this.getScale(),text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0})},Cr.prototype.getOverflow=function(){return this.overflow_},Cr.prototype.getFont=function(){return this.font_},Cr.prototype.getMaxAngle=function(){return this.maxAngle_},Cr.prototype.getPlacement=function(){return this.placement_},Cr.prototype.getOffsetX=function(){return this.offsetX_},Cr.prototype.getOffsetY=function(){return this.offsetY_},Cr.prototype.getFill=function(){return this.fill_},Cr.prototype.getRotateWithView=function(){return this.rotateWithView_},Cr.prototype.getRotation=function(){return this.rotation_},Cr.prototype.getScale=function(){return this.scale_},Cr.prototype.getStroke=function(){return this.stroke_},Cr.prototype.getText=function(){return this.text_},Cr.prototype.getTextAlign=function(){return this.textAlign_},Cr.prototype.getTextBaseline=function(){return this.textBaseline_},Cr.prototype.getBackgroundFill=function(){return this.backgroundFill_},Cr.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},Cr.prototype.getPadding=function(){return this.padding_},Cr.prototype.setOverflow=function(t){this.overflow_=t},Cr.prototype.setFont=function(t){this.font_=t},Cr.prototype.setMaxAngle=function(t){this.maxAngle_=t},Cr.prototype.setOffsetX=function(t){this.offsetX_=t},Cr.prototype.setOffsetY=function(t){this.offsetY_=t},Cr.prototype.setPlacement=function(t){this.placement_=t},Cr.prototype.setFill=function(t){this.fill_=t},Cr.prototype.setRotation=function(t){this.rotation_=t},Cr.prototype.setScale=function(t){this.scale_=t},Cr.prototype.setStroke=function(t){this.stroke_=t},Cr.prototype.setText=function(t){this.text_=t},Cr.prototype.setTextAlign=function(t){this.textAlign_=t},Cr.prototype.setTextBaseline=function(t){this.textBaseline_=t},Cr.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},Cr.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},Cr.prototype.setPadding=function(t){this.padding_=t};var Rr=Cr,wr=new Er({color:"rgba(0,0,0,0.2)"}),Ir=[90,45,30,20,10,5,2,1,.5,.2,.1,.05,.01,.005,.002,.001],Lr=function(t){var e=t||{};this.map_=null,this.postcomposeListenerKey_=null,this.projection_=null,this.maxLat_=1/0,this.maxLon_=1/0,this.minLat_=-1/0,this.minLon_=-1/0,this.maxLatP_=1/0,this.maxLonP_=1/0,this.minLatP_=-1/0,this.minLonP_=-1/0,this.targetSize_=void 0!==e.targetSize?e.targetSize:100,this.maxLines_=void 0!==e.maxLines?e.maxLines:100,this.meridians_=[],this.parallels_=[],this.strokeStyle_=void 0!==e.strokeStyle?e.strokeStyle:wr,this.fromLonLatTransform_=void 0,this.toLonLatTransform_=void 0,this.projectionCenterLonLat_=null,this.meridiansLabels_=null,this.parallelsLabels_=null,1==e.showLabels&&(this.lonLabelFormatter_=void 0==e.lonLabelFormatter?qi.bind(this,"EW"):e.lonLabelFormatter,this.latLabelFormatter_=void 0==e.latLabelFormatter?qi.bind(this,"NS"):e.latLabelFormatter,this.lonLabelPosition_=void 0==e.lonLabelPosition?0:e.lonLabelPosition,this.latLabelPosition_=void 0==e.latLabelPosition?1:e.latLabelPosition,this.lonLabelStyle_=void 0!==e.lonLabelStyle?e.lonLabelStyle:new Rr({font:"12px Calibri,sans-serif",textBaseline:"bottom",fill:new mr({color:"rgba(0,0,0,1)"}),stroke:new Er({color:"rgba(255,255,255,1)",width:3})}),this.latLabelStyle_=void 0!==e.latLabelStyle?e.latLabelStyle:new Rr({font:"12px Calibri,sans-serif",textAlign:"end",fill:new mr({color:"rgba(0,0,0,1)"}),stroke:new Er({color:"rgba(255,255,255,1)",width:3})}),this.meridiansLabels_=[],this.parallelsLabels_=[]),this.intervals_=void 0!==e.intervals?e.intervals:Ir,this.setMap(void 0!==e.map?e.map:null)};Lr.prototype.addMeridian_=function(t,e,i,r,n,o){var s=this.getMeridian_(t,e,i,r,o);if(Pt(s.getExtent(),n)){if(this.meridiansLabels_){var a=this.getMeridianPoint_(s,n,o);this.meridiansLabels_[o]={geom:a,text:this.lonLabelFormatter_(t)}}this.meridians_[o++]=s}return o},Lr.prototype.getMeridianPoint_=function(t,e,i){var r,n=t.getFlatCoordinates(),o=Math.max(e[1],n[1]),s=Math.min(e[3],n[n.length-1]),a=kt(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,o,s),h=[n[0],a];return i in this.meridiansLabels_?(r=this.meridiansLabels_[i].geom).setCoordinates(h):r=new ci(h),r},Lr.prototype.addParallel_=function(t,e,i,r,n,o){var s=this.getParallel_(t,e,i,r,o);if(Pt(s.getExtent(),n)){if(this.parallelsLabels_){var a=this.getParallelPoint_(s,n,o);this.parallelsLabels_[o]={geom:a,text:this.latLabelFormatter_(t)}}this.parallels_[o++]=s}return o},Lr.prototype.getParallelPoint_=function(t,e,i){var r,n=t.getFlatCoordinates(),o=Math.max(e[0],n[0]),s=Math.min(e[2],n[n.length-2]),a=[kt(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,o,s),n[1]];return i in this.parallelsLabels_?(r=this.parallelsLabels_[i].geom).setCoordinates(a):r=new ci(a),r},Lr.prototype.createGraticule_=function(t,e,i,r){var n=this.getInterval_(i);if(-1==n)return this.meridians_.length=this.parallels_.length=0,this.meridiansLabels_&&(this.meridiansLabels_.length=0),void(this.parallelsLabels_&&(this.parallelsLabels_.length=0));var o,s,a,h,l=this.toLonLatTransform_(e),u=l[0],p=l[1],c=this.maxLines_,d=[Math.max(t[0],this.minLonP_),Math.max(t[1],this.minLatP_),Math.min(t[2],this.maxLonP_),Math.min(t[3],this.maxLatP_)],f=(d=be(d,this.projection_,"EPSG:4326"))[3],_=d[2],g=d[1],y=d[0];for(h=kt(u=Math.floor(u/n)*n,this.minLon_,this.maxLon_),s=this.addMeridian_(h,g,f,r,t,0),o=0;h!=this.minLon_&&o++0&&this.points_[i+2]>t;)i-=3;var r=this.points_[e+2]-this.points_[i+2];if(r<1e3/60)return!1;var n=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,n),this.initialVelocity_=Math.sqrt(n*n+o*o)/r,this.initialVelocity_>this.minVelocity_},Pr.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},Pr.prototype.getAngle=function(){return this.angle_};var br=Pr,Mr=function(t){function e(e,i,r){t.call(this,e),this.map=i,this.frameState=void 0!==r?r:null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),Fr=function(t){function e(e,i,r,n,o){t.call(this,e,i,o),this.originalEvent=r,this.pixel=i.getEventPixel(r),this.coordinate=i.getCoordinateFromPixel(this.pixel),this.dragging=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.preventDefault=function(){t.prototype.preventDefault.call(this),this.originalEvent.preventDefault()},e.prototype.stopPropagation=function(){t.prototype.stopPropagation.call(this),this.originalEvent.stopPropagation()},e}(Mr),Ar={SINGLECLICK:"singleclick",CLICK:M.CLICK,DBLCLICK:M.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Nr=function(t){function e(e,i,r,n,o){t.call(this,e,i,r.originalEvent,n,o),this.pointerEvent=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Fr),Gr={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Dr=function(t,e){this.dispatcher=t,this.mapping_=e};Dr.prototype.getEvents=function(){return Object.keys(this.mapping_)},Dr.prototype.getHandlerForEvent=function(t){return this.mapping_[t]};var kr=Dr,jr=1,Ur="mouse";function Yr(t){if(!this.isEventSimulatedFromTouch_(t)){jr.toString()in this.pointerMap&&this.cancel(t);var e=Wr(t,this.dispatcher);this.pointerMap[jr.toString()]=t,this.dispatcher.down(e,t)}}function Br(t){if(!this.isEventSimulatedFromTouch_(t)){var e=Wr(t,this.dispatcher);this.dispatcher.move(e,t)}}function Vr(t){if(!this.isEventSimulatedFromTouch_(t)){var e=this.pointerMap[jr.toString()];if(e&&e.button===t.button){var i=Wr(t,this.dispatcher);this.dispatcher.up(i,t),this.cleanupMouse()}}}function Xr(t){if(!this.isEventSimulatedFromTouch_(t)){var e=Wr(t,this.dispatcher);this.dispatcher.enterOver(e,t)}}function zr(t){if(!this.isEventSimulatedFromTouch_(t)){var e=Wr(t,this.dispatcher);this.dispatcher.leaveOut(e,t)}}function Wr(t,e){var i=e.cloneEvent(t,t),r=i.preventDefault;return i.preventDefault=function(){t.preventDefault(),r()},i.pointerId=jr,i.isPrimary=!0,i.pointerType=Ur,i}var Kr=function(t){function e(e){var i={mousedown:Yr,mousemove:Br,mouseup:Vr,mouseover:Xr,mouseout:zr};t.call(this,e,i),this.pointerMap=e.pointerMap,this.lastTouches=[]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isEventSimulatedFromTouch_=function(t){for(var e=this.lastTouches,i=t.clientX,r=t.clientY,n=0,o=e.length,s=void 0;n=e.length){for(var n=[],o=0;o-1;r&&t.splice(i,1)}(e,r)},this.dedupTimeout_)}},e}(kr),Sn=[["bubbles",!1],["cancelable",!1],["view",null],["detail",null],["screenX",0],["screenY",0],["clientX",0],["clientY",0],["ctrlKey",!1],["altKey",!1],["shiftKey",!1],["metaKey",!1],["button",0],["relatedTarget",null],["buttons",0],["pointerId",0],["width",0],["height",0],["pressure",0],["tiltX",0],["tiltY",0],["pointerType",""],["hwTimestamp",0],["isPrimary",!1],["type",""],["target",null],["currentTarget",null],["which",0]],Tn=function(t){function e(e){t.call(this),this.element_=e,this.pointerMap={},this.eventMap_={},this.eventSourceList_=[],this.registerSources()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.registerSources=function(){if(Yi)this.registerSource("native",new dn(this));else if(Bi)this.registerSource("ms",new nn(this));else{var t=new Kr(this);this.registerSource("mouse",t),Ui&&this.registerSource("touch",new En(this,t))}this.register_()},e.prototype.registerSource=function(t,e){var i=e,r=i.getEvents();r&&(r.forEach(function(t){var e=i.getHandlerForEvent(t);e&&(this.eventMap_[t]=e.bind(i))}.bind(this)),this.eventSourceList_.push(i))},e.prototype.register_=function(){for(var t=this.eventSourceList_.length,e=0;ethis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(E(this.relayedListenerKey_),this.relayedListenerKey_=null),this.pointerdownListenerKey_&&(E(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(E),this.dragListenerKeys_.length=0,this.documentPointerEventHandler_&&(this.documentPointerEventHandler_.dispose(),this.documentPointerEventHandler_=null),this.pointerEventHandler_&&(this.pointerEventHandler_.dispose(),this.pointerEventHandler_=null),t.prototype.disposeInternal.call(this)},e}(b),Rn="postrender",wn="movestart",In="moveend",Ln={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},On={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4,ABORT:5},Pn=function(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}};Pn.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,p(this.queuedElements_)},Pn.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var r=this.keyFunction_(i);return delete this.queuedElements_[r],i},Pn.prototype.enqueue=function(t){Y(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},Pn.prototype.getCount=function(){return this.elements_.length},Pn.prototype.getLeftChildIndex_=function(t){return 2*t+1},Pn.prototype.getRightChildIndex_=function(t){return 2*t+2},Pn.prototype.getParentIndex_=function(t){return t-1>>1},Pn.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},Pn.prototype.isEmpty=function(){return 0===this.elements_.length},Pn.prototype.isKeyQueued=function(t){return t in this.queuedElements_},Pn.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},Pn.prototype.siftUp_=function(t){for(var e=this.elements_,i=this.priorities_,r=e.length,n=e[t],o=i[t],s=t;t>1;){var a=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),l=ht;){var s=this.getParentIndex_(e);if(!(r[s]>o))break;i[e]=i[s],r[e]=r[s],e=s}i[e]=n,r[e]=o},Pn.prototype.reprioritize=function(){var t,e,i,r=this.priorityFunction_,n=this.elements_,o=this.priorities_,s=0,a=n.length;for(e=0;e0;)n=(r=this.dequeue()[0]).getKey(),(i=r.getState())===On.ABORT?s=!0:i!==On.IDLE||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++o,r.load());0===o&&s&&this.tileChangeCallback_()},e}(bn),Fn=42,An=256;function Nn(t){return t}function Gn(t,e){return void 0!==t?0:void 0}function Dn(t,e){return void 0!==t?t+e:void 0}var kn=0,jn=1,Un="center",Yn="resolution",Bn="rotation";function Vn(t){return Math.pow(t,3)}function Xn(t){return 1-Vn(1-t)}function zn(t){return 3*t*t-2*t*t*t}function Wn(t){return t}var Kn=0;function Hn(t,e){setTimeout(function(){t(e)},0)}function Zn(t){return!(t.sourceCenter&&t.targetCenter&&!Qi(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}var qn=function(t){function e(e){t.call(this);var i=u({},e);this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.updateAnimations_=this.updateAnimations_.bind(this),this.projection_=Ce(i.projection,"EPSG:3857"),this.applyOptions_(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.applyOptions_=function(t){var e={};e[Un]=void 0!==t.center?t.center:null;var i=function(t){var e,i,r,n=void 0!==t.minZoom?t.minZoom:Kn,o=void 0!==t.maxZoom?t.maxZoom:28,s=void 0!==t.zoomFactor?t.zoomFactor:2;if(void 0!==t.resolutions){var a=t.resolutions;i=a[n],r=void 0!==a[o]?a[o]:a[a.length-1],e=function(t){return function(e,i,r){if(void 0!==e){var n=z(t,e,r);n=kt(n+i,0,t.length-1);var o=Math.floor(n);if(n!=o&&o1&&"function"==typeof arguments[r-1]&&(e=arguments[r-1],--r),!this.isDef()){var n=arguments[r-1];return n.center&&this.setCenter(n.center),void 0!==n.zoom&&this.setZoom(n.zoom),void 0!==n.rotation&&this.setRotation(n.rotation),void(e&&Hn(e,!0))}for(var o=Date.now(),s=this.getCenter().slice(),a=this.getResolution(),h=this.getRotation(),l=[],u=0;u0},e.prototype.getInteracting=function(){return this.hints_[jn]>0},e.prototype.cancelAnimations=function(){this.setHint(kn,-this.hints_[kn]);for(var t=0,e=this.animations_.length;t=0;--i){for(var r=this.animations_[i],n=!0,o=0,s=r.length;o0?h/a.duration:1;l>=1?(a.complete=!0,l=1):n=!1;var u=a.easing(l);if(a.sourceCenter){var p=a.sourceCenter[0],c=a.sourceCenter[1],d=p+u*(a.targetCenter[0]-p),f=c+u*(a.targetCenter[1]-c);this.set(Un,[d,f])}if(a.sourceResolution&&a.targetResolution){var _=1===u?a.targetResolution:a.sourceResolution+u*(a.targetResolution-a.sourceResolution);a.anchor&&this.set(Un,this.calculateCenterZoom(_,a.anchor)),this.set(Yn,_)}if(void 0!==a.sourceRotation&&void 0!==a.targetRotation){var g=1===u?Xt(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+u*(a.targetRotation-a.sourceRotation);a.anchor&&this.set(Un,this.calculateCenterRotate(g,a.anchor)),this.set(Bn,g)}if(e=!0,!a.complete)break}}if(n){this.animations_[i]=null,this.setHint(kn,-1);var y=r[0].callback;y&&Hn(y,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_))}},e.prototype.calculateCenterRotate=function(t,e){var i,r=this.getCenter();return void 0!==r&&($i(i=[r[0]-e[0],r[1]-e[1]],t-this.getRotation()),Hi(i,e)),i},e.prototype.calculateCenterZoom=function(t,e){var i,r=this.getCenter(),n=this.getResolution();void 0!==r&&void 0!==n&&(i=[e[0]-t*(e[0]-r[0])/n,e[1]-t*(e[1]-r[1])/n]);return i},e.prototype.getSizeFromViewport_=function(){var t=[100,100],e='.ol-viewport[data-view="'+o(this)+'"]',i=document.querySelector(e);if(i){var r=getComputedStyle(i);t[0]=parseInt(r.width,10),t[1]=parseInt(r.height,10)}return t},e.prototype.constrainCenter=function(t){return this.constraints_.center(t)},e.prototype.constrainResolution=function(t,e,i){var r=e||0,n=i||0;return this.constraints_.resolution(t,r,n)},e.prototype.constrainRotation=function(t,e){var i=e||0;return this.constraints_.rotation(t,i)},e.prototype.getCenter=function(){return this.get(Un)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){var e=t||this.getSizeFromViewport_(),i=this.getCenter();Y(i,1);var r=this.getResolution();Y(void 0!==r,2);var n=this.getRotation();return Y(void 0!==n,3),Ct(i,r,n,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(Yn)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){var i=e||this.getSizeFromViewport_(),r=Ot(t)/i[0],n=Rt(t)/i[1];return Math.max(r,n)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,i=this.maxResolution_,r=this.minResolution_,n=Math.log(i/r)/Math.log(e);return function(t){return i/Math.pow(e,t*n)}},e.prototype.getRotation=function(){return this.get(Bn)},e.prototype.getValueForResolutionFunction=function(t){var e=t||2,i=this.maxResolution_,r=this.minResolution_,n=Math.log(i/r)/Math.log(e);return function(t){return Math.log(i/t)/Math.log(e)/n}},e.prototype.getState=function(t){var e=this.getCenter(),i=this.getProjection(),r=this.getResolution(),n=r/t,o=this.getRotation();return{center:[Math.round(e[0]/n)*n,Math.round(e[1]/n)*n],projection:void 0!==i?i:null,resolution:r,rotation:o,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,i,r=this.minZoom_||0;if(this.resolutions_){var n=z(this.resolutions_,t,1);r=n,e=this.resolutions_[n],i=n==this.resolutions_.length-1?2:e/this.resolutions_[n+1]}else e=this.maxResolution_,i=this.zoomFactor_;return r+Math.log(e/t)/Math.log(i)},e.prototype.getResolutionForZoom=function(t){return this.constrainResolution(this.maxResolution_,t-this.minZoom_,0)},e.prototype.fit=function(t,e){var i,r=e||{},n=r.size;n||(n=this.getSizeFromViewport_()),Y(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t)?(Y(!bt(t),25),i=Oi(t)):t.getType()===Nt.CIRCLE?(i=Oi(t=t.getExtent())).rotate(this.getRotation(),Tt(t)):i=t;var o,s=void 0!==r.padding?r.padding:[0,0,0,0],a=void 0===r.constrainResolution||r.constrainResolution,h=void 0!==r.nearest&&r.nearest;o=void 0!==r.minResolution?r.minResolution:void 0!==r.maxZoom?this.constrainResolution(this.maxResolution_,r.maxZoom-this.minZoom_,0):0;for(var l=i.getFlatCoordinates(),u=this.getRotation(),p=Math.cos(-u),c=Math.sin(-u),d=1/0,f=1/0,_=-1/0,g=-1/0,y=i.getStride(),v=0,m=l.length;v=0;i--){var r=e[i];if(r.getActive())if(!r.handleEvent(t))break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var i=this.maxTilesLoading_,r=i;if(t){var n=t.viewHints;n[kn]&&(i=this.loadTilesWhileAnimating_?8:0,r=2),n[jn]&&(i=this.loadTilesWhileInteracting_?8:0,r=2)}e.getTilesLoading()0&&t[1]>0}(i)&&r&&r.isDef()){for(var h=r.getHints(this.frameState_?this.frameState_.viewHints:void 0),l=this.getLayerGroup().getLayerStatesArray(),u={},p=0,c=l.length;p=t.minResolution&&e0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Z(e,this.renderedAttributions_)){to(this.ulElement_);for(var r=0,n=e.length;r0?t.animate({rotation:0,duration:this.duration_,easing:Xn}):t.setRotation(0))},e}(uo),Ro=function(t){function e(e){var i=e||{};t.call(this,{element:document.createElement("div"),target:i.target});var r=void 0!==i.className?i.className:"ol-zoom",n=void 0!==i.delta?i.delta:1,o=void 0!==i.zoomInLabel?i.zoomInLabel:"+",s=void 0!==i.zoomOutLabel?i.zoomOutLabel:"−",a=void 0!==i.zoomInTipLabel?i.zoomInTipLabel:"Zoom in",h=void 0!==i.zoomOutTipLabel?i.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=r+"-in",l.setAttribute("type","button"),l.title=a,l.appendChild("string"==typeof o?document.createTextNode(o):o),v(l,M.CLICK,this.handleClick_.bind(this,n));var u=document.createElement("button");u.className=r+"-out",u.setAttribute("type","button"),u.title=h,u.appendChild("string"==typeof s?document.createTextNode(s):s),v(u,M.CLICK,this.handleClick_.bind(this,-n));var p=r+" "+fo+" "+go,c=this.element;c.className=p,c.appendChild(l),c.appendChild(u),this.duration_=void 0!==i.duration?i.duration:250}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleClick_=function(t,e){e.preventDefault(),this.zoomByDelta_(t)},e.prototype.zoomByDelta_=function(t){var e=this.getMap().getView();if(e){var i=e.getResolution();if(i){var r=e.constrainResolution(i,t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:r,duration:this.duration_,easing:Xn})):e.setResolution(r)}}},e}(uo);function wo(t){var e=t||{},i=new U;return(void 0===e.zoom||e.zoom)&&i.push(new Ro(e.zoomOptions)),(void 0===e.rotate||e.rotate)&&i.push(new Co(e.rotateOptions)),(void 0===e.attribution||e.attribution)&&i.push(new So(e.attributionOptions)),i}var Io={ACTIVE:"active"};function Lo(t,e,i,r){Oo(t,e=t.constrainRotation(e,0),i,r)}function Oo(t,e,i,r){if(void 0!==e){var n=t.getRotation(),o=t.getCenter();void 0!==n&&o&&r>0?t.animate({rotation:e,anchor:i,duration:r,easing:Xn}):t.rotate(e,i)}}function Po(t,e,i,r,n){Mo(t,e=t.constrainResolution(e,0,n),i,r)}function bo(t,e,i,r){var n=t.getResolution(),o=t.constrainResolution(n,e,0);if(void 0!==o){var s=t.getResolutions();o=kt(o,t.getMinResolution()||s[s.length-1],t.getMaxResolution()||s[0])}if(i&&void 0!==o&&o!==n){var a=t.getCenter(),h=t.calculateCenterZoom(o,i);h=t.constrainCenter(h),i=[(o*a[0]-n*h[0])/(o-n),(o*a[1]-n*h[1])/(o-n)]}Mo(t,o,i,r)}function Mo(t,e,i,r){if(e){var n=t.getResolution(),o=t.getCenter();if(void 0!==n&&o&&e!==n&&r)t.animate({resolution:e,anchor:i,duration:r,easing:Xn});else{if(i){var s=t.calculateCenterZoom(e,i);t.setCenter(s)}t.setResolution(e)}}}var Fo=function(t){function e(e){t.call(this),e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getActive=function(){return this.get(Io.ACTIVE)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(Io.ACTIVE,t)},e.prototype.setMap=function(t){this.map_=t},e}(D);function Ao(t){var e=!1;if(t.type==Ar.DBLCLICK){var i=t.originalEvent,r=t.map,n=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_;bo(r.getView(),o,n,this.duration_),t.preventDefault(),e=!0}return!e}var No=function(t){function e(e){t.call(this,{handleEvent:Ao});var i=e||{};this.delta_=i.delta?i.delta:1,this.duration_=void 0!==i.duration?i.duration:250}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Fo),Go=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Do=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},ko=function(t){return t.target.getTargetElement()===document.activeElement},jo=R,Uo=function(t){var e=t.originalEvent;return 0==e.button&&!(Ni&&Gi&&e.ctrlKey)},Yo=w,Bo=function(t){return"pointermove"==t.type},Vo=function(t){return t.type==Ar.SINGLECLICK},Xo=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},zo=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Wo=function(t){var e=t.originalEvent.target.tagName;return"INPUT"!==e&&"SELECT"!==e&&"TEXTAREA"!==e},Ko=function(t){var e=t.pointerEvent;return Y(void 0!==e,56),"mouse"==e.pointerType},Ho=function(t){var e=t.pointerEvent;return Y(void 0!==e,56),e.isPrimary&&0===e.button};function Zo(t){for(var e=t.length,i=0,r=0,n=0;n0}}else if(t.type==Ar.POINTERDOWN){var r=this.handleDownEvent(t);r&&t.preventDefault(),this.handlingDownUpSequence=r,e=this.stopDown(r)}else t.type==Ar.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===Ar.POINTERDOWN||e===Ar.POINTERDRAG||e===Ar.POINTERUP}(t)){var e=t.pointerEvent,i=e.pointerId.toString();t.type==Ar.POINTERUP?delete this.trackedPointers_[i]:t.type==Ar.POINTERDOWN?this.trackedPointers_[i]=e:i in this.trackedPointers_&&(this.trackedPointers_[i]=e),this.targetPointers=c(this.trackedPointers_)}},e}(Fo),Jo=function(t){function e(e){t.call(this,{stopDown:w});var i=e||{};this.kinetic_=i.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1,this.condition_=i.condition?i.condition:Xo,this.noKinetic_=!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDragEvent=function(t){this.panning_||(this.panning_=!0,this.getMap().getView().setHint(jn,1));var e=this.targetPointers,i=Zo(e);if(e.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(i[0],i[1]),this.lastCentroid){var r=this.lastCentroid[0]-i[0],n=i[1]-this.lastCentroid[1],o=t.map.getView(),s=[r,n];tr(s,o.getResolution()),$i(s,o.getRotation()),Hi(s,o.getCenter()),s=o.constrainCenter(s),o.setCenter(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=i,this.lastPointersCount_=e.length},e.prototype.handleUpEvent=function(t){var e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){var r=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),o=i.getCenter(),s=e.getPixelFromCoordinate(o),a=e.getCoordinateFromPixel([s[0]-r*Math.cos(n),s[1]-r*Math.sin(n)]);i.animate({center:i.constrainCenter(a),duration:500,easing:Xn})}return this.panning_&&(this.panning_=!1,i.setHint(jn,-1)),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>0&&this.condition_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.setCenter(t.frameState.viewState.center),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}(qo),Qo=function(t){function e(e){var i=e||{};t.call(this,{stopDown:w}),this.condition_=i.condition?i.condition:Do,this.lastAngle_=void 0,this.duration_=void 0!==i.duration?i.duration:250}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDragEvent=function(t){if(Ko(t)){var e=t.map,i=e.getView();if(i.getConstraints().rotation!==Gn){var r=e.getSize(),n=t.pixel,o=Math.atan2(r[1]/2-n[1],n[0]-r[0]/2);if(void 0!==this.lastAngle_){var s=o-this.lastAngle_;Oo(i,i.getRotation()-s)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){if(!Ko(t))return!0;var e=t.map.getView();return e.setHint(jn,-1),Lo(e,e.getRotation(),void 0,this.duration_),!1},e.prototype.handleDownEvent=function(t){return!!Ko(t)&&(!(!Uo(t)||!this.condition_(t))&&(t.map.getView().setHint(jn,1),this.lastAngle_=void 0,!0))},e}(qo),$o=function(t){function e(e){t.call(this),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,i=this.element_.style;i.left=Math.min(t[0],e[0])+"px",i.top=Math.min(t[1],e[1])+"px",i.width=Math.abs(e[0]-t[0])+"px",i.height=Math.abs(e[1]-t[1])+"px"},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left=e.top=e.width=e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixel,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new Ii([i])},e.prototype.getGeometry=function(){return this.geometry_},e}(C),ts="boxstart",es="boxdrag",is="boxend",rs=function(t){function e(e,i,r){t.call(this,e),this.coordinate=i,this.mapBrowserEvent=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),ns=function(t){function e(e){t.call(this);var i=e||{};this.box_=new $o(i.className||"ol-dragbox"),this.minArea_=void 0!==i.minArea?i.minArea:64,this.onBoxEnd_=i.onBoxEnd?i.onBoxEnd:I,this.startPixel_=null,this.condition_=i.condition?i.condition:jo,this.boxEndCondition_=i.boxEndCondition?i.boxEndCondition:this.defaultBoxEndCondition}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.defaultBoxEndCondition=function(t,e,i){var r=i[0]-e[0],n=i[1]-e[1];return r*r+n*n>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){Ko(t)&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new rs(es,t.coordinate,t)))},e.prototype.handleUpEvent=function(t){return!Ko(t)||(this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd_(t),this.dispatchEvent(new rs(is,t.coordinate,t))),!1)},e.prototype.handleDownEvent=function(t){return!!Ko(t)&&(!(!Uo(t)||!this.condition_(t))&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new rs(ts,t.coordinate,t)),!0))},e}(qo);function os(){var t=this.getMap(),e=t.getView(),i=t.getSize(),r=this.getGeometry().getExtent();if(this.out_){var n=e.calculateExtent(i),o=function(t,e){return gt(ut(e),t)}([t.getPixelFromCoordinate(Et(r)),t.getPixelFromCoordinate(Lt(r))]);Mt(n,1/e.getResolutionForExtent(o,i)),r=n}var s=e.constrainResolution(e.getResolutionForExtent(r,i)),a=Tt(r);a=e.constrainCenter(a),e.animate({resolution:s,center:a,duration:this.duration_,easing:Xn})}var ss=function(t){function e(e){var i=e||{},r=i.condition?i.condition:zo;t.call(this,{condition:r,className:i.className||"ol-dragzoom",onBoxEnd:os}),this.duration_=void 0!==i.duration?i.duration:200,this.out_=void 0!==i.out&&i.out}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(ns),as={LEFT:37,UP:38,RIGHT:39,DOWN:40};function hs(t){var e=!1;if(t.type==M.KEYDOWN){var i=t.originalEvent.keyCode;if(this.condition_(t)&&(i==as.DOWN||i==as.LEFT||i==as.RIGHT||i==as.UP)){var r=t.map.getView(),n=r.getResolution()*this.pixelDelta_,o=0,s=0;i==as.DOWN?s=-n:i==as.LEFT?o=-n:i==as.RIGHT?o=n:s=n;var a=[o,s];$i(a,r.getRotation()),function(t,e,i){var r=t.getCenter();if(r){var n=t.constrainCenter([r[0]+e[0],r[1]+e[1]]);i?t.animate({duration:i,easing:Wn,center:n}):t.setCenter(n)}}(r,a,this.duration_),t.preventDefault(),e=!0}}return!e}var ls=function(t){function e(e){t.call(this,{handleEvent:hs});var i=e||{};this.defaultCondition_=function(t){return Xo(t)&&Wo(t)},this.condition_=void 0!==i.condition?i.condition:this.defaultCondition_,this.duration_=void 0!==i.duration?i.duration:100,this.pixelDelta_=void 0!==i.pixelDelta?i.pixelDelta:128}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Fo);function us(t){var e=!1;if(t.type==M.KEYDOWN||t.type==M.KEYPRESS){var i=t.originalEvent.charCode;if(this.condition_(t)&&(i=="+".charCodeAt(0)||i=="-".charCodeAt(0))){var r=t.map,n=i=="+".charCodeAt(0)?this.delta_:-this.delta_;bo(r.getView(),n,void 0,this.duration_),t.preventDefault(),e=!0}}return!e}var ps=function(t){function e(e){t.call(this,{handleEvent:us});var i=e||{};this.condition_=i.condition?i.condition:Wo,this.delta_=i.delta?i.delta:1,this.duration_=void 0!==i.duration?i.duration:100}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Fo),cs="trackpad",ds="wheel",fs=function(t){function e(e){var i=e||{};t.call(this,i),this.delta_=0,this.duration_=void 0!==i.duration?i.duration:250,this.timeout_=void 0!==i.timeout?i.timeout:80,this.useAnchor_=void 0===i.useAnchor||i.useAnchor,this.constrainResolution_=i.constrainResolution||!1,this.condition_=i.condition?i.condition:jo,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.trackpadDeltaPerZoom_=300,this.trackpadZoomBuffer_=1.5}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.decrementInteractingHint_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().setHint(jn,-1)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;var e=t.type;if(e!==M.WHEEL&&e!==M.MOUSEWHEEL)return!0;t.preventDefault();var i,r=t.map,n=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==M.WHEEL?(i=n.deltaY,Fi&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(i/=Di),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(i*=40)):t.type==M.MOUSEWHEEL&&(i=-n.wheelDeltaY,Ai&&(i/=3)),0===i)return!1;var o=Date.now();if(void 0===this.startTime_&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?cs:ds),this.mode_===cs){var s=r.getView();this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):s.setHint(jn,1),this.trackpadTimeoutId_=setTimeout(this.decrementInteractingHint_.bind(this),this.trackpadEventGap_);var a=s.getResolution()*Math.pow(2,i/this.trackpadDeltaPerZoom_),h=s.getMinResolution(),l=s.getMaxResolution(),u=0;if(al&&(a=Math.min(a,l*this.trackpadZoomBuffer_),u=-1),this.lastAnchor_){var p=s.calculateCenterZoom(a,this.lastAnchor_);s.setCenter(s.constrainCenter(p))}return s.setResolution(a),0===u&&this.constrainResolution_&&s.animate({resolution:s.constrainResolution(a,i>0?-1:1),easing:Xn,anchor:this.lastAnchor_,duration:this.duration_}),u>0?s.animate({resolution:h,easing:Xn,anchor:this.lastAnchor_,duration:500}):u<0&&s.animate({resolution:l,easing:Xn,anchor:this.lastAnchor_,duration:500}),this.startTime_=o,!1}this.delta_+=i;var c=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,r),c),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();bo(e,-kt(this.delta_,-1,1),this.lastAnchor_,this.duration_),this.mode_=void 0,this.delta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(Fo),_s=function(t){function e(e){var i=e||{},r=i;r.stopDown||(r.stopDown=w),t.call(this,r),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==i.threshold?i.threshold:.3,this.duration_=void 0!==i.duration?i.duration:250}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDragEvent=function(t){var e=0,i=this.targetPointers[0],r=this.targetPointers[1],n=Math.atan2(r.clientY-i.clientY,r.clientX-i.clientX);if(void 0!==this.lastAngle_){var o=n-this.lastAngle_;this.rotationDelta_+=o,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=n;var s=t.map,a=s.getView();if(a.getConstraints().rotation!==Gn){var h=s.getViewport().getBoundingClientRect(),l=Zo(this.targetPointers);if(l[0]-=h.left,l[1]-=h.top,this.anchor_=s.getCoordinateFromPixel(l),this.rotating_){var u=a.getRotation();s.render(),Oo(a,u+e,this.anchor_)}}},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView();if(e.setHint(jn,-1),this.rotating_)Lo(e,e.getRotation(),this.anchor_,this.duration_);return!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().setHint(jn,1),!0}return!1},e}(qo),gs=function(t){function e(e){var i=e||{},r=i;r.stopDown||(r.stopDown=w),t.call(this,r),this.constrainResolution_=i.constrainResolution||!1,this.anchor_=null,this.duration_=void 0!==i.duration?i.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDragEvent=function(t){var e=1,i=this.targetPointers[0],r=this.targetPointers[1],n=i.clientX-r.clientX,o=i.clientY-r.clientY,s=Math.sqrt(n*n+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/s),this.lastDistance_=s;var a=t.map,h=a.getView(),l=h.getResolution(),u=h.getMaxResolution(),p=h.getMinResolution(),c=l*e;c>u?(e=u/l,c=u):ce.getMaxResolution()){var r=this.lastScaleDelta_-1;Po(e,i,this.anchor_,this.duration_,r)}return!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().setHint(jn,1),!0}return!1},e}(qo);function ys(t){var e=t||{},i=new U,r=new br(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&i.push(new Qo),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&i.push(new No({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&i.push(new Jo({condition:e.onFocusOnly?ko:void 0,kinetic:r})),(void 0===e.pinchRotate||e.pinchRotate)&&i.push(new _s),(void 0===e.pinchZoom||e.pinchZoom)&&i.push(new gs({constrainResolution:e.constrainResolution,duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(i.push(new ls),i.push(new ps({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&i.push(new fs({condition:e.onFocusOnly?ko:void 0,constrainResolution:e.constrainResolution,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&i.push(new ss({duration:e.zoomDuration})),i}var vs=.5,ms=function(t){function e(e,i,r,n){t.call(this),this.extent=e,this.pixelRatio_=r,this.resolution=i,this.state=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.changed=function(){this.dispatchEvent(M.CHANGE)},e.prototype.getExtent=function(){return this.extent},e.prototype.getImage=function(){return r()},e.prototype.getPixelRatio=function(){return this.pixelRatio_},e.prototype.getResolution=function(){return this.resolution},e.prototype.getState=function(){return this.state},e.prototype.load=function(){r()},e}(b),xs={IDLE:0,LOADING:1,LOADED:2,ERROR:3},Es=function(t){function e(e,i,r,n,o){var s=void 0!==o?xs.IDLE:xs.LOADED;t.call(this,e,i,r,s),this.loader_=void 0!==o?o:null,this.canvas_=n,this.error_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getError=function(){return this.error_},e.prototype.handleLoad_=function(t){t?(this.error_=t,this.state=xs.ERROR):this.state=xs.LOADED,this.changed()},e.prototype.load=function(){this.state==xs.IDLE&&(this.state=xs.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))},e.prototype.getImage=function(){return this.canvas_},e}(ms),Ss={IMAGE:"IMAGE",TILE:"TILE",VECTOR_TILE:"VECTOR_TILE",VECTOR:"VECTOR"},Ts={IMAGE:"image",VECTOR:"vector"},Cs=function(t){function e(e,i,r,n,o){t.call(this,e),this.vectorContext=i,this.frameState=r,this.context=n,this.glContext=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),Rs=function(t){function e(e){t.call(this),this.highWaterMark=void 0!==e?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.canExpireCache=function(){return this.getCount()>this.highWaterMark},e.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null,this.dispatchEvent(M.CLEAR)},e.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},e.prototype.forEach=function(t,e){for(var i=this.oldest_;i;)t.call(e,i.value_,i.key_,this),i=i.newer},e.prototype.get=function(t){var e=this.entries_[t];return Y(void 0!==e,15),e===this.newest_?e.value_:(e===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(e.newer.older=e.older,e.older.newer=e.newer),e.newer=null,e.older=this.newest_,this.newest_.newer=e,this.newest_=e,e.value_)},e.prototype.remove=function(t){var e=this.entries_[t];return Y(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},e.prototype.getCount=function(){return this.count_},e.prototype.getKeys=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.key_;return e},e.prototype.getValues=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.value_;return e},e.prototype.peekLast=function(){return this.oldest_.value_},e.prototype.peekLastKey=function(){return this.oldest_.key_},e.prototype.peekFirstKey=function(){return this.newest_.key_},e.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},e.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},e.prototype.set=function(t,e){Y(!(t in this.entries_),16);var i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_},e.prototype.setSize=function(t){this.highWaterMark=t},e.prototype.prune=function(){for(;this.canExpireCache();)this.pop()},e}(b),ws=[0,0,0,1],Is=[],Ls=[0,0,0,1],Os=[0,0,0,0],Ps=new Rs,bs={},Ms=null,Fs={},As=function(){var t,e,i=60,r=bs,n="32px ",o=["monospace","serif"],s=o.length,a="wmytzilWMYTZIL@#/&?$%10";function h(t){for(var i=Ns(),r=100;r<=700;r+=300){for(var h=r+" ",l=!0,u=0;uthis.maxCacheSize_){var t=0;for(var e in this.cache_){var i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},zs.prototype.get=function(t,e,i){var r=Ws(t,e,i);return r in this.cache_?this.cache_[r]:null},zs.prototype.set=function(t,e,i,r){var n=Ws(t,e,i);this.cache_[n]=r,++this.cacheSize_},zs.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()};var Ks=new zs;function Hs(t,e){Ks.expire()}function Zs(t,e){return t.zIndex-e.zIndex}var qs=function(t){function e(e){t.call(this),this.map_=e,this.layerRenderers_={},this.layerRendererListeners_={},this.layerRendererConstructors_=[]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.dispatchRenderEvent=function(t,e){r()},e.prototype.registerLayerRenderers=function(t){this.layerRendererConstructors_.push.apply(this.layerRendererConstructors_,t)},e.prototype.calculateMatrices2D=function(t){var e=t.viewState,i=t.coordinateToPixelTransform,r=t.pixelToCoordinateTransform;Ye(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Be(Ge(r,i))},e.prototype.removeLayerRenderers=function(){for(var t in this.layerRenderers_)this.removeLayerRendererByKey_(t).dispose()},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,s,a){var h,l=e.viewState,u=l.resolution;function p(t,i){var s=e.layerStates[o(i)].managed;if(!(o(t)in e.skippedFeatureUids)||s)return r.call(n,t,s?i:null)}var c=l.projection,d=t;if(c.canWrapX()){var f=c.getExtent(),_=Ot(f),g=t[0];if(gf[2])d=[g+_*Math.ceil((f[0]-g)/_),t[1]]}var y,v=e.layerStatesArray;for(y=v.length-1;y>=0;--y){var m=v[y],x=m.layer;if(mo(m,u)&&s.call(a,x)){var E=this.getLayerRenderer(x),S=x.getSource();if(S&&(h=E.forEachFeatureAtCoordinate(S.getWrapX()?d:t,e,i,p)),h)return h}}},e.prototype.forEachLayerAtPixel=function(t,e,i,n,o,s,a){return r()},e.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,R,this,r,n)},e.prototype.getLayerRenderer=function(t){var e=o(t);if(e in this.layerRenderers_)return this.layerRenderers_[e];for(var i,r=0,n=this.layerRendererConstructors_.length;r=0;--h){var d=u[h],f=d.layer;if(mo(d,l)&&o.call(s,f))if(a=this.getLayerRenderer(f).forEachLayerAtCoordinate(c,e,i,r,n))return a}},e.prototype.registerLayerRenderers=function(e){t.prototype.registerLayerRenderers.call(this,e);for(var i=0,r=e.length;i=.5&&p>=.5&&i.drawImage(r,0,0,+r.width,+r.height,Math.round(h),Math.round(l),Math.round(u),Math.round(p)),i.globalAlpha=a,o&&i.restore()}this.postCompose(i,t,e)},e.prototype.getImage=function(){return r()},e.prototype.getImageTransform=function(){return r()},e.prototype.forEachLayerAtCoordinate=function(t,e,i,r,n){if(this.getImage()){var o=De(this.coordinateToCanvasPixelTransform,t.slice());tr(o,e.viewState.resolution/this.renderedResolution),this.hitCanvasContext_||(this.hitCanvasContext_=Jn(1,1)),this.hitCanvasContext_.clearRect(0,0,1,1),this.hitCanvasContext_.drawImage(this.getImage(),o[0],o[1],1,1,0,0,1,1);var s=this.hitCanvasContext_.getImageData(0,0,1,1).data;return s[3]>0?r.call(n,this.getLayer(),s):void 0}},e}(ta),ia=function(t){function e(i){if(t.call(this,i),this.image_=null,this.imageTransform_=[1,0,0,1,0,0],this.skippedFeatures_=[],this.vectorRenderer_=null,i.getType()===Ss.VECTOR)for(var r=0,n=Js.length;rthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},na.prototype.getHeight=function(){return this.maxY-this.minY+1},na.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},na.prototype.getWidth=function(){return this.maxX-this.minX+1},na.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY};var sa=na,aa=function(t){function e(e,i){t.call(this,e),this.context=i?null:Jn(),this.oversampling_,this.renderedExtent_=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=[1/0,1/0,-1/0,-1/0],this.tmpTileRange_=new sa(0,0,0,0),this.imageTransform_=[1,0,0,1,0,0],this.zDirection=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isDrawableTile_=function(t){var e=this.getLayer(),i=t.getState(),r=e.getUseInterimTilesOnError();return i==On.LOADED||i==On.EMPTY||i==On.ERROR&&!r},e.prototype.getTile=function(t,e,i,r,n){var o=this.getLayer(),s=o.getSource().getTile(t,e,i,r,n);return s.getState()==On.ERROR&&(o.getUseInterimTilesOnError()?o.getPreload()>0&&(this.newTiles_=!0):s.setState(On.LOADED)),this.isDrawableTile_(s)||(s=s.getInterimTile()),s},e.prototype.prepareFrame=function(t,e){var i=t.pixelRatio,r=t.size,n=t.viewState,s=n.projection,a=n.resolution,h=n.center,l=this.getLayer(),u=l.getSource(),p=u.getRevision(),c=u.getTileGridForProjection(s),d=c.getZForResolution(a,this.zDirection),f=c.getResolution(d),_=Math.round(a/f)||1,g=t.extent;if(void 0!==e.extent&&(g=wt(g,e.extent)),bt(g))return!1;var y=c.getTileRangeForExtentAndZ(g,d),v=c.getTileRangeExtent(d,y),m=u.getTilePixelRatio(i),x={};x[d]={};var E,S,T,C=this.createLoadedTileFinder(u,s,x),R=t.viewHints,w=R[kn]||R[jn],I=this.tmpExtent,L=this.tmpTileRange_;for(this.newTiles_=!1,S=y.minX;S<=y.maxX;++S)for(T=y.minY;T<=y.maxY;++T)if(!(Date.now()-t.time>16&&w)){if(E=this.getTile(d,S,T,i,s),this.isDrawableTile_(E)){var O=o(this);if(E.getState()==On.LOADED){x[d][E.tileCoord.toString()]=E;var P=E.inTransition(O);this.newTiles_||!P&&-1!==this.renderedTiles.indexOf(E)||(this.newTiles_=!0)}if(1===E.getAlpha(O,t.time))continue}var b=c.getTileCoordChildTileRange(E.tileCoord,L,I),M=!1;b&&(M=C(d+1,b)),M||c.forEachTileCoordParentTileRange(E.tileCoord,C,null,L,I)}var F=f*i/m*_;if(!(this.renderedResolution&&Date.now()-t.time>16&&w)&&(this.newTiles_||!this.renderedExtent_||!ot(this.renderedExtent_,g)||this.renderedRevision!=p||_!=this.oversampling_||!w&&F!=this.renderedResolution)){var A=this.context;if(A){var N=u.getTilePixelSize(d,i,s),G=Math.round(y.getWidth()*N[0]/_),D=Math.round(y.getHeight()*N[1]/_),k=A.canvas;k.width!=G||k.height!=D?(this.oversampling_=_,k.width=G,k.height=D):((this.renderedExtent_&&!dt(v,this.renderedExtent_)||this.renderedRevision!=p)&&A.clearRect(0,0,G,D),_=this.oversampling_)}this.renderedTiles.length=0;var j,U,Y,B,V,X,z,W,K,H,Z=Object.keys(x).map(Number);for(Z.sort(function(t,e){return t===d?1:e===d?-1:t>e?1:t0},e.prototype.drawTileImage=function(t,e,i,r,n,s,a,h,l){var u=this.getTileImage(t);if(u){var p=o(this),c=l?t.getAlpha(p,e.time):1,d=this.getLayer().getSource();1!==c||d.getOpaque(e.viewState.projection)||this.context.clearRect(r,n,s,a);var f=c!==this.context.globalAlpha;f&&(this.context.save(),this.context.globalAlpha=c),this.context.drawImage(u,h,h,u.width-2*h,u.height-2*h,r,n,s,a),f&&this.context.restore(),1!==c?e.animate=!0:l&&t.endTransition(p)}},e.prototype.getImage=function(){var t=this.context;return t?t.canvas:null},e.prototype.getImageTransform=function(){return this.imageTransform_},e.prototype.getTileImage=function(t){return t.getImage()},e}(ea);aa.handles=function(t){return t.getType()===Ss.TILE},aa.create=function(t,e){return new aa(e)},aa.prototype.getLayer;var ha=aa,la=i(0),ua=i.n(la),pa=function(){};pa.prototype.getReplay=function(t,e){return r()},pa.prototype.isEmpty=function(){return r()},pa.prototype.addDeclutter=function(t){return r()};var ca=pa,da={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function fa(t,e,i,r,n,o,s,a){for(var h,l,u,p=[],c=t[e]>t[i-r],d=n.length,f=t[e],_=t[e+1],g=t[e+=r],y=t[e+1],v=0,m=Math.sqrt(Math.pow(g-f,2)+Math.pow(y-_,2)),x="",E=0,S=0;S0?-Math.PI:Math.PI),void 0!==u){var L=I-u;if(L+=L>Math.PI?-2*Math.PI:L<-Math.PI?2*Math.PI:0,Math.abs(L)>a)return null}var O=w/m,P=zt(f,g,O),b=zt(_,y,O);u==I?(c&&(h[0]=P,h[1]=b,h[2]=C/2),h[4]=x):(E=C,h=[P,b,C/2,I,x=T],c?p.unshift(h):p.push(h),u=I),s+=C}return p}var _a={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},ga=[_a.FILL],ya=[_a.STROKE],va=[_a.BEGIN_PATH],ma=[_a.CLOSE_PATH],xa=_a,Ea=[da.POLYGON,da.CIRCLE,da.LINE_STRING,da.IMAGE,da.TEXT,da.DEFAULT],Sa={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Ta=[1/0,1/0,-1/0,-1/0],Ca=[1,0,0,1,0,0],Ra=function(t){function e(e,i,r,n,o,s){t.call(this),this.declutterTree=s,this.tolerance=e,this.maxExtent=i,this.overlaps=o,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=r,this.alignFill_,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=[],this.pixelCoordinates_=null,this.state={},this.viewRotation_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.replayTextBackground_=function(t,e,i,r,n,o,s){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,r),t.lineTo.apply(t,n),t.lineTo.apply(t,e),o&&(this.alignFill_=o[2],this.fill_(t)),s&&(this.setStrokeStyle_(t,s),t.stroke())},e.prototype.replayImage_=function(t,e,i,r,n,o,s,a,h,l,u,p,c,d,f,_,g,y){var v=g||y;e-=n*=c,i-=o*=c;var m,x,E,S,T=f+l>r.width?r.width-l:f,C=a+u>r.height?r.height-u:a,R=_[3]+T*c+_[1],w=_[0]+C*c+_[2],I=e-_[3],L=i-_[0];(v||0!==p)&&(m=[I,L],x=[I+R,L],E=[I+R,L+w],S=[I,L+w]);var O=null;if(0!==p){var P=e+n,b=i+o;O=Ye(Ca,P,b,1,1,p,-P,-b),ut(Ta),_t(Ta,De(Ca,m)),_t(Ta,De(Ca,x)),_t(Ta,De(Ca,E)),_t(Ta,De(Ca,S))}else lt(I,L,I+R,L+w,Ta);var M=t.canvas,F=y?y[2]*c/2:0,A=Ta[0]-F<=M.width&&Ta[2]+F>=0&&Ta[1]-F<=M.height&&Ta[3]+F>=0;if(d&&(e=Math.round(e),i=Math.round(i)),s){if(!A&&1==s[4])return;ft(s,Ta);var N=A?[t,O?O.slice(0):null,h,r,l,u,T,C,e,i,c]:null;N&&v&&N.push(g,y,m,x,E,S),s.push(N)}else A&&(v&&this.replayTextBackground_(t,m,x,E,S,g,y),Us(t,O,h,r,l,u,T,C,e,i,c))},e.prototype.applyPixelRatio=function(t){var e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})},e.prototype.appendFlatCoordinates=function(t,e,i,r,n,o){var s=this.coordinates.length,a=this.getBufferedMaxExtent();o&&(e+=r);var h,l,u,p=[t[e],t[e+1]],c=[NaN,NaN],d=!0;for(h=e+r;h5){var i=t[4];if(1==i||i==t.length-5){var r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};if(!this.declutterTree.collides(r)){this.declutterTree.insert(r);for(var n=5,o=t.length;n11&&this.replayTextBackground_(s[0],s[13],s[14],s[15],s[16],s[11],s[12]),Us.apply(void 0,s))}}t.length=5,ut(t)}}},e.prototype.replay_=function(t,e,i,r,n,s,a){var h;this.pixelCoordinates_&&Z(e,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Gt(this.coordinates,0,this.coordinates.length,2,e,this.pixelCoordinates_),Ge(this.renderedTransform_,e));for(var l,u,p,c,f,_,g,y,v,m,x,E,S=!d(i),T=0,C=r.length,R=0,w=0,I=0,L=null,O=null,P=this.coordinateCache_,b=this.viewRotation_,M={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:b},F=this.instructions!=r||this.overlaps?0:200;TF&&(this.fill_(t),w=0),I>F&&(t.stroke(),I=0),w||I||(t.beginPath(),c=f=NaN),++T;break;case xa.CIRCLE:var N=h[R=A[1]],G=h[R+1],D=h[R+2]-N,k=h[R+3]-G,j=Math.sqrt(D*D+k*k);t.moveTo(N+j,G),t.arc(N,G,j,0,2*Math.PI,!0),++T;break;case xa.CLOSE_PATH:t.closePath(),++T;break;case xa.CUSTOM:R=A[1],l=A[2];var U=A[3],Y=A[4],B=6==A.length?A[5]:void 0;M.geometry=U,M.feature=m,T in P||(P[T]=[]);var V=P[T];B?B(h,R,l,2,V):(V[0]=h[R],V[1]=h[R+1],V.length=2),Y(V,M),++T;break;case xa.DRAW_IMAGE:R=A[1],l=A[2],v=A[3],u=A[4],p=A[5],y=s?null:A[6];var X=A[7],z=A[8],W=A[9],K=A[10],H=A[11],q=A[12],J=A[13],Q=A[14],$=void 0,tt=void 0,et=void 0;for(A.length>16?($=A[15],tt=A[16],et=A[17]):($=Os,tt=et=!1),H&&(q+=b);Rthis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0},e.prototype.createFill=function(t,e){var i=t.fillStyle,r=[xa.SET_FILL_STYLE,i];return"string"!=typeof i&&r.push(!0),r},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[xa.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e,i){var r=t.fillStyle;"string"==typeof r&&t.currentFillStyle==r||(void 0!==r&&this.instructions.push(e.call(this,t,i)),t.currentFillStyle=r)},e.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle,r=t.lineCap,n=t.lineDash,o=t.lineDashOffset,s=t.lineJoin,a=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=r||n!=t.currentLineDash&&!Z(t.currentLineDash,n)||t.currentLineDashOffset!=o||t.currentLineJoin!=s||t.currentLineWidth!=a||t.currentMiterLimit!=h)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=r,t.currentLineDash=n,t.currentLineDashOffset=o,t.currentLineJoin=s,t.currentLineWidth=a,t.currentMiterLimit=h)},e.prototype.endGeometry=function(t,e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var i=[xa.END_GEOMETRY,e];this.instructions.push(i),this.hitDetectionInstructions.push(i)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=it(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;et(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(Vs),wa=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,r,n,o,s),this.declutterGroup_=null,this.hitDetectionImage_=null,this.image_=null,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawCoordinates_=function(t,e,i,r){return this.appendFlatCoordinates(t,e,i,r,!1,!1)},e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),r=t.getStride(),n=this.coordinates.length,o=this.drawCoordinates_(i,0,i.length,r);this.instructions.push([xa.DRAW_IMAGE,n,o,this.image_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.width_]),this.hitDetectionInstructions.push([xa.DRAW_IMAGE,n,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(t,e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),r=t.getStride(),n=this.coordinates.length,o=this.drawCoordinates_(i,0,i.length,r);this.instructions.push([xa.DRAW_IMAGE,n,o,this.image_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.width_]),this.hitDetectionInstructions.push([xa.DRAW_IMAGE,n,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(t,e)}},e.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0},e.prototype.setImageStyle=function(t,e){var i=t.getAnchor(),r=t.getSize(),n=t.getHitDetectionImage(1),o=t.getImage(1),s=t.getOrigin();this.anchorX_=i[0],this.anchorY_=i[1],this.declutterGroup_=e,this.hitDetectionImage_=n,this.image_=o,this.height_=r[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScale(),this.width_=r[0]},e}(Ra),Ia=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,r,n,o,s)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawFlatCoordinates_=function(t,e,i,r){var n=this.coordinates.length,o=this.appendFlatCoordinates(t,e,i,r,!1,!1),s=[xa.MOVE_TO_LINE_TO,n,o];return this.instructions.push(s),this.hitDetectionInstructions.push(s),i},e.prototype.drawLineString=function(t,e){var i=this.state,r=i.strokeStyle,n=i.lineWidth;if(void 0!==r&&void 0!==n){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],va);var o=t.getFlatCoordinates(),s=t.getStride();this.drawFlatCoordinates_(o,0,o.length,s),this.hitDetectionInstructions.push(ya),this.endGeometry(t,e)}},e.prototype.drawMultiLineString=function(t,e){var i=this.state,r=i.strokeStyle,n=i.lineWidth;if(void 0!==r&&void 0!==n){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],va);for(var o=t.getEnds(),s=t.getFlatCoordinates(),a=t.getStride(),h=0,l=0,u=o.length;lt&&(y>g&&(g=y,f=v,_=o),y=0,v=o-n)),s=a,u=c,p=d),h=m,l=x}return(y+=a)>g?[v,o]:[f,_]}var Pa={Circle:La,Default:Ra,Image:wa,LineString:Ia,Polygon:La,Text:function(t){function e(e,i,r,n,o,s){t.call(this,e,i,r,n,o,s),this.declutterGroup_,this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.widths_={},Ps.prune()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawText=function(t,e){var i=this.textFillState_,r=this.textStrokeState_,n=this.textState_;if(""!==this.text_&&n&&(i||r)){var o,s,a=this.coordinates.length,h=t.getType(),l=null,u=2,p=2;if(n.placement===Tr){if(!Pt(this.getBufferedMaxExtent(),t.getExtent()))return;var c;if(l=t.getFlatCoordinates(),p=t.getStride(),h==Nt.LINE_STRING)c=[l.length];else if(h==Nt.MULTI_LINE_STRING)c=t.getEnds();else if(h==Nt.POLYGON)c=t.getEnds().slice(0,1);else if(h==Nt.MULTI_POLYGON){var d=t.getEndss();for(c=[],o=0,s=d.length;o=E)&&l.push(S[o],S[o+1]);if(0==(u=l.length))return}u=this.appendFlatCoordinates(l,0,u,p,!1,!1),(n.backgroundFill||n.backgroundStroke)&&(this.setFillStrokeStyle(n.backgroundFill,n.backgroundStroke),n.backgroundFill&&(this.updateFillStyle(this.state,this.createFill,t),this.hitDetectionInstructions.push(this.createFill(this.state,t))),n.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e),this.drawTextImage_(x,a,u),this.endGeometry(t,e)}}},e.prototype.getImage=function(t,e,i,r){var n,o=r+e+t+i+this.pixelRatio;if(!Ps.containsKey(o)){var s=r?this.strokeStates[r]||this.textStrokeState_:null,a=i?this.fillStates[i]||this.textFillState_:null,h=this.textStates[e]||this.textState_,l=this.pixelRatio,u=h.scale*l,p=Sa[h.textAlign||"center"],c=r&&s.lineWidth?s.lineWidth:0,d=t.split("\n"),f=d.length,_=[],g=function(t,e,i){for(var r=e.length,n=0,o=0;o=o;)Fa(i,t+n,t+o),Fa(i,t+o,t+n),Fa(i,t-o,t+n),Fa(i,t-n,t+o),Fa(i,t-n,t-o),Fa(i,t-o,t-n),Fa(i,t+o,t-n),Fa(i,t+n,t-o),2*((s+=1+2*++o)-n)+1>0&&(s+=1-2*(n-=1));return Ma[t]=i,i}(r);function f(t){for(var e=u.getImageData(0,0,h,h).data,i=0;i0){var n=void 0;return(!p||c!=da.IMAGE&&c!=da.TEXT||-1!==p.indexOf(t))&&(n=o(t)),n||void u.clearRect(0,0,h,h)}}this.declutterTree_&&(p=this.declutterTree_.all().map(function(t){return t.value}));var _,g,y,v,m,x=Object.keys(this.replaysByZIndex_).map(Number);for(x.sort(V),_=x.length-1;_>=0;--_){var E=x[_].toString();for(y=this.replaysByZIndex_[E],g=Ea.length-1;g>=0;--g)if(void 0!==(v=y[c=Ea[g]]))if(!s||c!=da.IMAGE&&c!=da.TEXT){if(m=v.replayHitDetection(u,l,i,n,f,a))return m}else{var S=s[E];S?S.push(v,l.slice(0)):s[E]=[v,l.slice(0)]}}},e.prototype.getClipCoords=function(t){var e=this.maxExtent_,i=e[0],r=e[1],n=e[2],o=e[3],s=[i,r,i,o,n,o,n,r];return Gt(s,0,8,2,t,s),s},e.prototype.getReplay=function(t,e){var i=void 0!==t?t.toString():"0",r=this.replaysByZIndex_[i];void 0===r&&(r={},this.replaysByZIndex_[i]=r);var n=r[e];void 0===n&&(n=new(0,Pa[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_,this.overlaps_,this.declutterTree_),r[e]=n);return n},e.prototype.getReplays=function(){return this.replaysByZIndex_},e.prototype.isEmpty=function(){return d(this.replaysByZIndex_)},e.prototype.replay=function(t,e,i,r,n,o,s){var a=Object.keys(this.replaysByZIndex_).map(Number);a.sort(V),t.save(),this.clip(t,e);var h,l,u,p,c,d,f=o||Ea;for(h=0,l=a.length;h=n)for(r=n;rl[2];)O=b*++M,p=this.getTransform(e,O),f.replay(_,p,h,o,w),P-=b}if(ks(_,h,I/2,L/2),x&&this.dispatchRenderEvent(_,e,p),_!=t){if(m){var F=t.globalAlpha;t.globalAlpha=i.opacity,t.drawImage(_.canvas,-y,-v),t.globalAlpha=F}else t.drawImage(_.canvas,-y,-v);_.translate(-y,-v)}m||(_.globalAlpha=C)}d&&t.restore()},e.prototype.composeFrame=function(t,e,i){var r=this.getTransform(t,0);this.preCompose(i,t,r),this.compose(i,t,e),this.postCompose(i,t,e,r)},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(this.replayGroup_){var s=e.viewState.resolution,a=e.viewState.rotation,h=this.getLayer(),l={};return this.replayGroup_.forEachFeatureAtCoordinate(t,s,a,i,{},function(t){var e=o(t);if(!(e in l))return l[e]=!0,r.call(n,t,h)},null)}},e.prototype.handleFontsChanged_=function(t){var e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.prepareFrame=function(t,e){var i=this.getLayer(),r=i.getSource(),n=t.viewHints[kn],o=t.viewHints[jn],s=i.getUpdateWhileAnimating(),a=i.getUpdateWhileInteracting();if(!this.dirty_&&!s&&n||!a&&o)return!0;var h=t.extent,l=t.viewState,u=l.projection,p=l.resolution,c=t.pixelRatio,d=i.getRevision(),f=i.getRenderBuffer(),_=i.getRenderOrder();void 0===_&&(_=Da);var g=et(h,f*p),y=l.projection.getExtent();if(r.getWrapX()&&l.projection.canWrapX()&&!ot(y,t.extent)){var v=Ot(y),m=Math.max(Ot(g)/2,v);g[0]=y[0]-m,g[2]=y[2]+m}if(!this.dirty_&&this.renderedResolution_==p&&this.renderedRevision_==d&&this.renderedRenderOrder_==_&&ot(this.renderedExtent_,g))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var x=new Aa(ja(p,c),g,p,c,r.getOverlaps(),this.declutterTree_,i.getRenderBuffer());r.loadFeatures(g,p,u);var E=function(t){var e,r=t.getStyleFunction()||i.getStyleFunction();if(r&&(e=r(t,p)),e){var n=this.renderFeature(t,p,c,e,x);this.dirty_=this.dirty_||n}}.bind(this);if(_){var S=[];r.forEachFeatureInExtent(g,function(t){S.push(t)}),S.sort(_);for(var T=0,C=S.length;T=0;--x){var E=g[x];if(E.getState()!=On.ABORT)for(var S=E.tileCoord,T=y.getTileCoordExtent(S,this.tmpExtent)[0]-E.extent[0],C=void 0,R=0,w=E.tileKeys.length;R radius + v_halfWidth) {\n if (u_strokeColor.a == 0.0) {\n gl_FragColor = u_fillColor;\n } else {\n gl_FragColor = u_strokeColor;\n }\n gl_FragColor.a = gl_FragColor.a - (dist - (radius + v_halfWidth));\n } else if (u_fillColor.a == 0.0) {\n // Hooray, no fill, just stroke. We can use real antialiasing.\n gl_FragColor = u_strokeColor;\n if (dist < radius - v_halfWidth) {\n gl_FragColor.a = gl_FragColor.a - (radius - v_halfWidth - dist);\n }\n } else {\n gl_FragColor = u_fillColor;\n float strokeDist = radius - v_halfWidth;\n float antialias = 2.0 * v_pixelRatio;\n if (dist > strokeDist) {\n gl_FragColor = u_strokeColor;\n } else if (dist >= strokeDist - antialias) {\n float step = smoothstep(strokeDist - antialias, strokeDist, dist);\n gl_FragColor = mix(u_fillColor, u_strokeColor, step);\n }\n }\n gl_FragColor.a = gl_FragColor.a * u_opacity;\n if (gl_FragColor.a <= 0.0) {\n discard;\n }\n}\n"),ch=new uh("varying vec2 v_center;\nvarying vec2 v_offset;\nvarying float v_halfWidth;\nvarying float v_pixelRatio;\n\n\nattribute vec2 a_position;\nattribute float a_instruction;\nattribute float a_radius;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n v_center = vec4(u_projectionMatrix * vec4(a_position, 0.0, 1.0)).xy;\n v_pixelRatio = u_pixelRatio;\n float lineWidth = u_lineWidth * u_pixelRatio;\n v_halfWidth = lineWidth / 2.0;\n if (lineWidth == 0.0) {\n lineWidth = 2.0 * u_pixelRatio;\n }\n vec2 offset;\n // Radius with anitaliasing (roughly).\n float radius = a_radius + 3.0 * u_pixelRatio;\n // Until we get gl_VertexID in WebGL, we store an instruction.\n if (a_instruction == 0.0) {\n // Offsetting the edges of the triangle by lineWidth / 2 is necessary, however\n // we should also leave some space for the antialiasing, thus we offset by lineWidth.\n offset = vec2(-1.0, 1.0);\n } else if (a_instruction == 1.0) {\n offset = vec2(-1.0, -1.0);\n } else if (a_instruction == 2.0) {\n offset = vec2(1.0, -1.0);\n } else {\n offset = vec2(1.0, 1.0);\n }\n\n gl_Position = u_projectionMatrix * vec4(a_position + offset * radius, 0.0, 1.0) +\n offsetMatrix * vec4(offset * lineWidth, 0.0, 0.0);\n v_offset = vec4(u_projectionMatrix * vec4(a_position.x + a_radius, a_position.y,\n 0.0, 1.0)).xy;\n\n if (distance(v_center, v_offset) > 20000.0) {\n gl_Position = vec4(v_center, 0.0, 1.0);\n }\n}\n\n\n"),dh=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_lineWidth=t.getUniformLocation(e,"u_lineWidth"),this.u_pixelRatio=t.getUniformLocation(e,"u_pixelRatio"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.u_fillColor=t.getUniformLocation(e,"u_fillColor"),this.u_strokeColor=t.getUniformLocation(e,"u_strokeColor"),this.u_size=t.getUniformLocation(e,"u_size"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_instruction=t.getAttribLocation(e,"a_instruction"),this.a_radius=t.getAttribLocation(e,"a_radius")};function fh(t,e){return t[0]=e[0],t[1]=e[1],t[4]=e[2],t[5]=e[3],t[12]=e[4],t[13]=e[5],t}var _h=function(t){function e(e,i){t.call(this),this.tolerance=e,this.maxExtent=i,this.origin=Tt(i),this.projectionMatrix_=[1,0,0,1,0,0],this.offsetRotateMatrix_=[1,0,0,1,0,0],this.offsetScaleMatrix_=[1,0,0,1,0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.indices=[],this.indicesBuffer=null,this.startIndices=[],this.startIndicesFeature=[],this.vertices=[],this.verticesBuffer=null,this.lineStringReplay=void 0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDeleteResourcesFunction=function(t){return r()},e.prototype.finish=function(t){r()},e.prototype.setUpProgram=function(t,e,i,n){return r()},e.prototype.shutDownProgram=function(t,e){r()},e.prototype.drawReplay=function(t,e,i,n){r()},e.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,n,o){return r()},e.prototype.drawHitDetectionReplay=function(t,e,i,r,n,o){return n?this.drawHitDetectionReplayOneByOne(t,e,i,r,o):this.drawHitDetectionReplayAll(t,e,i,r)},e.prototype.drawHitDetectionReplayAll=function(t,e,i,r){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawReplay(t,e,i,!0);var n=r(null);return n||void 0},e.prototype.replay=function(t,e,i,r,n,o,s,a,h,l,u){var p,c,d,f,_,g,y,v,m=t.getGL();this.lineStringReplay&&(p=m.isEnabled(m.STENCIL_TEST),c=m.getParameter(m.STENCIL_FUNC),d=m.getParameter(m.STENCIL_VALUE_MASK),f=m.getParameter(m.STENCIL_REF),_=m.getParameter(m.STENCIL_WRITEMASK),g=m.getParameter(m.STENCIL_FAIL),y=m.getParameter(m.STENCIL_PASS_DEPTH_PASS),v=m.getParameter(m.STENCIL_PASS_DEPTH_FAIL),m.enable(m.STENCIL_TEST),m.clear(m.STENCIL_BUFFER_BIT),m.stencilMask(255),m.stencilFunc(m.ALWAYS,1,255),m.stencilOp(m.KEEP,m.KEEP,m.REPLACE),this.lineStringReplay.replay(t,e,i,r,n,o,s,a,h,l,u),m.stencilMask(0),m.stencilFunc(m.NOTEQUAL,1,255)),t.bindBuffer(34962,this.verticesBuffer),t.bindBuffer(34963,this.indicesBuffer);var x=this.setUpProgram(m,t,n,o),E=Fe(this.projectionMatrix_);je(E,2/(i*n[0]),2/(i*n[1])),ke(E,-r),Ue(E,-(e[0]-this.origin[0]),-(e[1]-this.origin[1]));var S=Fe(this.offsetScaleMatrix_);je(S,2/n[0],2/n[1]);var T,C=Fe(this.offsetRotateMatrix_);return 0!==r&&ke(C,-r),m.uniformMatrix4fv(x.u_projectionMatrix,!1,fh(this.tmpMat4_,E)),m.uniformMatrix4fv(x.u_offsetScaleMatrix,!1,fh(this.tmpMat4_,S)),m.uniformMatrix4fv(x.u_offsetRotateMatrix,!1,fh(this.tmpMat4_,C)),m.uniform1f(x.u_opacity,s),void 0===h?this.drawReplay(m,t,a,!1):T=this.drawHitDetectionReplay(m,t,a,h,l,u),this.shutDownProgram(m,x),this.lineStringReplay&&(p||m.disable(m.STENCIL_TEST),m.clear(m.STENCIL_BUFFER_BIT),m.stencilFunc(c,f,d),m.stencilMask(_),m.stencilOp(g,v,y)),T},e.prototype.drawElements=function(t,e,i,r){var n=e.hasOESElementIndexUint?5125:5123,o=r-i,s=i*(e.hasOESElementIndexUint?4:2);t.drawElements(4,o,n,s)},e}(Vs),gh=[0,0,0,1],yh=[],vh=[0,0,0,1],mh=Number.EPSILON||2.220446049250313e-16,xh=function(t,e,i,r,n,o){var s=(i-t)*(o-e)-(n-t)*(r-e);return s<=mh&&s>=-mh?void 0:s>0},Eh=35044,Sh=function(t,e){this.arr_=void 0!==t?t:[],this.usage_=void 0!==e?e:Eh};Sh.prototype.getArray=function(){return this.arr_},Sh.prototype.getUsage=function(){return this.usage_};var Th=Sh,Ch=function(t){function e(e,i){t.call(this,e,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.radius_=0,this.state_={fillColor:null,strokeColor:null,lineDash:null,lineDashOffset:void 0,lineWidth:void 0,changed:!1}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawCoordinates_=function(t,e,i,r){var n,o,s=this.vertices.length,a=this.indices.length,h=s/4;for(n=e,o=i;n0&&(this.styles_=[]),this.vertices=null,this.indices=null},e.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer,i=this.indicesBuffer;return function(){t.deleteBuffer(e),t.deleteBuffer(i)}},e.prototype.setUpProgram=function(t,e,i,r){var n,o=e.getProgram(ph,ch);return this.defaultLocations_?n=this.defaultLocations_:(n=new dh(t,o),this.defaultLocations_=n),e.useProgram(o),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,5126,!1,16,0),t.enableVertexAttribArray(n.a_instruction),t.vertexAttribPointer(n.a_instruction,1,5126,!1,16,8),t.enableVertexAttribArray(n.a_radius),t.vertexAttribPointer(n.a_radius,1,5126,!1,16,12),t.uniform2fv(n.u_size,i),t.uniform1f(n.u_pixelRatio,r),n},e.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_position),t.disableVertexAttribArray(e.a_instruction),t.disableVertexAttribArray(e.a_radius)},e.prototype.drawReplay=function(t,e,i,r){var n,o,s,a;if(d(i))for(s=this.startIndices[this.startIndices.length-1],n=this.styleIndices_.length-1;n>=0;--n)o=this.styleIndices_[n],a=this.styles_[n],this.setFillStyle_(t,a[0]),this.setStrokeStyle_(t,a[1],a[2]),this.drawElements(t,e,o,s),s=o;else this.drawReplaySkipping_(t,e,i)},e.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var s,a,h,l,u,p,c;for(c=this.startIndices.length-2,h=this.startIndices[c+1],s=this.styleIndices_.length-1;s>=0;--s)for(l=this.styles_[s],this.setFillStyle_(t,l[0]),this.setStrokeStyle_(t,l[1],l[2]),u=this.styleIndices_[s];c>=0&&this.startIndices[c]>=u;){if(a=this.startIndices[c],void 0===i[o(p=this.startIndicesFeature[c])]&&p.getGeometry()&&(void 0===n||Pt(n,p.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,a,h);var d=r(p);if(d)return d}c--,h=a}},e.prototype.drawReplaySkipping_=function(t,e,i){var r,n,s,a,h,l,u;for(l=this.startIndices.length-2,s=n=this.startIndices[l+1],r=this.styleIndices_.length-1;r>=0;--r){for(a=this.styles_[r],this.setFillStyle_(t,a[0]),this.setStrokeStyle_(t,a[1],a[2]),h=this.styleIndices_[r];l>=0&&this.startIndices[l]>=h;)u=this.startIndices[l],i[o(this.startIndicesFeature[l])]&&(n!==s&&this.drawElements(t,e,n,s),s=u),l--,n=u;n!==s&&this.drawElements(t,e,n,s),n=s=h}},e.prototype.setFillStyle_=function(t,e){t.uniform4fv(this.defaultLocations_.u_fillColor,e)},e.prototype.setStrokeStyle_=function(t,e,i){t.uniform4fv(this.defaultLocations_.u_strokeColor,e),t.uniform1f(this.defaultLocations_.u_lineWidth,i)},e.prototype.setFillStrokeStyle=function(t,e){var i,r;if(e){var n=e.getLineDash();this.state_.lineDash=n||yh;var o=e.getLineDashOffset();this.state_.lineDashOffset=o||0,i=(i=e.getColor())instanceof CanvasGradient||i instanceof CanvasPattern?vh:_r(i).map(function(t,e){return 3!=e?t/255:t})||vh,r=void 0!==(r=e.getWidth())?r:1}else i=[0,0,0,0],r=0;var s=t?t.getColor():[0,0,0,0];s=s instanceof CanvasGradient||s instanceof CanvasPattern?gh:_r(s).map(function(t,e){return 3!=e?t/255:t})||gh,this.state_.strokeColor&&Z(this.state_.strokeColor,i)&&this.state_.fillColor&&Z(this.state_.fillColor,s)&&this.state_.lineWidth===r||(this.state_.changed=!0,this.state_.fillColor=s,this.state_.strokeColor=i,this.state_.lineWidth=r,this.styles_.push([s,i,r]))},e}(_h),Rh=new lh("precision mediump float;\nvarying vec2 v_texCoord;\nvarying float v_opacity;\n\nuniform float u_opacity;\nuniform sampler2D u_image;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n float alpha = texColor.a * v_opacity * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n"),wh=new uh("varying vec2 v_texCoord;\nvarying float v_opacity;\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec2 a_offsets;\nattribute float a_opacity;\nattribute float a_rotateWithView;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n if (a_rotateWithView == 1.0) {\n offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n }\n vec4 offsets = offsetMatrix * vec4(a_offsets, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n v_texCoord = a_texCoord;\n v_opacity = a_opacity;\n}\n\n\n"),Ih=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.u_image=t.getUniformLocation(e,"u_image"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_texCoord=t.getAttribLocation(e,"a_texCoord"),this.a_offsets=t.getAttribLocation(e,"a_offsets"),this.a_opacity=t.getAttribLocation(e,"a_opacity"),this.a_rotateWithView=t.getAttribLocation(e,"a_rotateWithView")},Lh={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"};function Oh(t,e,i){var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),void 0!==e&&t.texParameteri(eh,$a,e),void 0!==i&&t.texParameteri(eh,th,i),r}function Ph(t,e,i,r,n){var o=Oh(t,r,n);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,i,0,t.RGBA,t.UNSIGNED_BYTE,null),o}function bh(t,e,i,r){var n=Oh(t,i,r);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),n}var Mh=function(t){function e(e,i){t.call(this),this.canvas_=e,this.gl_=i,this.bufferCache_={},this.shaderCache_={},this.programCache_={},this.currentProgram_=null,this.hitDetectionFramebuffer_=null,this.hitDetectionTexture_=null,this.hitDetectionRenderbuffer_=null,this.hasOESElementIndexUint=X(oh,"OES_element_index_uint"),this.hasOESElementIndexUint&&i.getExtension("OES_element_index_uint"),v(this.canvas_,Lh.LOST,this.handleWebGLContextLost,this),v(this.canvas_,Lh.RESTORED,this.handleWebGLContextRestored,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.bindBuffer=function(t,e){var i=this.getGL(),r=e.getArray(),n=o(e);if(n in this.bufferCache_){var s=this.bufferCache_[n];i.bindBuffer(t,s.buffer)}else{var a,h=i.createBuffer();i.bindBuffer(t,h),34962==t?a=new Float32Array(r):34963==t&&(a=this.hasOESElementIndexUint?new Uint32Array(r):new Uint16Array(r)),i.bufferData(t,a,e.getUsage()),this.bufferCache_[n]={buf:e,buffer:h}}},e.prototype.deleteBuffer=function(t){var e=this.getGL(),i=o(t),r=this.bufferCache_[i];e.isContextLost()||e.deleteBuffer(r.buffer),delete this.bufferCache_[i]},e.prototype.disposeInternal=function(){S(this.canvas_);var t=this.getGL();if(!t.isContextLost()){for(var e in this.bufferCache_)t.deleteBuffer(this.bufferCache_[e].buffer);for(var i in this.programCache_)t.deleteProgram(this.programCache_[i]);for(var r in this.shaderCache_)t.deleteShader(this.shaderCache_[r]);t.deleteFramebuffer(this.hitDetectionFramebuffer_),t.deleteRenderbuffer(this.hitDetectionRenderbuffer_),t.deleteTexture(this.hitDetectionTexture_)}},e.prototype.getCanvas=function(){return this.canvas_},e.prototype.getGL=function(){return this.gl_},e.prototype.getHitDetectionFramebuffer=function(){return this.hitDetectionFramebuffer_||this.initHitDetectionFramebuffer_(),this.hitDetectionFramebuffer_},e.prototype.getShader=function(t){var e=o(t);if(e in this.shaderCache_)return this.shaderCache_[e];var i=this.getGL(),r=i.createShader(t.getType());return i.shaderSource(r,t.getSource()),i.compileShader(r),this.shaderCache_[e]=r,r},e.prototype.getProgram=function(t,e){var i=o(t)+"/"+o(e);if(i in this.programCache_)return this.programCache_[i];var r=this.getGL(),n=r.createProgram();return r.attachShader(n,this.getShader(t)),r.attachShader(n,this.getShader(e)),r.linkProgram(n),this.programCache_[i]=n,n},e.prototype.handleWebGLContextLost=function(){p(this.bufferCache_),p(this.shaderCache_),p(this.programCache_),this.currentProgram_=null,this.hitDetectionFramebuffer_=null,this.hitDetectionTexture_=null,this.hitDetectionRenderbuffer_=null},e.prototype.handleWebGLContextRestored=function(){},e.prototype.initHitDetectionFramebuffer_=function(){var t=this.gl_,e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var i=Ph(t,1,1),r=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,1,1),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,r),t.bindTexture(t.TEXTURE_2D,null),t.bindRenderbuffer(t.RENDERBUFFER,null),t.bindFramebuffer(t.FRAMEBUFFER,null),this.hitDetectionFramebuffer_=e,this.hitDetectionTexture_=i,this.hitDetectionRenderbuffer_=r},e.prototype.useProgram=function(t){return t!=this.currentProgram_&&(this.getGL().useProgram(t),this.currentProgram_=t,!0)},e}(C),Fh=function(t){function e(e,i){t.call(this,e,i),this.anchorX=void 0,this.anchorY=void 0,this.groupIndices=[],this.hitDetectionGroupIndices=[],this.height=void 0,this.imageHeight=void 0,this.imageWidth=void 0,this.defaultLocations=null,this.opacity=void 0,this.originX=void 0,this.originY=void 0,this.rotateWithView=void 0,this.rotation=void 0,this.scale=void 0,this.width=void 0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer,i=this.indicesBuffer,r=this.getTextures(!0),n=t.getGL();return function(){var o,s;if(!n.isContextLost())for(o=0,s=r.length;o0?n[s-1]:0,u=n[s],p=l,c=l;h=0;--s)for(t.bindTexture(eh,c[s]),a=s>0?this.hitDetectionGroupIndices[s-1]:0,l=this.hitDetectionGroupIndices[s];p>=0&&this.startIndices[p]>=a;){if(h=this.startIndices[p],void 0===i[o(u=this.startIndicesFeature[p])]&&u.getGeometry()&&(void 0===n||Pt(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,h,l);var d=r(u);if(d)return d}l=h,p--}},e.prototype.finish=function(t){this.anchorX=void 0,this.anchorY=void 0,this.height=void 0,this.imageHeight=void 0,this.imageWidth=void 0,this.indices=null,this.opacity=void 0,this.originX=void 0,this.originY=void 0,this.rotateWithView=void 0,this.rotation=void 0,this.scale=void 0,this.vertices=null,this.width=void 0},e.prototype.getTextures=function(t){return r()},e.prototype.getHitDetectionTextures=function(){return r()},e}(_h),Ah=function(t){function e(e,i){t.call(this,e,i),this.images_=[],this.hitDetectionImages_=[],this.textures_=[],this.hitDetectionTextures_=[]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawMultiPoint=function(t,e){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(e);var i=t.getFlatCoordinates(),r=t.getStride();this.drawCoordinates(i,0,i.length,r)},e.prototype.drawPoint=function(t,e){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(e);var i=t.getFlatCoordinates(),r=t.getStride();this.drawCoordinates(i,0,i.length,r)},e.prototype.finish=function(e){var i=e.getGL();this.groupIndices.push(this.indices.length),this.hitDetectionGroupIndices.push(this.indices.length),this.verticesBuffer=new Th(this.vertices);var r=this.indices;this.indicesBuffer=new Th(r);var n={};this.createTextures(this.textures_,this.images_,n,i),this.createTextures(this.hitDetectionTextures_,this.hitDetectionImages_,n,i),this.images_=null,this.hitDetectionImages_=null,t.prototype.finish.call(this,e)},e.prototype.setImageStyle=function(t){var e=t.getAnchor(),i=t.getImage(1),r=t.getImageSize(),n=t.getHitDetectionImage(1),s=t.getOpacity(),a=t.getOrigin(),h=t.getRotateWithView(),l=t.getRotation(),u=t.getSize(),p=t.getScale();0===this.images_.length?this.images_.push(i):o(this.images_[this.images_.length-1])!=o(i)&&(this.groupIndices.push(this.indices.length),this.images_.push(i)),0===this.hitDetectionImages_.length?this.hitDetectionImages_.push(n):o(this.hitDetectionImages_[this.hitDetectionImages_.length-1])!=o(n)&&(this.hitDetectionGroupIndices.push(this.indices.length),this.hitDetectionImages_.push(n)),this.anchorX=e[0],this.anchorY=e[1],this.height=u[1],this.imageHeight=r[1],this.imageWidth=r[0],this.opacity=s,this.originX=a[0],this.originY=a[1],this.rotation=l,this.rotateWithView=h,this.scale=p,this.width=u[0]},e.prototype.getTextures=function(t){return t?this.textures_.concat(this.hitDetectionTextures_):this.textures_},e.prototype.getHitDetectionTextures=function(){return this.hitDetectionTextures_},e}(Fh);function Nh(t,e,i,r){var n=i-r;return t[e]===t[n]&&t[e+1]===t[n+1]&&(i-e)/r>3&&!!Ke(t,e,i,r)}var Gh=new lh("precision mediump float;\nvarying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_color;\nuniform vec2 u_size;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n if (v_round > 0.0) {\n vec2 windowCoords = vec2((v_roundVertex.x + 1.0) / 2.0 * u_size.x * u_pixelRatio,\n (v_roundVertex.y + 1.0) / 2.0 * u_size.y * u_pixelRatio);\n if (length(windowCoords - gl_FragCoord.xy) > v_halfWidth * u_pixelRatio) {\n discard;\n }\n }\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n"),Dh=new uh("varying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\nattribute vec2 a_lastPos;\nattribute vec2 a_position;\nattribute vec2 a_nextPos;\nattribute float a_direction;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_miterLimit;\n\nbool nearlyEquals(in float value, in float ref) {\n float epsilon = 0.000000000001;\n return value >= ref - epsilon && value <= ref + epsilon;\n}\n\nvoid alongNormal(out vec2 offset, in vec2 nextP, in float turnDir, in float direction) {\n vec2 dirVect = nextP - a_position;\n vec2 normal = normalize(vec2(-turnDir * dirVect.y, turnDir * dirVect.x));\n offset = u_lineWidth / 2.0 * normal * direction;\n}\n\nvoid miterUp(out vec2 offset, out float round, in bool isRound, in float direction) {\n float halfWidth = u_lineWidth / 2.0;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_nextPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n round = 0.0;\n if (isRound) {\n round = 1.0;\n } else if (miterLength > u_miterLimit + u_lineWidth) {\n offset = halfWidth * tmpNormal * direction;\n }\n}\n\nbool miterDown(out vec2 offset, in vec4 projPos, in mat4 offsetMatrix, in float direction) {\n bool degenerate = false;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_lastPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n vec2 longOffset, shortOffset, longVertex;\n vec4 shortProjVertex;\n float halfWidth = u_lineWidth / 2.0;\n if (length(a_nextPos - a_position) > length(a_lastPos - a_position)) {\n longOffset = tmpNormal * direction * halfWidth;\n shortOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_nextPos;\n shortProjVertex = u_projectionMatrix * vec4(a_lastPos, 0.0, 1.0);\n } else {\n shortOffset = tmpNormal * direction * halfWidth;\n longOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_lastPos;\n shortProjVertex = u_projectionMatrix * vec4(a_nextPos, 0.0, 1.0);\n }\n //Intersection algorithm based on theory by Paul Bourke (http://paulbourke.net/geometry/pointlineplane/).\n vec4 p1 = u_projectionMatrix * vec4(longVertex, 0.0, 1.0) + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p2 = projPos + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p3 = shortProjVertex + offsetMatrix * vec4(-shortOffset, 0.0, 0.0);\n vec4 p4 = shortProjVertex + offsetMatrix * vec4(shortOffset, 0.0, 0.0);\n float denom = (p4.y - p3.y) * (p2.x - p1.x) - (p4.x - p3.x) * (p2.y - p1.y);\n float firstU = ((p4.x - p3.x) * (p1.y - p3.y) - (p4.y - p3.y) * (p1.x - p3.x)) / denom;\n float secondU = ((p2.x - p1.x) * (p1.y - p3.y) - (p2.y - p1.y) * (p1.x - p3.x)) / denom;\n float epsilon = 0.000000000001;\n if (firstU > epsilon && firstU < 1.0 - epsilon && secondU > epsilon && secondU < 1.0 - epsilon) {\n shortProjVertex.x = p1.x + firstU * (p2.x - p1.x);\n shortProjVertex.y = p1.y + firstU * (p2.y - p1.y);\n offset = shortProjVertex.xy;\n degenerate = true;\n } else {\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n }\n return degenerate;\n}\n\nvoid squareCap(out vec2 offset, out float round, in bool isRound, in vec2 nextP,\n in float turnDir, in float direction) {\n round = 0.0;\n vec2 dirVect = a_position - nextP;\n vec2 firstNormal = normalize(dirVect);\n vec2 secondNormal = vec2(turnDir * firstNormal.y * direction, -turnDir * firstNormal.x * direction);\n vec2 hypotenuse = normalize(firstNormal - secondNormal);\n vec2 normal = vec2(turnDir * hypotenuse.y * direction, -turnDir * hypotenuse.x * direction);\n float length = sqrt(v_halfWidth * v_halfWidth * 2.0);\n offset = normal * length;\n if (isRound) {\n round = 1.0;\n }\n}\n\nvoid main(void) {\n bool degenerate = false;\n float direction = float(sign(a_direction));\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n vec2 offset;\n vec4 projPos = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n bool round = nearlyEquals(mod(a_direction, 2.0), 0.0);\n\n v_round = 0.0;\n v_halfWidth = u_lineWidth / 2.0;\n v_roundVertex = projPos.xy;\n\n if (nearlyEquals(mod(a_direction, 3.0), 0.0) || nearlyEquals(mod(a_direction, 17.0), 0.0)) {\n alongNormal(offset, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 5.0), 0.0) || nearlyEquals(mod(a_direction, 13.0), 0.0)) {\n alongNormal(offset, a_lastPos, -1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 23.0), 0.0)) {\n miterUp(offset, v_round, round, direction);\n } else if (nearlyEquals(mod(a_direction, 19.0), 0.0)) {\n degenerate = miterDown(offset, projPos, offsetMatrix, direction);\n } else if (nearlyEquals(mod(a_direction, 7.0), 0.0)) {\n squareCap(offset, v_round, round, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 11.0), 0.0)) {\n squareCap(offset, v_round, round, a_lastPos, -1.0, direction);\n }\n if (!degenerate) {\n vec4 offsets = offsetMatrix * vec4(offset, 0.0, 0.0);\n gl_Position = projPos + offsets;\n } else {\n gl_Position = vec4(offset, 0.0, 1.0);\n }\n}\n\n\n"),kh=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_lineWidth=t.getUniformLocation(e,"u_lineWidth"),this.u_miterLimit=t.getUniformLocation(e,"u_miterLimit"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.u_color=t.getUniformLocation(e,"u_color"),this.u_size=t.getUniformLocation(e,"u_size"),this.u_pixelRatio=t.getUniformLocation(e,"u_pixelRatio"),this.a_lastPos=t.getAttribLocation(e,"a_lastPos"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_nextPos=t.getAttribLocation(e,"a_nextPos"),this.a_direction=t.getAttribLocation(e,"a_direction")},jh=3,Uh=5,Yh=7,Bh=11,Vh=13,Xh=17,zh=19,Wh=23,Kh=function(t){function e(e,i){t.call(this,e,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,lineJoin:void 0,lineWidth:void 0,miterLimit:void 0,changed:!1}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawCoordinates_=function(t,e,i,r){var n,o,s,a,h,l,u,p,c=this.vertices.length,d=this.indices.length,f="bevel"===this.state_.lineJoin?0:"miter"===this.state_.lineJoin?1:2,_="butt"===this.state_.lineCap?0:"square"===this.state_.lineCap?1:2,g=Nh(t,e,i,r),y=d,v=1;for(n=e,o=i;ne&&(this.indices[d++]=h,this.indices[d++]=y-1,this.indices[d++]=y,this.indices[d++]=h+2,this.indices[d++]=h,this.indices[d++]=v*a>0?y:y-1),this.indices[d++]=h,this.indices[d++]=h+2,this.indices[d++]=h+1,y=h+2,v=a,f&&(c=this.addVertices_(l,u,p,a*Wh*f,c),this.indices[d++]=h+1,this.indices[d++]=h+3,this.indices[d++]=h)}g&&(h=h||c/7,a=Si([l[0],l[1],u[0],u[1],p[0],p[1]],0,6,2)?1:-1,c=this.addVertices_(l,u,p,a*Vh*(f||1),c),c=this.addVertices_(l,u,p,-a*zh*(f||1),c),this.indices[d++]=h,this.indices[d++]=y-1,this.indices[d++]=y,this.indices[d++]=h+1,this.indices[d++]=h,this.indices[d++]=v*a>0?y:y-1)},e.prototype.addVertices_=function(t,e,i,r,n){return this.vertices[n++]=t[0],this.vertices[n++]=t[1],this.vertices[n++]=e[0],this.vertices[n++]=e[1],this.vertices[n++]=i[0],this.vertices[n++]=i[1],this.vertices[n++]=r,n},e.prototype.isValid_=function(t,e,i,r){var n=i-e;return!(n<2*r)&&(n!==2*r||!Z([t[e],t[e+1]],[t[e+r],t[e+r+1]]))},e.prototype.drawLineString=function(t,e){var i=t.getFlatCoordinates(),r=t.getStride();this.isValid_(i,0,i.length,r)&&(i=Dt(i,0,i.length,r,-this.origin[0],-this.origin[1]),this.state_.changed&&(this.styleIndices_.push(this.indices.length),this.state_.changed=!1),this.startIndices.push(this.indices.length),this.startIndicesFeature.push(e),this.drawCoordinates_(i,0,i.length,r))},e.prototype.drawMultiLineString=function(t,e){var i=this.indices.length,r=t.getEnds();r.unshift(0);var n,o,s=t.getFlatCoordinates(),a=t.getStride();if(r.length>1)for(n=1,o=r.length;ni&&(this.startIndices.push(i),this.startIndicesFeature.push(e),this.state_.changed&&(this.styleIndices_.push(i),this.state_.changed=!1))},e.prototype.drawPolygonCoordinates=function(t,e,i){var r,n;if(Nh(t,0,t.length,i)||(t.push(t[0]),t.push(t[1])),this.drawCoordinates_(t,0,t.length,i),e.length)for(r=0,n=e.length;r0&&(this.styles_=[]),this.vertices=null,this.indices=null},e.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer,i=this.indicesBuffer;return function(){t.deleteBuffer(e),t.deleteBuffer(i)}},e.prototype.setUpProgram=function(t,e,i,r){var n,o=e.getProgram(Gh,Dh);return this.defaultLocations_?n=this.defaultLocations_:(n=new kh(t,o),this.defaultLocations_=n),e.useProgram(o),t.enableVertexAttribArray(n.a_lastPos),t.vertexAttribPointer(n.a_lastPos,2,5126,!1,28,0),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,5126,!1,28,8),t.enableVertexAttribArray(n.a_nextPos),t.vertexAttribPointer(n.a_nextPos,2,5126,!1,28,16),t.enableVertexAttribArray(n.a_direction),t.vertexAttribPointer(n.a_direction,1,5126,!1,28,24),t.uniform2fv(n.u_size,i),t.uniform1f(n.u_pixelRatio,r),n},e.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_lastPos),t.disableVertexAttribArray(e.a_position),t.disableVertexAttribArray(e.a_nextPos),t.disableVertexAttribArray(e.a_direction)},e.prototype.drawReplay=function(t,e,i,r){var n,o,s,a,h=t.getParameter(t.DEPTH_FUNC),l=t.getParameter(t.DEPTH_WRITEMASK);if(r||(t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.NOTEQUAL)),d(i))for(s=this.startIndices[this.startIndices.length-1],n=this.styleIndices_.length-1;n>=0;--n)o=this.styleIndices_[n],a=this.styles_[n],this.setStrokeStyle_(t,a[0],a[1],a[2]),this.drawElements(t,e,o,s),t.clear(t.DEPTH_BUFFER_BIT),s=o;else this.drawReplaySkipping_(t,e,i);r||(t.disable(t.DEPTH_TEST),t.clear(t.DEPTH_BUFFER_BIT),t.depthMask(l),t.depthFunc(h))},e.prototype.drawReplaySkipping_=function(t,e,i){var r,n,s,a,h,l,u;for(l=this.startIndices.length-2,s=n=this.startIndices[l+1],r=this.styleIndices_.length-1;r>=0;--r){for(a=this.styles_[r],this.setStrokeStyle_(t,a[0],a[1],a[2]),h=this.styleIndices_[r];l>=0&&this.startIndices[l]>=h;)u=this.startIndices[l],i[o(this.startIndicesFeature[l])]&&(n!==s&&(this.drawElements(t,e,n,s),t.clear(t.DEPTH_BUFFER_BIT)),s=u),l--,n=u;n!==s&&(this.drawElements(t,e,n,s),t.clear(t.DEPTH_BUFFER_BIT)),n=s=h}},e.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var s,a,h,l,u,p,c;for(c=this.startIndices.length-2,h=this.startIndices[c+1],s=this.styleIndices_.length-1;s>=0;--s)for(l=this.styles_[s],this.setStrokeStyle_(t,l[0],l[1],l[2]),u=this.styleIndices_[s];c>=0&&this.startIndices[c]>=u;){if(a=this.startIndices[c],void 0===i[o(p=this.startIndicesFeature[c])]&&p.getGeometry()&&(void 0===n||Pt(n,p.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,a,h);var d=r(p);if(d)return d}c--,h=a}},e.prototype.setStrokeStyle_=function(t,e,i,r){t.uniform4fv(this.defaultLocations_.u_color,e),t.uniform1f(this.defaultLocations_.u_lineWidth,i),t.uniform1f(this.defaultLocations_.u_miterLimit,r)},e.prototype.setFillStrokeStyle=function(t,e){var i=e.getLineCap();this.state_.lineCap=void 0!==i?i:"round";var r=e.getLineDash();this.state_.lineDash=r||yh;var n=e.getLineDashOffset();this.state_.lineDashOffset=n||0;var o=e.getLineJoin();this.state_.lineJoin=void 0!==o?o:"round";var s=e.getColor();s=s instanceof CanvasGradient||s instanceof CanvasPattern?vh:_r(s).map(function(t,e){return 3!=e?t/255:t})||vh;var a=e.getWidth();a=void 0!==a?a:1;var h=e.getMiterLimit();h=void 0!==h?h:10,this.state_.strokeColor&&Z(this.state_.strokeColor,s)&&this.state_.lineWidth===a&&this.state_.miterLimit===h||(this.state_.changed=!0,this.state_.strokeColor=s,this.state_.lineWidth=a,this.state_.miterLimit=h,this.styles_.push([s,a,h]))},e}(_h),Hh=new lh("precision mediump float;\n\n\n\nuniform vec4 u_color;\nuniform float u_opacity;\n\nvoid main(void) {\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n"),Zh=new uh("\n\nattribute vec2 a_position;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n}\n\n\n"),qh=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_color=t.getUniformLocation(e,"u_color"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.a_position=t.getAttribLocation(e,"a_position")},Jh=function(t){this.first_,this.last_,this.head_,this.circular_=void 0===t||t,this.length_=0};Jh.prototype.insertItem=function(t){var e={prev:void 0,next:void 0,data:t},i=this.head_;if(i){var r=i.next;e.prev=i,e.next=r,i.next=e,r&&(r.prev=e),i===this.last_&&(this.last_=e)}else this.first_=e,this.last_=e,this.circular_&&(e.next=e,e.prev=e);this.head_=e,this.length_++},Jh.prototype.removeItem=function(){var t=this.head_;if(t){var e=t.next,i=t.prev;e&&(e.prev=i),i&&(i.next=e),this.head_=e||i,this.first_===this.last_?(this.head_=void 0,this.first_=void 0,this.last_=void 0):this.first_===t?this.first_=this.head_:this.last_===t&&(this.last_=i?this.head_.prev:this.head_),this.length_--}},Jh.prototype.firstItem=function(){if(this.head_=this.first_,this.head_)return this.head_.data},Jh.prototype.lastItem=function(){if(this.head_=this.last_,this.head_)return this.head_.data},Jh.prototype.nextItem=function(){if(this.head_&&this.head_.next)return this.head_=this.head_.next,this.head_.data},Jh.prototype.getNextItem=function(){if(this.head_&&this.head_.next)return this.head_.next.data},Jh.prototype.prevItem=function(){if(this.head_&&this.head_.prev)return this.head_=this.head_.prev,this.head_.data},Jh.prototype.getPrevItem=function(){if(this.head_&&this.head_.prev)return this.head_.prev.data},Jh.prototype.getCurrItem=function(){if(this.head_)return this.head_.data},Jh.prototype.setFirstItem=function(){this.circular_&&this.head_&&(this.first_=this.head_,this.last_=this.head_.prev)},Jh.prototype.concat=function(t){if(t.head_){if(this.head_){var e=this.head_.next;this.head_.next=t.first_,t.first_.prev=this.head_,e.prev=t.last_,t.last_.next=e,this.length_+=t.length_}else this.head_=t.head_,this.first_=t.first_,this.last_=t.last_,this.length_=t.length_;t.head_=void 0,t.first_=void 0,t.last_=void 0,t.length_=0}},Jh.prototype.getLength=function(){return this.length_};var Qh=Jh,$h=function(t){this.rbush_=ua()(t,void 0),this.items_={}};$h.prototype.insert=function(t,e){var i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[o(e)]=i},$h.prototype.load=function(t,e){for(var i=new Array(e.length),r=0,n=e.length;r=s;o-=e)l=this.createPoint_(t[o],t[o+1],p++),d.push(this.insertItem_(h,l,i)),c.push([Math.min(h.x,l.x),Math.min(h.y,l.y),Math.max(h.x,l.x),Math.max(h.y,l.y)]),h=l;d.push(this.insertItem_(l,a,i)),c.push([Math.min(h.x,l.x),Math.min(h.y,l.y),Math.max(h.x,l.x),Math.max(h.y,l.y)])}r.load(c,d)},e.prototype.getMaxCoords_=function(t){var e=t.firstItem(),i=e,r=[i.p0.x,i.p0.y];do{(i=t.nextItem()).p0.x>r[0]&&(r=[i.p0.x,i.p0.y])}while(i!==e);return r},e.prototype.classifyPoints_=function(t,e,i){var r=t.firstItem(),n=r,o=t.nextItem(),s=!1;do{var a=i?xh(o.p1.x,o.p1.y,n.p1.x,n.p1.y,n.p0.x,n.p0.y):xh(n.p0.x,n.p0.y,n.p1.x,n.p1.y,o.p1.x,o.p1.y);void 0===a?(this.removeItem_(n,o,t,e),s=!0,o===r&&(r=t.getNextItem()),o=n,t.prevItem()):n.p1.reflex!==a&&(n.p1.reflex=a,s=!0),n=o,o=t.nextItem()}while(n!==r);return s},e.prototype.bridgeHole_=function(t,e,i,r,n){for(var o=t.firstItem();o.p1.x!==e;)o=t.nextItem();var s,a,h,l,u=o.p1,p={x:r,y:u.y,i:-1},c=1/0,d=this.getIntersections_({p0:u,p1:p},n,!0);for(s=0,a=d.length;s0){var y=this.getPointsInTriangle_(u,l,o.p1,n);if(y.length){var v=1/0;for(s=0,a=y.length;s3;)if(r){if(!this.clipEars_(t,e,r,i)&&!this.classifyPoints_(t,e,i)&&!this.resolveSelfIntersections_(t,e,!0))break}else if(!this.clipEars_(t,e,r,i)&&!this.classifyPoints_(t,e,i)&&!this.resolveSelfIntersections_(t,e)){if(!(r=this.isSimple_(t,e))){this.splitPolygon_(t,e);break}i=!this.isClockwise_(t),this.classifyPoints_(t,e,i)}if(3===t.getLength()){var n=this.indices.length;this.indices[n++]=t.getPrevItem().p0.i,this.indices[n++]=t.getCurrItem().p0.i,this.indices[n++]=t.getNextItem().p0.i}},e.prototype.clipEars_=function(t,e,i,r){var n,o,s,a=this.indices.length,h=t.firstItem(),l=t.getPrevItem(),u=h,p=t.nextItem(),c=t.getNextItem(),d=!1;do{if(n=u.p0,o=u.p1,s=p.p1,!1===o.reflex){var f=void 0;f=i?0===this.getPointsInTriangle_(n,o,s,e,!0).length:r?this.diagonalIsInside_(c.p1,s,o,n,l.p0):this.diagonalIsInside_(l.p0,n,o,s,c.p1),(i||0===this.getIntersections_({p0:n,p1:s},e).length)&&f&&(i||!1===n.reflex||!1===s.reflex||Si([l.p0.x,l.p0.y,n.x,n.y,o.x,o.y,s.x,s.y,c.p1.x,c.p1.y],0,10,2)===!r)&&(this.indices[a++]=n.i,this.indices[a++]=o.i,this.indices[a++]=s.i,this.removeItem_(u,p,t,e),p===h&&(h=c),d=!0)}l=t.getPrevItem(),u=t.getCurrItem(),p=t.nextItem(),c=t.getNextItem()}while(u!==h&&t.getLength()>3);return d},e.prototype.resolveSelfIntersections_=function(t,e,i){var r=t.firstItem();t.nextItem();var n=r,o=t.nextItem(),s=!1;do{var a=this.calculateIntersection_(n.p0,n.p1,o.p0,o.p1,i);if(a){var h=!1,l=this.vertices.length,u=this.indices.length,p=l/2,c=t.prevItem();t.removeItem(),e.remove(c),h=c===r;var d=void 0;if(i?(a[0]===n.p0.x&&a[1]===n.p0.y?(t.prevItem(),d=n.p0,o.p0=d,e.remove(n),h=h||n===r):(d=o.p1,n.p1=d,e.remove(o),h=h||o===r),t.removeItem()):(d=this.createPoint_(a[0],a[1],p),n.p1=d,o.p0=d,e.update([Math.min(n.p0.x,n.p1.x),Math.min(n.p0.y,n.p1.y),Math.max(n.p0.x,n.p1.x),Math.max(n.p0.y,n.p1.y)],n),e.update([Math.min(o.p0.x,o.p1.x),Math.min(o.p0.y,o.p1.y),Math.max(o.p0.x,o.p1.x),Math.max(o.p0.y,o.p1.y)],o)),this.indices[u++]=c.p0.i,this.indices[u++]=c.p1.i,this.indices[u++]=d.i,s=!0,h)break}n=t.getPrevItem(),o=t.nextItem()}while(n!==r);return s},e.prototype.isSimple_=function(t,e){var i=t.firstItem(),r=i;do{if(this.getIntersections_(r,e).length)return!1;r=t.nextItem()}while(r!==i);return!0},e.prototype.isClockwise_=function(t){var e=2*t.getLength(),i=new Array(e),r=t.firstItem(),n=r,o=0;do{i[o++]=n.p0.x,i[o++]=n.p0.y,n=t.nextItem()}while(n!==r);return Si(i,0,e,2)},e.prototype.splitPolygon_=function(t,e){var i=t.firstItem(),r=i;do{var n=this.getIntersections_(r,e);if(n.length){var o=n[0],s=this.vertices.length/2,a=this.calculateIntersection_(r.p0,r.p1,o.p0,o.p1),h=this.createPoint_(a[0],a[1],s),l=new Qh,u=new tl;this.insertItem_(h,r.p1,l,u),r.p1=h,e.update([Math.min(r.p0.x,h.x),Math.min(r.p0.y,h.y),Math.max(r.p0.x,h.x),Math.max(r.p0.y,h.y)],r);for(var p=t.nextItem();p!==o;)this.insertItem_(p.p0,p.p1,l,u),e.remove(p),t.removeItem(),p=t.getCurrItem();this.insertItem_(o.p0,h,l,u),o.p0=h,e.update([Math.min(o.p1.x,h.x),Math.min(o.p1.y,h.y),Math.max(o.p1.x,h.x),Math.max(o.p1.y,h.y)],o),this.classifyPoints_(t,e,!1),this.triangulate_(t,e),this.classifyPoints_(l,u,!1),this.triangulate_(l,u);break}r=t.nextItem()}while(r!==i)},e.prototype.createPoint_=function(t,e,i){var r=this.vertices.length;return this.vertices[r++]=t,this.vertices[r++]=e,{x:t,y:e,i:i,reflex:void 0}},e.prototype.insertItem_=function(t,e,i,r){var n={p0:t,p1:e};return i.insertItem(n),r&&r.insert([Math.min(t.x,e.x),Math.min(t.y,e.y),Math.max(t.x,e.x),Math.max(t.y,e.y)],n),n},e.prototype.removeItem_=function(t,e,i,r){i.getCurrItem()===e&&(i.removeItem(),t.p1=e.p1,r.remove(e),r.update([Math.min(t.p0.x,t.p1.x),Math.min(t.p0.y,t.p1.y),Math.max(t.p0.x,t.p1.x),Math.max(t.p0.y,t.p1.y)],t))},e.prototype.getPointsInTriangle_=function(t,e,i,r,n){for(var o=[],s=r.getInExtent([Math.min(t.x,e.x,i.x),Math.min(t.y,e.y,i.y),Math.max(t.x,e.x,i.x),Math.max(t.y,e.y,i.y)]),a=0,h=s.length;amh&&s<1-mh&&a>mh&&a<1-mh||n&&s>=0&&s<=1&&a>=0&&a<=1)return[t.x+s*(e.x-t.x),t.y+s*(e.y-t.y)]}},e.prototype.diagonalIsInside_=function(t,e,i,r,n){if(void 0===e.reflex||void 0===r.reflex)return!1;var o=(i.x-r.x)*(e.y-r.y)>(i.y-r.y)*(e.x-r.x),s=(n.x-r.x)*(e.y-r.y)<(n.y-r.y)*(e.x-r.x),a=(t.x-e.x)*(r.y-e.y)>(t.y-e.y)*(r.x-e.x),h=(i.x-e.x)*(r.y-e.y)<(i.y-e.y)*(r.x-e.x),l=r.reflex?s||o:s&&o,u=e.reflex?h||a:h&&a;return l&&u},e.prototype.drawMultiPolygon=function(t,e){var i,r,n,o,s=t.getEndss(),a=t.getStride(),h=this.indices.length,l=this.lineStringReplay.getCurrentIndex(),u=t.getFlatCoordinates(),p=0;for(i=0,r=s.length;i0){var d=Dt(u,p,c[0],a,-this.origin[0],-this.origin[1]);if(d.length){var f=[],_=void 0;for(n=1,o=c.length;nh&&(this.startIndices.push(h),this.startIndicesFeature.push(e),this.state_.changed&&(this.styleIndices_.push(h),this.state_.changed=!1)),this.lineStringReplay.getCurrentIndex()>l&&this.lineStringReplay.setPolygonStyle(e,l)},e.prototype.drawPolygon=function(t,e){var i=t.getEnds(),r=t.getStride();if(i.length>0){var n=t.getFlatCoordinates().map(Number),o=Dt(n,0,i[0],r,-this.origin[0],-this.origin[1]);if(o.length){var s,a,h,l=[];for(s=1,a=i.length;s0&&(this.styles_=[]),this.vertices=null,this.indices=null},e.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer,i=this.indicesBuffer,r=this.lineStringReplay.getDeleteResourcesFunction(t);return function(){t.deleteBuffer(e),t.deleteBuffer(i),r()}},e.prototype.setUpProgram=function(t,e,i,r){var n,o=e.getProgram(Hh,Zh);return this.defaultLocations_?n=this.defaultLocations_:(n=new qh(t,o),this.defaultLocations_=n),e.useProgram(o),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,5126,!1,8,0),n},e.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_position)},e.prototype.drawReplay=function(t,e,i,r){var n,o,s,a,h=t.getParameter(t.DEPTH_FUNC),l=t.getParameter(t.DEPTH_WRITEMASK);if(r||(t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.NOTEQUAL)),d(i))for(s=this.startIndices[this.startIndices.length-1],n=this.styleIndices_.length-1;n>=0;--n)o=this.styleIndices_[n],a=this.styles_[n],this.setFillStyle_(t,a),this.drawElements(t,e,o,s),s=o;else this.drawReplaySkipping_(t,e,i);r||(t.disable(t.DEPTH_TEST),t.clear(t.DEPTH_BUFFER_BIT),t.depthMask(l),t.depthFunc(h))},e.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var s,a,h,l,u,p,c;for(c=this.startIndices.length-2,h=this.startIndices[c+1],s=this.styleIndices_.length-1;s>=0;--s)for(l=this.styles_[s],this.setFillStyle_(t,l),u=this.styleIndices_[s];c>=0&&this.startIndices[c]>=u;){if(a=this.startIndices[c],void 0===i[o(p=this.startIndicesFeature[c])]&&p.getGeometry()&&(void 0===n||Pt(n,p.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,a,h);var d=r(p);if(d)return d}c--,h=a}},e.prototype.drawReplaySkipping_=function(t,e,i){var r,n,s,a,h,l,u;for(l=this.startIndices.length-2,s=n=this.startIndices[l+1],r=this.styleIndices_.length-1;r>=0;--r){for(a=this.styles_[r],this.setFillStyle_(t,a),h=this.styleIndices_[r];l>=0&&this.startIndices[l]>=h;)u=this.startIndices[l],i[o(this.startIndicesFeature[l])]&&(n!==s&&(this.drawElements(t,e,n,s),t.clear(t.DEPTH_BUFFER_BIT)),s=u),l--,n=u;n!==s&&(this.drawElements(t,e,n,s),t.clear(t.DEPTH_BUFFER_BIT)),n=s=h}},e.prototype.setFillStyle_=function(t,e){t.uniform4fv(this.defaultLocations_.u_color,e)},e.prototype.setFillStrokeStyle=function(t,e){var i=t?t.getColor():[0,0,0,0];if(i=i instanceof CanvasGradient||i instanceof CanvasPattern?gh:_r(i).map(function(t,e){return 3!=e?t/255:t})||gh,this.state_.fillColor&&Z(i,this.state_.fillColor)||(this.state_.fillColor=i,this.state_.changed=!0,this.styles_.push(i)),e)this.lineStringReplay.setFillStrokeStyle(null,e);else{var r=new Er({color:[0,0,0,0],width:0});this.lineStringReplay.setFillStrokeStyle(null,r)}},e}(_h),il=function(t,e){this.space_=e,this.emptyBlocks_=[{x:0,y:0,width:t,height:t}],this.entries_={},this.context_=Jn(t,t),this.canvas_=this.context_.canvas};il.prototype.get=function(t){return this.entries_[t]||null},il.prototype.add=function(t,e,i,r,n){for(var o=0,s=this.emptyBlocks_.length;o=e+this.space_&&a.height>=i+this.space_){var h={offsetX:a.x+this.space_,offsetY:a.y+this.space_,image:this.canvas_};return this.entries_[t]=h,r.call(n,this.context_,a.x+this.space_,a.y+this.space_),this.split_(o,a,e+this.space_,i+this.space_),h}}return null},il.prototype.split_=function(t,e,i,r){var n,o;e.width-i>e.height-r?(n={x:e.x+i,y:e.y,width:e.width-i,height:e.height},o={x:e.x,y:e.y+r,width:i,height:e.height-r},this.updateBlocks_(t,n,o)):(n={x:e.x+i,y:e.y,width:e.width-i,height:r},o={x:e.x,y:e.y+r,width:e.width,height:e.height-r},this.updateBlocks_(t,n,o))},il.prototype.updateBlocks_=function(t,e,i){var r=[t,1];e.width>0&&e.height>0&&r.push(e),i.width>0&&i.height>0&&r.push(i),this.emptyBlocks_.splice.apply(this.emptyBlocks_,r)};var rl=il,nl=function(t){var e=t||{};this.currentSize_=void 0!==e.initialSize?e.initialSize:256,this.maxSize_=void 0!==e.maxSize?e.maxSize:void 0!==nh?nh:2048,this.space_=void 0!==e.space?e.space:1,this.atlases_=[new rl(this.currentSize_,this.space_)],this.currentHitSize_=this.currentSize_,this.hitAtlases_=[new rl(this.currentHitSize_,this.space_)]};nl.prototype.getInfo=function(t){var e=this.getInfo_(this.atlases_,t);if(!e)return null;var i=this.getInfo_(this.hitAtlases_,t);return this.mergeInfos_(e,i)},nl.prototype.getInfo_=function(t,e){for(var i=0,r=t.length;ithis.maxSize_||i+this.space_>this.maxSize_)return null;var s=this.add_(!1,t,e,i,r,o);if(!s)return null;var a=void 0!==n?n:I,h=this.add_(!0,t,e,i,a,o);return this.mergeInfos_(s,h)},nl.prototype.add_=function(t,e,i,r,n,o){var s,a,h,l,u=t?this.hitAtlases_:this.atlases_;for(h=0,l=u.length;h=0;--d)if(void 0!==(_=f[Ea[d]])&&(g=_.replay(t,e,i,r,n,o,s,a,h,l,u)))return g},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,o,s,a,h,l){var u,p=e.getGL();return p.bindFramebuffer(p.FRAMEBUFFER,e.getHitDetectionFramebuffer()),void 0!==this.renderBuffer_&&(u=et(pt(t),r*this.renderBuffer_)),this.replayHitDetection_(e,t,r,n,sl,s,a,h,function(t){var e=new Uint8Array(4);if(p.readPixels(0,0,1,1,p.RGBA,p.UNSIGNED_BYTE,e),e[3]>0){var i=l(t);if(i)return i}},!0,u)},e.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n,o,s,a,h){var l=e.getGL();return l.bindFramebuffer(l.FRAMEBUFFER,e.getHitDetectionFramebuffer()),void 0!==this.replayHitDetection_(e,t,r,n,sl,s,a,h,function(t){var e=new Uint8Array(4);return l.readPixels(0,0,1,1,l.RGBA,l.UNSIGNED_BYTE,e),e[3]>0},!1)},e}(ca),ll=function(t){function e(e,i,r,n,o,s,a){t.call(this),this.context_=e,this.center_=i,this.extent_=s,this.pixelRatio_=a,this.size_=o,this.rotation_=n,this.resolution_=r,this.imageStyle_=null,this.fillStyle_=null,this.strokeStyle_=null,this.textStyle_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawText_=function(t,e){var i=this.context_,r=t.getReplay(0,da.TEXT);r.setTextStyle(this.textStyle_),r.drawText(e,null),r.finish(i);r.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),r.getDeleteResourcesFunction(i)()},e.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())},e.prototype.drawGeometry=function(t){switch(t.getType()){case Nt.POINT:this.drawPoint(t,null);break;case Nt.LINE_STRING:this.drawLineString(t,null);break;case Nt.POLYGON:this.drawPolygon(t,null);break;case Nt.MULTI_POINT:this.drawMultiPoint(t,null);break;case Nt.MULTI_LINE_STRING:this.drawMultiLineString(t,null);break;case Nt.MULTI_POLYGON:this.drawMultiPolygon(t,null);break;case Nt.GEOMETRY_COLLECTION:this.drawGeometryCollection(t,null);break;case Nt.CIRCLE:this.drawCircle(t,null)}},e.prototype.drawFeature=function(t,e){var i=e.getGeometryFunction()(t);i&&Pt(this.extent_,i.getExtent())&&(this.setStyle(e),this.drawGeometry(i))},e.prototype.drawGeometryCollection=function(t,e){var i,r,n=t.getGeometriesArray();for(i=0,r=n.length;in[0]||o[1]<0||o[1]>n[1])){this.hitCanvasContext_||(this.hitCanvasContext_=Jn(1,1)),this.hitCanvasContext_.clearRect(0,0,1,1),this.hitCanvasContext_.drawImage(this.image_.getImage(),o[0],o[1],1,1,0,0,1,1);var s=this.hitCanvasContext_.getImageData(0,0,1,1).data;return s[3]>0?i.call(r,this.getLayer(),s):void 0}}},e.prototype.getHitTransformationMatrix_=function(t,e){var i=[1,0,0,1,0,0];Ue(i,-1,-1),je(i,2/t[0],2/t[1]),Ue(i,0,t[1]),je(i,1,-1);var r=Be(this.projectionMatrix.slice()),n=[1,0,0,1,0,0];return Ue(n,0,e[1]),je(n,1,-1),je(n,e[0]/2,e[1]/2),Ue(n,1,1),Ae(n,r),Ae(n,i),n},e}(dl);fl.handles=function(t){return t.getType()===Ss.IMAGE},fl.create=function(t,e){return new fl(t,e)};var _l=fl,gl=function(t){function e(e){t.call(this,e);var i=e.getViewport();this.canvas_=document.createElement("canvas"),this.canvas_.style.width="100%",this.canvas_.style.height="100%",this.canvas_.style.display="block",this.canvas_.className=fo,i.insertBefore(this.canvas_,i.childNodes[0]||null),this.clipTileCanvasWidth_=0,this.clipTileCanvasHeight_=0,this.clipTileContext_=Jn(),this.renderedVisible_=!0,this.gl_=rh(this.canvas_,{antialias:!0,depth:!0,failIfMajorPerformanceCaveat:!0,preserveDrawingBuffer:!1,stencil:!0}),this.context_=new Mh(this.canvas_,this.gl_),v(this.canvas_,Lh.LOST,this.handleWebGLContextLost,this),v(this.canvas_,Lh.RESTORED,this.handleWebGLContextRestored,this),this.textureCache_=new Rs,this.focus_=null,this.tileTextureQueue_=new bn(function(t){var e=t[1],i=t[2],r=e[0]-this.focus_[0],n=e[1]-this.focus_[1];return 65536*Math.log(i)+Math.sqrt(r*r+n*n)/i}.bind(this),function(t){return t[0].getKey()}),this.loadNextTileTexture_=function(t,e){if(!this.tileTextureQueue_.isEmpty()){this.tileTextureQueue_.reprioritize();var i=this.tileTextureQueue_.dequeue(),r=i[0],n=i[3],o=i[4];this.bindTileTexture(r,n,o,Qa,Qa)}return!1}.bind(this),this.textureCacheFrameMarkerCount_=0,this.initializeGL_()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.bindTileTexture=function(t,e,i,r,n){var o=this.getGL(),s=t.getKey();if(this.textureCache_.containsKey(s)){var a=this.textureCache_.get(s);o.bindTexture(eh,a.texture),a.magFilter!=r&&(o.texParameteri(eh,10240,r),a.magFilter=r),a.minFilter!=n&&(o.texParameteri(eh,10241,n),a.minFilter=n)}else{var h=o.createTexture(),l=t;if(o.bindTexture(eh,h),i>0){var u=this.clipTileContext_.canvas,p=this.clipTileContext_;this.clipTileCanvasWidth_!==e[0]||this.clipTileCanvasHeight_!==e[1]?(u.width=e[0],u.height=e[1],this.clipTileCanvasWidth_=e[0],this.clipTileCanvasHeight_=e[1]):p.clearRect(0,0,e[0],e[1]),p.drawImage(l.getImage(),i,i,e[0],e[1],0,0,e[0],e[1]),o.texImage2D(eh,0,6408,6408,5121,u)}else o.texImage2D(eh,0,6408,6408,5121,l.getImage());o.texParameteri(eh,10240,r),o.texParameteri(eh,10241,n),o.texParameteri(eh,$a,33071),o.texParameteri(eh,th,33071),this.textureCache_.set(s,{texture:h,magFilter:r,minFilter:n})}},e.prototype.dispatchRenderEvent=function(t,e){var i=this.getMap();if(i.hasListener(t)){var r=this.context_,n=e.extent,o=e.size,s=e.viewState,a=e.pixelRatio,h=s.resolution,l=s.center,u=s.rotation,p=new ll(r,l,h,u,o,n,a),c=new Cs(t,p,e,null,r);i.dispatchEvent(c)}},e.prototype.disposeInternal=function(){var e=this.getGL();e.isContextLost()||this.textureCache_.forEach(function(t){t&&e.deleteTexture(t.texture)}),this.context_.dispose(),t.prototype.disposeInternal.call(this)},e.prototype.expireCache_=function(t,e){for(var i,r=this.getGL();this.textureCache_.getCount()-this.textureCacheFrameMarkerCount_>1024;){if(i=this.textureCache_.peekLast())r.deleteTexture(i.texture);else{if(+this.textureCache_.peekLastKey()==e.index)break;--this.textureCacheFrameMarkerCount_}this.textureCache_.pop()}},e.prototype.getContext=function(){return this.context_},e.prototype.getGL=function(){return this.gl_},e.prototype.getTileTextureQueue=function(){return this.tileTextureQueue_},e.prototype.handleWebGLContextLost=function(t){t.preventDefault(),this.textureCache_.clear(),this.textureCacheFrameMarkerCount_=0;var e=this.getLayerRenderers();for(var i in e){e[i].handleWebGLContextLost()}},e.prototype.handleWebGLContextRestored=function(){this.initializeGL_(),this.getMap().render()},e.prototype.initializeGL_=function(){var t=this.gl_;t.activeTexture(33984),t.blendFuncSeparate(770,771,1,771),t.disable(2884),t.disable(2929),t.disable(3089),t.disable(2960)},e.prototype.isTileTextureLoaded=function(t){return this.textureCache_.containsKey(t.getKey())},e.prototype.renderFrame=function(t){var e=this.getContext(),i=this.getGL();if(i.isContextLost())return!1;if(!t)return this.renderedVisible_&&(this.canvas_.style.display="none",this.renderedVisible_=!1),!1;this.focus_=t.focus,this.textureCache_.set((-t.index).toString(),null),++this.textureCacheFrameMarkerCount_,this.dispatchRenderEvent(ur.PRECOMPOSE,t);var r=[],n=t.layerStatesArray;q(n,Zs);var o,s,a=t.viewState.resolution;for(o=0,s=n.length;o1024&&t.postRenderFunctions.push(this.expireCache_.bind(this)),this.tileTextureQueue_.isEmpty()||(t.postRenderFunctions.push(this.loadNextTileTexture_),t.animate=!0),this.dispatchRenderEvent(ur.POSTCOMPOSE,t),this.scheduleRemoveUnusedLayerRenderers(t),this.scheduleExpireIconCache(t)},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,o,s){var a;if(this.getGL().isContextLost())return!1;var h,l=e.viewState,u=e.layerStatesArray;for(h=u.length-1;h>=0;--h){var p=u[h],c=p.layer;if(mo(p,l.resolution)&&o.call(s,c))if(a=this.getLayerRenderer(c).forEachFeatureAtCoordinate(t,e,i,r))return a}},e.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n){var o=!1;if(this.getGL().isContextLost())return!1;var s,a=e.viewState,h=e.layerStatesArray;for(s=h.length-1;s>=0;--s){var l=h[s],u=l.layer;if(mo(l,a.resolution)&&r.call(n,u))if(o=this.getLayerRenderer(u).hasFeatureAtCoordinate(t,e))return!0}return o},e.prototype.forEachLayerAtPixel=function(t,e,i,r,n,o,s){if(this.getGL().isContextLost())return!1;var a,h,l=e.viewState,u=e.layerStatesArray;for(h=u.length-1;h>=0;--h){var p=u[h],c=p.layer;if(mo(p,l.resolution)&&o.call(n,c))if(a=this.getLayerRenderer(c).forEachLayerAtPixel(t,e,r,n))return a}},e}(qs),yl=function(t){function e(e,i,r){t.call(this);var n=r||{};this.tileCoord=e,this.state=i,this.interimTile=null,this.key="",this.transition_=void 0===n.transition?250:n.transition,this.transitionStarts_={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.changed=function(){this.dispatchEvent(M.CHANGE)},e.prototype.getKey=function(){return this.key+"/"+this.tileCoord},e.prototype.getInterimTile=function(){if(!this.interimTile)return this;var t=this.interimTile;do{if(t.getState()==On.LOADED)return t;t=t.interimTile}while(t);return this},e.prototype.refreshInterimChain=function(){if(this.interimTile){var t=this.interimTile,e=this;do{if(t.getState()==On.LOADED){t.interimTile=null;break}t.getState()==On.LOADING?e=t:t.getState()==On.IDLE?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}},e.prototype.getTileCoord=function(){return this.tileCoord},e.prototype.getState=function(){return this.state},e.prototype.setState=function(t){this.state=t,this.changed()},e.prototype.load=function(){},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;var r=e-i+1e3/60;return r>=this.transition_?1:Vn(r/this.transition_)},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(b);function vl(){var t=Jn(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}var ml=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,s),this.crossOrigin_=n,this.src_=r,this.image_=new Image,null!==n&&(this.image_.crossOrigin=n),this.imageListenerKeys_=null,this.tileLoadFunction_=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.state==On.LOADING&&(this.unlistenImage_(),this.image_=vl()),this.interimTile&&this.interimTile.dispose(),this.state=On.ABORT,this.changed(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.image_},e.prototype.getKey=function(){return this.src_},e.prototype.handleImageError_=function(){this.state=On.ERROR,this.unlistenImage_(),this.image_=vl(),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=On.LOADED:this.state=On.EMPTY,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==On.ERROR&&(this.state=On.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==On.IDLE&&(this.state=On.LOADING,this.changed(),this.imageListenerKeys_=[m(this.image_,M.ERROR,this.handleImageError_,this),m(this.image_,M.LOAD,this.handleImageLoad_,this)],this.tileLoadFunction_(this,this.src_))},e.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach(E),this.imageListenerKeys_=null},e}(yl);function xl(t,e,i,r){return void 0!==r?(r[0]=t,r[1]=e,r[2]=i,r):[t,e,i]}function El(t,e,i){return t+"/"+e+"/"+i}function Sl(t){return El(t[0],t[1],t[2])}function Tl(t){return(t[1]<0||i&&0===o)})}(this.resolutions_,function(t,e){return e-t},!0),17),!t.origins)for(var i=0,r=this.resolutions_.length-1;i=this.minZoom;){if(o=2===this.zoomFactor_?oa(s=Math.floor(s/2),s,a=Math.floor(a/2),a,r):this.getTileRangeForExtentAndZ(h,l,r),e.call(i,l,o))return!0;--l}return!1},Ll.prototype.getExtent=function(){return this.extent_},Ll.prototype.getMaxZoom=function(){return this.maxZoom},Ll.prototype.getMinZoom=function(){return this.minZoom},Ll.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},Ll.prototype.getResolution=function(t){return this.resolutions_[t]},Ll.prototype.getResolutions=function(){return this.resolutions_},Ll.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]i||i>e.getMaxZoom())return!1;var o,s=e.getExtent();return!(o=s?e.getTileRangeForExtentAndZ(s,i):e.getFullTileRange(i))||o.containsXY(r,n)}(t,r)?t:null},e.prototype.refresh=function(){this.tileCache.clear(),this.changed()},e.prototype.useTile=function(t,e,i,r){},e}(wl),Dl=function(t){function e(e,i){t.call(this,e),this.tile=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),kl=Gl,jl=new lh("precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform sampler2D u_texture;\n\nvoid main(void) {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n}\n"),Ul=new uh("varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nuniform vec4 u_tileOffset;\n\nvoid main(void) {\n gl_Position = vec4(a_position * u_tileOffset.xy + u_tileOffset.zw, 0., 1.);\n v_texCoord = a_texCoord;\n}\n\n\n"),Yl=function(t,e){this.u_tileOffset=t.getUniformLocation(e,"u_tileOffset"),this.u_texture=t.getUniformLocation(e,"u_texture"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_texCoord=t.getAttribLocation(e,"a_texCoord")},Bl=function(t){function e(e,i){t.call(this,e,i),this.fragmentShader_=jl,this.vertexShader_=Ul,this.locations_=null,this.renderArrayBuffer_=new Th([0,0,0,1,1,0,1,1,0,1,0,0,1,1,1,0]),this.renderedTileRange_=null,this.renderedFramebufferExtent_=null,this.renderedRevision_=-1,this.tmpSize_=[0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.mapRenderer.getContext().deleteBuffer(this.renderArrayBuffer_),t.prototype.disposeInternal.call(this)},e.prototype.createLoadedTileFinder=function(t,e,i){var r=this.mapRenderer;return function(n,o){return t.forEachLoadedTile(e,n,o,function(t){var e=r.isTileTextureLoaded(t);return e&&(i[n]||(i[n]={}),i[n][t.tileCoord.toString()]=t),e})}},e.prototype.handleWebGLContextLost=function(){t.prototype.handleWebGLContextLost.call(this),this.locations_=null},e.prototype.prepareFrame=function(t,e,i){var r=this.mapRenderer,n=i.getGL(),o=t.viewState,s=o.projection,a=this.getLayer(),h=a.getSource();if(!(h instanceof kl))return!0;var l,u=h.getTileGridForProjection(s),p=u.getZForResolution(o.resolution),c=u.getResolution(p),d=h.getTilePixelSize(p,t.pixelRatio,s),f=d[0]/ho(u.getTileSize(p),this.tmpSize_)[0],_=c/f,g=h.getTilePixelRatio(f)*h.getGutterForProjection(s),y=o.center,v=t.extent,m=u.getTileRangeForExtentAndZ(v,p);if(this.renderedTileRange_&&this.renderedTileRange_.equals(m)&&this.renderedRevision_==h.getRevision())l=this.renderedFramebufferExtent_;else{var x=m.getSize(),E=function(t){return Y(00?i.call(r,this.getLayer(),h):void 0}},e}(dl);Bl.handles=function(t){return t.getType()===Ss.TILE},Bl.create=function(t,e){return new Bl(t,e)};var Vl=Bl,Xl=function(t){function e(e,i){t.call(this,e,i),this.dirty_=!1,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRenderOrder_=null,this.replayGroup_=null,this.layerState_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.composeFrame=function(t,e,i){this.layerState_=e;var r=t.viewState,n=this.replayGroup_,o=t.size,s=t.pixelRatio,a=this.mapRenderer.getGL();n&&!n.isEmpty()&&(a.enable(a.SCISSOR_TEST),a.scissor(0,0,o[0]*s,o[1]*s),n.replay(i,r.center,r.resolution,r.rotation,o,s,e.opacity,e.managed?t.skippedFeatureUids:{}),a.disable(a.SCISSOR_TEST))},e.prototype.disposeInternal=function(){var e=this.replayGroup_;if(e){var i=this.mapRenderer.getContext();e.getDeleteResourcesFunction(i)(),this.replayGroup_=null}t.prototype.disposeInternal.call(this)},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(this.replayGroup_&&this.layerState_){var s=this.mapRenderer.getContext(),a=e.viewState,h=this.getLayer(),l=this.layerState_,u={};return this.replayGroup_.forEachFeatureAtCoordinate(t,s,a.center,a.resolution,a.rotation,e.size,e.pixelRatio,l.opacity,{},function(t){var e=o(t);if(!(e in u))return u[e]=!0,r.call(n,t,h)})}},e.prototype.hasFeatureAtCoordinate=function(t,e){if(this.replayGroup_&&this.layerState_){var i=this.mapRenderer.getContext(),r=e.viewState,n=this.layerState_;return this.replayGroup_.hasFeatureAtCoordinate(t,i,r.center,r.resolution,r.rotation,e.size,e.pixelRatio,n.opacity,e.skippedFeatureUids)}return!1},e.prototype.forEachLayerAtPixel=function(t,e,i,r){var n=De(e.pixelToCoordinateTransform,t.slice());return this.hasFeatureAtCoordinate(n,e)?i.call(r,this.getLayer(),null):void 0},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.prepareFrame=function(t,e,i){var r=this.getLayer(),n=r.getSource(),o=t.viewHints[kn],s=t.viewHints[jn],a=r.getUpdateWhileAnimating(),h=r.getUpdateWhileInteracting();if(!this.dirty_&&!a&&o||!h&&s)return!0;var l=t.extent,u=t.viewState,p=u.projection,c=u.resolution,d=t.pixelRatio,f=r.getRevision(),_=r.getRenderBuffer(),g=r.getRenderOrder();void 0===g&&(g=Da);var y=et(l,_*c);if(!this.dirty_&&this.renderedResolution_==c&&this.renderedRevision_==f&&this.renderedRenderOrder_==g&&ot(this.renderedExtent_,y))return!0;this.replayGroup_&&t.postRenderFunctions.push(this.replayGroup_.getDeleteResourcesFunction(i)),this.dirty_=!1;var v=new hl(ja(c,d),y,r.getRenderBuffer());n.loadFeatures(y,c,p);var m=function(t){var e,i=t.getStyleFunction()||r.getStyleFunction();if(i&&(e=i(t,c)),e){var n=this.renderFeature(t,c,d,e,v);this.dirty_=this.dirty_||n}}.bind(this);if(g){var x=[];n.forEachFeatureInExtent(y,function(t){x.push(t)}),x.sort(g),x.forEach(m.bind(this))}else n.forEachFeatureInExtent(y,m);return v.finish(i),this.renderedResolution_=c,this.renderedRevision_=f,this.renderedRenderOrder_=g,this.renderedExtent_=y,this.replayGroup_=v,!0},e.prototype.renderFeature=function(t,e,i,r,n){if(!r)return!1;var o=!1;if(Array.isArray(r))for(var s=r.length-1;s>=0;--s)o=Ua(n,t,r[s],ka(e,i),this.handleStyleImageChange_,this)||o;else o=Ua(n,t,r,ka(e,i),this.handleStyleImageChange_,this)||o;return o},e}(dl);Xl.handles=function(t){return t.getType()===Ss.VECTOR},Xl.create=function(t,e){return new Xl(t,e)};var zl=Xl,Wl=function(t){function e(e){(e=u({},e)).controls||(e.controls=wo()),e.interactions||(e.interactions=ys()),t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createRenderer=function(){var t=new gl(this);return t.registerLayerRenderers([_l,Vl,zl]),t},e}(lo),Kl={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};function Hl(t,e,i,r){return function(n,o,s){var a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(n,o,s):t,!0),e.getType()==Kl.ARRAY_BUFFER&&(a.responseType="arraybuffer"),a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){var n,o=e.getType();o==Kl.JSON||o==Kl.TEXT?n=a.responseText:o==Kl.XML?(n=a.responseXML)||(n=(new DOMParser).parseFromString(a.responseText,"application/xml")):o==Kl.ARRAY_BUFFER&&(n=a.response),n?i.call(this,e.readFeatures(n,{featureProjection:s}),e.readProjection(n),e.getLastExtent()):r.call(this)}else r.call(this)}.bind(this),a.onerror=function(){r.call(this)}.bind(this),a.send()}}function Zl(t,e){return Hl(t,e,function(t,e){"function"==typeof this.addFeatures&&this.addFeatures(t)},I)}function ql(t,e){return[[-1/0,-1/0,1/0,1/0]]}var Jl=document.implementation.createDocument("","",null),Ql="http://www.w3.org/2001/XMLSchema-instance";function $l(t,e){return Jl.createElementNS(t,e)}function tu(t,e){return function t(e,i,r){if(e.nodeType==Node.CDATA_SECTION_NODE||e.nodeType==Node.TEXT_NODE)i?r.push(String(e.nodeValue).replace(/(\r\n|\r|\n)/g,"")):r.push(e.nodeValue);else{var n;for(n=e.firstChild;n;n=n.nextSibling)t(n,i,r)}return r}(t,e,[]).join("")}function eu(t){return"documentElement"in t}function iu(t){return(new DOMParser).parseFromString(t,"application/xml")}function ru(t,e){return function(i,r){var n=t.call(void 0!==e?e:this,i,r);void 0!==n&&K(r[r.length-1],n)}}function nu(t,e){return function(i,r){var n=t.call(void 0!==e?e:this,i,r);void 0!==n&&r[r.length-1].push(n)}}function ou(t,e){return function(i,r){var n=t.call(void 0!==e?e:this,i,r);void 0!==n&&(r[r.length-1]=n)}}function su(t,e,i){return function(r,n){var o=t.call(void 0!==i?i:this,r,n);if(void 0!==o){var s=n[n.length-1],a=void 0!==e?e:r.localName;(a in s?s[a]:s[a]=[]).push(o)}}}function au(t,e,i){return function(r,n){var o=t.call(void 0!==i?i:this,r,n);void 0!==o&&(n[n.length-1][void 0!==e?e:r.localName]=o)}}function hu(t,e){return function(i,r,n){t.call(void 0!==e?e:this,i,r,n),n[n.length-1].node.appendChild(i)}}function lu(t,e){var i,r;return function(e,n,o){if(void 0===i){i={};var s={};s[e.localName]=t,i[e.namespaceURI]=s,r=uu(e.localName)}gu(i,r,n,o)}}function uu(t,e){var i=t;return function(t,r,n){var o=r[r.length-1].node,s=i;return void 0===s&&(s=n),$l(void 0!==e?e:o.namespaceURI,s)}}var pu=uu();function cu(t,e){for(var i=e.length,r=new Array(i),n=0;n0)||H(h,function(i){return e.Identifier==i.TileMatrix||-1===e.Identifier.indexOf(":")&&t.Identifier+":"+e.Identifier===i.TileMatrix})){n.push(e.Identifier);var i=28e-5*e.ScaleDenominator/p,l=e.TileWidth,u=e.TileHeight;c?o.push([e.TopLeftCorner[1],e.TopLeftCorner[0]]):o.push(e.TopLeftCorner),r.push(i),s.push(l==u?l:[l,u]),a.push([e.MatrixWidth,-e.MatrixHeight])}}),new vu({extent:e,origins:o,resolutions:r,matrixIds:n,tileSizes:s,sizes:a})}var Eu=function(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale};Eu.prototype.clone=function(){return new Eu({opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},Eu.prototype.getOpacity=function(){return this.opacity_},Eu.prototype.getRotateWithView=function(){return this.rotateWithView_},Eu.prototype.getRotation=function(){return this.rotation_},Eu.prototype.getScale=function(){return this.scale_},Eu.prototype.getSnapToPixel=function(){return!1},Eu.prototype.getAnchor=function(){return r()},Eu.prototype.getImage=function(t){return r()},Eu.prototype.getHitDetectionImage=function(t){return r()},Eu.prototype.getImageState=function(){return r()},Eu.prototype.getImageSize=function(){return r()},Eu.prototype.getHitDetectionImageSize=function(){return r()},Eu.prototype.getOrigin=function(){return r()},Eu.prototype.getSize=function(){return r()},Eu.prototype.setOpacity=function(t){this.opacity_=t},Eu.prototype.setRotateWithView=function(t){this.rotateWithView_=t},Eu.prototype.setRotation=function(t){this.rotation_=t},Eu.prototype.setScale=function(t){this.scale_=t},Eu.prototype.setSnapToPixel=function(t){},Eu.prototype.listenImageChange=function(t,e){return r()},Eu.prototype.load=function(){r()},Eu.prototype.unlistenImageChange=function(t,e){r()};var Su=Eu,Tu=function(t){function e(e){var i=void 0!==e.rotateWithView&&e.rotateWithView;t.call(this,{opacity:1,rotateWithView:i,rotation:void 0!==e.rotation?e.rotation:0,scale:1}),this.checksums_=null,this.canvas_=null,this.hitDetectionCanvas_=null,this.fill_=void 0!==e.fill?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius_=void 0!==e.radius?e.radius:e.radius1,this.radius2_=e.radius2,this.angle_=void 0!==e.angle?e.angle:0,this.stroke_=void 0!==e.stroke?e.stroke:null,this.anchor_=null,this.size_=null,this.imageSize_=null,this.hitDetectionImageSize_=null,this.atlasManager_=e.atlasManager,this.render_(this.atlasManager_)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),atlasManager:this.atlasManager_});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.getAnchor=function(){return this.anchor_},e.prototype.getAngle=function(){return this.angle_},e.prototype.getFill=function(){return this.fill_},e.prototype.getHitDetectionImage=function(t){return this.hitDetectionCanvas_},e.prototype.getImage=function(t){return this.canvas_},e.prototype.getImageSize=function(){return this.imageSize_},e.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},e.prototype.getImageState=function(){return xs.LOADED},e.prototype.getOrigin=function(){return this.origin_},e.prototype.getPoints=function(){return this.points_},e.prototype.getRadius=function(){return this.radius_},e.prototype.getRadius2=function(){return this.radius2_},e.prototype.getSize=function(){return this.size_},e.prototype.getStroke=function(){return this.stroke_},e.prototype.listenImageChange=function(t,e){},e.prototype.load=function(){},e.prototype.unlistenImageChange=function(t,e){},e.prototype.render_=function(t){var e,i,r="",n="",o=0,s=null,a=0,h=0;this.stroke_&&(null===(i=this.stroke_.getColor())&&(i=Ls),i=Ys(i),void 0===(h=this.stroke_.getWidth())&&(h=1),s=this.stroke_.getLineDash(),a=this.stroke_.getLineDashOffset(),ki||(s=null,a=0),void 0===(n=this.stroke_.getLineJoin())&&(n="round"),void 0===(r=this.stroke_.getLineCap())&&(r="round"),void 0===(o=this.stroke_.getMiterLimit())&&(o=10));var l=2*(this.radius_+h)+1,u={strokeStyle:i,strokeWidth:h,size:l,lineCap:r,lineDash:s,lineDashOffset:a,lineJoin:n,miterLimit:o};if(void 0===t){var p=Jn(l,l);this.canvas_=p.canvas,e=l=this.canvas_.width,this.draw_(u,p,0,0),this.createHitDetectionCanvas_(u)}else{l=Math.round(l);var c,d=!this.fill_;d&&(c=this.drawHitDetectionCanvas_.bind(this,u));var f=this.getChecksum(),_=t.add(f,l,l,this.draw_.bind(this,u),c);this.canvas_=_.image,this.origin_=[_.offsetX,_.offsetY],e=_.image.width,d?(this.hitDetectionCanvas_=_.hitImage,this.hitDetectionImageSize_=[_.hitImage.width,_.hitImage.height]):(this.hitDetectionCanvas_=this.canvas_,this.hitDetectionImageSize_=[e,e])}this.anchor_=[l/2,l/2],this.size_=[l,l],this.imageSize_=[e,e]},e.prototype.draw_=function(t,e,i,r){var n,o,s;e.setTransform(1,0,0,1,0,0),e.translate(i,r),e.beginPath();var a=this.points_;if(a===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var h=void 0!==this.radius2_?this.radius2_:this.radius_;for(h!==this.radius_&&(a*=2),n=0;n<=a;n++)o=2*n*Math.PI/a-Math.PI/2+this.angle_,s=n%2==0?this.radius_:h,e.lineTo(t.size/2+s*Math.cos(o),t.size/2+s*Math.sin(o))}if(this.fill_){var l=this.fill_.getColor();null===l&&(l=ws),e.fillStyle=Ys(l),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke()),e.closePath()},e.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionImageSize_=[t.size,t.size],this.fill_)this.hitDetectionCanvas_=this.canvas_;else{var e=Jn(t.size,t.size);this.hitDetectionCanvas_=e.canvas,this.drawHitDetectionCanvas_(t,e,0,0)}},e.prototype.drawHitDetectionCanvas_=function(t,e,i,r){e.setTransform(1,0,0,1,0,0),e.translate(i,r),e.beginPath();var n=this.points_;if(n===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var o,s,a,h=void 0!==this.radius2_?this.radius2_:this.radius_;for(h!==this.radius_&&(n*=2),o=0;o<=n;o++)a=2*o*Math.PI/n-Math.PI/2+this.angle_,s=o%2==0?this.radius_:h,e.lineTo(t.size/2+s*Math.cos(a),t.size/2+s*Math.sin(a))}e.fillStyle=dr(ws),e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.stroke()),e.closePath()},e.prototype.getChecksum=function(){var t=this.stroke_?this.stroke_.getChecksum():"-",e=this.fill_?this.fill_.getChecksum():"-";if(!this.checksums_||t!=this.checksums_[1]||e!=this.checksums_[2]||this.radius_!=this.checksums_[3]||this.radius2_!=this.checksums_[4]||this.angle_!=this.checksums_[5]||this.points_!=this.checksums_[6]){var i="r"+t+e+(void 0!==this.radius_?this.radius_.toString():"-")+(void 0!==this.radius2_?this.radius2_.toString():"-")+(void 0!==this.angle_?this.angle_.toString():"-")+(void 0!==this.points_?this.points_.toString():"-");this.checksums_=[i,t,e,this.radius_,this.radius2_,this.angle_,this.points_]}return this.checksums_[0]},e}(Su),Cu=function(t){function e(e){var i=e||{};t.call(this,{points:1/0,fill:i.fill,radius:i.radius,stroke:i.stroke,atlasManager:i.atlasManager})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),atlasManager:this.atlasManager_});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.setRadius=function(t){this.radius_=t,this.render_(this.atlasManager_)},e}(Tu),Ru={FRACTION:"fraction",PIXELS:"pixels"},wu=function(t){function e(e,i,r,n,o,s){t.call(this),this.hitDetectionImage_=null,this.image_=e||new Image,null!==n&&(this.image_.crossOrigin=n),this.canvas_=s?document.createElement("canvas"):null,this.color_=s,this.imageListenerKeys_=null,this.imageState_=o,this.size_=r,this.src_=i,this.tainted_}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===xs.LOADED){this.tainted_=!1;var t=Jn(1,1);try{t.drawImage(this.image_,0,0),t.getImageData(0,0,1,1)}catch(t){this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(M.CHANGE)},e.prototype.handleImageError_=function(){this.imageState_=xs.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=xs.LOADED,this.size_&&(this.image_.width=this.size_[0],this.image_.height=this.size_[1]),this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.replaceColor_(),this.dispatchChangeEvent_()},e.prototype.getImage=function(t){return this.canvas_?this.canvas_:this.image_},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(t){if(!this.hitDetectionImage_)if(this.isTainted_()){var e=this.size_[0],i=this.size_[1],r=Jn(e,i);r.fillRect(0,0,e,i),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(this.imageState_==xs.IDLE){this.imageState_=xs.LOADING,this.imageListenerKeys_=[m(this.image_,M.ERROR,this.handleImageError_,this),m(this.image_,M.LOAD,this.handleImageLoad_,this)];try{this.image_.src=this.src_}catch(t){this.handleImageError_()}}},e.prototype.replaceColor_=function(){if(this.color_&&!this.isTainted_()){this.canvas_.width=this.image_.width,this.canvas_.height=this.image_.height;var t=this.canvas_.getContext("2d");t.drawImage(this.image_,0,0);for(var e=t.getImageData(0,0,this.image_.width,this.image_.height),i=e.data,r=this.color_[0]/255,n=this.color_[1]/255,o=this.color_[2]/255,s=0,a=i.length;s0,6);var p=void 0!==i.src?xs.IDLE:xs.LOADED;this.color_=void 0!==i.color?_r(i.color):null,this.iconImage_=function(t,e,i,r,n,o){var s=Ks.get(e,r,o);return s||(s=new wu(t,e,i,r,n,o),Ks.set(e,r,o,s)),s}(h,u,l,this.crossOrigin_,p,this.color_),this.offset_=void 0!==i.offset?i.offset:[0,0],this.offsetOrigin_=void 0!==i.offsetOrigin?i.offsetOrigin:Iu.TOP_LEFT,this.origin_=null,this.size_=void 0!==i.size?i.size:null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==Ru.FRACTION||this.anchorYUnits_==Ru.FRACTION){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==Ru.FRACTION&&(t[0]*=e[0]),this.anchorYUnits_==Ru.FRACTION&&(t[1]*=e[1])}if(this.anchorOrigin_!=Iu.TOP_LEFT){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=Iu.TOP_RIGHT&&this.anchorOrigin_!=Iu.BOTTOM_RIGHT||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=Iu.BOTTOM_LEFT&&this.anchorOrigin_!=Iu.BOTTOM_RIGHT||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(t){return this.iconImage_.getHitDetectionImage(t)},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_;if(this.offsetOrigin_!=Iu.TOP_LEFT){var e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),this.offsetOrigin_!=Iu.TOP_RIGHT&&this.offsetOrigin_!=Iu.BOTTOM_RIGHT||(t[0]=i[0]-e[0]-t[0]),this.offsetOrigin_!=Iu.BOTTOM_LEFT&&this.offsetOrigin_!=Iu.BOTTOM_RIGHT||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t,e){return v(this.iconImage_,M.CHANGE,t,e)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t,e){x(this.iconImage_,M.CHANGE,t,e)},e}(Su),Ou=function(t){var e=t||{};this.geometry_=null,this.geometryFunction_=Fu,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex};Ou.prototype.clone=function(){var t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new Ou({geometry:t,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},Ou.prototype.getRenderer=function(){return this.renderer_},Ou.prototype.setRenderer=function(t){this.renderer_=t},Ou.prototype.getGeometry=function(){return this.geometry_},Ou.prototype.getGeometryFunction=function(){return this.geometryFunction_},Ou.prototype.getFill=function(){return this.fill_},Ou.prototype.setFill=function(t){this.fill_=t},Ou.prototype.getImage=function(){return this.image_},Ou.prototype.setImage=function(t){this.image_=t},Ou.prototype.getStroke=function(){return this.stroke_},Ou.prototype.setStroke=function(t){this.stroke_=t},Ou.prototype.getText=function(){return this.text_},Ou.prototype.setText=function(t){this.text_=t},Ou.prototype.getZIndex=function(){return this.zIndex_},Ou.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Fu,this.geometry_=t},Ou.prototype.setZIndex=function(t){this.zIndex_=t};var Pu=null;function bu(t,e){if(!Pu){var i=new mr({color:"rgba(255,255,255,0.4)"}),r=new Er({color:"#3399CC",width:1.25});Pu=[new Ou({image:new Cu({fill:i,stroke:r,radius:5}),fill:i,stroke:r})]}return Pu}function Mu(){var t={},e=[255,255,255,1],i=[0,153,255,1];return t[Nt.POLYGON]=[new Ou({fill:new mr({color:[255,255,255,.5]})})],t[Nt.MULTI_POLYGON]=t[Nt.POLYGON],t[Nt.LINE_STRING]=[new Ou({stroke:new Er({color:e,width:5})}),new Ou({stroke:new Er({color:i,width:3})})],t[Nt.MULTI_LINE_STRING]=t[Nt.LINE_STRING],t[Nt.CIRCLE]=t[Nt.POLYGON].concat(t[Nt.LINE_STRING]),t[Nt.POINT]=[new Ou({image:new Cu({radius:6,fill:new mr({color:i}),stroke:new Er({color:e,width:1.5})}),zIndex:1/0})],t[Nt.MULTI_POINT]=t[Nt.POINT],t[Nt.GEOMETRY_COLLECTION]=t[Nt.POLYGON].concat(t[Nt.LINE_STRING],t[Nt.POINT]),t}function Fu(t){return t.getGeometry()}var Au=Ou;function Nu(t,e){var i=/\{z\}/g,r=/\{x\}/g,n=/\{y\}/g,o=/\{-y\}/g;return function(s,a,h){return s?t.replace(i,s[0].toString()).replace(r,s[1].toString()).replace(n,function(){return(-s[2]-1).toString()}).replace(o,function(){var t=s[0],i=e.getFullTileRange(t);return Y(i,55),(i.getHeight()+s[2]).toString()}):void 0}}function Gu(t,e){for(var i=t.length,r=new Array(i),n=0;n0&&(o/=l)}return o}function Bu(t,e,i,r){var n=i-t,o=r-e,s=Math.sqrt(n*n+o*o);return[Math.round(i+n/s),Math.round(r+o/s)]}function Vu(t,e,i,r,n,o,s,a,h,l,u){var p=Jn(Math.round(i*t),Math.round(i*e));if(0===h.length)return p.canvas;p.scale(i,i);var c=[1/0,1/0,-1/0,-1/0];h.forEach(function(t,e,i){ft(c,t.extent)});var d=Ot(c),f=Rt(c),_=Jn(Math.round(i*d/r),Math.round(i*f/r)),g=i/r;h.forEach(function(t,e,i){var r=t.extent[0]-c[0],n=-(t.extent[3]-c[3]),o=Ot(t.extent),s=Rt(t.extent);_.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,r*g,n*g,o*g,s*g)});var y=It(s);return a.getTriangles().forEach(function(t,e,n){var s=t.source,a=t.target,h=s[0][0],l=s[0][1],u=s[1][0],d=s[1][1],f=s[2][0],g=s[2][1],v=(a[0][0]-y[0])/o,m=-(a[0][1]-y[1])/o,x=(a[1][0]-y[0])/o,E=-(a[1][1]-y[1])/o,S=(a[2][0]-y[0])/o,T=-(a[2][1]-y[1])/o,C=h,R=l;h=0,l=0;var w=function(t){for(var e=t.length,i=0;in&&(n=s,r=o)}if(0===n)return null;var a=t[r];t[r]=t[i],t[i]=a;for(var h=i+1;h=0;c--){p[c]=t[c][e]/t[c][c];for(var d=c-1;d>=0;d--)t[d][e]-=t[d][c]*p[c]}return p}([[u-=C,d-=R,0,0,x-v],[f-=C,g-=R,0,0,S-v],[0,0,u,d,E-m],[0,0,f,g,T-m]]);if(w){p.save(),p.beginPath();var I=(v+x+S)/3,L=(m+E+T)/3,O=Bu(I,L,v,m),P=Bu(I,L,x,E),b=Bu(I,L,S,T);p.moveTo(P[0],P[1]),p.lineTo(O[0],O[1]),p.lineTo(b[0],b[1]),p.clip(),p.transform(w[0],w[2],w[1],w[3],v,m),p.translate(c[0]-C,c[3]-R),p.scale(r/i,-r/i),p.drawImage(_.canvas,0,0),p.restore()}}),u&&(p.save(),p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach(function(t,e,i){var r=t.target,n=(r[0][0]-y[0])/o,s=-(r[0][1]-y[1])/o,a=(r[1][0]-y[0])/o,h=-(r[1][1]-y[1])/o,l=(r[2][0]-y[0])/o,u=-(r[2][1]-y[1])/o;p.beginPath(),p.moveTo(a,h),p.lineTo(n,s),p.lineTo(l,u),p.closePath(),p.stroke()}),p.restore()),p.canvas}var Xu=function(t,e,i,r,n){this.sourceProj_=t,this.targetProj_=e;var o={},s=Oe(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];return o[e]||(o[e]=s(t)),o[e]},this.maxSourceExtent_=r,this.errorThresholdSquared_=n*n,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Ot(r)==Ot(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Ot(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Ot(this.targetProj_.getExtent()):null;var a=It(i),h=Lt(i),l=St(i),u=Et(i),p=this.transformInv_(a),c=this.transformInv_(h),d=this.transformInv_(l),f=this.transformInv_(u);if(this.addQuad_(a,h,l,u,p,c,d,f,10),this.wrapsXInSource_){var _=1/0;this.triangles_.forEach(function(t,e,i){_=Math.min(_,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-_>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-_>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-_>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-_>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var i=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-i.5&&u<1,d=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)d=Ot(tt([t,e,i,r]))/this.targetWorldWidth_>.25||d;!c&&this.sourceProj_.isGlobal()&&u&&(d=u>.25||d)}if(d||!this.maxSourceExtent_||Pt(l,this.maxSourceExtent_)){if(!(d||isFinite(n[0])&&isFinite(n[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(a[0])&&isFinite(a[1]))){if(!(h>0))return;d=!0}if(h>0){if(!d){var f,_=[(t[0]+i[0])/2,(t[1]+i[1])/2],g=this.transformInv_(_);if(c)f=(Xt(n[0],p)+Xt(s[0],p))/2-Xt(g[0],p);else f=(n[0]+s[0])/2-g[0];var y=(n[1]+s[1])/2-g[1];d=f*f+y*y>this.errorThresholdSquared_}if(d){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var v=[(e[0]+i[0])/2,(e[1]+i[1])/2],m=this.transformInv_(v),x=[(r[0]+t[0])/2,(r[1]+t[1])/2],E=this.transformInv_(x);this.addQuad_(t,e,v,x,n,o,m,E,h-1),this.addQuad_(x,v,i,r,E,m,s,a,h-1)}else{var S=[(t[0]+e[0])/2,(t[1]+e[1])/2],T=this.transformInv_(S),C=[(i[0]+r[0])/2,(i[1]+r[1])/2],R=this.transformInv_(C);this.addQuad_(t,S,C,r,n,T,R,a,h-1),this.addQuad_(S,e,i,C,T,o,s,R,h-1)}return}}if(c){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}this.addTriangle_(t,i,r,n,s,a),this.addTriangle_(t,e,i,n,o,s)}},Xu.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,r){var n=e.source;_t(t,n[0]),_t(t,n[1]),_t(t,n[2])}),t},Xu.prototype.getTriangles=function(){return this.triangles_};var zu=Xu,Wu=function(t){function e(e,i,r,n,o,s,a,h,l,u,p){t.call(this,o,On.IDLE),this.renderEdges_=void 0!==p&&p,this.pixelRatio_=a,this.gutter_=h,this.canvas_=null,this.sourceTileGrid_=i,this.targetTileGrid_=n,this.wrappedTileCoord_=s||o,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;var c=n.getTileCoordExtent(this.wrappedTileCoord_),d=this.targetTileGrid_.getExtent(),f=this.sourceTileGrid_.getExtent(),_=d?wt(c,d):c;if(0!==xt(_)){var g=e.getExtent();g&&(f=f?wt(f,g):g);var y=n.getResolution(this.wrappedTileCoord_[0]),v=Yu(e,r,Tt(_),y);if(!isFinite(v)||v<=0)this.state=On.EMPTY;else{var m=void 0!==u?u:vs;if(this.triangulation_=new zu(e,r,_,f,v*m),0!==this.triangulation_.getTriangles().length){this.sourceZ_=i.getZForResolution(v);var x=this.triangulation_.calculateSourceExtent();if(f&&(e.canWrapX()?(x[1]=kt(x[1],f[1],f[3]),x[3]=kt(x[3],f[1],f[3])):x=wt(x,f)),xt(x)){for(var E=i.getTileRangeForExtentAndZ(x,this.sourceZ_),S=E.minX;S<=E.maxX;S++)for(var T=E.minY;T<=E.maxY;T++){var C=l(this.sourceZ_,S,T,a);C&&this.sourceTiles_.push(C)}0===this.sourceTiles_.length&&(this.state=On.EMPTY)}else this.state=On.EMPTY}else this.state=On.EMPTY}}else this.state=On.EMPTY}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.state==On.LOADING&&this.unlistenSources_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,i,r){e&&e.getState()==On.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=On.ERROR;else{var e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),r="number"==typeof i?i:i[0],n="number"==typeof i?i:i[1],o=this.targetTileGrid_.getResolution(e),s=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Vu(r,n,this.pixelRatio_,s,this.sourceTileGrid_.getExtent(),o,a,this.triangulation_,t,this.gutter_,this.renderEdges_),this.state=On.LOADED}this.changed()},e.prototype.load=function(){if(this.state==On.IDLE){this.state=On.LOADING,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,i,r){var n=e.getState();if(n==On.IDLE||n==On.LOADING){t++;var o=v(e,M.CHANGE,function(i){var r=e.getState();r!=On.LOADED&&r!=On.ERROR&&r!=On.EMPTY||(E(o),0===--t&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(o)}}.bind(this)),this.sourceTiles_.forEach(function(t,e,i){t.getState()==On.IDLE&&t.load()}),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(E),this.sourcesListenerKeys_=null},e}(yl),Ku="tileloadstart",Hu="tileloadend",Zu="tileloaderror",qu=function(t){function e(e){t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible}),this.generateTileUrlFunction_=!e.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,this.tileUrlFunction=e.tileUrlFunction?e.tileUrlFunction.bind(this):ku,this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),e.tileUrlFunction&&this.setTileUrlFunction(e.tileUrlFunction,this.key_),this.tileLoadingKeys_={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,i=t.target,r=o(i),n=i.getState();n==On.LOADING?(this.tileLoadingKeys_[r]=!0,e=Ku):r in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[r],e=n==On.ERROR?Zu:n==On.LOADED||n==On.ABORT?Hu:void 0),void 0!=e&&this.dispatchEvent(new Dl(e,i))},e.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},e.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},e.prototype.setUrl=function(t){var e=this.urls=ju(t);this.setUrls(e)},e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(Gu(t,this.tileGrid),e):this.setKey(e)},e.prototype.useTile=function(t,e,i){var r=El(t,e,i);this.tileCache.containsKey(r)&&this.tileCache.get(r)},e}(kl);function Ju(t,e){t.getImage().src=e}var Qu=function(t){function e(e){t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Ju,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible}),this.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,this.tileClass=void 0!==e.tileClass?e.tileClass:ml,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var i=this.getTileCacheForProjection(t);for(var r in this.tileCache.expireCache(this.tileCache==i?e:{}),this.tileCacheForProjection){var n=this.tileCacheForProjection[r];n.expireCache(n==i?e:{})}},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Ie(this.getProjection(),t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!Ie(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Ie(e,t)){var i=o(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Pl(t)),this.tileGridForProjection[i]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||Ie(e,t))return this.tileCache;var i=o(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new Cl(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]},e.prototype.createTile_=function(t,e,i,r,n,o){var s=[t,e,i],a=this.getTileCoordForTileUrlFunction(s,n),h=a?this.tileUrlFunction(a,r,n):void 0,l=new this.tileClass(s,void 0!==h?On.IDLE:On.EMPTY,void 0!==h?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return l.key=o,v(l,M.CHANGE,this.handleTileChange,this),l},e.prototype.getTile=function(t,e,i,r,n){var o=this.getProjection();if(o&&n&&!Ie(o,n)){var s,a=this.getTileCacheForProjection(n),h=[t,e,i],l=Sl(h);a.containsKey(l)&&(s=a.get(l));var u=this.getKey();if(s&&s.key==u)return s;var p=this.getTileGridForProjection(o),c=this.getTileGridForProjection(n),d=this.getTileCoordForTileUrlFunction(h,n),f=new Wu(o,p,n,c,h,d,this.getTilePixelRatio(r),this.getGutter(),function(t,e,i,r){return this.getTileInternal(t,e,i,r,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_);return f.key=u,s?(f.interimTile=s,f.refreshInterimChain(),a.replace(l,f)):a.set(l,f),f}return this.getTileInternal(t,e,i,r,o||n)},e.prototype.getTileInternal=function(t,e,i,r,n){var o=null,s=El(t,e,i),a=this.getKey();if(this.tileCache.containsKey(s)){if((o=this.tileCache.get(s)).key!=a){var h=o;o=this.createTile_(t,e,i,r,n,a),h.getState()==On.IDLE?o.interimTile=h.interimTile:o.interimTile=h,o.refreshInterimChain(),this.tileCache.replace(s,o)}}else o=this.createTile_(t,e,i,r,n,a),this.tileCache.set(s,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var i=Ee(t);if(i){var r=o(i);r in this.tileGridForProjection||(this.tileGridForProjection[r]=e)}},e}(qu),$u=function(t){function e(e){var i=void 0!==e.hidpi&&e.hidpi;t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",opaque:!0,projection:Ee("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:ro.LOADING,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:i?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition}),this.hidpi_=i,this.culture_=void 0!==e.culture?e.culture:"en-us",this.maxZoom_=void 0!==e.maxZoom?e.maxZoom:-1,this.apiKey_=e.key,this.imagerySet_=e.imagerySet,Uu("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+this.apiKey_+"&c="+this.culture_,this.handleImageryMetadataResponse.bind(this),void 0,"jsonp")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getApiKey=function(){return this.apiKey_},e.prototype.getImagerySet=function(){return this.imagerySet_},e.prototype.handleImageryMetadataResponse=function(t){if(200==t.statusCode&&"OK"==t.statusDescription&&"ValidCredentials"==t.authenticationResultCode&&1==t.resourceSets.length&&1==t.resourceSets[0].resources.length){var e=t.resourceSets[0].resources[0],i=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,r=Nl(this.getProjection()),n=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/n:[e.imageWidth/n,e.imageHeight/n],s=Ml({extent:r,minZoom:e.zoomMin,maxZoom:i,tileSize:o});this.tileGrid=s;var a=this.culture_,h=this.hidpi_;if(this.tileUrlFunction=Du(e.imageUrlSubdomains.map(function(t){var i=[0,0,0],r=e.imageUrl.replace("{subdomain}",t).replace("{culture}",a);return function(t,e,n){if(t){xl(t[0],t[1],-t[2]-1,i);var o=r;return h&&(o+="&dpi=d1&device=mobile"),o.replace("{quadkey}",function(t){var e,i,r=t[0],n=new Array(r),o=1<>=1;return n.join("")}(i))}}})),e.imageryProviders){var l=Le(Ee("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var i=[],r=t.viewState,n=this.getTileGrid().getTileCoordForCoordAndResolution(r.center,r.resolution)[0];return e.imageryProviders.map(function(e){for(var r=!1,o=e.coverageAreas,s=0,a=o.length;s=h.zoomMin&&n<=h.zoomMax){var u=h.bbox;if(Pt(Ft([u[1],u[0],u[3],u[2]],l),t.extent)){r=!0;break}}}r&&i.push(e.attribution)}),i.push('Terms of Use'),i}.bind(this))}this.setState(ro.READY)}else this.setState(ro.ERROR)},e}(Qu),tp=function(t){function e(e){var i=e||{},r=void 0!==i.projection?i.projection:"EPSG:3857",n=void 0!==i.tileGrid?i.tileGrid:Ml({extent:Nl(r),maxZoom:i.maxZoom,minZoom:i.minZoom,tileSize:i.tileSize});t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,crossOrigin:i.crossOrigin,opaque:i.opaque,projection:r,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:i.tileLoadFunction,tilePixelRatio:i.tilePixelRatio,tileUrlFunction:i.tileUrlFunction,url:i.url,urls:i.urls,wrapX:void 0===i.wrapX||i.wrapX,transition:i.transition,attributionsCollapsible:i.attributionsCollapsible})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Qu),ep=function(t){function e(e){t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,maxZoom:void 0!==e.maxZoom?e.maxZoom:18,minZoom:e.minZoom,projection:e.projection,wrapX:e.wrapX}),this.account_=e.account,this.mapId_=e.map||"",this.config_=e.config||{},this.templateCache_={},this.initializeMap_()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getConfig=function(){return this.config_},e.prototype.updateConfig=function(t){u(this.config_,t),this.initializeMap_()},e.prototype.setConfig=function(t){this.config_=t||{},this.initializeMap_()},e.prototype.initializeMap_=function(){var t=JSON.stringify(this.config_);if(this.templateCache_[t])this.applyTemplate_(this.templateCache_[t]);else{var e="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(e+="/named/"+this.mapId_);var i=new XMLHttpRequest;i.addEventListener("load",this.handleInitResponse_.bind(this,t)),i.addEventListener("error",this.handleInitError_.bind(this)),i.open("POST",e),i.setRequestHeader("Content-type","application/json"),i.send(JSON.stringify(this.config_))}},e.prototype.handleInitResponse_=function(t,e){var i=e.target;if(!i.status||i.status>=200&&i.status<300){var r;try{r=JSON.parse(i.responseText)}catch(t){return void this.setState(ro.ERROR)}this.applyTemplate_(r),this.templateCache_[t]=r,this.setState(ro.READY)}else this.setState(ro.ERROR)},e.prototype.handleInitError_=function(t){this.setState(ro.ERROR)},e.prototype.applyTemplate_=function(t){var e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)},e}(tp),ip={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature"},rp=function(t){function e(e,i){t.call(this,e),this.feature=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),np=function(t){function e(e){var i=e||{};t.call(this,{attributions:i.attributions,projection:void 0,state:ro.READY,wrapX:void 0===i.wrapX||i.wrapX}),this.loader_=I,this.format_=i.format,this.overlaps_=void 0==i.overlaps||i.overlaps,this.url_=i.url,void 0!==i.loader?this.loader_=i.loader:void 0!==this.url_&&(Y(this.format_,7),this.loader_=Zl(this.url_,this.format_)),this.strategy_=void 0!==i.strategy?i.strategy:ql;var r,n,o=void 0===i.useSpatialIndex||i.useSpatialIndex;this.featuresRtree_=o?new tl:null,this.loadedExtentsRtree_=new tl,this.nullGeometryFeatures_={},this.idIndex_={},this.undefIdIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(i.features)?n=i.features:i.features&&(n=(r=i.features).getArray()),o||void 0!==r||(r=new U(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==r&&this.bindFeaturesCollection_(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=o(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var i=t.getGeometry();if(i){var r=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new rp(ip.ADDFEATURE,t))}},e.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[v(e,M.CHANGE,this.handleFeatureChange_,this),v(e,l,this.handleFeatureChange_,this)]},e.prototype.addToIndex_=function(t,e){var i=!0,r=e.getId();return void 0!==r?r.toString()in this.idIndex_?i=!1:this.idIndex_[r.toString()]=e:(Y(!(t in this.undefIdIndex_),30),this.undefIdIndex_[t]=e),i},e.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},e.prototype.addFeaturesInternal=function(t){for(var e=[],i=[],r=[],n=0,s=t.length;n=0;--i){var r=this.geometryFunction(t[i]);r?Hi(e,r.getCoordinates()):t.splice(i,1)}tr(e,1/t.length);var n=new B(new ci(e));return n.set("features",t),n},e}(np),sp=function(t){function e(e,i,r,n,o,s){var a=e.getExtent(),h=i.getExtent(),l=h?wt(r,h):r,u=Yu(e,i,Tt(l),n),p=new zu(e,i,l,a,u*vs),c=s(p.calculateSourceExtent(),u,o),d=xs.LOADED;c&&(d=xs.IDLE);var f=c?c.getPixelRatio():1;t.call(this,r,n,f,d),this.targetProj_=i,this.maxSourceExtent_=a,this.triangulation_=p,this.targetResolution_=n,this.targetExtent_=r,this.sourceImage_=c,this.sourcePixelRatio_=f,this.canvas_=null,this.sourceListenerKey_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.state==xs.LOADING&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==xs.LOADED){var e=Ot(this.targetExtent_)/this.targetResolution_,i=Rt(this.targetExtent_)/this.targetResolution_;this.canvas_=Vu(e,i,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==xs.IDLE){this.state=xs.LOADING,this.changed();var t=this.sourceImage_.getState();t==xs.LOADED||t==xs.ERROR?this.reproject_():(this.sourceListenerKey_=v(this.sourceImage_,M.CHANGE,function(t){var e=this.sourceImage_.getState();e!=xs.LOADED&&e!=xs.ERROR||(this.unlistenSource_(),this.reproject_())},this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){E(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(ms),ap="imageloadstart",hp="imageloadend",lp="imageloaderror",up=function(t){function e(e,i){t.call(this,e),this.image=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);function pp(t,e){t.getImage().src=e}var cp=function(t){function e(e){t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state}),this.resolutions_=void 0!==e.resolutions?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=z(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,i,r){var n=this.getProjection();if(n&&r&&!Ie(n,r)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Ie(this.reprojectedImage_.getProjection(),r)&&this.reprojectedImage_.getResolution()==e&&dt(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new sp(n,r,t,e,i,function(t,e,i){return this.getImageInternal(t,e,i,n)}.bind(this)),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return n&&(r=n),this.getImageInternal(t,e,i,r)},e.prototype.getImageInternal=function(t,e,i,n){return r()},e.prototype.handleImageChange=function(t){var e=t.target;switch(e.getState()){case xs.LOADING:this.loading=!0,this.dispatchEvent(new up(ap,e));break;case xs.LOADED:this.loading=!1,this.dispatchEvent(new up(hp,e));break;case xs.ERROR:this.loading=!1,this.dispatchEvent(new up(lp,e))}},e}(wl),dp=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,r,xs.IDLE),this.src_=n,this.image_=new Image,null!==o&&(this.image_.crossOrigin=o),this.imageListenerKeys_=null,this.state=xs.IDLE,this.imageLoadFunction_=s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=xs.ERROR,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=Rt(this.extent)/this.image_.height),this.state=xs.LOADED,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=xs.IDLE&&this.state!=xs.ERROR||(this.state=xs.LOADING,this.changed(),this.imageListenerKeys_=[m(this.image_,M.ERROR,this.handleImageError_,this),m(this.image_,M.LOAD,this.handleImageLoad_,this)],this.imageLoadFunction_(this,this.src_))},e.prototype.setImage=function(t){this.image_=t},e.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach(E),this.imageListenerKeys_=null},e}(ms);function fp(t,e){var i=[];Object.keys(e).forEach(function(t){null!==e[t]&&void 0!==e[t]&&i.push(t+"="+encodeURIComponent(e[t]))});var r=i.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+r}var _p=function(t){function e(e){var i=e||{};t.call(this,{attributions:i.attributions,projection:i.projection,resolutions:i.resolutions}),this.crossOrigin_=void 0!==i.crossOrigin?i.crossOrigin:null,this.hidpi_=void 0===i.hidpi||i.hidpi,this.url_=i.url,this.imageLoadFunction_=void 0!==i.imageLoadFunction?i.imageLoadFunction:pp,this.params_=i.params||{},this.image_=null,this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=void 0!==i.ratio?i.ratio:1.5}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,i,r){if(void 0===this.url_)return null;e=this.findNearestResolution(e),i=this.hidpi_?i:1;var n=this.image_;if(n&&this.renderedRevision_==this.getRevision()&&n.getResolution()==e&&n.getPixelRatio()==i&&ot(n.getExtent(),t))return n;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};u(o,this.params_);var s=((t=t.slice())[0]+t[2])/2,a=(t[1]+t[3])/2;if(1!=this.ratio_){var h=this.ratio_*Ot(t)/2,l=this.ratio_*Rt(t)/2;t[0]=s-h,t[1]=a-l,t[2]=s+h,t[3]=a+l}var p=e/i,c=Math.ceil(Ot(t)/p),d=Math.ceil(Rt(t)/p);t[0]=s-p*c/2,t[2]=s+p*c/2,t[1]=a-p*d/2,t[3]=a+p*d/2,this.imageSize_[0]=c,this.imageSize_[1]=d;var f=this.getRequestUrl_(t,this.imageSize_,i,r,o);return this.image_=new dp(t,e,i,f,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),v(this.image_,M.CHANGE,this.handleImageChange,this),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,i,r,n){var o=r.getCode().split(":").pop();n.SIZE=e[0]+","+e[1],n.BBOX=t.join(","),n.BBOXSR=o,n.IMAGESR=o,n.DPI=Math.round(90*i);var s=this.url_,a=s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return a==s&&Y(!1,50),fp(a,n)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){u(this.params_,t),this.image_=null,this.changed()},e}(cp),gp=function(t){function e(e){var i=e||{};t.call(this,{attributions:i.attributions,projection:i.projection,resolutions:i.resolutions,state:i.state}),this.canvasFunction_=i.canvasFunction,this.canvas_=null,this.renderedRevision_=0,this.ratio_=void 0!==i.ratio?i.ratio:1.5}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImageInternal=function(t,e,i,r){e=this.findNearestResolution(e);var n=this.canvas_;if(n&&this.renderedRevision_==this.getRevision()&&n.getResolution()==e&&n.getPixelRatio()==i&&ot(n.getExtent(),t))return n;Mt(t=t.slice(),this.ratio_);var o=[Ot(t)/e*i,Rt(t)/e*i],s=this.canvasFunction_.call(this,t,e,i,o,r);return s&&(n=new Es(t,e,i,s)),this.canvas_=n,this.renderedRevision_=this.getRevision(),n},e}(cp);var yp=function(t){function e(e){t.call(this,{projection:e.projection,resolutions:e.resolutions}),this.crossOrigin_=void 0!==e.crossOrigin?e.crossOrigin:null,this.displayDpi_=void 0!==e.displayDpi?e.displayDpi:96,this.params_=e.params||{},this.url_=e.url,this.imageLoadFunction_=void 0!==e.imageLoadFunction?e.imageLoadFunction:pp,this.hidpi_=void 0===e.hidpi||e.hidpi,this.metersPerUnit_=void 0!==e.metersPerUnit?e.metersPerUnit:1,this.ratio_=void 0!==e.ratio?e.ratio:1,this.useOverlay_=void 0!==e.useOverlay&&e.useOverlay,this.image_=null,this.renderedRevision_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,i,r){e=this.findNearestResolution(e),i=this.hidpi_?i:1;var n=this.image_;if(n&&this.renderedRevision_==this.getRevision()&&n.getResolution()==e&&n.getPixelRatio()==i&&ot(n.getExtent(),t))return n;1!=this.ratio_&&Mt(t=t.slice(),this.ratio_);var o=[Ot(t)/e*i,Rt(t)/e*i];if(void 0!==this.url_){var s=this.getUrl(this.url_,this.params_,t,o,r);v(n=new dp(t,e,i,s,this.crossOrigin_,this.imageLoadFunction_),M.CHANGE,this.handleImageChange,this)}else n=null;return this.image_=n,this.renderedRevision_=this.getRevision(),n},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.updateParams=function(t){u(this.params_,t),this.changed()},e.prototype.getUrl=function(t,e,i,r,n){var o=function(t,e,i,r){var n=Ot(t),o=Rt(t),s=e[0],a=e[1],h=.0254/r;return a*n>s*o?n*i/(s*h):o*i/(a*h)}(i,r,this.metersPerUnit_,this.displayDpi_),s=Tt(i),a={OPERATION:this.useOverlay_?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.displayDpi_,SETDISPLAYWIDTH:Math.round(r[0]),SETDISPLAYHEIGHT:Math.round(r[1]),SETVIEWSCALE:o,SETVIEWCENTERX:s[0],SETVIEWCENTERY:s[1]};return u(a,e),fp(t,a)},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e}(cp),vp=function(t){function e(e){var i=void 0!==e.crossOrigin?e.crossOrigin:null,r=void 0!==e.imageLoadFunction?e.imageLoadFunction:pp;t.call(this,{attributions:e.attributions,projection:Ee(e.projection)}),this.url_=e.url,this.imageExtent_=e.imageExtent,this.image_=new dp(this.imageExtent_,void 0,1,this.url_,i,r),this.imageSize_=e.imageSize?e.imageSize:null,v(this.image_,M.CHANGE,this.handleImageChange,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,i,r){return Pt(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},e.prototype.handleImageChange=function(e){if(this.image_.getState()==xs.LOADED){var i,r,n=this.image_.getExtent(),o=this.image_.getImage();this.imageSize_?(i=this.imageSize_[0],r=this.imageSize_[1]):(i=o.width,r=o.height);var s=Rt(n)/r,a=Math.ceil(Ot(n)/s);if(a!=i){var h=Jn(a,r),l=h.canvas;h.drawImage(o,0,0,i,r,0,0,l.width,l.height),this.image_.setImage(l)}}t.prototype.handleImageChange.call(this,e)},e}(cp),mp="1.3.0",xp="carmentaserver",Ep="geoserver",Sp="mapserver",Tp="qgis",Cp=[101,101],Rp=function(t){function e(e){var i=e||{};t.call(this,{attributions:i.attributions,projection:i.projection,resolutions:i.resolutions}),this.crossOrigin_=void 0!==i.crossOrigin?i.crossOrigin:null,this.url_=i.url,this.imageLoadFunction_=void 0!==i.imageLoadFunction?i.imageLoadFunction:pp,this.params_=i.params||{},this.v13_=!0,this.updateV13_(),this.serverType_=i.serverType,this.hidpi_=void 0===i.hidpi||i.hidpi,this.image_=null,this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=void 0!==i.ratio?i.ratio:1.5}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getGetFeatureInfoUrl=function(t,e,i,r){if(void 0!==this.url_){var n=Ee(i),o=this.getProjection();o&&o!==n&&(e=Yu(o,n,t,e),t=Pe(t,n,o));var s=Ct(t,e,0,Cp),a={SERVICE:"WMS",VERSION:mp,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};u(a,this.params_,r);var h=Math.floor((t[0]-s[0])/e),l=Math.floor((s[3]-t[1])/e);return a[this.v13_?"I":"X"]=h,a[this.v13_?"J":"Y"]=l,this.getRequestUrl_(s,Cp,1,o||n,a)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,i,r){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==i||this.hidpi_&&void 0!==this.serverType_||(i=1);var n=e/i,o=Tt(t),s=Ct(o,n,0,[Math.ceil(Ot(t)/n),Math.ceil(Rt(t)/n)]),a=Ct(o,n,0,[Math.ceil(this.ratio_*Ot(t)/n),Math.ceil(this.ratio_*Rt(t)/n)]),h=this.image_;if(h&&this.renderedRevision_==this.getRevision()&&h.getResolution()==e&&h.getPixelRatio()==i&&ot(h.getExtent(),s))return h;var l={SERVICE:"WMS",VERSION:mp,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};u(l,this.params_),this.imageSize_[0]=Math.round(Ot(a)/n),this.imageSize_[1]=Math.round(Rt(a)/n);var p=this.getRequestUrl_(a,this.imageSize_,i,r,l);return this.image_=new dp(a,e,i,p,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),v(this.image_,M.CHANGE,this.handleImageChange,this),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,i,r,n){if(Y(void 0!==this.url_,9),n[this.v13_?"CRS":"SRS"]=r.getCode(),"STYLES"in this.params_||(n.STYLES=""),1!=i)switch(this.serverType_){case Ep:var o=90*i+.5|0;"FORMAT_OPTIONS"in n?n.FORMAT_OPTIONS+=";dpi:"+o:n.FORMAT_OPTIONS="dpi:"+o;break;case Sp:n.MAP_RESOLUTION=90*i;break;case xp:case Tp:n.DPI=90*i;break;default:Y(!1,8)}n.WIDTH=e[0],n.HEIGHT=e[1];var s,a=r.getAxisOrientation();return s=this.v13_&&"ne"==a.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,n.BBOX=s.join(","),fp(this.url_,n)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){u(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||mp;this.v13_=Ki(t,"1.3")>=0},e}(cp),wp='© OpenStreetMap contributors.',Ip=function(t){function e(e){var i,r=e||{};i=void 0!==r.attributions?r.attributions:[wp];var n=void 0!==r.crossOrigin?r.crossOrigin:"anonymous",o=void 0!==r.url?r.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";t.call(this,{attributions:i,cacheSize:r.cacheSize,crossOrigin:n,opaque:void 0===r.opaque||r.opaque,maxZoom:void 0!==r.maxZoom?r.maxZoom:19,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileLoadFunction:r.tileLoadFunction,url:o,wrapX:r.wrapX,attributionsCollapsible:!1})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(tp),Lp=i(2),Op=function(t){function e(e){var i=e||{};t.call(this,i),this.type=Ss.IMAGE}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xo);Op.prototype.getSource;var Pp=Op,bp="preload",Mp="useInterimTilesOnError",Fp=function(t){function e(e){var i=e||{},r=u({},i);delete r.preload,delete r.useInterimTilesOnError,t.call(this,r),this.setPreload(void 0!==i.preload?i.preload:0),this.setUseInterimTilesOnError(void 0===i.useInterimTilesOnError||i.useInterimTilesOnError),this.type=Ss.TILE}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getPreload=function(){return this.get(bp)},e.prototype.setPreload=function(t){this.set(bp,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(Mp)},e.prototype.setUseInterimTilesOnError=function(t){this.set(Mp,t)},e}(xo);Fp.prototype.getSource;var Ap=Fp,Np="beforeoperations",Gp="afteroperations",Dp={PIXEL:"pixel",IMAGE:"image"},kp=function(t){function e(e,i,r){t.call(this,e),this.extent=i.extent,this.resolution=i.viewState.resolution/i.pixelRatio,this.data=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),jp=null;function Up(t,e,i){if(!t.prepareFrame(e,i))return null;var r=e.size[0],n=e.size[1];if(jp){var o=jp.canvas;o.width!==r||o.height!==n?jp=Jn(r,n):jp.clearRect(0,0,r,n)}else jp=Jn(r,n);return t.composeFrame(e,i,jp),jp.getImageData(0,0,r,n)}function Yp(t){var e=t,i=t,r=t,n=null;return"function"==typeof e.getTile?n=function(t){var e=new Ap({source:t});return new ha(e)}(e):"function"==typeof i.getImage?n=function(t){var e=new Pp({source:t});return new ra(e)}(i):r.getType()===Ss.TILE?n=new ha(r):r.getType()!=Ss.IMAGE&&r.getType()!=Ss.VECTOR||(n=new ra(r)),n}var Bp=function(t){function e(e){t.call(this,{projection:null}),this.worker_=null,this.operationType_=void 0!==e.operationType?e.operationType:Dp.PIXEL,this.threads_=void 0!==e.threads?e.threads:1,this.renderers_=function(t){for(var e=t.length,i=new Array(e),r=0;rStamen Design, under CC BY 3.0.',wp],Xp={terrain:{extension:"jpg",opaque:!0},"terrain-background":{extension:"jpg",opaque:!0},"terrain-labels":{extension:"png",opaque:!1},"terrain-lines":{extension:"png",opaque:!1},"toner-background":{extension:"png",opaque:!0},toner:{extension:"png",opaque:!0},"toner-hybrid":{extension:"png",opaque:!1},"toner-labels":{extension:"png",opaque:!1},"toner-lines":{extension:"png",opaque:!1},"toner-lite":{extension:"png",opaque:!0},watercolor:{extension:"jpg",opaque:!0}},zp={terrain:{minZoom:4,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:1,maxZoom:16}},Wp=function(t){function e(e){var i=e.layer.indexOf("-"),r=-1==i?e.layer:e.layer.slice(0,i),n=zp[r],o=Xp[e.layer],s=void 0!==e.url?e.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+e.layer+"/{z}/{x}/{y}."+o.extension;t.call(this,{attributions:Vp,cacheSize:e.cacheSize,crossOrigin:"anonymous",maxZoom:void 0!=e.maxZoom?e.maxZoom:n.maxZoom,minZoom:void 0!=e.minZoom?e.minZoom:n.minZoom,opaque:o.opaque,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,url:s,wrapX:e.wrapX})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(tp);function Kp(t,e,i){var r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(i)),!(r.getResolutions().length<=t[0])){var n=r.getTileCoordExtent(t,this.tmpExtent_),o=ho(r.getTileSize(t[0]),this.tmpSize);1!=e&&(o=ao(o,e,this.tmpSize));var s={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return u(s,this.params_),this.getRequestUrl_(t,o,n,e,i,s)}}var Hp=function(t){function e(e){var i=e||{};t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,crossOrigin:i.crossOrigin,projection:i.projection,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileGrid:i.tileGrid,tileLoadFunction:i.tileLoadFunction,tileUrlFunction:Kp,url:i.url,urls:i.urls,wrapX:void 0===i.wrapX||i.wrapX,transition:i.transition}),this.params_=i.params||{},this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.setKey(this.getKeyForParams_())}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,i,r,n,o){var s=this.urls;if(s){var a,h=n.getCode().split(":").pop();if(o.SIZE=e[0]+","+e[1],o.BBOX=i.join(","),o.BBOXSR=h,o.IMAGESR=h,o.DPI=Math.round(o.DPI?o.DPI*r:90*r),1==s.length)a=s[0];else a=s[Xt(Tl(t),s.length)];return fp(a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),o)}},e.prototype.getTilePixelRatio=function(t){return t},e.prototype.updateParams=function(t){u(this.params_,t),this.setKey(this.getKeyForParams_())},e}(Qu),Zp=function(t){function e(e,i,r){t.call(this,e,On.LOADED),this.tileSize_=i,this.text_=r,this.canvas_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImage=function(){if(this.canvas_)return this.canvas_;var t=this.tileSize_,e=Jn(t[0],t[1]);return e.strokeStyle="black",e.strokeRect(.5,.5,t[0]+.5,t[1]+.5),e.fillStyle="black",e.textAlign="center",e.textBaseline="middle",e.font="24px sans-serif",e.fillText(this.text_,t[0]/2,t[1]/2),this.canvas_=e.canvas,e.canvas},e.prototype.load=function(){},e}(yl),qp=function(t){function e(e){t.call(this,{opaque:!1,projection:e.projection,tileGrid:e.tileGrid,wrapX:void 0===e.wrapX||e.wrapX})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getTile=function(t,e,i){var r=El(t,e,i);if(this.tileCache.containsKey(r))return this.tileCache.get(r);var n=ho(this.tileGrid.getTileSize(t)),o=[t,e,i],s=this.getTileCoordForTileUrlFunction(o),a=s?this.getTileCoordForTileUrlFunction(s).toString():"",h=new Zp(o,n,a);return this.tileCache.set(r,h),h},e}(kl),Jp=function(t){function e(e){if(t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,projection:Ee("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:ro.LOADING,tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition}),this.tileJSON_=null,e.url)if(e.jsonp)Uu(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{var i=new XMLHttpRequest;i.addEventListener("load",this.onXHRLoad_.bind(this)),i.addEventListener("error",this.onXHRError_.bind(this)),i.open("GET",e.url),i.send()}else e.tileJSON?this.handleTileJSONResponse(e.tileJSON):Y(!1,51)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var i;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(i)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTileJSON=function(){return this.tileJSON_},e.prototype.handleTileJSONResponse=function(t){var e,i=Ee("EPSG:4326"),r=this.getProjection();if(void 0!==t.bounds){var n=Le(i,r);e=Ft(t.bounds,n)}var o=t.minzoom||0,s=t.maxzoom||22,a=Ml({extent:Nl(r),maxZoom:s,minZoom:o});if(this.tileGrid=a,this.tileUrlFunction=Gu(t.tiles,a),void 0!==t.attribution&&!this.getAttributions()){var h=void 0!==e?e:i.getExtent();this.setAttributions(function(e){return Pt(h,e.extent)?[t.attribution]:null})}this.tileJSON_=t,this.setState(ro.READY)},e.prototype.handleTileJSONError=function(){this.setState(ro.ERROR)},e}(Qu);function Qp(t,e,i){var r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(i)),!(r.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var n=r.getResolution(t[0]),o=r.getTileCoordExtent(t,this.tmpExtent_),s=ho(r.getTileSize(t[0]),this.tmpSize),a=this.gutter_;0!==a&&(s=so(s,a,this.tmpSize),o=et(o,n*a,o)),1!=e&&(s=ao(s,e,this.tmpSize));var h={SERVICE:"WMS",VERSION:mp,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return u(h,this.params_),this.getRequestUrl_(t,s,o,e,i,h)}}var $p=function(t){function e(e){var i=e||{},r=i.params||{},n=!("TRANSPARENT"in r)||r.TRANSPARENT;t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,crossOrigin:i.crossOrigin,opaque:!n,projection:i.projection,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileClass:i.tileClass,tileGrid:i.tileGrid,tileLoadFunction:i.tileLoadFunction,tileUrlFunction:Qp,url:i.url,urls:i.urls,wrapX:void 0===i.wrapX||i.wrapX,transition:i.transition}),this.gutter_=void 0!==i.gutter?i.gutter:0,this.params_=r,this.v13_=!0,this.serverType_=i.serverType,this.hidpi_=void 0===i.hidpi||i.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.updateV13_(),this.setKey(this.getKeyForParams_())}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getGetFeatureInfoUrl=function(t,e,i,r){var n=Ee(i),o=this.getProjection(),s=this.getTileGrid();s||(s=this.getTileGridForProjection(n));var a=s.getTileCoordForCoordAndResolution(t,e);if(!(s.getResolutions().length<=a[0])){var h=s.getResolution(a[0]),l=s.getTileCoordExtent(a,this.tmpExtent_),p=ho(s.getTileSize(a[0]),this.tmpSize),c=this.gutter_;0!==c&&(p=so(p,c,this.tmpSize),l=et(l,h*c,l)),o&&o!==n&&(h=Yu(o,n,t,h),l=be(l,n,o),t=Pe(t,n,o));var d={SERVICE:"WMS",VERSION:mp,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};u(d,this.params_,r);var f=Math.floor((t[0]-l[0])/h),_=Math.floor((l[3]-t[1])/h);return d[this.v13_?"I":"X"]=f,d[this.v13_?"J":"Y"]=_,this.getRequestUrl_(a,p,l,1,o||n,d)}},e.prototype.getGutter=function(){return this.gutter_},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,i,r,n,o){var s=this.urls;if(s){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=r)switch(this.serverType_){case Ep:var a=90*r+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+a:o.FORMAT_OPTIONS="dpi:"+a;break;case Sp:o.MAP_RESOLUTION=90*r;break;case xp:case Tp:o.DPI=90*r;break;default:Y(!1,52)}var h,l,u=n.getAxisOrientation(),p=i;if(this.v13_&&"ne"==u.substr(0,2))h=i[0],p[0]=i[1],p[1]=h,h=i[2],p[2]=i[3],p[3]=h;if(o.BBOX=p.join(","),1==s.length)l=s[0];else l=s[Xt(Tl(t),s.length)];return fp(l,o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_&&void 0!==this.serverType_?t:1},e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")},e.prototype.updateParams=function(t){u(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())},e.prototype.updateV13_=function(){var t=this.params_.VERSION||mp;this.v13_=Ki(t,"1.3")>=0},e}(Qu),tc=function(t){function e(e,i,r,n,o,s){t.call(this,e,i),this.src_=r,this.extent_=n,this.preemptive_=o,this.grid_=null,this.keys_=null,this.data_=null,this.jsonp_=s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImage=function(){return null},e.prototype.getData=function(t){if(!this.grid_||!this.keys_)return null;var e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),i=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),r=this.grid_[Math.floor((1-i)*this.grid_.length)];if("string"!=typeof r)return null;var n=r.charCodeAt(Math.floor(e*r.length));n>=93&&n--,n>=35&&n--;var o=null;if((n-=32)in this.keys_){var s=this.keys_[n];o=this.data_&&s in this.data_?this.data_[s]:s}return o},e.prototype.forDataAtCoordinate=function(t,e,i,r){this.state==On.IDLE&&!0===r?(m(this,M.CHANGE,function(r){e.call(i,this.getData(t))},this),this.loadInternal_()):!0===r?setTimeout(function(){e.call(i,this.getData(t))}.bind(this),0):e.call(i,this.getData(t))},e.prototype.getKey=function(){return this.src_},e.prototype.handleError_=function(){this.state=On.ERROR,this.changed()},e.prototype.handleLoad_=function(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=On.EMPTY,this.changed()},e.prototype.loadInternal_=function(){if(this.state==On.IDLE)if(this.state=On.LOADING,this.jsonp_)Uu(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{var t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",this.src_),t.send()}},e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var i;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleError_()}this.handleLoad_(i)}else this.handleError_()},e.prototype.onXHRError_=function(t){this.handleError_()},e.prototype.load=function(){this.preemptive_&&this.loadInternal_()},e}(yl),ec=function(t){function e(e){if(t.call(this,{projection:Ee("EPSG:3857"),state:ro.LOADING}),this.preemptive_=void 0===e.preemptive||e.preemptive,this.tileUrlFunction_=ku,this.template_=void 0,this.jsonp_=e.jsonp||!1,e.url)if(this.jsonp_)Uu(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{var i=new XMLHttpRequest;i.addEventListener("load",this.onXHRLoad_.bind(this)),i.addEventListener("error",this.onXHRError_.bind(this)),i.open("GET",e.url),i.send()}else e.tileJSON?this.handleTileJSONResponse(e.tileJSON):Y(!1,51)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var i;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(i)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTemplate=function(){return this.template_},e.prototype.forDataAtCoordinateAndResolution=function(t,e,i,r){if(this.tileGrid){var n=this.tileGrid.getTileCoordForCoordAndResolution(t,e);this.getTile(n[0],n[1],n[2],1,this.getProjection()).forDataAtCoordinate(t,i,null,r)}else!0===r?setTimeout(function(){i(null)},0):i(null)},e.prototype.handleTileJSONError=function(){this.setState(ro.ERROR)},e.prototype.handleTileJSONResponse=function(t){var e,i=Ee("EPSG:4326"),r=this.getProjection();if(void 0!==t.bounds){var n=Le(i,r);e=Ft(t.bounds,n)}var o=t.minzoom||0,s=t.maxzoom||22,a=Ml({extent:Nl(r),maxZoom:s,minZoom:o});this.tileGrid=a,this.template_=t.template;var h=t.grids;if(h){if(this.tileUrlFunction_=Gu(h,a),void 0!==t.attribution){var l=void 0!==e?e:i.getExtent();this.setAttributions(function(e){return Pt(l,e.extent)?[t.attribution]:null})}this.setState(ro.READY)}else this.setState(ro.ERROR)},e.prototype.getTile=function(t,e,i,r,n){var o=El(t,e,i);if(this.tileCache.containsKey(o))return this.tileCache.get(o);var s=[t,e,i],a=this.getTileCoordForTileUrlFunction(s,n),h=this.tileUrlFunction_(a,r,n),l=new tc(s,void 0!==h?On.IDLE:On.EMPTY,void 0!==h?h:"",this.tileGrid.getTileCoordExtent(s),this.preemptive_,this.jsonp_);return this.tileCache.set(o,l),l},e.prototype.useTile=function(t,e,i){var r=El(t,e,i);this.tileCache.containsKey(r)&&this.tileCache.get(r)},e}(kl),ic=function(t){function e(i,r,n,o,s,a,h,l,u,p,c,d,f,_,g){if(t.call(this,i,r,{transition:0}),this.context_={},this.loader_,this.replayState_={},this.sourceTiles_=p,this.tileKeys=[],this.extent=null,this.sourceRevision_=n,this.wrappedTileCoord=a,this.loadListenerKeys_=[],this.sourceTileListenerKeys_=[],a){var y=this.extent=u.getTileCoordExtent(a),m=u.getResolution(g),x=l.getZForResolution(m),E=g!=i[0],S=0;if(l.forEachTileCoord(y,x,function(t){var e=wt(y,l.getTileCoordExtent(t)),i=l.getExtent();if(i&&(e=wt(e,i,e)),Ot(e)/m>=.5&&Rt(e)/m>=.5){++S;var r=t.toString(),n=p[r];if(!n&&!E){var a=h(t,c,d);n=p[r]=new f(t,void 0==a?On.EMPTY:On.IDLE,void 0==a?"":a,o,s),this.sourceTileListenerKeys_.push(v(n,M.CHANGE,_))}!n||E&&n.getState()!=On.LOADED||(n.consumers++,this.tileKeys.push(r))}}.bind(this)),E&&S==this.tileKeys.length&&this.finishLoading_(),g<=i[0]&&this.state!=On.LOADED)for(;g>u.getMinZoom();){var T=new e(i,r,n,o,s,a,h,l,u,p,c,d,f,I,--g);if(T.state==On.LOADED){this.interimTile=T;break}}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.state=On.ABORT,this.changed(),this.interimTile&&this.interimTile.dispose();for(var e=0,i=this.tileKeys.length;e=0;--i){var r=this.getTile(this.tileKeys[i]).getState();r!=On.LOADED&&--t,r==On.EMPTY&&++e}t==this.tileKeys.length?(this.loadListenerKeys_.forEach(E),this.loadListenerKeys_.length=0,this.setState(On.LOADED)):this.setState(e==this.tileKeys.length?On.EMPTY:On.ERROR)},e}(yl);function rc(t,e){var i=Hl(e,t.getFormat(),t.onLoad.bind(t),t.onError.bind(t));t.setLoader(i)}var nc=[0,0,4096,4096],oc=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,s),this.consumers=0,this.extent_=null,this.format_=n,this.features_=null,this.loader_,this.projection_=null,this.replayGroups_={},this.tileLoadFunction_=o,this.url_=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.features_=null,this.replayGroups_={},this.state=On.ABORT,this.changed(),t.prototype.disposeInternal.call(this)},e.prototype.getExtent=function(){return this.extent_||nc},e.prototype.getFormat=function(){return this.format_},e.prototype.getFeatures=function(){return this.features_},e.prototype.getKey=function(){return this.url_},e.prototype.getProjection=function(){return this.projection_},e.prototype.getReplayGroup=function(t,e){return this.replayGroups_[o(t)+","+e]},e.prototype.load=function(){this.state==On.IDLE&&(this.setState(On.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_(null,NaN,null))},e.prototype.onLoad=function(t,e,i){this.setProjection(e),this.setFeatures(t),this.setExtent(i)},e.prototype.onError=function(){this.setState(On.ERROR)},e.prototype.setExtent=function(t){this.extent_=t},e.prototype.setFeatures=function(t){this.features_=t,this.setState(On.LOADED)},e.prototype.setProjection=function(t){this.projection_=t},e.prototype.setReplayGroup=function(t,e,i){this.replayGroups_[o(t)+","+e]=i},e.prototype.setLoader=function(t){this.loader_=t},e}(yl),sc=function(t){function e(e){var i=e.projection||"EPSG:3857",r=e.extent||Nl(i),n=e.tileGrid||Ml({extent:r,maxZoom:e.maxZoom||22,minZoom:e.minZoom,tileSize:e.tileSize||512});t.call(this,{attributions:e.attributions,cacheSize:void 0!==e.cacheSize?e.cacheSize:128,opaque:!1,projection:i,state:e.state,tileGrid:n,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:rc,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition}),this.format_=e.format?e.format:null,this.sourceTiles_={},this.overlaps_=void 0==e.overlaps||e.overlaps,this.tileClass=e.tileClass?e.tileClass:oc,this.tileGrids_={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getOverlaps=function(){return this.overlaps_},e.prototype.clear=function(){this.tileCache.clear(),this.sourceTiles_={}},e.prototype.getTile=function(t,e,i,r,n){var o=El(t,e,i);if(this.tileCache.containsKey(o))return this.tileCache.get(o);var s=[t,e,i],a=this.getTileCoordForTileUrlFunction(s,n),h=new ic(s,null!==a?On.IDLE:On.EMPTY,this.getRevision(),this.format_,this.tileLoadFunction,a,this.tileUrlFunction,this.tileGrid,this.getTileGridForProjection(n),this.sourceTiles_,r,n,this.tileClass,this.handleTileChange.bind(this),s[0]);return this.tileCache.set(o,h),h},e.prototype.getTileGridForProjection=function(t){var e=t.getCode(),i=this.tileGrids_[e];if(!i){var r=this.tileGrid;i=this.tileGrids_[e]=Al(t,void 0,r?r.getTileSize(r.getMinZoom()):void 0)}return i},e.prototype.getTilePixelRatio=function(t){return t},e.prototype.getTilePixelSize=function(t,e,i){var r=ho(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(r[0]*e),Math.round(r[1]*e)]},e}(qu),ac={KVP:"KVP",REST:"REST"},hc=function(t){function e(e){var i=void 0!==e.requestEncoding?e.requestEncoding:ac.KVP,r=e.tileGrid,n=e.urls;void 0===n&&void 0!==e.url&&(n=ju(e.url)),t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:r,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:ku,urls:n,wrapX:void 0!==e.wrapX&&e.wrapX,transition:e.transition}),this.version_=void 0!==e.version?e.version:"1.0.0",this.format_=void 0!==e.format?e.format:"image/jpeg",this.dimensions_=void 0!==e.dimensions?e.dimensions:{},this.layer_=e.layer,this.matrixSet_=e.matrixSet,this.style_=e.style,this.requestEncoding_=i,this.setKey(this.getKeyForDimensions_()),n&&n.length>0&&(this.tileUrlFunction=Du(n.map(lc.bind(this))))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(Du(t.map(lc.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var i in this.dimensions_)e[t++]=i+"-"+this.dimensions_[i];return e.join("/")},e.prototype.updateDimensions=function(t){u(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e}(Qu);function lc(t){var e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e==ac.KVP&&u(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e==ac.KVP?fp(t,i):t.replace(/\{(\w+?)\}/g,function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t});var r=this.tileGrid,n=this.dimensions_;return function(i,o,s){if(i){var a={TileMatrix:r.getMatrixId(i[0]),TileCol:i[1],TileRow:-i[2]-1};u(a,n);var h=t;return h=e==ac.KVP?fp(h,a):h.replace(/\{(\w+?)\}/g,function(t,e){return a[e]})}}}var uc={DEFAULT:"default",TRUNCATED:"truncated"},pc=function(t){function e(e,i,r,n,o,s,a){t.call(this,i,r,n,o,s,a),this.zoomifyImage_=null,this.tileSize_=ho(e.getTileSize(i[0]))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImage=function(){if(this.zoomifyImage_)return this.zoomifyImage_;var e=t.prototype.getImage.call(this);if(this.state==On.LOADED){var i=this.tileSize_;if(e.width==i[0]&&e.height==i[1])return this.zoomifyImage_=e,e;var r=Jn(i[0],i[1]);return r.drawImage(e,0,0),this.zoomifyImage_=r.canvas,r.canvas}return e},e}(ml),cc=function(t){function e(e){var i=e||{},r=i.size,n=void 0!==i.tierSizeCalculation?i.tierSizeCalculation:uc.DEFAULT,o=r[0],s=r[1],a=i.extent||[0,-r[1],r[0],0],h=[],l=i.tileSize||An,u=l;switch(n){case uc.DEFAULT:for(;o>u||s>u;)h.push([Math.ceil(o/u),Math.ceil(s/u)]),u+=u;break;case uc.TRUNCATED:for(var p=o,c=s;p>u||c>u;)h.push([Math.ceil(p/u),Math.ceil(c/u)]),p>>=1,c>>=1;break;default:Y(!1,53)}h.push([1,1]),h.reverse();for(var d=[1],f=[0],_=1,g=h.length;_0)break}this.source_&&(this.source_.clear(),this.source_.addFeatures(s)),this.dispatchEvent(new Sc(Ec,t,s,n))},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[v(e,M.DROP,Tc,this),v(e,M.DRAGENTER,Cc,this),v(e,M.DRAGOVER,Cc,this),v(e,M.DROP,Cc,this)]}},e.prototype.setActive=function(e){t.prototype.setActive.call(this,e),e?this.registerListeners_():this.unregisterListeners_()},e.prototype.setMap=function(e){this.unregisterListeners_(),t.prototype.setMap.call(this,e),this.getActive()&&this.registerListeners_()},e.prototype.tryReadFeatures_=function(t,e,i){try{return t.readFeatures(e,i)}catch(t){return null}},e.prototype.unregisterListeners_=function(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(E),this.dropListenKeys_=null)},e}(Fo),wc=function(t){function e(e){var i=e||{};t.call(this,i),this.condition_=i.condition?i.condition:zo,this.lastAngle_=void 0,this.lastMagnitude_=void 0,this.lastScaleDelta_=0,this.duration_=void 0!==i.duration?i.duration:400}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDragEvent=function(t){if(Ko(t)){var e=t.map,i=e.getSize(),r=t.pixel,n=r[0]-i[0]/2,o=i[1]/2-r[1],s=Math.atan2(o,n),a=Math.sqrt(n*n+o*o),h=e.getView();if(h.getConstraints().rotation!==Gn&&void 0!==this.lastAngle_){var l=s-this.lastAngle_;Oo(h,h.getRotation()-l)}if(this.lastAngle_=s,void 0!==this.lastMagnitude_)Mo(h,this.lastMagnitude_*(h.getResolution()/a));void 0!==this.lastMagnitude_&&(this.lastScaleDelta_=this.lastMagnitude_/a),this.lastMagnitude_=a}},e.prototype.handleUpEvent=function(t){if(!Ko(t))return!0;var e=t.map.getView();e.setHint(jn,-1);var i=this.lastScaleDelta_-1;return Lo(e,e.getRotation()),Po(e,e.getResolution(),void 0,this.duration_,i),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!Ko(t)&&(!!this.condition_(t)&&(t.map.getView().setHint(jn,1),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}(qo),Ic=function(t){function e(e,i,r){if(t.call(this),void 0!==r&&void 0===i)this.setFlatCoordinates(r,e);else{var n=i||0;this.setCenterAndRadius(e,n,r)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),void 0,this.layout)},e.prototype.closestPointXY=function(t,e,i,r){var n=this.flatCoordinates,o=t-n[0],s=e-n[1],a=o*o+s*s;if(a=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||mt(t,this.intersectsCoordinate,this))}return!1},e.prototype.setCenter=function(t){var e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],r=t.slice();r[e]=r[0]+i;for(var n=1;n=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,i=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===Ar.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e),r=!1):this.freehand_&&e.type===Ar.POINTERDOWN?r=!1:i?(r=e.type===Ar.POINTERMOVE)&&this.freehand_?r=this.handlePointerMove_(e):(e.pointerEvent.pointerType==Ur||e.type===Ar.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===Ar.DBLCLICK&&(r=!1),t.prototype.handleEvent.call(this,e)&&r},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t),!0):!!this.condition_(t)&&(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Nr(Ar.POINTERMOVE,t.map,t.pointerEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0)},e.prototype.handleUpEvent=function(t){var e=!0;this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);var i=this.mode_===Fc.CIRCLE;return this.shouldHandle_?(this.finishCoordinate_?this.freehand_||i?this.finishDrawing():this.atFinish_(t)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t):(this.startDrawing_(t),this.mode_===Fc.POINT&&this.finishDrawing()),e=!1):this.freehand_&&(this.finishCoordinate_=null,this.abortDrawing_()),!e&&this.stopClick_&&t.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,i=t.pixel,r=e[0]-i[0],n=e[1]-i[1],o=r*r+n*n;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return!0}return this.finishCoordinate_?this.modifyDrawing_(t):this.createOrUpdateSketchPoint_(t),!0},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var i=!1,r=[this.finishCoordinate_];if(this.mode_===Fc.LINE_STRING)i=this.sketchCoords_.length>this.minPoints_;else if(this.mode_===Fc.POLYGON){var n=this.sketchCoords_;i=n[0].length>this.minPoints_,r=[n[0][0],n[0][n[0].length-2]]}if(i)for(var o=t.map,s=0,a=r.length;s=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(r.slice()),this.geometryFunction_(i,n)):this.mode_===Fc.POLYGON&&((i=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(r.slice()),e&&(this.finishCoordinate_=i[0]),this.geometryFunction_(this.sketchCoords_,n)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry();this.mode_===Fc.LINE_STRING?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e),t.length>=2&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===Fc.POLYGON&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e)),0===t.length&&(this.finishCoordinate_=null),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,i=t.getGeometry();this.mode_===Fc.LINE_STRING?(e.pop(),this.geometryFunction_(e,i)):this.mode_===Fc.POLYGON&&(e[0].pop(),this.geometryFunction_(e,i),e=i.getCoordinates()),this.type_===Nt.MULTI_POINT?t.setGeometry(new Pc([e])):this.type_===Nt.MULTI_LINE_STRING?t.setGeometry(new Oc([e])):this.type_===Nt.MULTI_POLYGON&&t.setGeometry(new Mc([e])),this.dispatchEvent(new Gc(Nc,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return t&&(this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0)),t},e.prototype.extend=function(t){var e=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=e.getCoordinates();var i=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=i.slice(),this.sketchCoords_.push(i.slice()),this.updateSketchFeatures_(),this.dispatchEvent(new Gc(Ac,this.sketchFeature_))},e.prototype.updateSketchFeatures_=function(){var t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);var e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)},e.prototype.updateState_=function(){var t=this.getMap(),e=this.getActive();t&&e||this.abortDrawing_(),this.overlay_.setMap(e?t:null)},e}(qo),kc={EXTENTCHANGED:"extentchanged"},jc=function(t){function e(e){t.call(this,kc.EXTENTCHANGED),this.extent=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);function Uc(t){return function(e){return tt([t,e])}}function Yc(t,e){return t[0]==e[0]?function(i){return tt([t,[i[0],e[1]]])}:t[1]==e[1]?function(i){return tt([t,[e[0],i[1]]])}:null}var Bc=function(t){function e(e){var i=e||{};t.call(this,i),this.extent_=null,this.pointerHandler_=null,this.pixelTolerance_=void 0!==i.pixelTolerance?i.pixelTolerance:10,this.snappedToVertex_=!1,this.extentFeature_=null,this.vertexFeature_=null,e||(e={}),this.extentOverlay_=new _c({source:new np({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.boxStyle?e.boxStyle:function(){var t=Mu();return function(e,i){return t[Nt.POLYGON]}}(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.vertexOverlay_=new _c({source:new np({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.pointerStyle?e.pointerStyle:function(){var t=Mu();return function(e,i){return t[Nt.POINT]}}(),updateWhileAnimating:!0,updateWhileInteracting:!0}),e.extent&&this.setExtent(e.extent)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapToVertex_=function(t,e){var i=e.getCoordinateFromPixel(t),r=this.getExtent();if(r){var n=function(t){return[[[t[0],t[1]],[t[0],t[3]]],[[t[0],t[3]],[t[2],t[3]]],[[t[2],t[3]],[t[2],t[1]]],[[t[2],t[1]],[t[0],t[1]]]]}(r);n.sort(function(t,e){return rr(i,t)-rr(i,e)});var o=n[0],s=Zi(i,o),a=e.getPixelFromCoordinate(s);if(ir(t,a)<=this.pixelTolerance_){var h=e.getPixelFromCoordinate(o[0]),l=e.getPixelFromCoordinate(o[1]),u=er(a,h),p=er(a,l),c=Math.sqrt(Math.min(u,p));return this.snappedToVertex_=c<=this.pixelTolerance_,this.snappedToVertex_&&(s=u>p?o[1]:o[0]),s}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,i=t.map,r=this.snapToVertex_(e,i);r||(r=i.getCoordinateFromPixel(e)),this.createOrUpdatePointerFeature_(r)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(Oi(t)):e.setGeometry(void 0):(e=new B(t?Oi(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e},e.prototype.createOrUpdatePointerFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new B(new ci(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.pointerEvent||(e.type!=Ar.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=function(t){var e=t.pixel,i=t.map,r=this.getExtent(),n=this.snapToVertex_(e,i),o=function(t){var e=null,i=null;return t[0]==r[0]?e=r[2]:t[0]==r[2]&&(e=r[0]),t[1]==r[1]?i=r[3]:t[1]==r[3]&&(i=r[1]),null!==e&&null!==i?[e,i]:null};if(n&&r){var s=n[0]==r[0]||n[0]==r[2]?n[0]:null,a=n[1]==r[1]||n[1]==r[3]?n[1]:null;null!==s&&null!==a?this.pointerHandler_=Uc(o(n)):null!==s?this.pointerHandler_=Yc(o([s,r[1]]),o([s,r[3]])):null!==a&&(this.pointerHandler_=Yc(o([r[0],a]),o([r[2],a])))}else n=i.getCoordinateFromPixel(e),this.setExtent([n[0],n[1],n[0],n[1]]),this.pointerHandler_=Uc(n);return!0},e.prototype.handleDragEvent=function(t){if(this.pointerHandler_){var e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}return!0},e.prototype.handleUpEvent=function(t){this.pointerHandler_=null;var e=this.getExtent();return e&&0!==xt(e)||this.setExtent(null),!1},e.prototype.setMap=function(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getExtent=function(){return this.extent_},e.prototype.setExtent=function(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new jc(this.extent_))},e}(qo),Vc=1,Xc="modifystart",zc="modifyend",Wc=function(t){function e(e,i,r){t.call(this,e),this.features=i,this.mapBrowserEvent=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);function Kc(t,e){return t.index-e.index}function Hc(t,e){var i=e.geometry;if(i.getType()===Nt.CIRCLE){var r=i;if(e.index===Vc){var n=er(r.getCenter(),t),o=Math.sqrt(n)-r.getRadius();return o*o}}return rr(t,e.segment)}function Zc(t,e){var i=e.geometry;return i.getType()===Nt.CIRCLE&&e.index===Vc?i.getClosestPoint(t):Zi(t,e.segment)}var qc=function(t){function e(e){var i;if(t.call(this,e),this.condition_=e.condition?e.condition:Ho,this.defaultDeleteCondition_=function(t){return Go(t)&&Vo(t)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:jo,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.modified_=!1,this.rBush_=new tl,this.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new _c({source:new np({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:function(){var t=Mu();return function(e,i){return t[Nt.POINT]}}(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_,LineString:this.writeLineStringGeometry_,LinearRing:this.writeLineStringGeometry_,Polygon:this.writePolygonGeometry_,MultiPoint:this.writeMultiPointGeometry_,MultiLineString:this.writeMultiLineStringGeometry_,MultiPolygon:this.writeMultiPolygonGeometry_,Circle:this.writeCircleGeometry_,GeometryCollection:this.writeGeometryCollectionGeometry_},this.source_=null,e.source?(this.source_=e.source,i=new U(this.source_.getFeatures()),v(this.source_,ip.ADDFEATURE,this.handleSourceAdd_,this),v(this.source_,ip.REMOVEFEATURE,this.handleSourceRemove_,this)):i=e.features,!i)throw new Error("The modify interaction requires features or a source");this.features_=i,this.features_.forEach(this.addFeature_.bind(this)),v(this.features_,h.ADD,this.handleFeatureAdd_,this),v(this.features_,h.REMOVE,this.handleFeatureRemove_,this),this.lastPointerEvent_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addFeature_=function(t){var e=t.getGeometry();e&&e.getType()in this.SEGMENT_WRITERS_&&this.SEGMENT_WRITERS_[e.getType()].call(this,t,e);var i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),v(t,M.CHANGE,this.handleFeatureChange_,this)},e.prototype.willModifyFeatures_=function(t){this.modified_||(this.modified_=!0,this.dispatchEvent(new Wc(Xc,this.features_,t)))},e.prototype.removeFeature_=function(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),x(t,M.CHANGE,this.handleFeatureChange_,this)},e.prototype.removeFeatureSegmentData_=function(t){var e=this.rBush_,i=[];e.forEach(function(e){t===e.feature&&i.push(e)});for(var r=i.length-1;r>=0;--r)e.remove(i[r])},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var i=e.getCoordinates(),r={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),r)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length;r=0;--_)this.insertVertex_.apply(this,r[_])}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var i=this.dragSegments_[e][0],r=i.geometry;if(r.getType()===Nt.CIRCLE){var n=r.getCenter(),o=i.featureSegments[0],s=i.featureSegments[1];o.segment[0]=o.segment[1]=n,s.segment[0]=s.segment[1]=n,this.rBush_.update(pt(n),o),this.rBush_.update(r.getExtent(),s)}else this.rBush_.update(tt(i.segment),i)}return this.modified_&&(this.dispatchEvent(new Wc(zc,this.features_,t)),this.modified_=!1),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map)},e.prototype.handlePointerAtPixel_=function(t,e){var i=e.getCoordinateFromPixel(t),r=et(pt(i),e.getView().getResolution()*this.pixelTolerance_),n=this.rBush_.getInExtent(r);if(n.length>0){n.sort(function(t,e){return Hc(i,t)-Hc(i,e)});var s=n[0],a=s.segment,h=Zc(i,s),l=e.getPixelFromCoordinate(h),u=ir(t,l);if(u<=this.pixelTolerance_){var p={};if(s.geometry.getType()===Nt.CIRCLE&&s.index===Vc)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h);else{var c=e.getPixelFromCoordinate(a[0]),d=e.getPixelFromCoordinate(a[1]),f=er(l,c),_=er(l,d);u=Math.sqrt(Math.min(f,_)),this.snappedToVertex_=u<=this.pixelTolerance_,this.snappedToVertex_&&(h=f>_?a[1]:a[0]),this.createOrUpdateVertexFeature_(h);for(var g=1,y=n.length;g=0;--n)p=o((u=(i=c[n])[0]).feature),u.depth&&(p+="-"+u.depth.join("-")),p in d||(d[p]={}),0===i[1]?(d[p].right=u,d[p].index=u.index):1==i[1]&&(d[p].left=u,d[p].index=u.index+1);for(p in d){switch(l=d[p].right,a=d[p].left,h=(s=d[p].index)-1,u=void 0!==a?a:l,h<0&&(h=0),t=e=(r=u.geometry).getCoordinates(),f=!1,r.getType()){case Nt.MULTI_LINE_STRING:e[u.depth[0]].length>2&&(e[u.depth[0]].splice(s,1),f=!0);break;case Nt.LINE_STRING:e.length>2&&(e.splice(s,1),f=!0);break;case Nt.MULTI_POLYGON:t=t[u.depth[1]];case Nt.POLYGON:(t=t[u.depth[0]]).length>4&&(s==t.length-1&&(s=0),t.splice(s,1),f=!0,0===s&&(t.pop(),t.push(t[0]),h=t.length-1))}if(f){this.setGeometryCoordinates_(r,e);var _=[];if(void 0!==a&&(this.rBush_.remove(a),_.push(a.segment[0])),void 0!==l&&(this.rBush_.remove(l),_.push(l.segment[1])),void 0!==a&&void 0!==l){var g={depth:u.depth,feature:u.feature,geometry:u.geometry,index:h,segment:_};this.rBush_.insert(tt(g.segment),g)}this.updateSegmentIndices_(r,s,u.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),c.length=0}}return f},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,i,r){this.rBush_.forEachInExtent(t.getExtent(),function(n){n.geometry===t&&(void 0===i||void 0===n.depth||Z(n.depth,i))&&n.index>e&&(n.index+=r)})},e}(qo),Jc={SELECT:"select"},Qc=function(t){function e(e,i,r,n){t.call(this,e),this.selected=i,this.deselected=r,this.mapBrowserEvent=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);function $c(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),i=this.removeCondition_(t),r=this.toggleCondition_(t),n=!e&&!i&&!r,o=t.map,s=this.getFeatures(),a=[],h=[];if(n){p(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return h.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var l=s.getLength()-1;l>=0;--l){var u=s.item(l),c=h.indexOf(u);c>-1?h.splice(c,1):(s.remove(u),a.push(u))}0!==h.length&&s.extend(h)}else{o.forEachFeatureAtPixel(t.pixel,function(t,n){if(this.filter_(t,n))return!e&&!r||X(s.getArray(),t)?(i||r)&&X(s.getArray(),t)&&(a.push(t),this.removeFeatureLayerAssociation_(t)):(h.push(t),this.addFeatureLayerAssociation_(t,n)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var d=a.length-1;d>=0;--d)s.remove(a[d]);s.extend(h)}return(h.length>0||a.length>0)&&this.dispatchEvent(new Qc(Jc.SELECT,h,a,t)),Bo(t)}var td=function(t){function e(e){t.call(this,{handleEvent:$c});var i=e||{};this.condition_=i.condition?i.condition:Vo,this.addCondition_=i.addCondition?i.addCondition:Yo,this.removeCondition_=i.removeCondition?i.removeCondition:Yo,this.toggleCondition_=i.toggleCondition?i.toggleCondition:zo,this.multi_=!!i.multi&&i.multi,this.filter_=i.filter?i.filter:R,this.hitTolerance_=i.hitTolerance?i.hitTolerance:0;var r,n=new _c({source:new np({useSpatialIndex:!1,features:i.features,wrapX:i.wrapX}),style:i.style?i.style:function(){var t=Mu();return K(t[Nt.POLYGON],t[Nt.LINE_STRING]),K(t[Nt.GEOMETRY_COLLECTION],t[Nt.LINE_STRING]),function(e,i){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),updateWhileAnimating:!0,updateWhileInteracting:!0});if(this.featureOverlay_=n,i.layers)if("function"==typeof i.layers)r=i.layers;else{var o=i.layers;r=function(t){return X(o,t)}}else r=R;this.layerFilter_=r,this.featureLayerAssociation_={};var s=this.getFeatures();v(s,h.ADD,this.addFeature_,this),v(s,h.REMOVE,this.removeFeature_,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[o(t)]=e},e.prototype.getFeatures=function(){return this.featureOverlay_.getSource().getFeaturesCollection()},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[o(t)]},e.prototype.getOverlay=function(){return this.featureOverlay_},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){var i=this.getMap(),r=this.getFeatures();i&&r.forEach(i.unskipFeature.bind(i)),t.prototype.setMap.call(this,e),this.featureOverlay_.setMap(e),e&&r.forEach(e.skipFeature.bind(e))},e.prototype.addFeature_=function(t){var e=this.getMap();e&&e.skipFeature(t.element)},e.prototype.removeFeature_=function(t){var e=this.getMap();e&&e.unskipFeature(t.element)},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[o(t)]},e}(Fo);function ed(t){return t.feature?t.feature:t.element?t.element:void 0}var id=function(t){function e(e){var i=e||{},r=i;r.handleDownEvent||(r.handleDownEvent=R),r.stopDown||(r.stopDown=w),t.call(this,r),this.source_=i.source?i.source:null,this.vertex_=void 0===i.vertex||i.vertex,this.edge_=void 0===i.edge||i.edge,this.features_=i.features?i.features:null,this.featuresListenerKeys_=[],this.featureChangeListenerKeys_={},this.indexedFeaturesExtents_={},this.pendingFeatures_={},this.pixelCoordinate_=null,this.pixelTolerance_=void 0!==i.pixelTolerance?i.pixelTolerance:10,this.sortByDistance_=function(t,e){var i=rr(this.pixelCoordinate_,t.segment),r=rr(this.pixelCoordinate_,e.segment);return i-r}.bind(this),this.rBush_=new tl,this.SEGMENT_WRITERS_={Point:this.writePointGeometry_,LineString:this.writeLineStringGeometry_,LinearRing:this.writeLineStringGeometry_,Polygon:this.writePolygonGeometry_,MultiPoint:this.writeMultiPointGeometry_,MultiLineString:this.writeMultiLineStringGeometry_,MultiPolygon:this.writeMultiPolygonGeometry_,GeometryCollection:this.writeGeometryCollectionGeometry_,Circle:this.writeCircleGeometry_}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addFeature=function(t,e){var i=void 0===e||e,r=o(t),n=t.getGeometry();if(n){var s=this.SEGMENT_WRITERS_[n.getType()];s&&(this.indexedFeaturesExtents_[r]=n.getExtent([1/0,1/0,-1/0,-1/0]),s.call(this,t,n))}i&&(this.featureChangeListenerKeys_[r]=v(t,M.CHANGE,this.handleFeatureChange_,this))},e.prototype.forEachFeatureAdd_=function(t){this.addFeature(t)},e.prototype.forEachFeatureRemove_=function(t){this.removeFeature(t)},e.prototype.getFeatures_=function(){var t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t},e.prototype.handleEvent=function(e){var i=this.snapTo(e.pixel,e.coordinate,e.map);return i.snapped&&(e.coordinate=i.vertex.slice(0,2),e.pixel=i.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=ed(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=ed(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var i=o(e);i in this.pendingFeatures_||(this.pendingFeatures_[i]=e)}else this.updateFeature_(e)},e.prototype.handleUpEvent=function(t){var e=c(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1},e.prototype.removeFeature=function(t,e){var i=void 0===e||e,r=o(t),n=this.indexedFeaturesExtents_[r];if(n){var s=this.rBush_,a=[];s.forEachInExtent(n,function(e){t===e.feature&&a.push(e)});for(var h=a.length-1;h>=0;--h)s.remove(a[h])}i&&(E(this.featureChangeListenerKeys_[r]),delete this.featureChangeListenerKeys_[r])},e.prototype.setMap=function(e){var i=this.getMap(),r=this.featuresListenerKeys_,n=this.getFeatures_();i&&(r.forEach(E),r.length=0,n.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?r.push(v(this.features_,h.ADD,this.handleFeatureAdd_,this),v(this.features_,h.REMOVE,this.handleFeatureRemove_,this)):this.source_&&r.push(v(this.source_,ip.ADDFEATURE,this.handleFeatureAdd_,this),v(this.source_,ip.REMOVEFEATURE,this.handleFeatureRemove_,this)),n.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,i){var r=tt([i.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),i.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),n=this.rBush_.getInExtent(r);this.vertex_&&!this.edge_&&(n=n.filter(function(t){return t.feature.getGeometry().getType()!==Nt.CIRCLE}));var o,s,a,h,l=!1,u=null,p=null;if(n.length>0){this.pixelCoordinate_=e,n.sort(this.sortByDistance_);var c=n[0].segment,d=n[0].feature.getGeometry().getType()===Nt.CIRCLE;this.vertex_&&!this.edge_?(o=i.getPixelFromCoordinate(c[0]),s=i.getPixelFromCoordinate(c[1]),a=er(t,o),h=er(t,s),Math.sqrt(Math.min(a,h))<=this.pixelTolerance_&&(l=!0,u=a>h?c[1]:c[0],p=i.getPixelFromCoordinate(u))):this.edge_&&(u=d?function(t,e){var i=e.getRadius(),r=e.getCenter(),n=r[0],o=r[1],s=t[0]-n,a=t[1]-o;0===s&&0===a&&(s=1);var h=Math.sqrt(s*s+a*a);return[n+i*s/h,o+i*a/h]}(e,n[0].feature.getGeometry()):Zi(e,c),ir(t,p=i.getPixelFromCoordinate(u))<=this.pixelTolerance_&&(l=!0,this.vertex_&&!d&&(o=i.getPixelFromCoordinate(c[0]),s=i.getPixelFromCoordinate(c[1]),a=er(p,o),h=er(p,s),Math.sqrt(Math.min(a,h))<=this.pixelTolerance_&&(u=a>h?c[1]:c[0],p=i.getPixelFromCoordinate(u))))),l&&(p=[Math.round(p[0]),Math.round(p[1])])}return{snapped:l,vertex:u,vertexPixel:p}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){for(var i=Pi(e).getCoordinates()[0],r=0,n=i.length-1;r=0;i--){var u=o[i][0],p=ot(new pi(u).getExtent(),new pi(h).getExtent());if(p){o[i].push(h),l=!0;break}}l||o.push([h.reverse()])}return o}(r.rings,n);1===o.length?(i=Nt.POLYGON,t.rings=o[0]):(i=Nt.MULTI_POLYGON,t.rings=o)}return cd((0,_d[i])(t),!1,e)}function vd(t){var e=At.XY;return!0===t.hasZ&&!0===t.hasM?e=At.XYZM:!0===t.hasZ?e=At.XYZ:!0===t.hasM&&(e=At.XYM),e}function md(t){var e=t.getLayout();return{hasZ:e===At.XYZ||e===At.XYZM,hasM:e===At.XYM||e===At.XYZM}}function xd(t,e){return(0,gd[t.getType()])(cd(t,!0,e),e)}gd[Nt.POINT]=function(t,e){var i,r=t.getCoordinates(),n=t.getLayout();n===At.XYZ?i={x:r[0],y:r[1],z:r[2]}:n===At.XYM?i={x:r[0],y:r[1],m:r[2]}:n===At.XYZM?i={x:r[0],y:r[1],z:r[2],m:r[3]}:n===At.XY?i={x:r[0],y:r[1]}:Y(!1,34);return i},gd[Nt.LINE_STRING]=function(t,e){var i=t,r=md(i);return{hasZ:r.hasZ,hasM:r.hasM,paths:[i.getCoordinates()]}},gd[Nt.POLYGON]=function(t,e){var i=t,r=md(i);return{hasZ:r.hasZ,hasM:r.hasM,rings:i.getCoordinates(!1)}},gd[Nt.MULTI_POINT]=function(t,e){var i=t,r=md(i);return{hasZ:r.hasZ,hasM:r.hasM,points:i.getCoordinates()}},gd[Nt.MULTI_LINE_STRING]=function(t,e){var i=t,r=md(i);return{hasZ:r.hasZ,hasM:r.hasM,paths:i.getCoordinates()}},gd[Nt.MULTI_POLYGON]=function(t,e){for(var i=md(t),r=t.getCoordinates(!1),n=[],o=0;o=0;s--)n.push(r[o][s]);return{hasZ:i.hasZ,hasM:i.hasM,rings:n}};var Ed=function(t){function e(e){var i=e||{};t.call(this),this.geometryName_=i.geometryName}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFeatureFromObject=function(t,e){var i=t,r=yd(i.geometry,e),n=new B;return this.geometryName_&&n.setGeometryName(this.geometryName_),n.setGeometry(r),e&&e.idField&&i.attributes[e.idField]&&n.setId(i.attributes[e.idField]),i.attributes&&n.setProperties(i.attributes),n},e.prototype.readFeaturesFromObject=function(t,e){var i=e||{};if(t.features){var r=[],n=t.features;i.idField=t.objectIdFieldName;for(var o=0,s=n.length;o0?i[0]:null},e.prototype.readFeatureFromNode=function(t,e){return null},e.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var i=iu(t);return this.readFeaturesFromDocument(i,e)}return eu(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},e.prototype.readFeaturesFromDocument=function(t,e){for(var i=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&K(i,this.readFeaturesFromNode(r,e));return i},e.prototype.readFeaturesFromNode=function(t,e){return r()},e.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var i=iu(t);return this.readGeometryFromDocument(i,e)}return eu(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},e.prototype.readGeometryFromDocument=function(t,e){return null},e.prototype.readGeometryFromNode=function(t,e){return null},e.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=iu(t);return this.readProjectionFromDocument(e)}return eu(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},e.prototype.readProjectionFromDocument=function(t){return this.dataProjection},e.prototype.readProjectionFromNode=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){var i=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(i)},e.prototype.writeFeatureNode=function(t,e){return null},e.prototype.writeFeatures=function(t,e){var i=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(i)},e.prototype.writeFeaturesNode=function(t,e){return null},e.prototype.writeGeometry=function(t,e){var i=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(i)},e.prototype.writeGeometryNode=function(t,e){return null},e}(pd),Td="http://www.opengis.net/gml",Cd=/^[\s\xa0]*$/,Rd=function(t){function e(e){t.call(this);var i=e||{};this.featureType=i.featureType,this.featureNS=i.featureNS,this.srsName=i.srsName,this.schemaLocation="",this.FEATURE_COLLECTION_PARSERS={},this.FEATURE_COLLECTION_PARSERS[this.namespace]={featureMember:nu(this.readFeaturesInternal),featureMembers:ou(this.readFeaturesInternal)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFeaturesInternal=function(t,e){var i=t.localName,r=null;if("FeatureCollection"==i)r=_u([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==i||"featureMember"==i){var n=e[0],o=n.featureType,s=n.featureNS;if(!o&&t.childNodes){o=[],s={};for(var a=0,h=t.childNodes.length;a0){n[a]={_content_:n[a]};for(var l=0;l1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var s=n_[i.namespaceURI],a=cu(o,s);return yu(n,o_,pu,a,[e],s,this),i},e}(Sd);function __(t,e){var i=null,r=[0,0],n="start";if(t.getImage()){var o=t.getImage().getImageSize();if(null===o&&(o=Yf),2==o.length){var s=t.getImage().getScale();r[0]=s*o[0]/2,r[1]=-s*o[1]/2,n="left"}}if(null!==t.getText()){var a=t.getText();(i=a.clone()).setFont(a.getFont()||p_.getFont()),i.setScale(a.getScale()||p_.getScale()),i.setFill(a.getFill()||p_.getFill()),i.setStroke(a.getStroke()||l_)}else i=p_.clone();return i.setText(e),i.setOffsetX(r[0]),i.setOffsetY(r[1]),i.setTextAlign(n),new Au({text:i})}function g_(t){var e=tu(t,!1),i=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(i){var r=i[1];return[parseInt(r.substr(6,2),16),parseInt(r.substr(4,2),16),parseInt(r.substr(2,2),16),parseInt(r.substr(0,2),16)/255]}}function y_(t){for(var e,i=tu(t,!1),r=[],n=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i;e=n.exec(i);){var o=parseFloat(e[1]),s=parseFloat(e[2]),a=e[3]?parseFloat(e[3]):0;r.push(o,s,a),i=i.substr(e[0].length)}if(""===i)return r}function v_(t){var e=tu(t,!1).trim(),i=t.baseURI;return i&&"about:blank"!=i||(i=window.location.href),i?new URL(e,i).href:e}function m_(t){return Pd(t)}var x_=du(Qf,{Pair:function(t,e){var i=_u({},Z_,t,e);if(!i)return;var r=i.key;if(r&&"normal"==r){var n=i.styleUrl;n&&(e[e.length-1]=n);var o=i.Style;o&&(e[e.length-1]=o)}}});function E_(t,e){return _u(void 0,x_,t,e)}var S_=du(Qf,{Icon:au(function(t,e){var i=_u({},b_,t,e);return i||null}),heading:au(Pd),hotSpot:au(function(t){var e,i=t.getAttribute("xunits"),r=t.getAttribute("yunits");return e="insetPixels"!==i?"insetPixels"!==r?Iu.BOTTOM_LEFT:Iu.TOP_LEFT:"insetPixels"!==r?Iu.BOTTOM_RIGHT:Iu.TOP_RIGHT,{x:parseFloat(t.getAttribute("x")),xunits:$f[i],y:parseFloat(t.getAttribute("y")),yunits:$f[r],origin:e}}),scale:au(m_)});var T_=du(Qf,{color:au(g_),scale:au(m_)});var C_=du(Qf,{color:au(g_),width:au(Pd)});var R_=du(Qf,{color:au(g_),fill:au(Id),outline:au(Id)});var w_=du(Qf,{coordinates:ou(y_)});function I_(t,e){return _u(null,w_,t,e)}var L_=du(Jf,{Track:nu(P_)});var O_=du(Qf,{when:function(t,e){var i=e[e.length-1].whens,r=tu(t,!1),n=Date.parse(r);i.push(isNaN(n)?0:n)}},du(Jf,{coord:function(t,e){var i=e[e.length-1].flatCoordinates,r=tu(t,!1),n=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(r);if(n){var o=parseFloat(n[1]),s=parseFloat(n[2]),a=parseFloat(n[3]);i.push(o,s,a,0)}else i.push(0,0,0,0)}}));function P_(t,e){var i=_u({flatCoordinates:[],whens:[]},O_,t,e);if(i){for(var r=i.flatCoordinates,n=i.whens,o=0,s=Math.min(r.length,n.length);o0,u=h.href;u?r=u:l&&(r=Bf);var p,c=Iu.BOTTOM_LEFT,d=i.hotSpot;d?(n=[d.x,d.y],o=d.xunits,s=d.yunits,c=d.origin):r===Bf?(n=kf,o=jf,s=Uf):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(r)&&(n=[.5,0],o=Ru.FRACTION,s=Ru.FRACTION);var f,_=h.x,g=h.y;void 0!==_&&void 0!==g&&(p=[_,g]);var y,v=h.w,m=h.h;void 0!==v&&void 0!==m&&(f=[v,m]);var x=i.heading;void 0!==x&&(y=Vt(x));var E=i.scale;if(l){r==Bf&&(f=Yf,void 0===E&&(E=Vf));var S=new Lu({anchor:n,anchorOrigin:c,anchorXUnits:o,anchorYUnits:s,crossOrigin:"anonymous",offset:p,offsetOrigin:Iu.BOTTOM_LEFT,rotation:y,scale:E,size:f,src:r});a.imageStyle=S}else a.imageStyle=a_}},LabelStyle:function(t,e){var i=_u({},T_,t,e);if(i){var r=e[e.length-1],n=new Rr({fill:new mr({color:"color"in i?i.color:Df}),scale:i.scale});r.textStyle=n}},LineStyle:function(t,e){var i=_u({},C_,t,e);if(i){var r=e[e.length-1],n=new Er({color:"color"in i?i.color:Df,width:"width"in i?i.width:1});r.strokeStyle=n}},PolyStyle:function(t,e){var i=_u({},R_,t,e);if(i){var r=e[e.length-1],n=new mr({color:"color"in i?i.color:Df});r.fillStyle=n;var o=i.fill;void 0!==o&&(r.fill=o);var s=i.outline;void 0!==s&&(r.outline=s)}}});function V_(t,e){var i=_u({},B_,t,e);if(!i)return null;var r,n="fillStyle"in i?i.fillStyle:s_,o=i.fill;void 0===o||o||(n=null),"imageStyle"in i?i.imageStyle!=a_&&(r=i.imageStyle):r=h_;var s="textStyle"in i?i.textStyle:p_,a="strokeStyle"in i?i.strokeStyle:u_,h=i.outline;return void 0===h||h||(a=null),[new Au({fill:n,image:r,stroke:a,text:s,zIndex:void 0})]}function X_(t,e){var i,r,n,o=e.length,s=new Array(e.length),a=new Array(e.length),h=new Array(e.length);i=r=n=!1;for(var l=0;l0){var a=cu(n,s);yu(r,Rg,Ig,[{names:s,values:a}],i)}var h=e.getStyleFunction();if(h){var l=h(e,0);if(l){var u=Array.isArray(l)?l[0]:l;this.writeStyles_&&(n.Style=u);var p=u.getText();p&&(n.name=p.getText())}}var c=i[i.length-1].node,d=wg[c.namespaceURI],f=cu(n,d);yu(r,Rg,pu,f,i,d);var _=i[0],g=e.getGeometry();g&&(g=cd(g,!0,_)),yu(r,Rg,gg,[g],i)}var Og=du(Qf,["extrude","tessellate","altitudeMode","coordinates"]),Pg=du(Qf,{extrude:hu(Nd),tessellate:hu(Nd),altitudeMode:hu(kd),coordinates:hu(function(t,e,i){var r,n=i[i.length-1],o=n.layout,s=n.stride;o==At.XY||o==At.XYM?r=2:o==At.XYZ||o==At.XYZM?r=3:Y(!1,34);var a=e.length,h="";if(a>0){h+=e[0];for(var l=1;l>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(r)}}function Zg(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t)for(var r=i.readVarint()+i.pos;i.pos>3}s--,1===o||2===o?(a+=t.readSVarint(),h+=t.readSVarint(),1===o&&l>u&&(r.push(l),u=l),i.push(a,h),l+=2):7===o?l>u&&(i.push(i[u],i[u+1]),l+=2):Y(!1,59)}l>u&&(r.push(l),u=l)},e.prototype.createFeature_=function(t,e,i){var r,n=e.type;if(0===n)return null;var o=e.id,s=e.properties;s[this.layerName_]=e.layer.name;var a=[],h=[];this.readRawGeometry_(t,e,a,h);var l=function(t,e){var i;1===t?i=1===e?Nt.POINT:Nt.MULTI_POINT:2===t?i=1===e?Nt.LINE_STRING:Nt.MULTI_LINE_STRING:3===t&&(i=Nt.POLYGON);return i}(n,h.length);if(this.featureClass_===Wg)r=new this.featureClass_(l,a,h,s,o);else{var u;if(l==Nt.POLYGON){for(var p=[],c=0,d=0,f=0,_=h.length;f<_;++f){var g=h[f];Si(a,c,g,2)||(p.push(h.slice(d,f)),d=f),c=g}u=p.length>1?new Mc(a,At.XY,p):new Ii(a,At.XY,h)}else u=l===Nt.POINT?new ci(a,At.XY):l===Nt.LINE_STRING?new hr(a,At.XY):l===Nt.POLYGON?new Ii(a,At.XY,h):l===Nt.MULTI_POINT?new Pc(a,At.XY):l===Nt.MULTI_LINE_STRING?new Oc(a,At.XY,h):null;r=new(0,this.featureClass_),this.geometryName_&&r.setGeometryName(this.geometryName_);var y=cd(u,!1,this.adaptOptions(i));r.setGeometry(y),r.setId(o),r.setProperties(s)}return r},e.prototype.getLastExtent=function(){return this.extent_},e.prototype.getType=function(){return Kl.ARRAY_BUFFER},e.prototype.readFeatures=function(t,e){var i=this.layers_,r=new Vg.a(t),n=r.readFields(Kg,{}),o=[];for(var s in n)if(!i||-1!=i.indexOf(s)){for(var a=n[s],h=0,l=a.length;h>1):n>>1}return e}(t),n=0,o=r.length;n=32;)e=63+(32|31&t),i+=String.fromCharCode(e),t>>=5;return e=t+63,i+=String.fromCharCode(e)}var py=function(t){function e(e){t.call(this);var i=e||{};this.dataProjection=Ee("EPSG:4326"),this.factor_=i.factor?i.factor:1e5,this.geometryLayout_=i.geometryLayout?i.geometryLayout:At.XY}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFeatureFromText=function(t,e){var i=this.readGeometryFromText(t,e);return new B(i)},e.prototype.readFeaturesFromText=function(t,e){return[this.readFeatureFromText(t,e)]},e.prototype.readGeometryFromText=function(t,e){var i=ze(this.geometryLayout_),r=ay(t,i,this.factor_);oy(r,0,r.length,i,r);var n=ri(r,0,r.length,i);return cd(new hr(n,this.geometryLayout_),!1,this.adaptOptions(e))},e.prototype.writeFeatureText=function(t,e){var i=t.getGeometry();return i?this.writeGeometryText(i,e):(Y(!1,40),"")},e.prototype.writeFeaturesText=function(t,e){return this.writeFeatureText(t[0],e)},e.prototype.writeGeometryText=function(t,e){var i=(t=cd(t,!0,this.adaptOptions(e))).getFlatCoordinates(),r=t.getStride();return oy(i,0,i.length,r,i),sy(i,r,this.factor_)},e}(Xf),cy={Point:function(t,e,i){var r=t.coordinates;e&&i&&yy(r,e,i);return new ci(r)},LineString:function(t,e){var i=dy(t.arcs,e);return new hr(i)},Polygon:function(t,e){for(var i=[],r=0,n=t.arcs.length;r0&&n.pop(),r=i>=0?e[i]:e[~i].slice().reverse(),n.push.apply(n,r);for(var a=0,h=n.length;a=2,57)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xy),Sy=function(t){function e(e){t.call(this,"And",Array.prototype.slice.call(arguments))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ey),Ty=function(t){function e(e,i,r){t.call(this,"BBOX"),this.geometryName=e,this.extent=i,this.srsName=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xy),Cy=function(t){function e(e,i,r,n){t.call(this,e),this.geometryName=i||"the_geom",this.geometry=r,this.srsName=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xy),Ry=function(t){function e(e,i,r){t.call(this,"Contains",e,i,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Cy),wy=function(t){function e(e,i){t.call(this,e),this.propertyName=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xy),Iy=function(t){function e(e,i,r){t.call(this,"During",e),this.begin=i,this.end=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(wy),Ly=function(t){function e(e,i,r,n){t.call(this,e,i),this.expression=r,this.matchCase=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(wy),Oy=function(t){function e(e,i,r){t.call(this,"PropertyIsEqualTo",e,i,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ly),Py=function(t){function e(e,i){t.call(this,"PropertyIsGreaterThan",e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ly),by=function(t){function e(e,i){t.call(this,"PropertyIsGreaterThanOrEqualTo",e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ly),My=function(t){function e(e,i,r){t.call(this,"Intersects",e,i,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Cy),Fy=function(t){function e(e,i,r){t.call(this,"PropertyIsBetween",e),this.lowerBoundary=i,this.upperBoundary=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(wy),Ay=function(t){function e(e,i,r,n,o,s){t.call(this,"PropertyIsLike",e),this.pattern=i,this.wildCard=void 0!==r?r:"*",this.singleChar=void 0!==n?n:".",this.escapeChar=void 0!==o?o:"!",this.matchCase=s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(wy),Ny=function(t){function e(e){t.call(this,"PropertyIsNull",e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(wy),Gy=function(t){function e(e,i){t.call(this,"PropertyIsLessThan",e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ly),Dy=function(t){function e(e,i){t.call(this,"PropertyIsLessThanOrEqualTo",e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ly),ky=function(t){function e(e){t.call(this,"Not"),this.condition=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xy),jy=function(t){function e(e,i,r){t.call(this,"PropertyIsNotEqualTo",e,i,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ly),Uy=function(t){function e(e){t.call(this,"Or",Array.prototype.slice.call(arguments))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ey),Yy=function(t){function e(e,i,r){t.call(this,"Within",e,i,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Cy);function By(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(Sy,e))}function Vy(t,e,i){return new Ty(t,e,i)}var Xy={"http://www.opengis.net/gml":{boundedBy:au(wd.prototype.readGeometryElement,"bounds")}},zy={"http://www.opengis.net/wfs":{totalInserted:au(Md),totalUpdated:au(Md),totalDeleted:au(Md)}},Wy={"http://www.opengis.net/wfs":{TransactionSummary:au(function(t,e){return _u({},zy,t,e)},"transactionSummary"),InsertResults:au(function(t,e){return _u([],nv,t,e)},"insertIds")}},Ky={"http://www.opengis.net/wfs":{PropertyName:hu(kd)}},Hy={"http://www.opengis.net/wfs":{Insert:hu(function(t,e,i){var r=i[i.length-1],n=r.featureType,o=r.featureNS,s=r.gmlVersion,a=$l(o,n);t.appendChild(a),2===s?Hd.prototype.writeFeatureElement(a,e,i):Bd.prototype.writeFeatureElement(a,e,i)}),Update:hu(function(t,e,i){var r=i[i.length-1];Y(void 0!==e.getId(),27);var n=r.featureType,o=r.featurePrefix,s=r.featureNS,a=sv(o,n),h=e.getGeometryName();t.setAttribute("typeName",a),t.setAttributeNS(qy,"xmlns:"+o,s);var l=e.getId();if(void 0!==l){for(var u=e.getKeys(),p=[],c=0,d=u.length;c="a"&&t<="z"||t>="A"&&t<="Z"},Lv.prototype.isNumeric_=function(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)},Lv.prototype.isWhiteSpace_=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},Lv.prototype.nextChar_=function(){return this.wkt.charAt(++this.index_)},Lv.prototype.nextToken=function(){var t,e=this.nextChar_(),i=this.index_,r=e;if("("==e)t=Ev;else if(","==e)t=Cv;else if(")"==e)t=Sv;else if(this.isNumeric_(e)||"-"==e)t=Tv,r=this.readNumber_();else if(this.isAlpha_(e))t=xv,r=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(""!==e)throw new Error("Unexpected character: "+e);t=Rv}return{position:i,value:r,type:t}},Lv.prototype.readNumber_=function(){var t,e=this.index_,i=!1,r=!1;do{"."==t?i=!0:"e"!=t&&"E"!=t||(r=!0),t=this.nextChar_()}while(this.isNumeric_(t,i)||!r&&("e"==t||"E"==t)||r&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))},Lv.prototype.readText_=function(){var t,e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()};var Ov=function(t){this.lexer_=t,this.token_,this.layout_=At.XY};function Pv(t){var e=t.getCoordinates();return 0===e.length?"":e.join(" ")}function bv(t){for(var e=t.getCoordinates(),i=[],r=0,n=e.length;r0&&(e+=" "+r)}return 0===i.length?e+" "+yv:e+"("+i+")"}var Nv=function(t){function e(e){t.call(this);var i=e||{};this.splitCollection_=void 0!==i.splitCollection&&i.splitCollection}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parse_=function(t){var e=new Lv(t);return new Ov(e).parse()},e.prototype.readFeatureFromText=function(t,e){var i=this.readGeometryFromText(t,e);if(i){var r=new B;return r.setGeometry(i),r}return null},e.prototype.readFeaturesFromText=function(t,e){for(var i=[],r=this.readGeometryFromText(t,e),n=[],o=0,s=(i=this.splitCollection_&&r.getType()==Nt.GEOMETRY_COLLECTION?r.getGeometriesArray():[r]).length;o.75*u||l>.75*p?this.resetExtent_():ot(o,r)||this.recenter_()}},e.prototype.resetExtent_=function(){var t=this.getMap(),e=this.ovmap_,i=t.getSize(),r=t.getView().calculateExtent(i),n=e.getView(),o=Math.log(7.5)/Math.LN2;Mt(r,1/(.1*Math.pow(2,o/2))),n.fit(r)},e.prototype.recenter_=function(){var t=this.getMap(),e=this.ovmap_,i=t.getView();e.getView().setCenter(i.getCenter())},e.prototype.updateBox_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var i=t.getSize(),r=t.getView(),n=e.getView(),o=r.getRotation(),s=this.boxOverlay_,a=this.boxOverlay_.getElement(),h=r.calculateExtent(i),l=n.getResolution(),u=Et(h),p=Lt(h),c=this.calculateCoordinateRotate_(o,u);s.setPosition(c),a&&(a.style.width=Math.abs((u[0]-p[0])/l)+"px",a.style.height=Math.abs((p[1]-u[1])/l)+"px")}},e.prototype.calculateCoordinateRotate_=function(t,e){var i,r=this.getMap().getView().getCenter();return r&&($i(i=[e[0]-r[0],e[1]-r[1]],t),Hi(i,r)),i},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle(yo),this.collapsed_?Qn(this.collapseLabel_,this.label_):Qn(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;var t=this.ovmap_;this.collapsed_||t.isRendered()||(t.updateSize(),this.resetExtent_(),m(t,Rn,function(t){this.updateBox_()},this))},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e.prototype.getOverviewMap=function(){return this.ovmap_},e}(uo),tx="units",ex={DEGREES:"degrees",IMPERIAL:"imperial",NAUTICAL:"nautical",METRIC:"metric",US:"us"},ix=[1,2,5];function rx(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}var nx=function(t){function e(e){var i=e||{},r=void 0!==i.className?i.className:"ol-scale-line";t.call(this,{element:document.createElement("div"),render:i.render||rx,target:i.target}),this.innerElement_=document.createElement("div"),this.innerElement_.className=r+"-inner",this.element.className=r+" "+fo,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==i.minWidth?i.minWidth:64,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",v(this,G(tx),this.handleUnitsChanged_,this),this.setUnits(i.units||ex.METRIC)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getUnits=function(){return this.get(tx)},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set(tx,t)},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,i=t.projection,r=this.getUnits(),n=r==ex.DEGREES?$t.DEGREES:$t.METERS,o=Se(i,t.resolution,e,n);i.getUnits()!=$t.DEGREES&&i.getMetersPerUnit()&&n==$t.METERS&&(o*=i.getMetersPerUnit());var s=this.minWidth_*o,a="";if(r==ex.DEGREES){var h=Qt[$t.DEGREES];i.getUnits()==$t.DEGREES?s*=h:o/=h,s=this.minWidth_)break;++p}var c=l+" "+a;this.renderedHTML_!=c&&(this.innerElement_.innerHTML=c,this.renderedHTML_=c),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e}(uo),ox={VERTICAL:0,HORIZONTAL:1};function sx(t){if(t.frameState){this.sliderInitialized_||this.initSlider_();var e=t.frameState.viewState.resolution;e!==this.currentResolution_&&(this.currentResolution_=e,this.setThumbPosition_(e))}}var ax=function(t){function e(e){var i=e||{};t.call(this,{element:document.createElement("div"),render:i.render||sx}),this.dragListenerKeys_=[],this.currentResolution_=void 0,this.direction_=ox.VERTICAL,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.previousX_,this.previousY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=void 0!==i.duration?i.duration:200;var r=void 0!==i.className?i.className:"ol-zoomslider",n=document.createElement("button");n.setAttribute("type","button"),n.className=r+"-thumb "+fo;var o=this.element;o.className=r+" "+fo+" "+go,o.appendChild(n),this.dragger_=new Tn(o),v(this.dragger_,Gr.POINTERDOWN,this.handleDraggerStart_,this),v(this.dragger_,Gr.POINTERMOVE,this.handleDraggerDrag_,this),v(this.dragger_,Gr.POINTERUP,this.handleDraggerEnd_,this),v(o,M.CLICK,this.handleContainerClick_,this),v(n,M.CLICK,O)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.dragger_.dispose(),t.prototype.disposeInternal.call(this)},e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),e&&e.render()},e.prototype.initSlider_=function(){var t=this.element,e=t.offsetWidth,i=t.offsetHeight,r=t.firstElementChild,n=getComputedStyle(r),o=r.offsetWidth+parseFloat(n.marginRight)+parseFloat(n.marginLeft),s=r.offsetHeight+parseFloat(n.marginTop)+parseFloat(n.marginBottom);this.thumbSize_=[o,s],e>i?(this.direction_=ox.HORIZONTAL,this.widthLimit_=e-o):(this.direction_=ox.VERTICAL,this.heightLimit_=i-s),this.sliderInitialized_=!0},e.prototype.handleContainerClick_=function(t){var e=this.getMap().getView(),i=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),r=this.getResolutionForPosition_(i);e.animate({resolution:e.constrainResolution(r),duration:this.duration_,easing:Xn})},e.prototype.handleDraggerStart_=function(t){if(!this.dragging_&&t.originalEvent.target===this.element.firstElementChild&&(this.getMap().getView().setHint(jn,1),this.previousX_=t.clientX,this.previousY_=t.clientY,this.dragging_=!0,0===this.dragListenerKeys_.length)){var e=this.handleDraggerDrag_,i=this.handleDraggerEnd_;this.dragListenerKeys_.push(v(document,M.MOUSEMOVE,e,this),v(document,Gr.POINTERMOVE,e,this),v(document,M.MOUSEUP,i,this),v(document,Gr.POINTERUP,i,this))}},e.prototype.handleDraggerDrag_=function(t){if(this.dragging_){var e=this.element.firstElementChild,i=t.clientX-this.previousX_+parseFloat(e.style.left),r=t.clientY-this.previousY_+parseFloat(e.style.top),n=this.getRelativePosition_(i,r);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_),this.setThumbPosition_(this.currentResolution_),this.previousX_=t.clientX,this.previousY_=t.clientY}},e.prototype.handleDraggerEnd_=function(t){if(this.dragging_){var e=this.getMap().getView();e.setHint(jn,-1),e.animate({resolution:e.constrainResolution(this.currentResolution_),duration:this.duration_,easing:Xn}),this.dragging_=!1,this.previousX_=void 0,this.previousY_=void 0,this.dragListenerKeys_.forEach(E),this.dragListenerKeys_.length=0}},e.prototype.setThumbPosition_=function(t){var e=this.getPositionForResolution_(t),i=this.element.firstElementChild;this.direction_==ox.HORIZONTAL?i.style.left=this.widthLimit_*e+"px":i.style.top=this.heightLimit_*e+"px"},e.prototype.getRelativePosition_=function(t,e){return kt(this.direction_===ox.HORIZONTAL?t/this.widthLimit_:e/this.heightLimit_,0,1)},e.prototype.getResolutionForPosition_=function(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)},e.prototype.getPositionForResolution_=function(t){return 1-this.getMap().getView().getValueForResolutionFunction()(t)},e}(uo),hx=function(t){function e(e){var i=e||{};t.call(this,{element:document.createElement("div"),target:i.target}),this.extent=i.extent?i.extent:null;var r=void 0!==i.className?i.className:"ol-zoom-extent",n=void 0!==i.label?i.label:"E",o=void 0!==i.tipLabel?i.tipLabel:"Fit to extent",s=document.createElement("button");s.setAttribute("type","button"),s.title=o,s.appendChild("string"==typeof n?document.createTextNode(n):n),v(s,M.CLICK,this.handleClick_,this);var a=r+" "+fo+" "+go,h=this.element;h.className=a,h.appendChild(s)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleClick_=function(t){t.preventDefault(),this.handleZoomToExtent()},e.prototype.handleZoomToExtent=function(){var t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fit(e)},e}(uo),lx={array:{},color:{},colorlike:{},control:{},coordinate:{},easing:{},events:{}};lx.events.condition={},lx.extent={},lx.featureloader={},lx.format={},lx.format.filter={},lx.geom={},lx.has={},lx.interaction={},lx.layer={},lx.loadingstrategy={},lx.proj={},lx.proj.Units={},lx.proj.proj4={},lx.render={},lx.render.canvas={},lx.renderer={},lx.renderer.canvas={},lx.renderer.webgl={},lx.size={},lx.source={},lx.sphere={},lx.style={},lx.style.IconImageCache={},lx.tilegrid={},lx.xml={},lx.Collection=U,lx.Feature=B,lx.Geolocation=zi,lx.Graticule=Or,lx.Kinetic=br,lx.Map=Ha,lx.Object=D,lx.Observable=F,lx.Observable.unByKey=function(t){if(Array.isArray(t))for(var e=0,i=t.length;e180)&&(i[0]=Xt(r+180,360)-180),i},lx.proj.transform=Pe,lx.proj.transformExtent=be,lx.render.VectorContext=Vs,lx.render.canvas.labelCache=Ps,lx.render.toContext=function(t,e){var i=t.canvas,r=e||{},n=r.pixelRatio||Di,o=r.size;o&&(i.width=o[0]*n,i.height=o[1]*n,i.style.width=o[0]+"px",i.style.height=o[1]+"px");var s=[0,0,i.width,i.height],a=je([1,0,0,1,0,0],n,n);return new Xs(t,n,s,a,0)},lx.renderer.canvas.ImageLayer=ra,lx.renderer.canvas.Map=Qs,lx.renderer.canvas.TileLayer=ha,lx.renderer.canvas.VectorLayer=Ba,lx.renderer.canvas.VectorTileLayer=Ka,lx.renderer.webgl.ImageLayer=_l,lx.renderer.webgl.Map=gl,lx.renderer.webgl.TileLayer=Vl,lx.renderer.webgl.VectorLayer=zl,lx.size.toSize=ho,lx.source.BingMaps=$u,lx.source.CartoDB=ep,lx.source.Cluster=op,lx.source.Image=cp,lx.source.ImageArcGISRest=_p,lx.source.ImageCanvas=gp,lx.source.ImageMapGuide=yp,lx.source.ImageStatic=vp,lx.source.ImageWMS=Rp,lx.source.OSM=Ip,lx.source.OSM.ATTRIBUTION=wp,lx.source.Raster=Bp,lx.source.Source=wl,lx.source.Stamen=Wp,lx.source.Tile=kl,lx.source.TileArcGISRest=Hp,lx.source.TileDebug=qp,lx.source.TileImage=Qu,lx.source.TileJSON=Jp,lx.source.TileWMS=$p,lx.source.UTFGrid=ec,lx.source.Vector=np,lx.source.VectorTile=sc,lx.source.WMTS=hc,lx.source.WMTS.optionsFromCapabilities=function(t,e){var i=H(t.Contents.Layer,function(t,i,r){return t.Identifier==e.layer});if(null===i)return null;var r,n=t.Contents.TileMatrixSet;(r=i.TileMatrixSetLink.length>1?J(i.TileMatrixSetLink,"projection"in e?function(t,i,r){var o=H(n,function(e){return e.Identifier==t.TileMatrixSet}).SupportedCRS,s=Ee(o.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ee(o),a=Ee(e.projection);return s&&a?Ie(s,a):o==e.projection}:function(t,i,r){return t.TileMatrixSet==e.matrixSet}):0)<0&&(r=0);var o=i.TileMatrixSetLink[r].TileMatrixSet,s=i.TileMatrixSetLink[r].TileMatrixSetLimits,a=i.Format[0];"format"in e&&(a=e.format),(r=J(i.Style,function(t,i,r){return"style"in e?t.Title==e.style:t.isDefault}))<0&&(r=0);var h=i.Style[r].Identifier,l={};"Dimension"in i&&i.Dimension.forEach(function(t,e,i){var r=t.Identifier,n=t.Default;void 0===n&&(n=t.Value[0]),l[r]=n});var u,p=H(t.Contents.TileMatrixSet,function(t,e,i){return t.Identifier==o}),c=p.SupportedCRS;if(c&&(u=Ee(c.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ee(c)),"projection"in e){var d=Ee(e.projection);d&&(u&&!Ie(d,u)||(u=d))}var f,_,g=i.WGS84BoundingBox;if(void 0!==g){var y=Ee("EPSG:4326").getExtent();_=g[0]==y[0]&&g[2]==y[2],f=be(g,"EPSG:4326",u);var v=u.getExtent();v&&(ot(v,f)||(f=void 0))}var m=xu(p,f,s),x=[],E=e.requestEncoding;if(E=void 0!==E?E:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata)for(var S=t.OperationsMetadata.GetTile.DCP.HTTP.Get,T=0,C=S.length;T