
/**
 * The code below uses open source software. Please visit the URL below for an overview of the licenses:
 * http://js.api.here.com/v3/3.1.8.1/HERE_NOTICE
 */

(function(){var n,aa=[];function ba(a){return function(){return aa[a].apply(this,arguments)}}function ca(a,b){return aa[a]=b}var da="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ea="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;
function fa(a,b){if(b){var c=ea;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&da(c,a,{configurable:!0,writable:!0,value:b})}}fa("Array.prototype.find",function(a){return a?a:function(a,c){a:{var b=this;b instanceof String&&(b=String(b));for(var e=b.length,f=0;f<e;f++){var g=b[f];if(a.call(c,g,f,b)){a=g;break a}}a=void 0}return a}});function ha(){ha=function(){};ea.Symbol||(ea.Symbol=ia)}
var ia=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}();function ka(){ha();var a=ea.Symbol.iterator;a||(a=ea.Symbol.iterator=ea.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&da(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return la(this)}});ka=function(){}}function la(a){var b=0;return ma(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})}function ma(a){ka();a={next:a};a[ea.Symbol.iterator]=function(){return this};return a}
function na(a,b){ka();a instanceof String&&(a+="");var c=0,d={next:function(){if(c<a.length){var e=c++;return{value:b(e,a[e]),done:!1}}d.next=function(){return{done:!0,value:void 0}};return d.next()}};d[Symbol.iterator]=function(){return d};return d}fa("Array.prototype.keys",function(a){return a?a:function(){return na(this,function(a){return a})}});
fa("Array.prototype.fill",function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}});var oa=this;function qa(a){return void 0!==a}function ra(a){return"string"==typeof a}
function sa(a,b,c){a=a.split(".");c=c||oa;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&qa(b)?c[d]=b:c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}}function ta(){}
function ua(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function va(a){var b=ua(a);return"array"==b||"object"==b&&"number"==typeof a.length}function r(a){return"function"==ua(a)}function wa(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}var xa="closure_uid_"+(1E9*Math.random()>>>0),ya=0;function za(a,b,c){return a.call.apply(a.bind,arguments)}
function Aa(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function Ba(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Ba=za:Ba=Aa;return Ba.apply(null,arguments)}
function Ca(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}}function u(a,b){sa(a,b,void 0)}function w(a,b){function c(){}c.prototype=b.prototype;a.l=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Bo=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};function Da(a){if(Error.captureStackTrace)Error.captureStackTrace(this,Da);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}w(Da,Error);Da.prototype.name="CustomError";function Ea(a,b){this.c=a;this.f=b;this.b=0;this.a=null}Ea.prototype.get=function(){if(0<this.b){this.b--;var a=this.a;this.a=a.next;a.next=null}else a=this.c();return a};Ea.prototype.put=function(a){this.f(a);100>this.b&&(this.b++,a.next=this.a,this.a=a)};function Fa(){this.b=this.a=null}var Ia=new Ea(function(){return new Ha},function(a){a.reset()});Fa.prototype.add=function(a,b){var c=Ia.get();c.set(a,b);this.b?this.b.next=c:this.a=c;this.b=c};Fa.prototype.remove=function(){var a=null;this.a&&(a=this.a,this.a=this.a.next,this.a||(this.b=null),a.next=null);return a};function Ha(){this.next=this.b=this.a=null}Ha.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};Ha.prototype.reset=function(){this.next=this.b=this.a=null};function Ja(a,b){for(var c in a)if(b.call(void 0,a[c],c,a))return!0;return!1}function Ka(a){for(var b in a)return!1;return!0}function La(a){var b={},c;for(c in a)b[c]=a[c];return b}function Na(a){var b=ua(a);if("object"==b||"array"==b){if(r(a.clone))return a.clone();b="array"==b?[]:{};for(var c in a)b[c]=Na(a[c]);return b}return a}var Oa="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
function Pa(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<Oa.length;f++)c=Oa[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var Qa=String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]};function Ra(a,b){return-1!=a.indexOf(b)}function Sa(a,b){return a<b?-1:a>b?1:0};var Ta;a:{var Ua=oa.navigator;if(Ua){var Va=Ua.userAgent;if(Va){Ta=Va;break a}}Ta=""}function Wa(a){return Ra(Ta,a)};var Xa=Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b,void 0)}:function(a,b){if(ra(a))return ra(b)&&1==b.length?a.indexOf(b,0):-1;for(var c=0;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};function Ya(a){oa.setTimeout(function(){throw a;},0)}var Za;
function $a(){var a=oa.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!Wa("Presto")&&(a=function(){var a=document.createElement("IFRAME");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow;a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host;a=Ba(function(a){if(("*"==d||a.origin==d)&&a.data==
c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&!Wa("Trident")&&!Wa("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(qa(c.next)){c=c.next;var a=c.bj;c.bj=null;a()}};return function(a){d.next={bj:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(a){var b=document.createElement("SCRIPT");
b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){oa.setTimeout(a,0)}};function ab(a,b){bb||cb();db||(bb(),db=!0);eb.add(a,b)}var bb;function cb(){if(-1!=String(oa.Promise).indexOf("[native code]")){var a=oa.Promise.resolve(void 0);bb=function(){a.then(fb)}}else bb=function(){var a=fb;!r(oa.setImmediate)||oa.Window&&oa.Window.prototype&&!Wa("Edge")&&oa.Window.prototype.setImmediate==oa.setImmediate?(Za||(Za=$a()),Za(a)):oa.setImmediate(a)}}var db=!1,eb=new Fa;function fb(){for(var a;a=eb.remove();){try{a.a.call(a.b)}catch(b){Ya(b)}Ia.put(a)}db=!1};function gb(a){this.C=hb;this.i=void 0;this.c=this.a=this.b=null;this.f=this.g=!1;if(a!=ta)try{var b=this;a.call(void 0,function(a){ib(b,jb,a)},function(a){ib(b,kb,a)})}catch(c){ib(this,kb,c)}}var hb=0,jb=2,kb=3;function lb(){this.next=this.c=this.b=this.f=this.a=null;this.g=!1}lb.prototype.reset=function(){this.c=this.b=this.f=this.a=null;this.g=!1};var mb=new Ea(function(){return new lb},function(a){a.reset()});function nb(a,b,c){var d=mb.get();d.f=a;d.b=b;d.c=c;return d}
function pb(a){if(a instanceof gb)return a;var b=new gb(ta);ib(b,jb,a);return b}function qb(a){return new gb(function(b,c){c(a)})}function rb(){var a,b,c=new gb(function(c,e){a=c;b=e});return new sb(c,a,b)}gb.prototype.then=function(a,b,c){return tb(this,r(a)?a:null,r(b)?b:null,c)};gb.prototype.then=gb.prototype.then;gb.prototype.$goog_Thenable=!0;gb.prototype.cancel=function(a){this.C==hb&&ab(function(){var b=new ub(a);vb(this,b)},this)};
function vb(a,b){if(a.C==hb)if(a.b){var c=a.b;if(c.a){for(var d=0,e=null,f=null,g=c.a;g&&(g.g||(d++,g.a==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(c.C==hb&&1==d?vb(c,b):(f?(d=f,d.next==c.c&&(c.c=d),d.next=d.next.next):wb(c),xb(c,e,kb,b)))}a.b=null}else ib(a,kb,b)}function yb(a,b){a.a||a.C!=jb&&a.C!=kb||zb(a);a.c?a.c.next=b:a.a=b;a.c=b}
function tb(a,b,c,d){var e=nb(null,null,null);e.a=new gb(function(a,g){e.f=b?function(c){try{var e=b.call(d,c);a(e)}catch(l){g(l)}}:a;e.b=c?function(b){try{var e=c.call(d,b);!qa(e)&&b instanceof ub?g(b):a(e)}catch(l){g(l)}}:g});e.a.b=a;yb(a,e);return e.a}gb.prototype.m=function(a){this.C=hb;ib(this,jb,a)};gb.prototype.u=function(a){this.C=hb;ib(this,kb,a)};
function ib(a,b,c){if(a.C==hb){a===c&&(b=kb,c=new TypeError("Promise cannot resolve to itself"));a.C=1;a:{var d=c,e=a.m,f=a.u;if(d instanceof gb){yb(d,nb(e||ta,f||null,a));var g=!0}else{if(d)try{var h=!!d.$goog_Thenable}catch(l){h=!1}else h=!1;if(h)d.then(e,f,a),g=!0;else{if(wa(d))try{var k=d.then;if(r(k)){Ab(d,k,e,f,a);g=!0;break a}}catch(l){f.call(a,l);g=!0;break a}g=!1}}}g||(a.i=c,a.C=b,a.b=null,zb(a),b!=kb||c instanceof ub||Bb(a,c))}}
function Ab(a,b,c,d,e){function f(a){h||(h=!0,d.call(e,a))}function g(a){h||(h=!0,c.call(e,a))}var h=!1;try{b.call(a,g,f)}catch(k){f(k)}}function zb(a){a.g||(a.g=!0,ab(a.j,a))}function wb(a){var b=null;a.a&&(b=a.a,a.a=b.next,b.next=null);a.a||(a.c=null);return b}gb.prototype.j=function(){for(var a;a=wb(this);)xb(this,a,this.C,this.i);this.g=!1};
function xb(a,b,c,d){if(c==kb&&b.b&&!b.g)for(;a&&a.f;a=a.b)a.f=!1;if(b.a)b.a.b=null,Cb(b,c,d);else try{b.g?b.f.call(b.c):Cb(b,c,d)}catch(e){Db.call(null,e)}mb.put(b)}function Cb(a,b,c){b==jb?a.f.call(a.c,c):a.b&&a.b.call(a.c,c)}function Bb(a,b){a.f=!0;ab(function(){a.f&&Db.call(null,b)})}var Db=Ya;function ub(a){Da.call(this,a)}w(ub,Da);ub.prototype.name="cancel";function sb(a,b,c){this.bi=a;this.resolve=b;this.reject=c};var y=this;function Fb(){return Object.create(z,void 0)}var A=Ba,Gb=String,Hb=y.Object.freeze||function(a){return a};function Ib(a){for(var b=Object.keys(a),c=b.length,d;c--;)d=a[b[c]],wa(d)&&Ib(d);return Hb(a)}var B=self.eval("undefined"),z=self.eval("null");function Jb(a,b){return Gb(a).split(b!==B?b:" ")}var Kb="prototype constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
function C(a,b,c,d,e){if(!(b=a instanceof b)&&c)throw new D(c,d,Lb(e)?e:a);return b}function Mb(a,b){if(!0===(C(a,b)&&a.constructor===b))throw new TypeError("Illegal constructor "+Nb(b));}function Ob(a,b,c,d,e){if(!(b=Pb(a)===b)&&c)throw new D(c,d,Lb(e)?e:a);return b}function Qb(a,b,c,d){return Ob(a,"Array",b,c,d)}u("H.lang.isArray",Qb);function Lb(a){return a!==B}u("H.lang.isString",ra);var Rb=parseInt,Sb=parseFloat,F=isNaN;function Tb(a){return a===+a}u("H.lang.isNumber",Tb);
var Ub=Number.isInteger?Number.isInteger:function(a){return"number"===typeof a&&0===a%1};u("H.lang.isInteger",Ub);function Vb(a){return!F(+a)}function Pb(a){var b=Object[Kb[0]][Kb[6]].call(a).match(/^\[object (\w+)\]$/);return b?b[1]:typeof a}var Xb=[];function Yb(a){0>Xb.indexOf(a)&&Xb.push(a)}Yb(Xb);
function Nb(a,b,c,d){var e="",f=2>arguments.length,g;f&&(b={H:y.H},c="",d=Xb.slice());Zb(b,!0,function(b,f){try{if(g=b[f],f=$b(b,g),!(wa(g)&&g.window===g&&g.self===g||wa(g)&&0<g.nodeType&&r(g.cloneNode))&&wa(g)){if(g===a)return e=c+"."+f,!0;if(0>d.indexOf(g)&&(d.push(g),e=Nb(a,g,c+"."+f,d)))return!0}}catch(l){}});f&&(e=e?e.substr(1).replace("."+Kb[0]+".","#"):"~"+(r(a)?ac(a)+"()":Pb(a)));return e}
function $b(a,b){var c=[];Zb(a,!1,function(a,e){a[e]===b&&c.push(e)});return c.sort(bc)[0]}function bc(a,b){return b.length-a.length}var cc=Object[Kb[0]][Kb[2]];function Zb(a,b,c){var d;if(a){for(e in a)if((!b||cc.call(a,e))&&c(a,e,!0))return;for(d=Kb.length;d--;){var e=Kb[d];if((!b||cc.call(a,e))&&c(a,e,!1))break}}}function ac(a){return(a=/^\s*function ([^\( ]+)/.exec(a))?a[1]:"anonymous"}function dc(a,b,c){c[b]="#"+b}var ec=!!y.__karma__;function fc(){throw Error("unimplemented method");};function gc(a,b){b=b||{};"status"in b&&(this.status=+b.status);"statusText"in b&&(this.statusText=b.statusText);this.ok=200<=this.status&&300>this.status;this.bodyUsed=!1;a?"string"===typeof a?this.c=a:ArrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(a)||a.buffer)?this.a=a.buffer||a:Blob.prototype.isPrototypeOf(a)&&(this.b=a):this.c=""}u("H.net.Response",gc);gc.prototype.type="default";gc.prototype.type=gc.prototype.type;gc.prototype.status=200;gc.prototype.status=gc.prototype.status;
gc.prototype.statusText="OK";gc.prototype.statusText=gc.prototype.statusText;gc.a=function(a){if(a.bodyUsed)return qb(new TypeError("Already read"));a.bodyUsed=!0};gc.error=function(){gc.b||(gc.b=new gc(null,{status:0,statusText:""}),gc.b.type="error");return gc.b};gc.error=gc.error;gc.prototype.text=function(){var a=gc.a(this);a||(this.c?a=pb(this.c):this.a?a=gc.c(this.a):this.b?a=gc.g(this.b):a=qb("Unsupported response body"));return a};gc.prototype.json=function(){return this.text().then(y.JSON.parse)};
gc.prototype.blob=function(){var a,b=gc.a(this);b||(this.b?a=this.b:this.a&&(a=new Blob([this.a],{type:"application/octet-stream"})));return b||pb(a)};gc.prototype.arrayBuffer=function(){return this.a?gc.a(this)||pb(this.a.slice(0)):this.blob().then(gc.f)};gc.f=function(a){var b=new FileReader;b.readAsArrayBuffer(a);return new gb(function(a,d){b.onload=function(){a(b.result)};b.onerror=function(){d(b.error)}})};
gc.g=function(a){var b=new FileReader;b.readAsText(a);return new gb(function(a,d){b.onload=function(){a(b.result)};b.onerror=function(){d(b.error)}})};gc.c=function(a){a=new Uint8Array(a);var b=a.length,c=Array(b),d;for(d=0;d<b;d++)c[d]=String.fromCharCode(a[d]);return pb(c.join(""))};!ec&&y.Response&&y.Response.error&&(gc=y.Response,Yb(gc.prototype));function hc(a,b,c){function d(){var a=A(l.a,l),b=+k.timeout||0;ic?(jc(l,"timeout",a),e.timeout=b):b&&(l.c=setTimeout(function(){e.abort();l.a({type:"timeout"})},b));jc(l,"error",a);jc(l,"load",a);e.send(k.data)}var e,f,g,h=c&&c.headers||{},k={},l=this;if(!r(b))throw new D(hc,1,"function required");Pa(h,kc.headers,h);Pa(k,kc,c||{});k.headers=h;this.b=b;this.ia=e=new XMLHttpRequest;b=k.method;try{e.open(b,a,!0);for(f in h)h.hasOwnProperty(f)&&(g=h[f])&&e.setRequestHeader(f,g);e.withCredentials=!!k.withCredentials;
d()}catch(m){this.a({type:"cors"})}}u("H.net.Xhr",hc);var kc={method:"GET",headers:{},data:null},lc="withCredentials"in new XMLHttpRequest,ic="timeout"in new XMLHttpRequest;function jc(a,b,c){lc?a.ia.addEventListener(b,c):a.ia["on"+b]=c}function mc(a,b,c){lc?a.ia.removeEventListener(b,c):a.ia["on"+b]=null}hc.prototype.abort=function(){this.ia&&(this.ia.abort(),this.ia&&this.a({type:"abort"}))};hc.prototype.abort=hc.prototype.abort;
hc.prototype.a=function(a){var b=a.type;a=this.ia;var c,d;this.c&&clearTimeout(this.c);"load"===b?a instanceof XMLHttpRequest&&200!==a.status&&(c="network"):c=4===a.readyState&&0===a.status&&"error"==b?"cors":"error"!=b?b:"network";b=this.a;mc(this,"timeout",b);mc(this,"error",b);mc(this,"load",b);0===a.status||c&&"network"!==c?d=gc.error():d=new gc(a.responseText,a);c=this.b;delete this.a;delete this.b;delete this.ia;c(d)};function nc(a,b){var c=[];a&&c.push(Nb(a));1<arguments.length&&c.push(b);this.message=c.join(" ");this.stack=Error().stack}w(nc,Error);u("H.lang.IllegalOperationError",nc);nc.prototype=Error();nc.prototype.name="IllegalOperationError";var oc;function D(a,b,c){var d=arguments.length;b=1<d?+b:b;d=2<d?Gb(c):"";if(b!==B){var e=(e=/^.*?\(([^\)]+)/.exec((""+a).replace(/(\/\*([\s\S]*?)\*\/)|(\/\/(.*)$)/gm,"")))?Jb(e[1].replace(/\s+/g,""),","):[];e.forEach(dc);e=e[b]||"#"+b}this.message=(a?Nb(a):"")+(e||d?" (":"")+(e?"Argument "+e:"")+(d?(e?" ":"")+d:"")+(e||d?")":"");this.stack=Error().stack}u("H.lang.InvalidArgumentError",D);D.prototype=Error();D.prototype.name="InvalidArgumentError";function pc(){if(!ra("STATIC_DB"))throw new D(this.constructor,0);this.g=y.indexedDB||y.webkitIndexedDB||y.mozIndexedDB||y.msIndexedDB;if(!this.g)throw new nc(this.constructor,"This browser does not support IndexedDB");this.a=[];this.c=[];this.Wh=A(this.Wh,this)}var qc,rc;n=pc.prototype;n.put=function(a,b,c,d){if(!ra(a)&&!Tb(a))throw new D(this.put,0);if(!sc(b))throw new D(this.put,1);tc(this,function(e){uc(e.put(b,a),c,d)},d)};
n.get=function(a,b,c){var d;if(!ra(a)&&!Tb(a))throw new D(this.get,0);if(!r(b))throw new D(this.get,1);tc(this,function(e){d=e.get(a);uc(d,b,c)},c);return{cancel:function(){d&&(d.onsuccess=vc)}}};n.remove=function(a,b,c){if(!ra(a)&&!Tb(a))throw new D(this.remove,0);tc(this,function(d){uc(d["delete"](a),b,c)},c)};n.clear=function(a,b){tc(this,function(c){uc(c.clear(),a,b)},b)};n.Wh=function(){var a=this.b.result;a.objectStoreNames.contains("data")||a.createObjectStore("data")};
function wc(a,b,c){if(a.b)a.a?(a.a.push(b),c&&a.c.push(c)):a.f?c&&c(a.f):b(a.b.result);else{a.b=a.g.open(xc+"STATIC_DB",1);a.b.onupgradeneeded=a.Wh;var d=a.b.onerror=function(){clearTimeout(a.i);a.f=this.error;a.c.forEach(function(b){b(a.f)});a.a=a.c=null};a.i=setTimeout(function(){d.call({error:Error("DbOpenTimeoutError")})},500);a.b.onsuccess=function(){clearTimeout(a.i);a.a?(a.a.forEach(function(a){a(this.result)},this),a.a=a.c=null):(a.b=a.f=null,a.a=[],a.c=[])};a.a.push(b);c&&a.c.push(c)}}
function tc(a,b,c){wc(a,function(a){a=a.transaction(["data"],"readwrite");b(a.objectStore("data"))},c)}function uc(a,b,c){b&&(a.onsuccess=function(){b(this.result)});c&&(a.onerror=function(){c(this.error)})}function sc(a){var b=Object.prototype.toString.call(a);return"[object Blob]"===b||"[object ArrayBuffer]"===b||ra(a)||wa(a)}function yc(){qc||(qc=new pc);return qc}u("H.util.IndexedDBStorage.getInstance",yc);var xc="H_";
function zc(){if(!Lb(rc))if("file:"===window.location.protocol&&-1<navigator.userAgent.toLowerCase().indexOf("firefox")&&128<=window.location.href.length)rc=!1;else{var a=y.indexedDB||y.webkitIndexedDB||y.mozIndexedDB||y.msIndexedDB;var b=xc+"TEST_DB";try{var c=a&&a.open(b,1)}catch(d){}rc=!!c&&null===c.onupgradeneeded;c&&a.deleteDatabase&&a.deleteDatabase(b)}return rc}u("H.util.IndexedDBStorage.isSupported",zc);function Ac(){0!=Bc&&(Cc[this[xa]||(this[xa]=++ya)]=this);this.Bd=this.Bd;this.Xa=this.Xa}var Bc=0,Cc={};Ac.prototype.Bd=!1;Ac.prototype.F=function(){if(!this.Bd&&(this.Bd=!0,this.s(),0!=Bc)){var a=this[xa]||(this[xa]=++ya);if(0!=Bc&&this.Xa&&0<this.Xa.length)throw Error(this+" did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");delete Cc[a]}};
Ac.prototype.xb=function(a,b){this.Bd?qa(b)?a.call(b):a():(this.Xa||(this.Xa=[]),this.Xa.push(qa(b)?Ba(a,b):a))};Ac.prototype.s=function(){if(this.Xa)for(;this.Xa.length;)this.Xa.shift()()};function Dc(a){a&&"function"==typeof a.F&&a.F()};function Ec(a,b){this.type=a;this.currentTarget=this.target=b;this.f=this.a=!1;this.Ek=!0}Ec.prototype.stopPropagation=function(){this.a=!0};Ec.prototype.preventDefault=function(){this.f=!0;this.Ek=!1};u("H.util.Event",Ec);Ec.prototype.stopPropagation=Ec.prototype.stopPropagation;Ec.prototype.stopPropagation=Ec.prototype.stopPropagation;Ec.prototype.CAPTURING_PHASE=1;Ec.prototype.CAPTURING_PHASE=Ec.prototype.CAPTURING_PHASE;Ec.prototype.AT_TARGET=2;Ec.prototype.AT_TARGET=Ec.prototype.AT_TARGET;Ec.prototype.BUBBLING_PHASE=3;Ec.prototype.BUBBLING_PHASE=Ec.prototype.BUBBLING_PHASE;Ec.prototype.eventPhase=0;Ec.prototype.eventPhase=Ec.prototype.eventPhase;function Fc(a,b,c){Fc.l.constructor.call(this,a,c);this.data=b}w(Fc,Ec);u("H.util.DataEvent",Fc);function Gc(a,b,c){Gc.l.constructor.call(this,a,c);this.message=b}w(Gc,Ec);u("H.util.ErrorEvent",Gc);var Hc=Math,Ic=Hc.min,Jc=Hc.max,Kc=Hc.round,Lc=Hc.floor,Mc=Hc.ceil,Nc=Hc.abs,Oc=Hc.log,Pc=Hc.sqrt,Qc=Hc.pow,Rc=Hc.exp,Sc=Hc.sin,Tc=Hc.asin,Vc=Hc.cos,Wc=Hc.tan,Xc=Hc.atan,Yc=Hc.atan2,Zc=Hc.LN2,$c=Hc.PI,ad=$c/2,bd=$c/4,cd=2*$c,dd=3*$c,ed=$c/180,fd=180/$c,gd=1/0,hd=Qc(-2,53),id=id||function(a){return Oc(a)/Zc};function jd(a,b){var c;return 0>(c=a%b)===0>b?c:c+b}function kd(a,b,c){b-=c=c||0;a-=c;return a-Lc(a/b)*b+c}u("H.math.normalize",kd);function ld(a,b,c){return a>c?c:a<b?b:a}
u("H.math.clamp",ld);function md(a,b,c,d){d||(d=0);return b<c?a>=b-d&&a<=c+d:a>=c-d&&a<=b+d}function nd(a,b,c,d,e,f){return Pc(Qc((a-e)*(d-f)-(b-f)*(c-e),2)/(Qc(c-e,2)+Qc(d-f,2)))}var od={NONE:0,VERTEX:1,EDGE:2,SURFACE:3};u("H.math.CoverType",od);
function pd(a,b,c,d,e){for(var f=c.length,g=f,h,k,l,m=c[0],p=0,q=0,t=0,v=d/2||0,x=e?1:3;1!=p&&g>x;){h=c[--g];d=c[--g];l=c[g?g-1:(f+(g-1))%f];k=c[g?g-2:(f+(g-2))%f];if(d>=a-v&&d<=a+v&&h>=b-v&&h<=b+v||k>=a-v&&k<=a+v&&l>=b-v&&l<=b+v)p=1;else if(!p&&d===a)k===a&&(h<b&&l>b||h>b&&l<b)||(m<=a&&k>a||m>=a&&k<a)&&(h>=b?++q:++t),p=md(b,h,l,v)&&nd(a,b,d,h,k,l)<=v?2:0;else if(!p&&md(a,d,k,v)){if(d<a&&k>a||d>a&&k<a)m=h+(a-d)/(k-d)*(l-h),q+=m>b,t+=m<b;p=md(b,h,l,v)&&nd(a,b,d,h,k,l)<=v?2:0}m=d}!p&&e&&0!==t&&0!==
q%2&&(p=3);return p}u("H.math.isCoveredBy",pd);function qd(a,b,c){this.type=a;this.data=b;this.f=rb();this.resolve=A(this.resolve,this);this.reject=A(this.reject,this);this.c=rd;c!==B&&(this.c=c);this.fh().add(this)}var rd=1,sd={wo:0,zo:rd,vo:2};n=qd.prototype;n.then=function(a,b,c){return this.f.bi.then(a,b,c)};n.resolve=function(a){this.ae=3;this.f.resolve(a)};n.reject=function(a){this.ae=5;this.f.reject(a)};n.ae=0;n.cancel=function(){this.f.bi.cancel();3>this.ae&&(this.qe(),this.fh().remove(this),this.ae=4)};function td(a){var b;this.a={};for(b in sd)this.a[sd[b]]=[];this.gg=a;this.gg.addEventListener("allocatable",A(this.b,this))}u("H.util.JobManager",td);var ud=Object.keys(sd).map(function(a){return sd[a]}).sort().reverse();td.prototype.add=function(a){C(a,qd,this.add,0);this.a[a.c].push(a);this.b()};td.prototype.contains=function(a){return-1<this.a[a.c].indexOf(a)};td.prototype.remove=function(a){var b=a.c;a=this.a[b].indexOf(a);return-1<a?(this.a[b].splice(a,1),!0):!1};
td.prototype.b=function(){ud.forEach(function(a){this.a[a]=this.a[a].filter(function(a){var b;if((b=this.gg.Eg(a))!==z){var d=A(this.gg.Qg,this.gg,b,a);a.then(d,d);a.ae=a.qj(b)?1:5}else return!0},this)},this)};function vd(a,b,c){var d=[];1<arguments.length&&d.push(b);2<arguments.length&&d.push("out of ["+c[0]+"..."+c[1]+"]");this.message=(a?Nb(a):"")+(d.length?" ("+d.join(" ")+")":"");this.stack=Error().stack}u("H.lang.OutOfRangeError",vd);vd.prototype=Error();vd.prototype.name="OutOfRangeError";var wd="closure_listenable_"+(1E6*Math.random()|0);function xd(a){return!(!a||!a[wd])}var yd=0;function zd(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.Kf=e;this.key=++yd;this.ce=this.sf=!1}function Ad(a){a.ce=!0;a.listener=null;a.proxy=null;a.src=null;a.Kf=null};function Bd(a){this.src=a;this.a={};this.b=0}Bd.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.a[f];a||(a=this.a[f]=[],this.b++);var g=Cd(a,b,d,e);-1<g?(b=a[g],c||(b.sf=!1)):(b=new zd(b,this.src,f,!!d,e),b.sf=c,a.push(b));return b};Bd.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.a))return!1;var e=this.a[a];b=Cd(e,b,c,d);return-1<b?(Ad(e[b]),Array.prototype.splice.call(e,b,1),0==e.length&&(delete this.a[a],this.b--),!0):!1};
function Dd(a,b){var c=b.type;if(!(c in a.a))return!1;var d=a.a[c],e=Xa(d,b),f;(f=0<=e)&&Array.prototype.splice.call(d,e,1);f&&(Ad(b),0==a.a[c].length&&(delete a.a[c],a.b--));return f}Bd.prototype.ha=function(a){a=a&&a.toString();var b=0,c;for(c in this.a)if(!a||c==a){for(var d=this.a[c],e=0;e<d.length;e++)++b,Ad(d[e]);delete this.a[c];this.b--}return b};
function Fd(a,b){var c=qa(b),d=c?b.toString():"",e=qa(void 0);return Ja(a.a,function(a){for(var b=0;b<a.length;++b)if(!(c&&a[b].type!=d||e&&void 0!=a[b].capture))return!0;return!1})}function Cd(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.ce&&f.listener==b&&f.capture==!!c&&f.Kf==d)return e}return-1};function Gd(a){Gd[" "](a);return a}Gd[" "]=ta;var Hd=Wa("Opera"),Id=Wa("Trident")||Wa("MSIE"),Jd=Wa("Edge"),Kd=Wa("Gecko")&&!(Ra(Ta.toLowerCase(),"webkit")&&!Wa("Edge"))&&!(Wa("Trident")||Wa("MSIE"))&&!Wa("Edge"),Ld=Ra(Ta.toLowerCase(),"webkit")&&!Wa("Edge");function Md(){var a=oa.document;return a?a.documentMode:void 0}var Nd;
a:{var Od="",Pd=function(){var a=Ta;if(Kd)return/rv:([^\);]+)(\)|;)/.exec(a);if(Jd)return/Edge\/([\d\.]+)/.exec(a);if(Id)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(Ld)return/WebKit\/(\S+)/.exec(a);if(Hd)return/(?:Version)[ \/]?(\S+)/.exec(a)}();Pd&&(Od=Pd?Pd[1]:"");if(Id){var Qd=Md();if(null!=Qd&&Qd>parseFloat(Od)){Nd=String(Qd);break a}}Nd=Od}var Rd={},Sd;var Td=oa.document;Sd=Td&&Id?Md()||("CSS1Compat"==Td.compatMode?parseInt(Nd,10):5):void 0;var Ud;(Ud=!Id)||(Ud=9<=Number(Sd));var Vd=Ud,Wd;
if(Wd=Id){var Xd;if(Object.prototype.hasOwnProperty.call(Rd,"9"))Xd=Rd["9"];else{for(var Yd,Zd=0,$d=Qa(String(Nd)).split("."),ae=Qa("9").split("."),be=Math.max($d.length,ae.length),ce=0;0==Zd&&ce<be;ce++){var de=$d[ce]||"",ee=ae[ce]||"";do{var fe=/(\d*)(\D*)(.*)/.exec(de)||["","","",""],ge=/(\d*)(\D*)(.*)/.exec(ee)||["","","",""];if(0==fe[0].length&&0==ge[0].length)break;Zd=Sa(0==fe[1].length?0:parseInt(fe[1],10),0==ge[1].length?0:parseInt(ge[1],10))||Sa(0==fe[2].length,0==ge[2].length)||Sa(fe[2],
ge[2]);de=fe[3];ee=ge[3]}while(0==Zd)}Yd=0<=Zd;Xd=Rd["9"]=Yd}Wd=!Xd}var he=Wd,ie=function(){if(!oa.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});oa.addEventListener("test",ta,b);oa.removeEventListener("test",ta,b);return a}();function je(a,b){Ec.call(this,a?a.type:"");this.relatedTarget=this.currentTarget=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=0;this.key="";this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.pointerId=0;this.pointerType="";this.b=null;if(a){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.currentTarget=b;if(b=a.relatedTarget){if(Kd){a:{try{Gd(b.nodeName);var e=!0;break a}catch(f){}e=!1}e||(b=null)}}else"mouseover"==
c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;null===d?(this.clientX=void 0!==a.clientX?a.clientX:a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0);this.button=a.button;this.key=a.key||"";this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=
a.metaKey;this.pointerId=a.pointerId||0;this.pointerType=ra(a.pointerType)?a.pointerType:ke[a.pointerType]||"";this.b=a;a.defaultPrevented&&this.preventDefault()}}w(je,Ec);var ke={2:"touch",3:"pen",4:"mouse"};je.prototype.stopPropagation=function(){je.l.stopPropagation.call(this);this.b.stopPropagation?this.b.stopPropagation():this.b.cancelBubble=!0};
je.prototype.preventDefault=function(){je.l.preventDefault.call(this);var a=this.b;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,he)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var le="closure_lm_"+(1E6*Math.random()|0),me={},ne=0;function oe(a,b,c,d,e){if(d&&d.once)return pe(a,b,c,d,e);if("array"==ua(b)){for(var f=0;f<b.length;f++)oe(a,b[f],c,d,e);return null}c=qe(c);return xd(a)?a.W.add(String(b),c,!1,wa(d)?!!d.capture:!!d,e):re(a,b,c,!1,d,e)}
function re(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=wa(e)?!!e.capture:!!e,h=se(a);h||(a[le]=h=new Bd(a));c=h.add(b,c,d,g,f);if(c.proxy)return c;d=te();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)ie||(e=g),void 0===e&&(e=!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(ue(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");ne++;return c}
function te(){var a=ve,b=Vd?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b}function pe(a,b,c,d,e){if("array"==ua(b)){for(var f=0;f<b.length;f++)pe(a,b[f],c,d,e);return null}c=qe(c);return xd(a)?a.W.add(String(b),c,!0,wa(d)?!!d.capture:!!d,e):re(a,b,c,!0,d,e)}
function we(a,b,c,d,e){if("array"==ua(b)){for(var f=0;f<b.length;f++)we(a,b[f],c,d,e);return null}d=wa(d)?!!d.capture:!!d;c=qe(c);if(xd(a))return a.W.remove(String(b),c,d,e);if(!a)return!1;if(a=se(a))if(b=a.a[b.toString()],a=-1,b&&(a=Cd(b,c,d,e)),c=-1<a?b[a]:null)return xe(c);return!1}
function xe(a){if("number"==typeof a||!a||a.ce)return!1;var b=a.src;if(xd(b))return Dd(b.W,a);var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent(ue(c),d):b.addListener&&b.removeListener&&b.removeListener(d);ne--;(c=se(b))?(Dd(c,a),0==c.b&&(c.src=null,b[le]=null)):Ad(a);return!0}function ue(a){return a in me?me[a]:me[a]="on"+a}
function ze(a,b,c,d){var e=!0;if(a=se(a))if(b=a.a[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.capture==c&&!f.ce&&(f=Ae(f,d),e=e&&!1!==f)}return e}function Ae(a,b){var c=a.listener,d=a.Kf||a.src;a.sf&&xe(a);return c.call(d,b)}
function ve(a,b){if(a.ce)return!0;if(!Vd){if(!b)a:{b=["window","event"];for(var c=oa,d=0;d<b.length;d++)if(c=c[b[d]],null==c){b=null;break a}b=c}d=b;b=new je(d,this);c=!0;if(!(0>d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.currentTarget;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;!b.a&&0<=e;e--){b.currentTarget=d[e];var f=ze(d[e],a,!0,b);c=c&&f}for(e=0;!b.a&&e<d.length;e++)b.currentTarget=
d[e],f=ze(d[e],a,!1,b),c=c&&f}return c}return Ae(a,new je(b,this))}function se(a){a=a[le];return a instanceof Bd?a:null}var Be="__closure_events_fn_"+(1E9*Math.random()>>>0);function qe(a){if(r(a))return a;a[Be]||(a[Be]=function(b){return a.handleEvent(b)});return a[Be]};function G(){Ac.call(this);this.W=new Bd(this);this.pn=this;this.Sg=null}w(G,Ac);G.prototype[wd]=!0;n=G.prototype;n.fc=function(){return this.Sg};n.ba=function(a){this.Sg=a};n.addEventListener=function(a,b,c,d){oe(this,a,b,c,d)};n.removeEventListener=function(a,b,c,d){we(this,a,b,c,d)};
n.dispatchEvent=function(a){var b,c=this.fc();if(c)for(b=[];c;c=c.fc())b.push(c);c=this.pn;var d=a.type||a;if(ra(a))a=new Ec(a,c);else if(a instanceof Ec)a.target=a.target||c;else{var e=a;a=new Ec(d,c);Pa(a,e)}e=!0;if(b)for(var f=b.length-1;!a.a&&0<=f;f--){var g=a.currentTarget=b[f];e=g.kd(d,!0,a)&&e}a.a||(g=a.currentTarget=c,e=g.kd(d,!0,a)&&e,a.a||(e=g.kd(d,!1,a)&&e));if(b)for(f=0;!a.a&&f<b.length;f++)g=a.currentTarget=b[f],e=g.kd(d,!1,a)&&e;return e};
n.s=function(){G.l.s.call(this);this.W&&this.W.ha(void 0);this.Sg=null};n.kd=function(a,b,c){a=this.W.a[String(a)];if(!a)return!0;a=a.concat();for(var d=!0,e=0;e<a.length;++e){var f=a[e];if(f&&!f.ce&&f.capture==b){var g=f.listener,h=f.Kf||f.src;f.sf&&Dd(this.W,f);d=!1!==g.call(h,c)&&d}}return d&&0!=c.Ek};u("H.util.EventTarget",G);G.prototype.ba=G.prototype.ba;G.prototype.setParentEventTarget=G.prototype.ba;G.prototype.fc=G.prototype.fc;G.prototype.getParentEventTarget=G.prototype.fc;G.prototype.addEventListener=G.prototype.addEventListener;G.prototype.addEventListener=G.prototype.addEventListener;G.prototype.removeEventListener=G.prototype.removeEventListener;G.prototype.removeEventListener=G.prototype.removeEventListener;G.prototype.dispatchEvent=G.prototype.dispatchEvent;
G.prototype.dispatchEvent=G.prototype.dispatchEvent;G.prototype.F=G.prototype.F;G.prototype.dispose=G.prototype.F;G.prototype.xb=G.prototype.xb;G.prototype.addOnDisposeCallback=G.prototype.xb;G.prototype.qn=G.prototype.kd;
G.prototype.kd=function(a,b,c){var d,e,f=!0;var g=c[c.currentTarget===c.target?"AT_TARGET":b?"CAPTURING_PHASE":(d=!0,"BUBBLING_PHASE")];if(!d||"pointerenter"!==(e=c.type)&&"pointerleave"!==e)c.eventPhase=g,f=G.prototype.qn.apply(this,arguments),d&&this.fc&&null===this.fc()&&delete c.eventPhase;return f};function Ce(a){a=a||{};var b=a.callback;this.a=a.label;r(b)&&(this.callback=b);this.u=!!a.disabled;Ce.l.constructor.call(this)}w(Ce,G);u("H.util.ContextItem",Ce);Ce.prototype.He=function(){return this.a};Ce.prototype.getLabel=Ce.prototype.He;Ce.prototype.Mc=function(a){this.a!==a&&(this.a=a,this.dispatchEvent("update"));return this};Ce.prototype.setLabel=Ce.prototype.Mc;Ce.prototype.Dc=function(){return this.u};Ce.prototype.isDisabled=Ce.prototype.Dc;
Ce.prototype.Ca=function(a){a^this.u&&(this.u=a,this.dispatchEvent("update"));return this};Ce.prototype.setDisabled=Ce.prototype.Ca;var De=new Ce;Ce.SEPARATOR=De;function Ee(){if(y.document){var a=document.createElement("canvas");a.width=a.height=1;return a.getContext("2d")}return null}function Fe(){return window.devicePixelRatio||1}u("H.util.getPixelRatio",Fe);var Ge=/^rgba\(([^,]+),([^,]+),([^,]+),([^)]+)\)$/;
function He(a){var b=Ie[a],c=y.RegExp;b||(y.Uint8ClampedArray||(y.Uint8ClampedArray=function(a){return a instanceof Number?Array(a):a.map(function(a){return ld(Kc(a),0,255)})}),"none"===a?b=new Uint8ClampedArray([0,0,0,0]):(Je.fillStyle="black",Je.fillStyle=a,Ge.test(Je.fillStyle)?b=new Uint8ClampedArray([c.$1,c.$2,c.$3,255*c.$4]):(Je.clearRect(0,0,1,1),Je.fillRect(0,0,1,1),b=Je.getImageData(0,0,1,1).data)),Ie[a]=b);return b}function Ke(a){return"none"!==a&&0<He(a)[3]}var Ie=Fb(),Le=!!y.VBArray;
u("H.util.eval",function(a){return eval(a)});function Me(a,b){return a!==B?a:b}function Ne(a){return/^<svg/.test(a)?"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(a):a}u("H.util.provide",function(a){sa(a,void 0)});function Oe(a){this.kc=0<a?Hc.round(a):0}Oe.prototype.next=function(a){if(9007199254740992===this.kc)throw new vd(a,this.kc,[0,9007199254740991]);return this.kc++};var Pe=new Oe,Qe=A(Pe.next,Pe);function Re(){return!0}function Se(){return!1}function vc(){}
var Te=Hb([]),Ue=Hb({});function Ve(a){return"CANVAS"===a.tagName?[a]:a.getElementsByTagName("CANVAS")}function We(a,b,c){var d;b=a.ownerDocument===b?a.cloneNode(!0):b.importNode(a,!0);if(c)for(a=Ve(a),c=Ve(b),d=c.length;d--;)c[d].getContext("2d").drawImage(a[d],0,0);return b}var Je=Ee(),Xe=Ee();function Ye(a){var b=a.complete,c=0<a.naturalWidth;if(b&&!c&&Le)try{Xe.drawImage(a,0,0),c=!0}catch(d){}return b&&c}var Ze=y.BlobBuilder||y.WebKitBlobBuilder||y.MozBlobBuilder;
function $e(a,b){b=b||"";if(Ze){var c=new Ze;c.append(a);a=c.getBlob(b)}else a=new Blob([a],{type:b});return a};function af(){var a=af.a;a||(a=this,af.a=a,Yb(af.a),G.call(a),bf(this));return a}w(af,G);af.prototype.s=function(){af.l.s.call(this);bf(this)};function bf(a){a.g=10;a.i=6;a.a=Fb();a.b=Fb();a.c=0}af.prototype.Eg=function(a){a=a.type;var b=this.a[a]||0;if(this.c<this.g&&b<this.i){var c=++this.f;this.c++;this.a[a]=b+1;this.b[c+""]=a;return c}return z};
af.prototype.Qg=function(a){var b=this.b[a];if(!Lb(b)||!this.a[b])throw new nc(this.Qg,"Unknown requestId");this.c--;this.a[b]--;this.a[b]||delete this.a[b];delete this.b[a];this.dispatchEvent("allocatable")};af.prototype.f=-1;function cf(a,b,c,d){if(!this.b[a])throw new D(cf,0,"Mime type is not supported");this.i=a;a=d?La(d):{};"crossOrigin"in a||(a.crossOrigin="anonymous");this.a=a;a=df;a.href=b.toString();qd.call(this,a.protocol+"//"+a.hostname,b,c)}w(cf,qd);cf.prototype.qj=function(){this.g=this.b[this.i].call(this);return!0};cf.prototype.qe=function(){this.g&&(this.g.abort(),this.g=null)};
cf.prototype.b={"application/json":function(){var a=this,b=ef(this.a),c=b.headers;b.headers=c=c?La(c):{};c.Accept="application/json";return new hc(this.data,function(b){200<=b.status&&300>b.status?a.resolve(b.json()):a.reject(b)},b)},"text/plain":function(){var a=this;return new hc(this.data,function(b){200<=b.status&&300>b.status?a.resolve(b.text()):a.reject(b)},ef(this.a))},image:function(){var a=y.document.createElement("img"),b=this,c=this.data;a.onload=A(this.resolve,this,a);a.onerror=function(){b.reject(gc.error())};
a.crossOrigin=this.a.crossOrigin;a.src=c;return{abort:function(){a.onerror=a.onload=null;Le&&Ye(a)||a.removeAttribute("src")}}}};
(function(){try{var a=new XMLHttpRequest;a.open("get","/",!0)}catch(b){a={}}"response"in a&&(cf.prototype.b.arraybuffer=function(){var a=new XMLHttpRequest,c=this,d=this.a,e=d.headers,f;a.open("GET",this.data);ff(a,d);a.responseType="arraybuffer";if(e)for(f in e)a.setRequestHeader(f,e[f]);a.onerror=a.ontimeout=function(){c.reject(gc.error())};a.onload=function(){c.resolve(new gc(a.response))};a.send();return a})})();var gf=new td(new af);cf.prototype.fh=function(){return gf};var df=y.document.createElement("a");
function ef(a){var b=La(a);delete b.crossOrigin;ff(b,a);return b}function ff(a,b){a.withCredentials="use-credentials"===b.crossOrigin};function H(a,b){this.x=+a;this.y=+b}u("H.math.Point",H);H.prototype.set=H;H.prototype.set=H.prototype.set;H.prototype.clone=function(a){a?(a.x=this.x,a.y=this.y):a=new H(this.x,this.y);return a};H.prototype.clone=H.prototype.clone;H.prototype.add=function(a){this.x+=a.x;this.y+=a.y;return this};H.prototype.add=H.prototype.add;H.prototype.sub=function(a){this.x-=a.x;this.y-=a.y;return this};H.prototype.sub=H.prototype.sub;H.prototype.scale=function(a,b){this.x*=a;this.y*=void 0===b?a:b;return this};
H.prototype.scale=H.prototype.scale;H.prototype.round=function(){this.x=Kc(this.x);this.y=Kc(this.y);return this};H.prototype.round=H.prototype.round;H.prototype.floor=function(){this.x=Lc(this.x);this.y=Lc(this.y);return this};H.prototype.floor=H.prototype.floor;H.prototype.ceil=function(){this.x=Mc(this.x);this.y=Mc(this.y);return this};H.prototype.ceil=H.prototype.ceil;H.prototype.da=function(a){return!(!a||this.x!==a.x||this.y!==a.y)};H.prototype.equals=H.prototype.da;
H.prototype.xj=function(a,b){var c=b.x-a.x,d=b.y-a.y,e=a;if(c||d){var f=((this.x-a.x)*c+(this.y-a.y)*d)/(c*c+d*d);0>=f?e=a:1<=f?e=b:e=new H(a.x+f*c,a.y+f*d)}return e};H.prototype.getNearest=H.prototype.xj;H.prototype.bb=function(a){return Pc(Qc(this.x-a.x,2)+Qc(this.y-a.y,2))};H.prototype.distance=H.prototype.bb;function hf(a){if(!a)throw Error("invalid argument");return a instanceof H?a:new H(a.x,a.y)}H.fromIPoint=hf;function jf(a){var b=kf[a];if(!b)if(a in lf)b=kf[a]=a;else{b=mf.length;var c="",d=a.charAt(0).toUpperCase()+a.substr(1),e="",f=!1;nf&&(e=nf+d,f=e in lf);for(;b--&&!f;)c=mf[b],e=c+d,f=e in lf;f&&(nf=c);if(b=f?e:null)kf[a]=b;else throw Error("Could not find any variant of CSS property ["+a+"]");}return b}u("H.dom.cssPrefixer.prefix",jf);var mf=["O","Ms","ms","Moz","Webkit"],kf={},nf="",lf=document.createElement("span").style;function of(a,b,c,d){if(!a||!b||!c)throw new D(of,null,"Must specify name, version and revision parameter");this.name=a;this.version=b;this.revision=c;d&&Pa(this,d)}u("H.util.BuildInfo",of);of.prototype.toString=function(){var a,b=[];for(a in this)ra(this[a])&&b.push(this[a]);return b.join(";")};var pf={};function qf(a,b,c,d){if(!a)throw new D(qf,1,"Must specify a name parameter");return pf[a]||(pf[a]=new of(a,b,c,d))}of.get=qf;function rf(){rf.l.constructor.call(this);this.a=sf(this);this.f=Fb();this.c=A(this.c,this);this.a.addEventListener("message",this.c);this.b={}}w(rf,G);rf.prototype.s=function(){this.a.terminate()};rf.prototype.i=function(a){var b=a.type,c=!!this.f[b],d=a.data,e=tf++,f=d&&d.oo?d.oo:B,g=!0;c?(this.b[e]=a,uf(this,b,e,d&&d.message,f)):(a.reject(new D(this.i,0,"processor_not_found")),g=!1);return g};
rf.prototype.c=function(a){a=a.data;var b=this.b[a.taskId],c=a.taskId,d=a.data,e=this;if(2===a.type)(new cf("arraybuffer",d)).then(function(a){return a.arrayBuffer()}).then(function(a){e.a.postMessage(["3",c,[a]],[a])},function(){e.a.postMessage(["3",c,[null,"ERROR"]])});else{if(b){switch(a.type){case 1:b.resolve(d);break;case 0:b.reject(d)}delete this.b[c]}this.dispatchEvent(new Ec(this.g.IDLE))}};var tf=0;function vf(a,b,c){var d=tf++,e;a.b[d]=e=rb();uf(a,b,d,c);return e.bi}
function uf(a,b,c,d,e){d===B||va(d)||(d=[d]);try{a.a.postMessage([b,c,d],e)}catch(f){a=a.b[c],a.reject(f.message)}}rf.prototype.g={IDLE:"idle",Mi:"error"};rf.prototype.j=function(a,b){var c=this.m||(this.m=new Ec(this.g.Mi));c.data=b;delete this.f[a];this.dispatchEvent(c)};
function sf(a){var b=y.H.__bootstrap__;b=r(b)?(""+b).replace(/^[^{]+{((.|[\r\n])+?)}\s*$/,"$1"):""+b;if(y.Worker&&y.URL)try{var c=new y.Worker(y.URL.createObjectURL($e(b,"application/javascript")))}catch(d){}c||(a=new wf(a),function(){eval("var self = arguments[0];"+b)}(a),c=new xf(a));return c}function xf(a){G.call(this);this.a=a}w(xf,G);xf.prototype.postMessage=function(a){y.setTimeout(A(this.b,this,a),0)};xf.prototype.b=function(a){var b=new Ec("message");b.data=a;this.a.dispatchEvent(b)};
xf.prototype.terminate=function(){this.a.F();this.F()};function wf(a){G.call(this);this.a=a;this.addEventListener=A(this.addEventListener,this);this.removeEventListener=A(this.removeEventListener,this);this.postMessage=A(this.postMessage,this);this.eval=A(eval,this)}w(wf,G);wf.prototype.postMessage=function(a){var b=new Ec("message");b.data=a;y.setTimeout(A(this.a.c,this.a,b),0)};function yf(){var a=zf;a||(a=zf=this,G.call(a),Af(this));return a}var zf;w(yf,G);yf.prototype.s=function(){yf.l.s.call(this);Af(this)};function Af(a){var b=a.b,c;if(b)for(c=b.length;c--;)b[c].F();a.b=[];Yb(a.b);a.c=Fb();a.f=Fb()}
yf.prototype.Eg=function(a){var b;a=a.type;if(b=this.f[a]){var c=this.b;var d=c[0];d||(d=c[0]=new rf,this.xb(Ca(Dc,d)),Ka(this.c)||(c=y.Object.keys(this.c),vf(d,"0",c)));c=d;c.f[a]||(c.f[a]=b,vf(c,"1",[a,r(b)?b+"":b]).then(vc,A(c.j,c,a)))}else throw new nc(this.Eg,'Unknown type "'+a+'"');return d};yf.prototype.Qg=function(){};yf.prototype.a=function(a,b){var c=this.f,d=c[a];if(d){if(b!==d)throw new nc(this.a,'Type "'+a+'" is already registered');}else c[a]=b};function Bf(a,b,c){qd.call(this,a,b,c)}var Cf;w(Bf,qd);Bf.prototype.fh=function(){Cf||(Cf=new td(new yf));return Cf};Bf.prototype.qe=function(){};Bf.prototype.qj=function(a){return a.i(this)};function Df(a,b,c){var d=ld(+a,-90,90);if(b&&F(d))throw new D(b,c,a);return d}function Ef(a,b,c){var d=+a;if(-180>d||180<d)d=jd(d+180,360)-180;if(b&&F(d))throw new D(b,c,a);return d}function Ff(a,b,c){var d;if(a!==B&&F(d=+a)&&b)throw new D(b,c,a);return d}function Gf(a,b){return 0!==(0>a^0>b)&&180<Nc(b-a)}u("H.geo.isDBC",Gf);function Hf(){Mb(this,Hf)}u("H.geo.AbstractGeometry",Hf);Hf.prototype.getBoundingBox=Hf.prototype.I;Hf.prototype.equals=Hf.prototype.da;Hf.prototype.nb="";Hf.prototype.toString=function(){return this.Oc([this.nb.toUpperCase()," "]).join("")};Hf.prototype.toString=Hf.prototype.toString;Hf.prototype.U=function(){return{type:this.nb,coordinates:this.uc(),boundingBox:this.I().U()}};function I(a,b,c){this.lat=Df(a,I,0);this.lng=Ef(b,I,1);c!==B&&(this.alt=Ff(c,I,2))}w(I,Hf);u("H.geo.Point",I);I.prototype.da=function(a){return this===a||!!a&&this.lat===a.lat&&this.lng===a.lng&&(this.alt||0)===(a.alt||0)};I.prototype.equals=I.prototype.da;I.prototype.bb=function(a){if(this===a||this.lat===a.lat&&this.lng===a.lng)a=0;else{var b=this.lat*ed;var c=a.lat*ed;a=1.274200158E7*Tc(Ic(1,Pc(Qc(Sc((b-c)/2),2)+Vc(b)*Vc(c)*Qc(Sc((this.lng*ed-a.lng*ed)/2),2))))}return a};
I.prototype.distance=I.prototype.bb;
I.prototype.rg=function(a,b,c){if(c){if(b/=6371000.79){a*=ed;var d=ed*this.lat;var e=Sc(d);var f=Sc(b);var g=Vc(b);var h=ed*this.lng;var k=Vc(d);d=Tc(k*Vc(a)*f+e*g);a=Yc(Sc(a)*k*f,g-e*Sc(d));a=(h+a+$c)%(2*$c)-$c;k=a*fd}return b?new I(d*fd,(k+540)%360-180):this}a=(a%360+360)%360;if(0===(a+90)%180)return d=this.lng+b/(6371000.79*cd*Vc(this.lat*ed))*(270===a?-360:360),new I(this.lat,(d+540)%360-180);if(b/=6371000.79){a*=ed;h=this.lat*ed;e=this.lng*ed;f=h+b*Vc(a);g=f-h;d=Oc(Wc(f/2+bd)/Wc(h/2+bd));d=F(g/
d)?Vc(h):g/d;var l=b*Sc(a)/d;Nc(f)>ad&&(f=0<f?$c-f:-($c+f))}return b?new I(f*fd,((e+l+dd+(Nc(h+g)>ad?$c:0))%cd-$c)*fd):this};I.prototype.walk=I.prototype.rg;I.prototype.I=function(){return new J(this.lat,this.lng,this.lat,this.lng)};I.prototype.getBoundingBox=I.prototype.I;function If(a,b,c){var d=wa(a)&&!(F(a.lat=Df(a.lat))||F(a.lng=Ef(a.lng))||a.alt!==B&&F(a.alt=Ff(a.alt)));if(!d&&b)throw new D(b,c,a);return d}I.validate=If;
function Jf(a){if(!a)throw new D(Jf,0,a);return new I(a.lat,a.lng,a.alt)}I.fromIPoint=Jf;I.prototype.nb="Point";I.prototype.Oc=function(a){a.push("(",this.lng," ",this.lat,")");return a};I.prototype.uc=function(){return[this.lat,this.lng,this.alt||0]};function J(a,b,c,d){Lf(this,Df(a,J,0),Ef(b,J,1),Df(c,J,2),Ef(d,J,3))}w(J,Hf);u("H.geo.Rect",J);J.prototype.nb="Polygon";J.prototype.Oc=function(a){var b=this.oa,c=this.aa,d=this.ka,e=this.ea;a.push("(","(",c," ",b,",",e," ",b,",",e," ",d,",",c," ",d,",",c," ",b,")",")");return a};J.prototype.da=function(a){return this===a||!!a&&this.oa===a.oa&&this.aa===a.aa&&this.ka===a.ka&&this.ea===a.ea};J.prototype.equals=J.prototype.da;J.prototype.clone=function(){return new J(this.oa,this.aa,this.ka,this.ea)};
J.prototype.clone=J.prototype.clone;function Lf(a,b,c,d,e){a.aa=c;a.ea=e;b<d&&(c=b,b=d,d=c);a.oa=b;a.ka=d;a.c=a.a=a.b=null;return a}J.prototype.Qb=function(){this.c||(this.c=new I(this.oa,this.aa));return this.c};J.prototype.getTopLeft=J.prototype.Qb;J.prototype.Nb=function(){this.a||(this.a=new I(this.ka,this.ea));return this.a};J.prototype.getBottomRight=J.prototype.Nb;J.prototype.Xm=function(){return this.oa};J.prototype.getTop=J.prototype.Xm;J.prototype.Xl=function(){return this.ka};
J.prototype.getBottom=J.prototype.Xl;J.prototype.wm=function(){return this.aa};J.prototype.getLeft=J.prototype.wm;J.prototype.Rm=function(){return this.ea};J.prototype.getRight=J.prototype.Rm;J.prototype.lb=function(){this.b||(this.b=new I(this.ka+(this.oa-this.ka)/2,Mf(this.aa,this.Fb())));return this.b};J.prototype.getCenter=J.prototype.lb;J.prototype.Fb=function(){return Nf(this.aa,this.ea)};J.prototype.getWidth=J.prototype.Fb;J.prototype.Od=function(){return this.oa-this.ka};
J.prototype.getHeight=J.prototype.Od;J.prototype.Gb=function(){return this.aa>this.ea};J.prototype.isCDB=J.prototype.Gb;J.prototype.Nf=function(){return!this.Fb()&&!this.Od()};J.prototype.isEmpty=J.prototype.Nf;J.prototype.I=function(){return new J(this.oa,this.aa,this.ka,this.ea)};J.prototype.getBoundingBox=J.prototype.I;
J.prototype.vf=function(a,b,c){var d=this.lb();c||(a=Df(a,this.vf,0),b=Ef(b,this.vf,1));b=this.bd(a,b,c);a=b.lb();return a.lat===d.lat&&a.lng===d.lng&&this.Od()===b.Od()&&this.Fb()===b.Fb()};J.prototype.containsLatLng=J.prototype.vf;J.prototype.Gd=function(a,b){b||If(a,this.Gd,0);return this.vf(a.lat,a.lng,b)};J.prototype.containsPoint=J.prototype.Gd;
J.prototype.Kg=function(a,b){var c=this.lb();if(!b&&!C(a,J))throw new D(this.Kg,0,a);b=this.jc(a,b);a=b.lb();return a.lat===c.lat&&a.lng===c.lng&&this.Od()===b.Od()&&this.Fb()===b.Fb()};J.prototype.containsRect=J.prototype.Kg;J.prototype.bd=function(a,b,c,d){if(!c){if(F(a=Df(a)))throw new D(this.bd,0,a);if(F(b=Ef(b)))throw new D(this.bd,1,b);}return Of(this.oa,this.aa,this.ka,this.ea,a,b,a,b,d)};J.prototype.mergeLatLng=J.prototype.bd;
J.prototype.hk=function(a,b,c){b||If(a,this.hk,0);return this.bd(a.lat,a.lng,b,c)};J.prototype.mergePoint=J.prototype.hk;J.prototype.jc=function(a,b,c){if(!b&&!C(a,J))throw new D(this.jc,0,a);return Of(this.oa,this.aa,this.ka,this.ea,a.oa,a.aa,a.ka,a.ea,c)};J.prototype.mergeRect=J.prototype.jc;J.prototype.Fc=function(a,b,c,d,e,f){e||(a=Df(a,this.Fc,0),b=Ef(b,this.Fc,1),c=Df(c,this.Fc,2),d=Ef(d,this.Fc,3));return Of(this.oa,this.aa,this.ka,this.ea,a,b,c,d,f)};J.prototype.mergeTopLeftBottomRight=J.prototype.Fc;
J.prototype.Vd=function(a,b){var c=this.aa<=this.ea,d=a.aa<=a.ea,e=this.aa<a.ea,f=a.aa<this.ea;if(!b&&!C(a,J))throw new D(this.Vd,0,a);return this.ka<=a.oa&&a.ka<=this.oa&&(!c&&(!d||e||f)||!d&&(e||f)||e&&f)};J.prototype.intersects=J.prototype.Vd;function Nf(a,b){a=b-a;return a+(0>a?360:0)}function Mf(a,b){a+=b/2;return a-(180<a?360:0)}
function Of(a,b,c,d,e,f,g,h,k){c=Ic(c,g);a=Jc(a,e);e=Nf(b,d);var l=Mf(b,e);g=Nf(f,h);var m=Mf(f,g)-l;m+=0>m-1E-6?360:0;if(180>m-1E-6){l=b;var p=h}else m=360-m,l=f,p=d;m=m+e/2+g/2;360<=m+5E-7?(l=-180,p=180):m-5E-7<e?(l=b,p=d):m-5E-7<g&&(l=f,p=h);return k?Lf(k,a,l,c,p):new J(a,l,c,p)}J.merge=Of;function Pf(a,b,c){c||(If(a,Pf,0),If(b,Pf,1));return new J(a.lat,a.lng,b.lat,b.lng)}J.fromPoints=Pf;
function Qf(a,b){var c=1,d=a.length,e=null;if(!va(a))throw new D(Qf,0,a);if(0<d){var f=a[0];for(e=Pf(f,f,b);c<d;c++)f=a[c],e.bd(f.lat,f.lng,b,e)}return e}J.coverPoints=Qf;function Rf(a,b){var c=3,d=a.length,e;if(!(b||a&&null!=a.length))throw new D(Rf,0,a);if(0<d)for(e=new J(a[0],a[1],a[0],a[1]);c<d;c+=3)e.bd(a[c],a[c+1],b,e);return e}J.coverLatLngAlts=Rf;
function Sf(a,b){var c=1,d=a.length,e;if(b&&(!a||null==a.length))throw new D(Sf,0,a);if(0<d)for(e=new J(a[0].oa,a[0].aa,a[0].ka,a[0].ea);c<d;c++)e.jc(a[c],b,e);return e}J.coverRects=Sf;
J.prototype.Dk=function(a,b){var c=this.aa,d=this.oa,e=this.ea,f=this.ka,g=this.lb().lng;If(a,this.Dk,0);var h=a.lat-f-(d-f)/2;var k=a.lng-g;k=180<k||-180>k?-(g+a.lng):k;a=c+(0>k?2*k:0);a=-180>a?360+a:a;e+=0<k?2*k:0;e=180<e?e-360:e;d=0<h?d+2*h:d;90<=d&&(d=90);f=0>h?f+2*h:f;-90>=f&&(f=-90);return b?Lf(b,d,a,f,e):new J(d,a,f,e)};J.prototype.resizeToCenter=J.prototype.Dk;J.prototype.U=function(){return this.uc()};J.prototype.uc=function(){return[this.oa,this.aa,this.ka,this.ea]};function Tf(a,b,c,d,e,f){Mb(this,Tf);this.c=a||10;this.b=this.a=null;this.f=d||0;this.g=e||0;this.i=b||1;this.j=c||1;this.u=!!f;this.flush()}var Uf={sl:0,tl:1,hl:2,il:3};function Vf(a){var b=a.b;if(a.u&&!b){var c=a.head;if(c.entries||c[0]||c[1]||c[2]||c[3])b=[c],b=Wf([b,b,b,b],[c[6],c[7],c[4],c[5]]),a.b=b}return b}
function Wf(a,b){var c,d,e,f,g=0;for(c=3;0<=c;c--){var h=c+4;var k=0<c%3;var l=[];var m=b[c];var p=a[c];for(d=p.length;d--;){var q=p[d];if(e=q.entries)for(f=e.length;f--;){var t=e[f].md(c);if(k?t>m:t<m)m=t}for(f=4;f--;)(e=q[f])&&(k?e[h]>m:e[h]<m)&&l.push(e)}g+=l.length;b[c]=m;a[c]=l}g&&(b=Wf(a,b));return b}function Xf(a,b,c){var d,e;if(a.u&&(d=a.b))for(e=3;0<=e;e--){var f=b.md(e);if(e%3?f>=d[e]:f<=d[e])if(c)d[e]=f;else{a.b=null;break}}}
Tf.prototype.remove=function(a){var b,c,d,e=!1;a&&(b=a.node)&&b.b===this&&(c=b.entries)&&0<=(d=c.indexOf(a))&&(c.splice(d,1),this.m(b),Xf(this,a,!1),e=!0);return e};Tf.prototype.flush=function(){var a=new Yf(null,NaN,this.f-this.i,this.g-this.j,this.f+this.i,this.g+this.j);a.b=this;this.head=this.a=a;this.b=null};function Zf(a,b){var c=a.head,d;if(b){var e=b;if(e!==c)for(c=e;e=e.parent;)if(e.entries||1<e.a)c=e}else for(;!c.entries&&2>(d=c.a);)if(d)c=e;else break;a.head=c}
Tf.prototype.Za=function(a,b,c,d){var e=[],f=this.head,g=this.a;a<=f[5]&&b<=f[6]&&c>f[7]&&d>f[4]&&$f(this,f,e,a,b,c,d,d>=g[6],c>=g[5]);return e};
function $f(a,b,c,d,e,f,g,h,k){var l=b.entries,m=b[7],p=b[4],q=b[5],t=b[6],v=b[8],x=b[9],E;if(l){var O=l.length;if(e>p||d>m||g<t||f<q)for(;O--;){m=l[O];p=m.md(3);q=m.md(0);t=m.md(1);var Y=m.md(2);Y>=e&&t>=d&&(q<g||h&&q==g)&&(p<f||k&&p==f)&&c.push(m)}else for(;O--;)c.push(l[O])}f>v&&(e<x&&(E=b[Uf.tl])&&$f(a,E,c,d,e,f,g,h,k),g>x&&(E=b[Uf.il])&&$f(a,E,c,d,e,f,g,h,k));d<v&&(e<x&&(E=b[Uf.sl])&&$f(a,E,c,d,e,f,g,h,k),g>x&&(E=b[Uf.hl])&&$f(a,E,c,d,e,f,g,h,k))}Tf.prototype.Pc=ba(1);var ag=0;
function Yf(a,b,c,d,e,f){this.c=b;a&&(this.parent=a,this.b=a.b,b&1?(c=a[8],e=a[5]):(c=a[7],e=a[8]),b&2?(d=a[9],f=a[6]):(d=a[4],f=a[9]));this[7]=c;this[5]=e;this[8]=(c+e)/2;this[4]=d;this[6]=f;this[9]=(d+f)/2}Yf.prototype.a=0;function bg(a,b){return a[b]||(++a.a,a[b]=new Yf(a,b))}Yf.prototype.removeChild=function(a){var b=a.c;this[b]===a&&(delete this[b],delete a.parent,--this.a)};Yf.prototype.Pc=ba(0);function cg(a,b){(a.entries||(a.entries=[])).push(b);b.node=a}
function dg(a,b,c,d,e){var f=a[5],g=a[6];return a[7]<=b&&a[4]<=c&&(f>d||f===d&&f===a.b.a[5])&&(g>e||g===e&&g===a.b.a[6])};function eg(a,b,c,d,e,f){eg.l.constructor.apply(this,arguments)}w(eg,Tf);eg.prototype.m=function(a){for(var b,c,d=this.head;a;){if(!(b=a.entries)||!b.length)if(b&&delete a.entries,!a.a&&(c=a.parent)){c.removeChild(a);d===a&&(d=c);a=c;continue}a=z}this.head!==d&&(this.head=d,Zf(this))};function fg(a,b,c,d,e){if(dg(a.a,b,c,d,e))return gg(a,a.a,b,c,d,e,a.c);throw Error("Coordinates out of bounds");}eg.prototype.Cc=function(a,b){return fg(this,a,b,a,b)};
function gg(a,b,c,d,e,f,g){var h=b[8],k=b[9],l,m;g&&(e<h||(l=c>=h))&&(f<k||(m=d>=k))?c=gg(a,bg(b,l|m<<1),c,d,e,f,g-1):(cg(b,c=new hg(c,d,e,f)),Xf(a,c,!0),Zf(a,b));return c}function hg(a,b,c,d){this.id=ag++;this[0]=b;this[1]=c;this[2]=d;this[3]=a}hg.prototype.md=function(a){return this[a]};function ig(a){this.f=new eg(+a||10,180,90,0,0,!0);this.c=[];this.g=!1;this.a=this.b=this.N=null}u("H.geo.QuadTree",ig);n=ig.prototype;n.Dh=0;n.Yc=function(){return this.Dh};n.Gb=function(){return this.g};
n.I=function(){var a,b;if(!this.N){var c=[];!this.b&&(a=Vf(this.f))&&(this.b=new J(-a[0],a[3],-a[2],a[1]));(b=this.b)&&c.push(b);var d,e,f;if(!this.a&&(f=(e=this.c).length)){a=90;var g=360;var h=-90;for(d=0;f--;){var k=e[f];a=Ic(a,k[0]);g=Ic(g,k[3]);h=Jc(h,k[2]);d=Jc(d,k[1])}this.a=new J(-a,g,-h,d-360)}(b=this.a)&&c.push(b);if(b=c[0])c[1]&&(b=b.jc(c[1],!0)),this.N=b}return this.N};
function jg(a,b,c,d,e,f){f?(f=new hg(e,-b,c+360,-d),a.c.push(f),a.g=!0,a.a&&a.a.Fc(b,c,d,e,!0,a.a)):(f=fg(a.f,c,-b,e,-d),a.b&&a.b.Fc(b,c,d,e,!0,a.b));++a.Dh;a.N=null;return f}n.Cc=function(a){var b=a.lng;a=a.lat;return jg(this,a,b,a,b,!1)};n.Mj=function(a){var b=a.Qb(),c=a.Nb();return(a=a.Gb())?jg(this,b.lat,c.lng,c.lat,b.lng,a):jg(this,b.lat,b.lng,c.lat,c.lng,a)};ig.prototype.insertBoundingBox=ig.prototype.Mj;
ig.prototype.remove=function(a){var b;if(a.node){var c=this.f.remove(a);this.b=null}else if(a=(b=this.c).indexOf(a),c=0<=a)b.splice(a,1),this.g=0<b.length,this.a=null;c&&(--this.Dh,this.N=null);return c};ig.prototype.remove=ig.prototype.remove;function kg(a,b,c,d,e){a=a.c;var f=a.length,g=[],h;if(f){var k=c+360;for(h=e+360;f--;){var l=a[f];lg(l,b,c,d,e)?g.push(l):lg(l,b,k,d,h)&&g.push(l)}}return g}function lg(a,b,c,d,e){var f=a[3],g=a[1],h=a[2];return a[0]<d&&f<e&&h>=b&&g>=c}
function mg(a,b){var c,d,e;if(c=b.length){var f=a.length;for(d={};f--;)d[a[f].id]=1;for(;c--;)(e=b[c]).id in d||a.push(e)}}ig.prototype.Mf=function(a){var b=this.f,c=a.Qb(),d=a.Nb(),e=-c.lat;c=c.lng;var f=-d.lat;d=d.lng;e===f||c===d?a=[]:a.Gb()?(a=b.Za(-180,e,d,f),mg(a,b.Za(c,e,180,f)),mg(a,kg(this,e,d,f,c+360))):(a=b.Za(c,e,d,f),mg(a,kg(this,e,c,f,d)));return a};ig.prototype.intersectBoundingBox=ig.prototype.Mf;function K(a){K.l.constructor.call(this);a&&ng(a,K,0);this.qa=a||[];this.a=og(this,0,this.qa.length)}w(K,Hf);u("H.geo.LineString",K);function og(a,b,c){a=a.qa;var d=0;b=Jc(b,0);c=Ic(c,a.length);c-=2;for(b+=1;b<c;)d+=Gf(a[b],a[b+=3]);return d}K.prototype.fi=function(a,b,c){pg(this,a,b,c,this.fi)};K.prototype.pushLatLngAlt=K.prototype.fi;function pg(a,b,c,d,e){var f=a.qa.length;b=Df(b,e);c=Ef(c,e);a.qa.push(Df(b,e),Ef(c,e),d===B?0:Ff(d,e));f&&(a.a+=Gf(a.qa[f-2],c));delete a.N;delete a.b}
K.prototype.jf=function(a,b,c){c&&ng(c,this.jf,2);void 0===b&&(b=this.qa.length);b&&(this.a-=og(this,a-3,a+b+3));var d=c?this.qa.splice.apply(this.qa,[a,b].concat(c)):this.qa.splice(a,b);c&&(this.a+=og(this,a-3,a+c.length+3));b&&!c&&(this.a+=og(this,a-3,a-3));delete this.N;delete this.b;return d};K.prototype.spliceLatLngAlts=K.prototype.jf;K.prototype.Nj=function(a,b,c,d){this.jf(a,0,[b,c,d])};K.prototype.insertLatLngAlt=K.prototype.Nj;K.prototype.zk=function(a){this.jf(a,3)};
K.prototype.removeLatLngAlt=K.prototype.zk;K.prototype.sd=function(a){pg(this,a.lat,a.lng,a.alt,this.sd)};K.prototype.pushPoint=K.prototype.sd;K.prototype.Cc=function(a,b){this.Nj(3*a,b.lat,b.lng,b.alt)};K.prototype.insertPoint=K.prototype.Cc;K.prototype.We=function(a){this.zk(3*a)};K.prototype.removePoint=K.prototype.We;K.prototype.we=function(a,b){var c=this.qa,d=3*a;a=c[d];var e=c[d+1];c=c[d+2];b&&(b.lat=a,b.lng=e,b.alt=c);return b||new I(a,e,c)};K.prototype.extractPoint=K.prototype.we;
K.prototype.Kl=function(a,b,c){var d=this.qa;b=b||0;c=Me(c,d.length/3);for(var e=3*b;b<c;)a(d[e++],d[e++],d[e++],b++)};K.prototype.eachLatLngAlt=K.prototype.Kl;K.isDBC=Gf;K.prototype.ah=function(a){var b=this.a;a&&(a=this.qa,b+=Gf(a[a.length-2],a[1]));return b};K.prototype.getDBCs=K.prototype.ah;K.prototype.Ie=function(){return this.qa.length/3};K.prototype.getPointCount=K.prototype.Ie;K.prototype.um=function(){return this.qa};K.prototype.getLatLngAltArray=K.prototype.um;K.prototype.N=z;
K.prototype.I=function(){var a;if(!(a=this.N)){a=this.qa;var b=a.length,c=3,d,e,f=z,g=Of;if(3<=b){var h=d=a[0];var k=e=a[1];for(f=new J(h,k,d,e);c<b;c+=3){h=a[c-3];k=a[c-2];d=a[c];e=a[c+1];if(k>e&&180<e-k||k<e&&-180>k-e||e<k&&180>Nc(e-k)){var l=k;k=e;e=l}h<d&&(l=h,h=d,d=l);g(f.oa,f.aa,f.ka,f.ea,h,k,d,e,f)}}a=this.N=f}return a};K.prototype.getBoundingBox=K.prototype.I;K.prototype.fn=function(){return this.N!==z};K.prototype.hasBoundingBox=K.prototype.fn;
function ng(a,b,c){for(var d=a.length,e=!(d%3),f;e&&d;)e=!(F(a[--d]=Ff((f=a[d])===B?0:f))||F(a[--d]=Ef(a[d]))||F(a[--d]=Df(a[d])));if(!e&&b)throw new D(b,c,a);}function qg(a){var b=new K,c=0,d=a.length;if(d%2)throw new D(qg,0,a);for(;c<d;)pg(b,a[c++],a[c++],0,qg);return b}K.fromLatLngArray=qg;K.prototype.da=function(a){var b=this===a,c;if(!b&&(b=C(a,K))){var d=this.qa;a=a.qa;for(b=(c=d.length)===a.length;b&&c--;)b=d[c]==a[c]}return b};K.prototype.equals=K.prototype.da;
function rg(a,b){return a.a-b.a}
function sg(a,b){var c=a.qa,d=-2,e=[],f;var g=a.b;if(!g){g=a.b=new ig;var h=0;var k=a.qa;var l=k.length;for(f=0;f<l;f+=3){var m=k[f];var p=k[f+1];if(f){if(t<p){var q=t;var t=p}else q=p;if(x<m)var v=m;else{v=x;var x=m}q=jg(g,v,q,x,t,180<t-q);q.a=h++}x=m;t=p}}g=g.Mf(b).sort(rg);k=g.length;for(b=0;b<k;b++){h=g[b];h=h.a;l=3*h;if(h>d+1){var E=[c[l],c[l+1]];e.push(E)}d=h;E.push(c[l+3],c[l+4])}if(a.a){c=[];d=e.length;for(b=0;b<d;b++)if(E=e[b],g=E.length){k=[];for(a=0;a<g;a+=2)h=E[a],l=E[a+1],k.push(h,l),
f=E[a-1],a&&Gf(l,f)&&(c.push(k),k=[],f+=0>f?360:-360,k.push(E[a-2],f,h,l));c.push(k)}e=c}return e}K.prototype.nb="LineString";K.prototype.Oc=function(a){var b=this.qa,c=b.length,d;if(c){a.push("(");for(d=0;d<c;d+=3)d&&a.push(","),a.push(b[d+1]," ",b[d]);a.push(")")}else a.push("EMPTY");return a};K.prototype.uc=function(){var a=this.qa,b;if(this.I().Gb()){a=a.slice();var c=1;for(b=a.length;c<b;c+=3)0>a[c]&&(a[c]+=360)}return a};function tg(a){tg.l.constructor.call(this);void 0!==a&&(this.data=a)}w(tg,G);u("H.map.Feature",tg);tg.prototype.getData=function(){return this.data};tg.prototype.getData=tg.prototype.getData;tg.prototype.s=function(){tg.l.s.call(this);delete this.data};function ug(){}u("H.map.provider.Invalidations",ug);ug.MARK_INITIAL=hd;ug.prototype.update=function(a,b){b!==vg.NONE&&(this.a=a,b&vg.SPATIAL&&(this.f=a),b&vg.VISUAL&&(this.g=a),b&vg.ADD&&(this.b=a),b&vg.REMOVE&&(this.c=a),b&vg.Z_ORDER&&(this.j=a),b&vg.VOLATILITY&&(this.i=a))};ug.prototype.update=ug.prototype.update;ug.prototype.Am=function(){return this.a};ug.prototype.getMark=ug.prototype.Am;ug.prototype.a=hd;ug.prototype.kn=function(a){return this.a>a};ug.prototype.isAny=ug.prototype.kn;
ug.prototype.g=hd;ug.prototype.Yd=function(a){return this.g>a};ug.prototype.isVisual=ug.prototype.Yd;ug.prototype.f=hd;ug.prototype.xh=function(a){return this.f>a};ug.prototype.isSpatial=ug.prototype.xh;ug.prototype.b=hd;ug.prototype.Oj=function(a){return this.b>a};ug.prototype.isAdd=ug.prototype.Oj;ug.prototype.c=hd;ug.prototype.Of=function(a){return this.c>a};ug.prototype.isRemove=ug.prototype.Of;ug.prototype.j=hd;ug.prototype.yh=function(a){return this.j>a};ug.prototype.isZOrder=ug.prototype.yh;
ug.prototype.i=hd;ug.prototype.on=function(a){return this.i>a};ug.prototype.isVolatility=ug.prototype.on;var vg={NONE:0,VISUAL:1,SPATIAL:2,ADD:4,REMOVE:8,Z_ORDER:16,VOLATILITY:32};ug.Flag=vg;function wg(a,b,c){wg.l.constructor.call(this,a);this.oldValue=c;this.newValue=b}w(wg,Ec);u("H.util.ChangeEvent",wg);function L(a){Mb(this,L);L.l.constructor.call(this,a?a.data:B);this.G=xg.next();if(a){var b="min";Tb(a[b])&&(this.o=a[b]);b="max";Tb(a[b])&&(this.u=a[b]);b="visibility";b in a&&(this.g=!!a[b]);b="volatility";b in a&&(this.D=!!a[b]);b="zIndex";b in a&&(this.m=+a[b]||0);b="provider";b in a&&(this.a=a[b],this.Aa(vg.ADD))}}w(L,tg);u("H.map.Object",L);var xg=new Oe(1),yg={ANY:0,OVERLAY:1,SPATIAL:2,MARKER:3,DOM_MARKER:4,GROUP:5};L.Type=yg;L.prototype.eb=function(){return this.G};
L.prototype.getId=L.prototype.eb;L.prototype.o=-1/0;L.prototype.u=1/0;L.prototype.Bm=function(){return this.u};L.prototype.getMax=L.prototype.Bm;L.prototype.Dm=function(){return this.o};L.prototype.getMin=L.prototype.Dm;L.prototype.g=!0;L.prototype.wb=function(a){var b=this.g;(a=!!a)^b&&(this.g=a,this.invalidate(vg.VISUAL));return this};L.prototype.setVisibility=L.prototype.wb;L.prototype.Ac=function(a){for(var b=this,c;(c=b.g)&&a&&(b=b.Va););return c};L.prototype.getVisibility=L.prototype.Ac;
L.prototype.D=!1;L.prototype.Dj=function(a){for(var b=this,c;!(c=b.D)&&a&&(b=b.Va););return c};L.prototype.getVolatility=L.prototype.Dj;L.prototype.Uk=function(a){var b=this.D;b^a&&(this.D=!b,this.invalidate(vg.VOLATILITY));return this};L.prototype.setVolatility=L.prototype.Uk;L.prototype.m=B;L.prototype.Ej=function(){return this.m};L.prototype.getZIndex=L.prototype.Ej;L.prototype.ff=function(a){a!==this.m&&(this.Ze(),this.m=a,this.invalidate(vg.Z_ORDER));return this};L.prototype.setZIndex=L.prototype.ff;
L.prototype.B=B;function zg(a){var b=a.B,c,d;if(!b){var e=(c=a.m)!==B;(b=a.Va)?(b=zg(b).slice(),b[0]|=e):b=[e|0];b.push(c||0,0>(d=a.yi)?a.G:d);a.B=b}return b}L.prototype.Ze=function(){this.B=B};function Ag(a,b,c){var d,e;if(!c||a[0]|b[0]){var f=a.length;var g=b.length;var h=Ic(f,g);var k=1;for(e=1+c;k<h;k+=e)if(d=a[k]-b[k])return d}return c?0:f-g}function Bg(a,b){return a.cj(b)}L.compareZOrder=Bg;L.prototype.cj=function(a){return this.sg-a.sg||Ag(zg(this),zg(a),!1)};L.prototype.compareZOrder=L.prototype.cj;
n=L.prototype;n.previousSibling=z;n.nextSibling=z;n.yi=-1;n.Va=z;n.Fm=function(){return this.Va};L.prototype.getParentGroup=L.prototype.Fm;L.prototype.gc=function(){for(var a=this,b;b=a.Va;)a=b;return a};L.prototype.getRootGroup=L.prototype.gc;L.prototype.contains=function(a){return this===a};L.prototype.contains=L.prototype.contains;L.prototype.ba=function(a){if(this.Va)throw new nc(this.ba,"Not allowed for a child of a group");L.l.ba.call(this,a)};L.prototype.setParentEventTarget=L.prototype.ba;
L.prototype.a=z;L.prototype.za=function(){return this.a};L.prototype.getProvider=L.prototype.za;L.prototype.fe=function(a,b){var c=this.a,d;if(d=c!==a){if(b&&(c&&!C(c,M)||a&&!C(a,M)))throw new nc(b,"Only LocalObjectProvider allows an object transfers");b=this.type!==yg.GROUP;c&&(this.invalidate(vg.REMOVE),b&&c.La(this));if(this.a=a)b&&a.T(this),this.ja=z,this.invalidate(vg.ADD)}return d};L.prototype.Pb=function(){return this.ja||(this.ja=new ug)};L.prototype.getInvalidations=L.prototype.Pb;
L.prototype.Aa=function(a){var b=this.za(),c;(c=!!b)&&b.invalidateObject(this,a);return c};L.prototype.invalidate=L.prototype.Aa;L.prototype.s=function(){this.Va&&this.Va.La(this);L.l.s.call(this)};L.prototype.setData=function(a){this.data=a;return this};L.prototype.setData=L.prototype.setData;L.prototype.U=function(){return{id:this.G,properties:{min:this.o,max:this.u,zIdx:this.m,sIdx:this.yi,parent:this.Va?this.Va.eb():0,visible:this.Ac(),"volatile":this.Dj()},type:"Feature"}};
L.prototype.forWorkerMessage=L.prototype.U;function Cg(a){var b;if(a){var c=Dg;for(b=C(a,Cg);c--;){var d=Eg[c];if(a.hasOwnProperty(d)){var e=a[d];if(b)this[d]=e;else{if((e=Fg[c](e))===Gg)throw new D(Cg,0,d+": "+a[d]);e!==this[d]&&e!==B&&(this[d]=e)}}}c=b?a.Me:this.lineWidth&&Ke(this.strokeColor);c||(this.Me=c);c=b?a.Rb:Ke(this.fillColor);c||(this.Rb=c);c=b?a.Le:"none"!==this.strokeColor&&this.lineWidth;c||(this.Le=c)}Hb(this)}u("H.map.SpatialStyle",Cg);Cg.prototype.Rb=!0;Cg.prototype.Me=!0;Cg.prototype.Le=!0;var Eg=[];
Cg.prototype[Eg[0]="strokeColor"]="rgba(0,85,170,.6)";Cg.prototype[Eg[1]="fillColor"]="rgba(0,85,170,.4)";Cg.prototype[Eg[2]="lineWidth"]=2;Cg.prototype[Eg[3]="lineCap"]="round";Cg.prototype[Eg[4]="lineJoin"]="miter";Cg.prototype[Eg[5]="miterLimit"]=1;Cg.prototype[Eg[6]="lineDash"]=Te;Cg.prototype[Eg[7]="lineDashOffset"]=0;Cg.prototype[Eg[8]="lineHeadCap"]=B;Cg.prototype[Eg[9]="lineTailCap"]=B;var Dg=Eg.length;
Cg.prototype.da=function(a){var b=this===a;if(!b&&a){for(b=0;b<Dg;b++){var c=Eg[b];if(this[c]!==a[c])break}b=b===Dg}return b};Cg.prototype.equals=Cg.prototype.da;Cg.prototype.vj=function(a){if(a){var b={};Pa(b,this,a)}else b=this;return new Cg(b)};Cg.prototype.getCopy=Cg.prototype.vj;
var Gg=Hb({}),Fg=[function(a){return a?Gb(a):Gg},function(a){return a?Gb(a):Gg},function(a){return 0<=a&&100>=a?+a:Gg},function(a){a=Gb(a);return"butt"===a||"square"===a||"round"===a||"arrow-head"===a||"arrow-tail"===a?a:Gg},function(a){return"round"===a||"bevel"===a||"miter"===a?a:Gg},function(a){return 0<a&&100>=a?+a:Gg},function(a){return a&&a.every&&a.every(Vb)?a:Gg},function(a){return F(+a)?Gg:+a},function(a){return Lb(a)?Fg[3](a):B},function(a){return Lb(a)?Fg[3](a):B}];Cg.MAX_LINE_WIDTH=100;
var Hg=new Cg;Cg.DEFAULT_STYLE=Hg;var Ig="fillColor strokeColor lineWidth lineCap lineJoin miterLimit lineDashOffset lineDash lineTailCap lineHeadCap".split(" ");Cg.prototype.U=function(){for(var a={},b=Ig.length,c;b--;)c=Ig[b],a[c]=this[c];return a};Cg.prototype.forWorkerMessage=Cg.prototype.U;function Jg(a){var b;if(a){var c=C(a,Jg);for(b in a)if(b in this){var d=a[b];d!==this[b]&&("fillColor"===b||0<(d=+d))&&(this[b]=d)}a=c?a.Rb:!!(Ke(this.fillColor)&&this.width&&this.width);a||(this.Rb=a)}Hb(this)}u("H.map.ArrowStyle",Jg);Jg.prototype.Rb=!0;Jg.prototype.fillColor="rgba(255,255,255,.75)";Jg.prototype.width=1.2;Jg.prototype.length=1.6;Jg.prototype.frequency=5;Jg.prototype.uj=function(){return new Jg(this)};
Jg.prototype.da=function(a){var b=this===a;!b&&a&&(b=a.width===this.width&&a.fillColor===this.fillColor&&a.length===this.length&&a.frequency===this.frequency);return b};Jg.prototype.equals=Jg.prototype.da;function Kg(a,b){var c;Kg.l.constructor.call(this,b);b&&this.fd(b.style);a&&(this.j=!0);b&&(c=b.arrows)&&this.Jk(c)}w(Kg,L);u("H.map.Spatial",Kg);Kg.prototype.type=yg.SPATIAL;Kg.prototype.sg=0;Kg.prototype.style=Hg;Kg.prototype.Ia=function(){return this.style};Kg.prototype.getStyle=Kg.prototype.Ia;Kg.prototype.fd=function(a){var b=!0;a?this.style=C(a,Cg)?a:new Cg(a):this.style?delete this.style:b=!1;b&&this.invalidate(vg.VISUAL);return this};Kg.prototype.setStyle=Kg.prototype.fd;
Kg.prototype.Ul=function(){return this.f};Kg.prototype.getArrows=Kg.prototype.Ul;Kg.prototype.Jk=function(a){var b=this.f,c=!1;!a&&b?(delete this.f,c=!0):!a||b&&b.da(a)||(this.f=new Jg(a),c=!0);c&&"none"!==this.style.strokeColor&&this.Aa(1);return this};Kg.prototype.setArrows=Kg.prototype.Jk;function Lg(a,b){var c=!1,d=!1,e;if(b.length){for(c=0;c<b.length;c++)if(b[c]!==Mg){d=!0;break}b=a.style;c=d?b.Me||b.Rb&&a.j||(e=a.f||!1)&&b.Le&&e.Rb:b.Rb}return c&&a.Ac(!0)}Kg.prototype.j=!1;Kg.prototype.mn=function(){return this.j};
Kg.prototype.isClosed=Kg.prototype.mn;Kg.prototype.getGeometriesForTile=Kg.prototype.Nd;Kg.prototype.gh=function(){return z};Kg.prototype.getLabels=Kg.prototype.gh;function Ng(a,b){Ng.l.constructor.call(this,a,b)}w(Ng,Kg);u("H.map.GeoShape",Ng);Ng.prototype.getBoundingBox=Ng.prototype.I;function Og(a,b,c,d){var e=[],f=b.length,g;for(g=0;g<f;g++){var h=b[g];h.length&&e.push(Pg(a,h,c,d))}return e}function Pg(a,b,c,d){var e,f=[],g=b.length,h=0;a.X=0;for(e=e||0;h<g;)f.push(Qg(a,b[h++],b[h++],e,d));c&&f.push(Qg(a,b[0],b[1],e,d));return f}function Qg(a,b,c,d,e){var f=a.X;f&&180<Nc(f-c)&&(c+=0>f?-360:360);a.X=c;return e.zh(b,c+d)}
function Rg(a,b,c){for(var d=b,e,f=a.length+b,g,h;d--;){b=a[d];g=b.length;for(e=Array(g);g--;)h=b[g],e[g]=new H(h.x+c,h.y);a[--f]=e}}var Sg=new K([0,0,0,0,0,0,0,0,0]);function Tg(a){Mb(this,Tg);Tg.l.constructor.call(this);this.sa=Ug(this,a,this.constructor,0)}w(Tg,Hf);u("H.geo.MultiGeometry",Tg);Tg.prototype.splice=function(a,b,c){a=[a];b!==B&&a.push(b);c&&(b=Ug(this,c,this.splice,2),a=a.concat(b));this.N=z;return this.sa.splice.apply(this.sa,a)};Tg.prototype.splice=Tg.prototype.splice;Tg.prototype.lc=function(a){var b=this.sa.length;if(!(0<=a&&a<b))throw new vd(this.lc,a,[0,b-1]);this.N=z;return this.sa.splice(a,1)[0]};Tg.prototype.removeAt=Tg.prototype.lc;
Tg.prototype.remove=function(a){a=this.sa.indexOf(a);if(0<=a){var b=this.sa.splice(a,1)[0];this.N=z}return b||z};Tg.prototype.remove=Tg.prototype.remove;Tg.prototype.nm=function(){return this.sa};Tg.prototype.getGeometries=Tg.prototype.nm;Tg.prototype.push=function(a){var b=Ug(this,[a],this.push,0)[0];this.N&&(this.N=this.N.jc(a.I()));this.sa.push(b)};Tg.prototype.push=Tg.prototype.push;
Tg.prototype.I=function(){var a;if(!(a=this.N)){a=z;var b,c;if(this.sa.length)for(a=this.sa[0].I(),c=1;c<this.sa.length;c++)if(b=this.sa[c].I())a=a?a.jc(b):b}return this.N=a};Tg.prototype.getBoundingBox=Tg.prototype.I;Tg.prototype.N=z;function Ug(a,b,c,d){var e,f=[];if(!Qb(b))throw new D(c,d);for(e=0;e<b.length;e++)if(a.a(b[e]))f.push(a.b(b[e]));else throw new D(c,d);return f}Tg.prototype.b=function(a){return a};
Tg.prototype.da=function(a){var b=this===a,c;if(!b&&(b=C(a,this.constructor))){var d=this.sa;a=a.sa;for(b=(c=d.length)===a.length;b&&c--;)b=d[c].da(a[c])}return b};Tg.prototype.equals=Tg.prototype.da;Tg.prototype.Oc=function(a){var b=this.sa,c=b.length,d,e,f=!1;if(c){a.push("(");for(d=0;d<c;d++)(e=0<d&&f)&&a.push(","),b[d].Oc(a),"EMPTY"===a[a.length-1]?a.splice(-1-e,1+e):f=!0;f?a.push(")"):a.splice(-1,1,"EMPTY")}else a.push("EMPTY");return a};
Tg.prototype.toString=function(){return this.Oc([this.nb.toUpperCase()," "]).join("")};Tg.prototype.uc=function(){for(var a=[],b=this.sa,c=b.length;c--;)a[c]=b[c].uc();return a};Tg.prototype.U=function(){var a=Tg.l.U.call(this);a.type=this.nb;return a};function Vg(a){Vg.l.constructor.call(this,a)}w(Vg,Tg);u("H.geo.MultiLineString",Vg);Vg.prototype.a=function(a){return C(a,K)};Vg.prototype.nb="Multi"+K.prototype.nb;function Wg(a,b){Wg.l.constructor.call(this,!1,b);this.fa(a)}w(Wg,Ng);u("H.map.Polyline",Wg);Wg.prototype.I=function(){return this.cb.I()};Wg.prototype.getBoundingBox=Wg.prototype.I;Wg.prototype.cb=z;Wg.prototype.fa=function(a){var b=this.fa,c,d;if(C(a,Vg)){var e=a.sa;if(c=e.length)for(d=0;d<c;d++)Xg(e[d],b);else throw new D(b,0);}else Xg(a,b);this.od=!!e;this.cb=a;this.Aa(vg.SPATIAL);return this};Wg.prototype.setGeometry=Wg.prototype.fa;Wg.prototype.pa=function(){return this.cb};
Wg.prototype.getGeometry=Wg.prototype.pa;Wg.prototype.clip=function(a){var b=this.cb;return sg(this.od?b.sa[0]:b,a)};Wg.prototype.clip=Wg.prototype.clip;Wg.prototype.Nd=function(a){var b=this.cb;var c,d=[];if(this.od)for(b=b.sa,c=b.length;c--;)Yg(this,b[c],a,d);else Yg(this,b,a,d);return d.length?d:B};Wg.prototype.getGeometriesForTile=Wg.prototype.Nd;function Xg(a,b){if(!C(a,K)||2>a.Ie())throw new D(b,0);}
function Yg(a,b,c,d){var e=sg(b,c.Ff());if(e.length&&(b=c.Hf(),a=Og(a,e,!1,b),e=a.length)){var f=c.Ke();b=b.w;c.x||Rg(a,e,-b);c.x===(1<<c.z)-1&&Rg(a,e,b);c=Zg(a,f.left,f.top,f.right,f.bottom,!1);c.length&&d.push(new $g(c))}}Wg.prototype.U=function(){var a=Wg.l.U.call(this),b=a.properties;a.geometry=this.pa().U();b.style=this.Ia().U();b.height=0;return a};Wg.prototype.forWorkerMessage=Wg.prototype.U;function N(a,b){var c;N.l.constructor.call(this);C(a,K,N,0);if(b!==B&&Qb(b,N,1)){for(c=0;c<b.length;c++)C(b[c],K,N,1,"index "+c);this.gb=b}else this.gb=[];this.ec=a;this.a=[]}w(N,Hf);u("H.geo.Polygon",N);function ah(a){var b=N,c=K,d=a.oa,e=a.aa,f=a.ka,g=a.ea;e=[d,e,B,d,g,B,f,g,B,f,e,B];180<=a.Fb()&&(e.splice(9,0,f,a=a.lb().lng,B),e.splice(3,0,d,a,B));return new b(new c(e))}var bh={NORTH:90,SOUTH:-90};N.Direction=bh;N.prototype.qd=bh.NORTH;
N.prototype.Qk=function(a){this.qd!==a&&(this.N=z,this.a.length=0,this.qd=a);return this};N.prototype.setPoleCovering=N.prototype.Qk;N.prototype.Km=function(){return this.qd};N.prototype.getPoleCovering=N.prototype.Km;N.prototype.hm=function(){return this.ec};N.prototype.getExterior=N.prototype.hm;N.prototype.Nk=function(a){if(!C(a,K))throw new D(this.Nk,0,a);this.ec=a;this.N=z};N.prototype.setExterior=N.prototype.Nk;N.prototype.rm=function(){return this.gb};N.prototype.getInteriors=N.prototype.rm;
N.prototype.og=function(a,b,c){var d=arguments.length,e;for(e=2;e<d;e++)C(arguments[e],K,this.og,e);var f=this.gb.splice.apply(this.gb,arguments);for(e=2;e<d;e++)arguments[e]=B;this.a.splice.apply(this.a,arguments);return f};N.prototype.spliceInteriors=N.prototype.og;N.prototype.Un=function(a){return this.og(a,1)[0]};N.prototype.removeInteriorAt=N.prototype.Un;N.prototype.Tn=function(a){a=this.gb.indexOf(a);return 0>a?B:this.og(a,1)[0]};N.prototype.removeInterior=N.prototype.Tn;
N.prototype.xk=function(a){if(!C(a,K))throw new D(this.xk,0,a);this.gb.push(a)};N.prototype.pushInterior=N.prototype.xk;N.prototype.I=function(){var a=this.N;a||(this.N=a=ch(this.ec,this.qd));return a};N.prototype.getBoundingBox=N.prototype.I;n=N.prototype;n.tj=function(a){var b=this.gb.length;if(0>a||a>=b)throw new vd(this.tj,a,[0,b-1]);(b=this.a[a])||(this.a[a]=b=ch(this.gb[a],this.qd));return b};n.ec=z;n.gb=[];
function ch(a,b){var c,d,e;if(e=a.I())(c=a.ah(!0))&&(d=a.Ie())&&(e=e.jc(Qf([a.we(0),a.we(d-1)],!0),!0)),360===e.Fb()&&1===c%2&&(e=e.bd(b,0));return e}n.nb="Polygon";n.Oc=function(a){var b=this.gb,c=b.length,d;if(this.ec.Ie()){a.push("(");this.ec.Oc(a);for(d=0;d<c;d++)b[d].Ie()&&(a.push(","),b[d].Oc(a));a.push(")")}else a.push("EMPTY");return a};n.U=function(){var a=N.l.U.call(this);this.I().Gb()&&(a.type="Multi"+a.type);return a};
n.uc=function(){var a=[],b=this.gb,c=b.length;for(a.push(this.ec.uc());c--;)a[c+1]=b[c].uc();return this.I().Gb()?[a]:a};n.da=function(a){var b=a.gb,c=this.gb.length,d=b.length;a=this.ec.da(a.ec)&&c===d;for(d=0;a&&d<c;)a=a&&this.gb[d].da(b[d]),d++;return a};function dh(a){dh.l.constructor.call(this,a)}w(dh,Tg);u("H.geo.MultiPolygon",dh);dh.prototype.a=function(a){return C(a,N)};dh.prototype.nb="Multi"+N.prototype.nb;function $g(a,b,c){this.paths=this.a=a;b!==B&&(this.interiorsIndex=this.b=b);c!==B&&(this.outlinesIndex=this.c=c)}$g.prototype.interiorsIndex=$g.prototype.b=gd;$g.prototype.outlinesIndex=$g.prototype.c=gd;var Mg=Ib(new $g([])),eh=Hb([]);function fh(a,b){var c=b&&(+b.extrusion||+b.extrude),d=b&&+b.elevation,e=0;fh.l.constructor.call(this,!0,b);0<d&&(e+=d,this.c=d);0<c&&(e+=c,this.i=c);if(e>gh)throw new vd(fh,e,[0,gh]);C(a,K)?this.fa(new N(a)):this.fa(a)}w(fh,Ng);u("H.map.Polygon",fh);fh.prototype.i=0;fh.prototype.c=0;fh.prototype.cb=z;var gh=2047;fh.MAX_EXTRUDE_HEIGHT=gh;fh.prototype.ki=function(a){var b=+a;if(b!==a)throw new D(this.ki,0,a);if(0>b||this.c+b>gh)throw new vd(this.ki,this.c+b,[0,gh]);this.i=b;this.Aa(vg.SPATIAL)};
fh.prototype.setExtrusion=fh.prototype.ki;fh.prototype.im=function(){return this.i};fh.prototype.getExtrusion=fh.prototype.im;fh.prototype.ji=function(a){var b=+a;if(b!==a)throw new D(this.ji,0,a);if(0>b||this.i+b>gh)throw new vd(this.ji,this.i+b,[0,gh]);this.c=b;this.Aa(vg.SPATIAL)};fh.prototype.setElevation=fh.prototype.ji;fh.prototype.gm=function(){return this.c};fh.prototype.getElevation=fh.prototype.gm;fh.prototype.pa=function(){return this.cb};fh.prototype.getGeometry=fh.prototype.pa;
fh.prototype.fa=function(a){if(a===z||C(a,N))var b=!1;else C(a,dh,this.fa,0),b=!0;this.od=b;b=this.cb;this.cb=a;b!==z&&this.Aa(vg.SPATIAL);return this};fh.prototype.setGeometry=fh.prototype.fa;fh.prototype.I=function(){return this.pa().I()};fh.prototype.getBoundingBox=fh.prototype.I;
fh.prototype.Nd=function(a){var b,c=this.pa(),d,e;if(this.od){c=c.sa;var f=0;for(e=c.length;f<e;f++)if(d=hh(this,c[f],a,c[f].qd))b||(b=[]),b.push(d)}else d=this.ca,d===B&&(d=this.od?bh.NORTH:this.pa().qd),(d=hh(this,c,a,d))&&(b=[d]);return b};fh.prototype.getGeometriesForTile=fh.prototype.Nd;
function hh(a,b,c,d){var e,f,g=0,h=!0;if(e=ih(a,b.ec,c,d,b.I())){var k=new $g(e);var l=b.gb;if(f=l.length)for(k.b=k.a.length;g<f;g++)if(e=ih(a,l[g],c,d,b.tj(g)))k.a=k.a.concat(e);f=k.a.length;for(g=0;g<f;g++)if(k.a[g]!==eh){h=!1;break}h&&(k=g%2?Mg:B)}return k}
function ih(a,b,c,d,e){var f=c.Ke(),g=e,h=g.Fb();var k=[[]];var l=b.qa;var m=[],p=l.length,q,t=!1;for(q=0;q<p;q+=3){var v=l[q];var x=l[q+1];t||180!=Nc(x)||(m.push(v),m.push(x),m.push(v),m.push(-x),t=!0);m.push(v);m.push(x)}l=m;360>h&&-180==g.aa&&(g=new J(g.oa,180,g.ka,g.ea));360>h&&180==g.ea&&(g=new J(g.oa,g.aa,g.ka,-180));if(g.Gb()){h=l;v=h.length;l=-1;for(m=0;m<v-2;m+=2)if(Gf(h[m+1],h[m+3])){l=m+2;break}-1===l&&Gf(h[v-1],h[1])&&(l=v);-1!==l&&(p=h[l-2],m=h[l-1],q=h[l%v],t=h[(l+1)%v],180!==Nc(p)&&
180!==Nc(q)&&(x=Nc(q-p),v=Nc(t-m),v+=180<v?-360:0,t=Nc(180-t),t+=180<t?-360:0,v&&t&&(x/=Nc(v)/Nc(t),p=q+(q>p?-x:x),m=0<m?180:-180,h.splice(l,0,p,m,p,-m))));l=h}k[0]=jh([].concat(l),g.aa);360>g.Fb()&&g.Gd(new I(g.oa,180))&&(l=jh([].concat(l),g.ea),k.push(l));g=c.Hf();a=Og(a,k,!0,g);if(360===e.Fb()&&1===b.ah(!0)%2){b=a;a=c.Ke();b[0][1].x>b[0][b[0].length-1].x&&(b[0]=b[0].reverse());l=[];h=b[0].length-1;for(k=0;k<h;k++)m=b[0][k],l[k]=new H(m.x-2*g.w,m.y),l[k+h]=new H(m.x-g.w,m.y),l[k+2*h]=new H(m.x,
m.y),l[k+3*h]=new H(m.x+g.w,m.y),l[k+4*h]=new H(m.x+2*g.w,m.y);b[0]=l;k=g.zh(d,0);k.y=2*a[d===bh.NORTH?"top":"bottom"];d=k.clone();k.x=b[0][b[0].length-1].x+1;d.x=b[0][0].x-1;b[0].push(k,d);a=b}d=f.left;b=f.top;k=f.right;f=f.bottom;if(Zg(a,d,b,k,f,!0).length){if(!c.Ff().Kg(e)){c=a;e=[new H(d,b),new H(k,b),new H(k,f),new H(d,f)];f=[];for(a=c.length;a--;)if(d=kh(e,c[a]))for(b=lh(d),f.push(b);d.Rh;)d=d.Rh,b=lh(d),f.push(b);a=f}}else c=mh(d,b,a[0]),a[1]&&(c^=mh(d,b,a[1])),a=c?[eh]:B;return a}
function mh(a,b,c){var d,e,f;var g=d=c[0].x;var h=e=c[0].y;var k=1;for(f=c.length;k<f;k++){var l=c[k].x;var m=c[k].y;l>d?d=l:l<g&&(g=l);m>e?e=m:m<h&&(h=m)}return g<=a&&a<=d&&h<=b&&b<=e&&nh({x:a,y:b},c.concat(c[0]))}function lh(a){var b=[],c=a;do{var d=Kc(100*(c.Ln?c.Ln:c.x))/100;var e=Kc(100*(c.Mn?c.Mn:c.y))/100;if(!f||.01<Pc(Qc(f.x-d,2)+Qc(f.y-e,2))){var f=new H(d,e);b.push(f)}c=c.next}while(c&&c!==a);return b}fh.prototype.P=z;
function jh(a,b){var c,d=Number.POSITIVE_INFINITY,e=-1,f=a.length;for(c=0;c<f;c+=2){var g=Nc(a[c+1]-b);g+=180<g?360-g:g;g<d&&(d=g,e=c)}return 0<c?(b=a.splice(e,a.length-e),b.concat(a)):a}
fh.prototype.U=function(){var a=fh.l.U.call(this),b=this.pa(),c=this.od?b.sa:[b],d,e=a.properties;var f=a.geometry=b.U();e.style=this.Ia().U();e.height=this.i+this.c;e.min_height=this.c;if(this.I().Gb()&&(f.type="MultiPolygon",this.od)){var g=[];c.forEach(function(a,b){d=f.coordinates[b];a.I().Gb()?g=g.concat(d):g.push(d)});f.coordinates=g}return a};fh.prototype.forWorkerMessage=fh.prototype.U;function oh(a,b,c){oh.l.constructor.call(this,Sg,c);this.kg(a);this.ui(b);c&&"precision"in c&&this.ti(c.precision)}w(oh,fh);u("H.map.Circle",oh);oh.prototype.kg=function(a){(a=Jf(a)).da(this.b)||(this.b=a,ph(this))};oh.prototype.setCenter=oh.prototype.kg;oh.prototype.lb=function(){return this.b};oh.prototype.getCenter=oh.prototype.lb;oh.prototype.ui=function(a){if(F(a=ld(a,0,6371000.79*$c/2)))throw new D(this.ui,0,a);this.L!==a&&(this.L=a,ph(this))};oh.prototype.setRadius=oh.prototype.ui;
oh.prototype.Qm=function(){return this.L};oh.prototype.getRadius=oh.prototype.Qm;oh.prototype.v=60;oh.prototype.ti=function(a){if(!Tb(a))throw new D(this.ti,0,a);this.v!==(a=ld(Kc(a),4,360))&&(this.v=a,ph(this))};oh.prototype.setPrecision=oh.prototype.ti;oh.prototype.Mm=function(){return this.v};oh.prototype.getPrecision=oh.prototype.Mm;oh.prototype.fa=function(){return this};oh.prototype.setGeometry=oh.prototype.fa;oh.prototype.pa=function(){this.cb||oh.l.fa.call(this,qh(this));return this.cb};
oh.prototype.getGeometry=oh.prototype.pa;function ph(a){a.cb!==z&&oh.l.fa.call(a,qh(a))}function qh(a){var b=a.b,c=b.lat,d=a.L,e=0,f=new K;if(90===Nc(c))for(c=b.rg(0,d,!0).lat;360>e;e+=120)f.fi(c,e-180,B);else for(a=a.v,a=360/a;360>e;e+=a)f.sd(b.rg(e,d,!0));b=new N(f);0>c&&b.Qk(bh.SOUTH);return b};function rh(a,b){if(!C(a,Element)){sh.innerHTML=a;a=sh.firstElementChild;if(!a)throw new D(rh,0,"No element data");sh.removeChild(a);var c=!0;sh.innerHTML=""}this.a=0!==Ve(a).length;this.c=c?a:We(a,y.document,this.a);b&&(c="onAttach",c in b&&Ob(a=b[c],"Function",rh,1,c)&&(this.Sh=a),c="onDetach",c in b&&Ob(a=b[c],"Function",rh,1,c)&&(this.b=a))}u("H.map.DomIcon",rh);var sh=document.createElement("DIV");rh.prototype.Sh=null;rh.prototype.b=null;rh.prototype.uj=function(a){return We(this.c,a,this.a)};
rh.prototype.a=!1;function th(a){th.l.constructor.call(this,a)}w(th,Tg);u("H.geo.MultiPoint",th);th.prototype.a=function(a){return If(a)};th.prototype.b=function(a){return C(a,I)?a:Jf(a)};th.prototype.nb="Multi"+I.prototype.nb;function uh(a,b){this.w=+a;this.h=+b}u("H.math.Size",uh);function vh(a,b){var c;var d=a;var e=b||[];if(a!==wh.NONE){b=c=e.length;if(-1===this.b.indexOf(d))throw new D(vh,0,a);if(!e)throw new D(vh,1,e);for(;c--;)if(F(e[c]))throw new D(vh,1,e);d===wh.RECT&&3<b&&(e=[e[0],e[1],e[2],e[1],e[2],e[3],e[0],e[3]],d=wh.POLYGON);if(d===wh.CIRCLE&&2<b&&(a=e[2],0<a)){d=e[0];var f=e[1];c=Ic(2*Mc(a),40);var g=360/c;for(e=[];c--;){var h=g*c*ed;e.push(d+Sc(h)*a,f+Vc(h)*a)}d=wh.POLYGON}if(d!==wh.POLYGON||!b||e.length%2)throw new D(vh,1,e);this.a=e}}
u("H.map.HitArea",vh);var wh={NONE:0,RECT:1,CIRCLE:2,POLYGON:3};vh.ShapeType=wh;vh.prototype.b=[wh.RECT,wh.CIRCLE,wh.POLYGON];vh.prototype.Lf=function(a,b,c){return this.a?pd(a,b,this.a,c,!0):od.NONE};vh.prototype.hitTest=vh.prototype.Lf;function xh(a,b){var c;Mb(this,xh);xh.l.constructor.call(this,b);this.fa(a);b&&"icon"in b&&(c=b.icon);this.ed(c||yh(this))}w(xh,L);u("H.map.AbstractMarker",xh);xh.prototype.pa=function(){return this.b};xh.prototype.getGeometry=xh.prototype.pa;xh.prototype.fa=function(a){var b=this.b;C(a,I)||C(a,th)?this.b=a:(If(a,this.fa,0),this.b=Jf(a));b&&this.Aa(vg.SPATIAL);return this};xh.prototype.setGeometry=xh.prototype.fa;xh.prototype.I=function(){return this.b.I()};xh.prototype.Ab=function(){return this.icon};
xh.prototype.getIcon=xh.prototype.Ab;xh.prototype.ed=function(a){var b=this.icon,c=!b;if(b!==a){if(!this.Qj(a))throw D.apply(b=new D,c?[this.constructor,1,"icon"]:[this.fa,0,a]),b;this.icon=a;c||this.Aa(vg.VISUAL)}return this};xh.prototype.setIcon=xh.prototype.ed;function yh(a){var b=a.f;b||(b=a.constructor.prototype.f=a.c(zh));return b}
var zh={svg:'<svg xmlns="http://www.w3.org/2000/svg" width="38" height="47" viewBox="0 0 38 47"><g fill="none"><path fill="#0F1621" fill-opacity=".4" d="M15 46c0 .317 1.79.574 4 .574s4-.257 4-.574c0-.317-1.79-.574-4-.574s-4 .257-4 .574z"></path><path fill="#01b6b2" d="M33.25 31.652A19.015 19.015 0 0 0 38 19.06C38 8.549 29.478 0 19 0S0 8.55 0 19.059c0 4.823 1.795 9.233 4.75 12.593L18.975 46 33.25 31.652z"></path><path fill="#6A6D74" fill-opacity=".5" d="M26.862 37.5l4.714-4.77c3.822-3.576 5.924-8.411 5.924-13.62C37.5 8.847 29.2.5 19 .5S.5 8.848.5 19.11c0 5.209 2.102 10.044 5.919 13.614l4.719 4.776h15.724zM19 0c10.493 0 19 8.525 19 19.041 0 5.507-2.348 10.454-6.079 13.932L19 46 6.079 32.973C2.348 29.495 0 24.548 0 19.04 0 8.525 8.507 0 19 0z"></path></g></svg>',size:new uh(38,
47),anchor:new H(19,45),hitArea:new vh(3,[19,46,2,27,0,18,5,6,19,0,32,5,38,15,36,27,19,47])};xh.prototype.U=function(){var a=xh.l.U.call(this),b=this.Ab(),c=b.Db(),d=b.ld();a.geometry=this.pa().U();c&&(b=a.properties.icon={id:b.uid},b.size={w:c.w,h:c.h},b.offset=[c.w/2-(d?d.x:0),c.h/2-(d?d.y:0)]);return a};xh.prototype.forWorkerMessage=xh.prototype.U;function Ah(a,b){Ah.l.constructor.call(this,a,b)}w(Ah,xh);u("H.map.DomMarker",Ah);Ah.prototype.type=yg.DOM_MARKER;Ah.prototype.sg=2;Ah.prototype.c=function(a){var b=new rh(a.svg,a);a=a.anchor;b.c.style.margin=-a.y+"px 0 0 -"+a.x+"px";return b};Ah.prototype.Qj=function(a){return C(a,rh)};function Bh(a,b,c,d){Bh.l.constructor.call(this,a,b,c);this.modifiers=d}w(Bh,wg);u("H.map.ChangeEvent",Bh);Bh.prototype.pl=1;Bh.prototype.SIZE=Bh.prototype.pl;Bh.prototype.ac=2;Bh.prototype.POSITION=Bh.prototype.ac;Bh.prototype.pc=4;Bh.prototype.HEADING=Bh.prototype.pc;Bh.prototype.bc=8;Bh.prototype.TILT=Bh.prototype.bc;Bh.prototype.ke=16;Bh.prototype.INCLINE=Bh.prototype.ke;Bh.prototype.Rc=32;Bh.prototype.ZOOM=Bh.prototype.Rc;Bh.prototype.zd=64;Bh.prototype.BOUNDS=Bh.prototype.zd;function Ch(){this.a=[];Ch.l.constructor.call(this)}w(Ch,G);u("H.util.OList",Ch);function Dh(a,b,c){a=a.a.length;if(c)var d=a;else if(F(d=0>(d=+b)?Jc(0,a+d):Ic(a,d)))throw new vd(Ch,b,[0,a-1]);return d}Ch.prototype.add=function(a,b){b=Dh(this,b,F(b));this.a.splice(b,0,a);this.dispatchEvent(new Eh(this,this.b.he,b,a,null,null))};Ch.prototype.add=Ch.prototype.add;function Fh(a,b){var c=a.a.splice(b,1)[0];a.dispatchEvent(new Eh(a,a.b.le,b,null,c,null));return c}
Ch.prototype.lc=function(a){this.get(a);return Fh(this,a)};Ch.prototype.removeAt=Ch.prototype.lc;Ch.prototype.remove=function(a){a=this.indexOf(a);return 0<=a?(Fh(this,a),!0):!1};Ch.prototype.remove=Ch.prototype.remove;Ch.prototype.set=function(a,b){if(0!==this.a.length||0!==a){this.get(a);a=Dh(this,a,!1);var c=this.a[a]}this.a[a]=b;this.dispatchEvent(new Eh(this,this.b.me,a,b,c,null));return c};Ch.prototype.set=Ch.prototype.set;Ch.prototype.indexOf=function(a){return this.a.indexOf(a)};
Ch.prototype.indexOf=Ch.prototype.indexOf;Ch.prototype.get=function(a){var b=Dh(this,a,!1),c=this.a;if(b>=c.length)throw new vd(this.get,a,[0,c.length-1]);return c[b]};Ch.prototype.get=Ch.prototype.get;Ch.prototype.xm=function(){return this.a.length};Ch.prototype.getLength=Ch.prototype.xm;Ch.prototype.ab=function(){return[].concat(this.a)};Ch.prototype.asArray=Ch.prototype.ab;Ch.prototype.flush=function(){for(var a=this.a.length;a--;)Fh(this,a)};Ch.prototype.flush=Ch.prototype.flush;
Ch.prototype.s=function(){this.flush();Ch.l.s.call(this)};Ch.prototype.b={he:"add",le:"remove",me:"set",yo:"move"};function Eh(a,b,c,d,e,f){Eh.l.constructor.call(this,b,a);this.idx=c;this.added=d;this.removed=e;this.moved=f}w(Eh,Ec);var Gh={};u("H.geo.mercator",Gh);Gh.a=function(a){return Ic(1,Jc(0,.5-Oc(Wc(bd+ad*a/180))/$c/2))};Gh.b=function(a){return a/360+.5};Gh.Pf=function(a,b,c){c?(c.x=Gh.b(b),c.y=Gh.a(a)):c=new H(Gh.b(b),Gh.a(a));return c};Gh.latLngToPoint=Gh.Pf;Gh.Mb=function(a,b){return Gh.Pf(a.lat,a.lng,b)};Gh.geoToPoint=Gh.Mb;Gh.f=function(a){return 0>=a?90:1<=a?-90:fd*(2*Xc(Rc($c*(1-2*a)))-ad)};Gh.c=function(a){return 360*(1===a?1:jd(a,1))-180};
Gh.Ra=function(a,b,c){c?(c.lat=Gh.f(b),c.lng=Gh.c(a)):c=new I(Gh.f(b),Gh.c(a));return c};Gh.xyToGeo=Gh.Ra;Gh.Yf=function(a,b){return Gh.Ra(a.x,a.y,b)};Gh.pointToGeo=Gh.Yf;u("H.util.constants.DEFAULT_MIN_ZOOM_LEVEL",0);u("H.util.constants.DEFAULT_MAX_ZOOM_LEVEL",22);function Hh(a,b){this.projection=a||Gh;this.b=0;this.a=this.exp=Oc(b||256)/Zc;Ih(this);this.y=this.x=0}u("H.geo.PixelProjection",Hh);var Jh=Nc(24)+Nc(-8);Hh.prototype.Ea=function(a){if(F(a))throw new D(this.Ea,0,a);var b=this.x/this.w;var c=this.y/this.h;this.b=a;this.a=this.exp+a;Ih(this);this.x=b*this.w;this.y=c*this.h};Hh.prototype.rescale=Hh.prototype.Ea;function Ih(a){a.a>Jh&&(a.a=Jh);a.w=Qc(2,a.a);a.h=Qc(2,a.a)}Hh.prototype.Fj=function(){return this.b||0};Hh.prototype.getZoomScale=Hh.prototype.Fj;
Hh.prototype.kb=function(a,b){a=this.projection.Pf(a.lat,a.lng,b);a.x=a.x*this.w-this.x;a.y=a.y*this.h-this.y;return a};Hh.prototype.geoToPixel=Hh.prototype.kb;Hh.prototype.Se=function(a,b){return this.projection.Ra((a.x+this.x)/this.w,(a.y+this.y)/this.h,b)};Hh.prototype.pixelToGeo=Hh.prototype.Se;Hh.prototype.Ra=function(a,b,c){return this.projection.Ra((a+this.x)/this.w,(b+this.y)/this.h,c)};Hh.prototype.xyToGeo=Hh.prototype.Ra;
Hh.prototype.zh=function(a,b,c){a=this.projection.Pf(a,b,c);a.x=a.x*this.w-this.x;a.y=a.y*this.h-this.y;return a};Hh.prototype.latLngToPixel=Hh.prototype.zh;Hh.prototype.cd=function(a){return new H(a.x*this.w-this.x,a.y*this.h-this.y)};Hh.prototype.pointToPixel=Hh.prototype.cd;var Kh;function Lh(a,b){if(y.URL)return(new y.URL(a,b)).toString();if(!a||!Mh(a))return a;if(!b||Mh(b))throw new TypeError("Failed to construct 'URL': Invalid base URL");Kh||(Kh=document.createElement("a"),Yb(Kh));var c=Kh;c.href=b;"/"!==a[0]?a=c.href.replace(/\/[^\/]*$/,"/")+a:((b=c.origin)||(b=c.protocol+"//"+c.host),a=b+a);return a}function Mh(a){var b=!1;"string"===typeof a&&(b=!(-1<a.search(/^(http|https|data|blob):/)||"//"===a.substr(0,2)));return b};function Nh(a){return y.H.gl.yaml.safeLoad(a,{json:!0})}function Oh(a,b){var c,d=arguments.length,e,f;for(c=1;c<d;c++)if((e=arguments[c])&&e!==a&&e!==g){var g=e;for(f in e){var h=e[f];a[f]!==h&&(Ph(h)?Ph(a[f])?a[f]=Oh(a[f],h):a[f]=Na(h):void 0!==h&&(a[f]=Na(h)))}}return a}var Qh=Fb();function Rh(a,b,c){var d=c[a];return b&&d in b&&0>Kb.indexOf(d)?(b=b[d],++a<c.length?Rh(a,b,c):b):Qh}
var Sh=Rh.bind(null,0),Th={polygons:1,lines:1,"pattern-lines":1,points:1,text:1,raster:1,custom_icons:1,overlays:1},Uh={data:1,draw:1,enabled:1,filter:1,properties:1},Vh=Object.keys(Uh);function Wh(a,b,c,d,e,f){var g=d[a],h=c[g];if(++a<d.length){var k=b[g]||{};for(c=Vh.length;c--;){var l=Vh[c];if("draw"!==l||!f){var m=h[l];m!==B&&(k[l]=Na(m))}}Wh(a,k,h,d,e,f)}else e?k=Na(h):(k=h,delete c[g]);b[g]=b[g]?Oh(b[g],k):k}var Xh=Wh.bind(null,0);function Yh(a,b){a in Th&&(b[a]=1)}
function Zh(a,b,c){var d,e,f;for(d in a)if(Uh[d]){if("draw"===d){var g=a[d];for(e in g){var h=g[e];(f=h.style)?(h.style=b+f,Yh(f,c)):(delete g[e],g[b+e]=h,Yh(e,c))}}}else Zh(a[d],b,c)}
function $h(a,b){var c={},d,e,f,g;b+="_";a=Oh({},a);if(d=a.styles)for(e in d){var h=d[e];delete d[e];d[b+e]=h;if(f=h.mix)for(ra(f)&&(f=[f]),g=f.length;g--;)Yh(f[g],c),f[g]=b+f[g];if(g=h.base)f||(f=h.mix=[]),f.unshift(b+g),delete h.base,Yh(g,c);Yh(e,c)}else d=a.styles={};if(h=a.layers)for(e in h)f=h[e],delete h[e],(g=f.data)&&!g.layer&&(g.layer=e),h[b+e]=f,Zh(f,b,c);for(e in c)d[b+e]={base:e};return a}
function ai(a,b){var c=a.sources,d=Object.keys(c)[0],e=Oh(c[d],{uid:b});c=a.layers;var f;a.sources={};a.sources[b]=e;for(f in c)a=c[f],a.data?a.data.source===d&&(a.data.source=b):a.data={source:b}}function bi(a,b){var c;var d=a.textures;var e=a.fonts;for(c in d){var f=d[c];f.url&&(f.url=Lh(f.url,b))}for(c in e)if(d=e[c],Qb(d))for(f=0;f<d.length;f++){var g=d[f];g.url=g.url&&Lh(g.url,b)}else g=a.fonts[c],g.url=g.url&&Lh(g.url,b)}
function fi(a,b){return"function(){return "+("feature."+a+(b||""))+";}"}function gi(a){return fi("style."+a,void 0)}function hi(a,b,c,d){a={base:a,blend:b,blend_order:c};d&&(a.clean_depth=!!d);return a}function ii(a){var b={};b["translucent-"+(a?"extruded-":"")+"polygons"]={color:gi("fillColor"),order:1,interactive:!0,extrude:a};return b}function ji(a,b,c,d){a={data:{source:a,layer:b}};c&&(a.draw=c);d&&(a.filter=d);return a}function Ph(a){return wa(a)&&!Qb(a)};function ki(a){a=a||{};ki.l.constructor.call(this);this.min=0;this.max=22;this.Fl=!!a.dark;a.min&&this.pi(a.min);a.max&&this.ni(a.max);this.pixelProjection=new Hh(a.projection,a.minWorldSize);a.provider&&(this.a=a.provider,this.g=A(this.g,this),this.a.addEventListener(li.prototype.i.Fa,this.g,!1,this),this.i=A(this.i,this),this.a.addEventListener(li.prototype.i.ie,this.i,!1,this))}w(ki,G);u("H.map.layer.Layer",ki);ki.prototype.b={Fa:"update",ie:"configchange",Qi:"minchange",Pi:"maxchange"};
ki.prototype.za=function(){return this.a};ki.prototype.getProvider=ki.prototype.za;ki.prototype.nn=function(a){return this.min<=a&&a<=this.max};ki.prototype.isValid=ki.prototype.nn;function mi(a,b,c){var d=a[b],e="min"===b,f=e?a.pi:a.ni;if(c!==d)if(e?c<=a.max:c>=a.min)a[b]=c,a.g(),a.i(),a.dispatchEvent(new wg(e?a.b.Qi:a.b.Pi,c,d));else throw new D(f,0,"Invalid condition min <= max");return a}ki.prototype.pi=function(a){return mi(this,"min",+a)};ki.prototype.setMin=ki.prototype.pi;
ki.prototype.ni=function(a){return mi(this,"max",+a)};ki.prototype.setMax=ki.prototype.ni;ki.prototype.g=function(){this.dispatchEvent(this.b.Fa)};ki.prototype.i=function(){this.dispatchEvent(this.b.ie)};ki.prototype.s=function(){ki.l.s.call(this)};ki.prototype.la=function(){return null};ki.prototype.getCopyrights=ki.prototype.la;function ni(a){var b;ni.l.constructor.call(this);this.dispatchEvent=A(this.dispatchEvent,this);if(a){var c=a.length;for(b=0;b<c;b++)this.add(a[b])}}w(ni,Ch);u("H.map.DataModel",ni);function oi(a,b){var c=b.getProvider&&b.getProvider();c&&(pi[c.uid]=c);b.ba(a)}function qi(a){var b=a.getProvider&&a.getProvider();b&&delete pi[b.uid];a.ba(null)}ni.prototype.add=function(a,b){C(a,ki,this.add,0);oi(this,a);ni.l.add.call(this,a,b)};ni.prototype.add=ni.prototype.add;
ni.prototype.set=function(a,b){C(b,ki,this.set,0);oi(this,b);(a=ni.l.set.call(this,a,b))&&qi(a);return a};ni.prototype.set=ni.prototype.set;ni.prototype.lc=function(a){var b;(b=ni.l.lc.call(this,a))&&qi(b);return b};ni.prototype.removeAt=ni.prototype.lc;ni.prototype.remove=function(a){var b;(b=ni.l.remove.call(this,a))&&qi(a);return b};ni.prototype.remove=ni.prototype.remove;ni.prototype.flush=function(){for(var a=this.a.length;a--;)this.lc(a);ni.l.flush.call(this)};ni.prototype.flush=ni.prototype.flush;
var pi={};Yb(pi);function ri(a,b,c){if(a=pi[a])return C(a[b],Function,ri,1,"invalid method"),a[b].apply(a,c)}ni.invoke=ri;function si(a,b){r(a)&&(this.i=a);Tb(b)&&(this.a=b)}u("H.util.Request",si);si.State={PENDING:0,PROCESSING:1,COMPLETE:2,CANCELLED:3,ERROR:4};var ti={Si:0,xg:1,vg:2,so:3,Mi:4},ui=[0,1,2,3,4];si.prototype.C=0;si.prototype.getState=function(){return this.C};si.prototype.getState=si.prototype.getState;si.prototype.R=function(a){if(0>ui.indexOf(a))throw new D(this.R,0,a);if(this.C!==a||1===a&&1<this.a)this.C=a,this.i&&this.i(this)};si.prototype.a=1;si.prototype.Ym=function(){return this.a};
si.prototype.getTotal=si.prototype.Ym;si.prototype.b=0;si.prototype.Nm=function(){return this.b};si.prototype.getProcessed=si.prototype.Nm;si.prototype.g=0;si.prototype.jm=function(){return this.g};si.prototype.getFailed=si.prototype.jm;function vi(a,b){a.b<a.a&&(Lb(b)||(b=ti.vg),b===ti.Si||b===ti.xg||a.C!==ti.Si&&a.C!==ti.xg||(a.b++,b!==ti.vg&&a.g++,a.R(a.b<a.a?ti.xg:ti.vg)))}si.prototype.qe=function(){};si.prototype.cancel=function(){3!==this.C&&(this.qe(),this.R(3))};si.prototype.cancel=si.prototype.cancel;function wi(){}u("H.util.ICapturable",wi);wi.prototype.capture=function(){};wi.prototype.capture=wi.prototype.capture;u("H.util.Disposable",Ac);Ac.prototype.xb=Ac.prototype.xb;Ac.prototype.addOnDisposeCallback=Ac.prototype.xb;u("H.util.dispose",Dc);function xi(a,b){var c=a.J(),d=c.ownerDocument;xi.l.constructor.call(this);this.a=a;this.O=c=c.appendChild(yi(d,"DIV","position:absolute;bottom:0;right:0;left:0px;z-index:1;direction:ltr;pointer-events:none;height:40px",null,"H_imprint"));this.qf=yi(d,"DIV","margin: -"+zi+"px 0 0 "+zi+"px; display:inline-block;",Ai,"H_logo");c.appendChild(this.qf);c=c.appendChild(yi(d,"DIV","-webkit-touch-callout: none;-webkit-user-select:none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select:none;right:0;bottom:0;position:absolute;background-color:rgba(255,255,255,.8);color:#0F1621;padding:2px 16px",
null,"H_copyright"));this.g=c.appendChild(yi(d,"A","color:inherit; margin:0px 8px; text-decoration:none; pointer-events:all;","Terms of use"));this.g.target="_blank";this.f=c.appendChild(yi(d,"SPAN","margin:0px 8px"));this.j=La(Bi);this.ri(b);this.c=A(this.c,this);this.b=A(this.b,this);this.a.addEventListener(this.a.u.Oi,this.c);this.a.a.addEventListener("add",this.b);this.a.a.addEventListener("remove",this.b);this.a.a.addEventListener("set",this.b);this.b()}var Ci;w(xi,Ac);
u("H.map.Imprint",xi);var zi=16,Bi={font:'11px "Lucida Grande", Arial, Helvetica, sans-serif',href:"https://legal.here.com/{LN}/terms/serviceterms/{CN}",invert:!1,reportHref:"https://wego.here.com/",locale:"en-US"};
xi.prototype.ri=function(a){var b,c=this.qf.firstChild.firstChild.childNodes;a||(this.j=La(Bi));var d=this.j;for(b in d)a&&b in a&&(d[b]=a[b]);a=(this.vh=a=d.invert)?Di:Ei;c[0].style.fill=a.Vk;c[0].style.fillOpacity=a.Wk;c[1].style.fill=a.$k;c[1].style.fillOpacity=a.al;a=d.locale;Fi[a]||(a="en-US",d.locale=a);this.g.innerHTML=Fi[a];a=a.split("-");this.g.href=d.href.replace("{LN}",a[0]).replace("{CN}",a[1].toLowerCase());this.O.style.font=d.font};xi.prototype.setOptions=xi.prototype.ri;
function yi(a,b,c,d,e){a=a.createElement(b);c&&(a.style.cssText=c);d&&(a.innerHTML=d);e&&(a.className=e);return a}xi.prototype.J=function(){return this.O};xi.prototype.c=function(){this.f.innerHTML=this.i+" "+this.la()};xi.prototype.b=function(){this.c();setTimeout(this.c,5E3)};
var Ai='<svg height="40" viewBox="0 0 47 40" width="47" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m45.2054149 8.82876345.6003191.40637037-.2240425.6914074-.4490426 1.38570368c-.1024468.3148889-.6998936 1.9596297-2.43 3.5918519l-.017234.0163704c-.188617.1887407-.3801064.3659259-.5467021.5084444l-.4605319.4285185-.486383.4516296-.1407447-.0702963c-.7257447.4583704-1.4926596.7886667-2.2796809.9831852l.5840426.5864445-.6769149.6817778-2.052766 2.0636296-.169468.1704444-.019149.0192593-2.3821276 2.3958518c-.4902128.8493334-1.1202128 1.6331852-1.8497873 2.3111112-.6031915.6047407-1.2504255 1.1054814-1.935 1.4954814l-.4777659.4805186-4.3247873 4.3506666-.0296808.0298519-.0315958.0269629-2.1532978 1.8171111-.2661702.2253334h-.3485107-3.8948936l-3.968617 3.9914815-1.3547873 1.3616296-.6769148.6808148-.6769149-.6808148-1.3538298-1.3616296-4.80925535-4.837926-3.2687234-3.2875555-1.63436171-1.6437778h2.3112766 4.62255319 2.67223407l-4.71063832-4.7368148-.6769149-.6808148.6769149-.6808148 4.93851062-4.9650371.6769149-.6798518.6769149.6808148 2.7296809 2.7454074c.9363829-.8820741 2.1485106-1.4685185 3.4037234-1.6562963.278617-1.4694815 1.0187234-2.834963 2.168617-3.9885926.5696808-.572 1.1843617-1.0438519 1.8335106-1.4107407l.2901064-.2917778 4.3094681-4.31985187c.5830851-1.0582963 1.4256383-1.78918519 2.0364893-2.12718519l.4471277-.24748148c.3829787-.7617037.9047872-1.47622222 1.5539362-2.12622222 1.510851-1.51666667 3.3165957-2.31881482 5.22-2.31881482.0871276 0 .1752127.00192593.2594681.00577778 1.9484042.06933334 3.8441489.97933334 5.4775532 2.62792593.1512765.15022222.3303191.34859259.5361702.5797037l.0526595.05874074c.1120213.12518519.2345745.26192593.370532.40733334l1.2657446 1.36066666.6328724.67985185-.6548936.65866667-.2508511.25325926zm-27.9288192 22.17414815h-9.57446804l4.78723404 4.8148148zm23.1864894-21.70422223c-.9220213 1.38666663-2.5180851 3.63037033-4.1984042 1.94133333l4.2510638-4.27651851c-.3810638-.41022222-.6711702-.754-.8923404-.97740741-2.2921277-2.31207407-4.8743617-2.34192593-6.8984043-.312-1.3528723 1.35681481-1.7071277 2.91007407-1.313617 4.38533332l-1.332766-1.52629628c-.385851.21474074-2.0182979 1.65918518-.7937234 3.84703708l-1.5252127-1.274963-2.0240426 2.0299259 2.7344681 2.7502222c-2.1121277-1.6861481-4.3889362-1.5205185-6.2157447.312-1.9560638 1.9615556-1.8181915 4.3381482-.3532979 6.293926l-.295851-.2946667c-1.9321277-1.9432593-4.0318085-1.2576296-5.0706383-.2128148-.8023405.8079259-1.2944681 1.9191852-1.0924468 2.6905185l-4.195532-4.2187407-2.22893613 2.2408148 8.25893613 8.3065185h4.4339362l-2.9767021-2.9938519c-.5893908-.6029568-.9604155-1.0987731-1.1531529-1.5232627-.3182349-.7008886-.1504161-1.2073234.3230465-1.680515.7334043-.7318519 1.583617-.2763704 3.0829787 1.2277777l2.9412766 2.9562963 2.2164894-2.2292592-2.7909575-2.8060741c2.0125532 1.5291852 4.4224468 1.612 6.5728724-.545037 1.3567021-1.2653334 1.7425532-2.4565185 1.7425532-2.4565185l-1.6755319-1.1314815c-.9229788 1.3866666-2.5152128 3.6361481-4.195532 1.9461481l4.2606383-4.2851852 2.655 2.6712593 2.3160639-2.3294074-3.3223405-3.3424445c-1.5520212-1.5609629-.6328723-3.0275555.0124469-3.5793333.3025531.6442222.7448936 1.2624445 1.3078723 1.8296296 2.1485106 2.1676297 4.9260638 2.6038519 7.3685106.1550371 1.3567022-1.2643704 1.7425532-2.4565185 1.7425532-2.4565185zm-3.6564894-1.35537321-2.0211702 2.03377777c-.9890425-1.18251851-.9392553-1.81422222-.3245744-2.43051851.7439361-.7462963 1.4993617-.43044445 2.3457446.39674074zm-12.4879787 12.56088884c-.9890425-1.1825185-.9411702-1.819037-.3284042-2.4353333.7448936-.7462963 1.5003191-.4304444 2.3467021.3967408z" fill="#0f1621" fill-opacity=".7"/><path d="m17.2765957 31.0029116-4.787234 4.8148148-4.78723404-4.8148148zm23.1864894-21.70422223 1.6755319 1.13148153s-.385851 1.1921481-1.7425532 2.4565185c-2.4424468 2.4488148-5.22 2.0125926-7.3685106-.1550371-.5629787-.5671851-1.0053192-1.1854074-1.3078723-1.8296296-.6453192.5517778-1.5644681 2.0183704-.0124469 3.5793333l3.3223405 3.3424445-2.3160639 2.3294074-2.655-2.6712593-4.2606383 4.2851852c1.6803192 1.69 3.2725532-.5594815 4.195532-1.9461481l1.6755319 1.1314815s-.3858511 1.1911851-1.7425532 2.4565185c-2.1504256 2.157037-4.5603192 2.0742222-6.5728724.545037l2.7909575 2.8060741-2.2164894 2.2292592-2.9412766-2.9562963c-1.4993617-1.5041481-2.3495744-1.9596296-3.0829787-1.2277777-.4734626.4731916-.6412814.9796264-.3230465 1.680515.1927374.4244896.5637621.9203059 1.1531529 1.5232627l2.9767021 2.9938519h-4.4339362l-8.25893613-8.3065185 2.22893613-2.2408148 4.195532 4.2187407c-.2020213-.7713333.2901063-1.8825926 1.0924468-2.6905185 1.0388298-1.0448148 3.1385106-1.7304445 5.0706383.2128148l.295851.2946667c-1.4648936-1.9557778-1.6027659-4.3323704.3532979-6.293926 1.8268085-1.8325185 4.103617-1.9981481 6.2157447-.312l-2.7344681-2.7502222 2.0240426-2.0299259 1.5252127 1.274963c-1.2245745-2.1878519.4078724-3.63229634.7937234-3.84703708l1.332766 1.52629628c-.3935107-1.47525925-.0392553-3.02851851 1.313617-4.38533332 2.0240426-2.02992593 4.6062766-2.00007407 6.8984043.312.2211702.22340741.5112766.56718519.8923404.97740741l-4.2510638 4.27651851c1.6803191 1.689037 3.2763829-.5546667 4.1984042-1.94133333zm-16.1444681 11.20551563 2.0182979-2.0385925c-.846383-.8271852-1.6018085-1.1430371-2.3467021-.3967408-.612766.6162963-.6606383 1.2528148.3284042 2.4353333zm12.4879787-12.56088884c-.8463829-.82718519-1.6018085-1.14303704-2.3457446-.39674074-.6146809.61629629-.6644681 1.248.3245744 2.43051851z" fill="#fff" fill-opacity=".3"/></g></svg>',Ei=
{$k:"#0F1621",al:.3,Vk:"#fff",Wk:.6},Di={$k:"#fff",al:1,Vk:"#0F1621",Wk:.7},Gi="1987&ndash;"+Jc(2015,(new Date).getFullYear())+" HERE";xi.prototype.la=function(){var a=this.a,b=a.qb(),c=a.b.pb().bounds;a=a.a;var d=a.a.length,e={},f=0,g,h,k,l=[Gi];if(c)for(;f<d;f++)if(h=a.get(f).getCopyrights(c.I(),b))for(g=0;g<h.length;g++)e[k=h[g].label]||(l.push(k),e[k]=1);return l.join(", ")};xi.prototype.getCopyrights=xi.prototype.la;xi.prototype.Ia=function(){return this.O.style};xi.prototype.i=String.fromCharCode(169);
xi.prototype.s=function(){this.a.removeEventListener(this.a.u.Oi,this.c);this.a.a.removeEventListener("add",this.b);this.a.a.removeEventListener("remove",this.b);this.a.a.removeEventListener("set",this.b);if(this.O.parentNode){var a=this.O;a.parentNode.removeChild(a)}};
xi.prototype.capture=function(a,b,c,d){var e=a.getContext("2d"),f=window.getComputedStyle(this.f.parentElement),g=2*Rb(f.paddingLeft,10),h=(this.f.offsetWidth+2*g)*b,k=this.f.offsetHeight*b,l=Sb(f.getPropertyValue("font-size")),m=this.O.ownerDocument,p=+a.width,q=+a.height,t=zi*b,v=this.qf.childNodes[0].getBoundingClientRect(),x=v.width*b,E=v.height*b,O=vc;r(d)&&(O=function(){d("capture_error")});e.fillStyle=f.backgroundColor;e.fillRect(p-h,q-k,h,k);h=this.i+" "+function(a){a=yi(m,"div",null,a);return a.textContent||
a.innerText||""}(this.la());e.font=l*b+"px "+f.getPropertyValue("font-family");e.fillStyle=f.getPropertyValue("color");e.textBaseline="bottom";e.textAlign="right";e.fillText(h,p-g*b,q);Hi(this,e.font,function(b){(new cf("image",b)).then(function(b){e.drawImage(b,t,q-(E+t),x,E);c(a)},O)},O)};xi.prototype.capture=xi.prototype.capture;
function Hi(a,b,c,d){Ii(A(function(a){a?this.vh?c("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAeCAYAAABe3VzdAAADNklEQVRYR82XW6hVVRSGv7+rmJfSMKSnSkMEfY7EogcJC7tilGRopBAiSaI+SBARQSCIIqgFISih2YW0oAgLCsKXojA0RB+81VugZEFZv/yHuWTt7d7Hfc4+6+h4OWefNfcc3xlj/v+YS1zjoab5bE8DZgGngB8keSg5GwO0PQ54F3i2BnQIWCLpx14hGwG0fT3wOfBwB5DzwOOSDvQC2RTgM8Ae4D/gaeA3YDdwN5AWvyxp+6gD2r4OmAq8AbwInAMmA/OAT4CbgBWStvYClzUjWkHbrwHLgF8LVHJ8DDxah7P9JHCil7M40oA/A7OBC8ANtSqlrQOVs30/8CWQat8r6cxg1RwRQNvPA88Bk4D7gJzBV4A5teSp5MlS4VuA/ZIeu1Kr+wa0/QTwIRDlRhT5eTswBvi2CKOd42AULilndNAYCcA7gK+BmbVMiyXtsh3Qt4FFBTgW8w6wXtLfV4LrSyS2FwAvAWOBX+JtwF0laUDmS/oun23fDNwJnJb0Ty9g1ZphVdB2qrK2LdFfBbb685/AIxXkUKDqa4cMaDs2kjalRe8Fola57J3qRQSJviGHA3gMuAdYI2lDUfDOArQLWAd8VTuTOW9vjUoFy6TIGYpS9wKfAjuK5wVuSfn91iKcvZJeHy5ci0hsZwzNk5Qh3xIFbLyks7aPAtPLgv+L4VZwDwLvA6uKz6XdfcVAi22PBz4q4+lVSRurXW2vKYKIZfwEHCmmXC35HngAyITYD0ys2t8XWflyBfhmvKm24QCk7aVFCPVc7WMszzKucknI+NoHPCUppt13VICZm2nNwjoksByY0SXL72Vi3FieZ97mgrpyqF432H9xScW2O0H+W6oSE/4D2FYuA9kzlUzVTwO3Ad9IOtx3ydo2aLGZLpABm5KW2Z4AfAbMLfsEcpGkKLqRuMwHu0CukrSpCCrvGlF6hBEVL5MUw24kOhp1B8gc+FTqgxpkFLuzSbjk6jpJOkC2tDPeKCkVbDRkO67fDTTC2VK7vgfyBUlfNEpV2zyAK4HNXRLmZfshScdHC6g9T+WDGU2XpkdZdNXhWs6g7dXAhmsJ7jKR2M77bG4kV7Wt9TZfBLgYEC7PSpcIAAAAAElFTkSuQmCC"):c("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAeCAYAAABe3VzdAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIMSURBVFiFzdZPiE1RGADwXzPTTPIMQoodVpbKgpoUG5qExUi8DSVJQv4slJJsbNjYWFhNETWLUUosRDRLUVLCYhIiojFojHkW997uvefNGIuZc99Xp/fOO6/Or++c75xDi0d7hDlWYQNqeB9hvv+OGq6jUWjPsKZKVBbtuKOMy9p3bKqOlsROCWYc27AWr9PfJnCgKlgbluNqivmGDmzBrxR3sCocnMEw7sqXdEAzboeK9uLTFPVbed8VcesxglFJtqNEHbcxlIL68ChADuCSpEgauBULt11SDI3C5yJJdrLCCNsQumMBl+J5AKinY4slBfNTfsRcxJwYsK0YxD3J0r1RPut6Cv/twgp0xoDBBc3LNhr0RwJktNifAn7gsnLmsuxVinyVTn4i7dcLoH4sU96Tp2Pi2uSVehN75Gdev+QO7pIXztmZnLwTvf+AzU+/v5Rn50+A24gP2IW5M4mbJ7+ejgVjJ/EpHXuCa8p77nGK68FX5eWfsTgfTJoh92qu1vAaa+CtPJuDZuEh3CHZUyHyxSSYrL3DWKE/gStm8aybDDkmKYperJM/BrJMnsJuHMLq2YJNh/wsX7JuPAyQfTFg0yGPFMZreCCv4n2xgTQjxyXP+CxquK8iXBYhMlzOtliQBVg4RVuCG/iSto/YHAuWxWFTHyXDWBkbNFkc1cK4LI5rYVwW57QY7i/pZeJv8QQJRQAAAABJRU5ErkJggg=="):
(a=this.qf.cloneNode(!0),a.firstChild.setAttribute("style","font:"+b),c(Ne(a.innerHTML)))},a),d)}xi.prototype.vh=!1;function Ii(a,b){var c="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(Ai),d=Ci;Lb(d)?a(d):(new cf("image",c)).then(function(b){Je.drawImage(b,0,0);try{Je.getImageData(0,0,1,1),d=!1}catch(f){d=18===f.code}finally{Ci=d,a(d)}},b)}
var Fi={"de-DE":"Nutzungsbedingungen","en-US":"Terms of use","en-GB":"Terms of use","es-ES":"Condiciones de uso","fi-FI":"Palveluehdot","fr-FR":"Conditions d'utilisation","it-IT":"Condizioni di utilizzo","nl-NL":"Dienstvoorwaarden","pl-PL":"Warunki \u015bwiadczenia us\u0142ugi","pt-BR":"Termos de servi\u00e7o","pt-PT":"Termos do servi\u00e7o","ru-RU":"\u0423\u0441\u043b\u043e\u0432\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f","tr-TR":"Servis Ko\u015fullar\u0131",
"zh-CN":"\u4f7f\u7528\u6761\u6b3e"};function P(a){var b={};this.i=b.previousSibling=b.nextSibling=b;this.j=new Oe;P.l.constructor.call(this,a);a&&"objects"in a&&this.gd(a.objects)}w(P,L);u("H.map.Group",P);P.prototype.type=yg.GROUP;P.prototype.fe=function(a,b){this.c=!0;a=P.l.fe.call(this,a,b);this.c=!1;a&&this.forEach(Ji,!0);return a};P.prototype.setProvider=P.prototype.fe;function Ji(a,b,c){a.fe(c.a)}P.prototype.contains=function(a){var b=this===a;if(!b&&this.b&&C(a,L))for(;!b&&a;)a===this?b=!0:a=a.Va;return b};
P.prototype.contains=P.prototype.contains;P.prototype.Ze=function(){this.B=B;this.forEach(Ki,!0)};P.prototype.resetZInfo=P.prototype.Ze;function Ki(a){a.Ze()}P.prototype.c=!1;P.prototype.Aa=function(a){var b=P.l.Aa.call(this,a);b&&!this.c&&(this.f=a,this.forEach(Li,!0),delete this.f);return b};P.prototype.invalidate=P.prototype.Aa;function Li(a,b,c){a.Aa(c.f)}
P.prototype.forEach=function(a,b,c){var d;if(this.b){var e=this.i;var f=e.nextSibling;for(d=0;f!==e;){var g=f.nextSibling;a.call(c,f,d++,this);b&&C(f,P)&&f.forEach(a,b,c);f=g}}};P.prototype.forEach=P.prototype.forEach;P.prototype.Cb=function(a){var b=[];this.forEach(Mi,a,b);return b};P.prototype.getObjects=P.prototype.Cb;P.prototype.I=function(){var a=null;this.b&&this.forEach(function(b){(b=b.I())&&(a?a=a.jc(b):a=b)});return a};P.prototype.getBoundingBox=P.prototype.I;
function Mi(a){this.push(a)}P.prototype.b=0;P.prototype.Zl=function(){return this.b};P.prototype.getChildCount=P.prototype.Zl;
P.prototype.T=function(a){var b=this.i,c=b.previousSibling;C(a,L,this.T,0);if(a.contains(this))throw new nc(this.T,"The new object contains the parent group");var d=a.Va;if(d!==this){if(d){d=a.previousSibling;var e=a.nextSibling;d.nextSibling=e;e.previousSibling=d}a.Va=this;L.l.ba.call(a,this);c.nextSibling=a;a.previousSibling=c;a.nextSibling=b;b.previousSibling=a;this.b++}a.yi=this.j.next();a.Ze();a.fe(this.a,this.T)||a.Aa(vg.Z_ORDER);return a};P.prototype.addObject=P.prototype.T;
P.prototype.gd=function(a){var b;Qb(a,this.gd,0);var c=a.length;for(b=0;b<c;b++)this.T(a[b])};P.prototype.addObjects=P.prototype.gd;P.prototype.La=function(a){if(!a||a.Va!==this)throw new nc(this.La,"object not found");var b=a.previousSibling,c=a.nextSibling;b.nextSibling=c;c.previousSibling=b;a.Va=null;L.l.ba.call(a,null);delete a.previousSibling;delete a.nextSibling;C(a.a,M)&&a.fe(null,this.La);this.b--;return a};P.prototype.removeObject=P.prototype.La;
P.prototype.td=function(a){var b;Qb(a,this.td,0);var c=a.length;for(b=0;b<c;b++)this.La(a[b])};P.prototype.removeObjects=P.prototype.td;P.prototype.ha=function(){var a=this.Cb();this.td(a)};P.prototype.removeAll=P.prototype.ha;P.prototype.U=function(){var a=P.l.U.call(this);a.type="Group";return a};P.prototype.forWorkerMessage=P.prototype.U;function Ni(a,b,c,d,e){b&&(this.b=b);Lb(c)&&(this.Fg=!!c);this.Fg&&d&&(this.Hg=new uh(d.w,d.h));Lb(e)&&(this.c={crossOrigin:e});switch(Oi[Pb(a)]){case 2:this.rd=a;Pi(this,1);break;case 1:if(Ye(a)){this.rd=a;Qi(this);Pi(this,1);break}a=a.src;case 0:if(a){a=Ne(a);this.a=new cf("image",a,B,this.c);this.a.then(A(this.In,this),A(this.Hn,this));break}default:throw Pi(this,-1),new D(Ni,0,"No image data");}}n=Ni.prototype;n.C=0;n.getState=function(){return this.C};
function Pi(a,b){a.C=b;delete a.a;a.b&&a.b(b,a)}n.Fg=!0;function Qi(a){if(a.Fg){var b=a.rd,c=Ri(a),d=c&&c.w||+b.width,e=c&&c.h||+b.height,f=Fe();if(C(b,y.HTMLCanvasElement))c=b;else{c=b.ownerDocument.createElement("canvas");c.width=d*f;c.height=e*f;var g=c.getContext("2d");g.scale(f,f);g.drawImage(b,0,0,d,e)}a.rd=c}}n.rd=z;n.getData=function(){return this.rd};var Oi={String:0,HTMLImageElement:1,HTMLCanvasElement:2};n=Ni.prototype;n.Hg=z;n.Db=function(){return 1===this.C?Ri(this):z};
function Ri(a){var b=a.Hg,c;if(!b){var d=a.rd;b=d.naturalWidth||d.width;if(0===b&&Le&&1===Oi[Pb(d)]){var e=!0;if(c=d.parentNode)var f=d.nextSibling;document.body.appendChild(d)}a.Hg=b=new uh(d.naturalWidth||d.width,d.naturalHeight||d.height);e&&(c?c.insertBefore(d,f):document.body.removeChild(d))}return b}n.In=function(a){this.rd=a;Qi(this);Pi(this,1)};n.Hn=function(){Pi(this,-1)};n.cancel=function(){this.a&&this.a.cancel()};function Si(a,b){var c,d="anonymous";this.uid=Ti.next();Si.l.constructor.call(this);if(b){var e="size";if(e in b){var f=b[e];if(!f||isNaN(f.w)||isNaN(f.h))throw new D(Si,1,e);this.c=new uh(f.w,f.h)}e="anchor";if(e in b){f=b[e];if(!f||isNaN(f.x)||isNaN(f.y))throw new D(Si,1,e);this.a=new H(f.x,f.y)}e="hitArea";e in b&&(f=b[e],C(f,vh,Si,1),this.g=b[e]);e="asCanvas";e in b&&(c=b[e]);e="crossOrigin";e in b&&(d=b[e]);f=b.stickHeight;f===+f&&0<f&&(this.io=f);e="stickColor";f=b[e];e in b&&ra(f)&&(this.ho=
f)}a=new Ni(a,A(this.i,this),c,this.c,d);b=this.C=a.getState();0!==b?this.i(b,a):this.f=a}w(Si,G);u("H.map.Icon",Si);var Ti=new Oe;Si.State={ERROR:-1,LOADING:0,READY:1};Si.prototype.getState=function(){return this.C};Si.prototype.getState=Si.prototype.getState;Si.prototype.i=function(a,b){this.b=b.getData();if(1===a){var c=this.c;c||(c=this.c=b.Db());this.a||(this.a=new H(c.w/2|0,c.h))}this.f&&(this.C=a,delete this.f,this.dispatchEvent("statechange"))};Si.prototype.b=z;Si.prototype.Xc=function(){return this.b};
Si.prototype.getBitmap=Si.prototype.Xc;Si.prototype.c=z;Si.prototype.Db=function(){return this.c};Si.prototype.getSize=Si.prototype.Db;Si.prototype.a=z;Si.prototype.ld=function(){return this.a};Si.prototype.getAnchor=Si.prototype.ld;Si.prototype.g=z;Si.prototype.om=function(){return this.g};Si.prototype.getHitArea=Si.prototype.om;Si.prototype.s=function(){Si.l.s.call(this);this.b?(this.b.removeAttribute("src"),delete this.b):(this.f.cancel(),delete this.f)};function Ui(a,b,c,d,e,f){Ui.l.constructor.call(this,isNaN(a)?15:a,b,c,d,e,f)}w(Ui,Tf);Ui.prototype.m=function(a){for(var b,c,d,e=this.head;a;){if(b=a.entries)if(c=b.length){if(2>c&&(d=a.parent)&&1===d.a){d.removeChild(a);e===a&&(e=d);d.entries=b;a=b[0].node=d;continue}}else if(delete a.entries,d=a.parent)if(d.removeChild(a),e===a&&(e=d),1===d.a){a=d.a?d[0]||d[1]||d[2]||d[3]:null;continue}a=z}this.head!==e&&(this.head=e,Zf(this))};
Ui.prototype.Cc=function(a,b){if(dg(this.a,a,b,a,b))return Vi(this,this.a,a,b,this.c);throw Error("Coordinates out of bounds");};function Vi(a,b,c,d,e){var f=b.entries;if(e)if(b.a)f=Wi(a,b,c,d,e);else if(f){f=f[0];var g=bg(b,f[1]>=b[8]|(f[0]>=b[9])<<1);g.entries=b.entries;delete b.entries;f.node=g;Zf(a,g);f=Wi(a,b,c,d,e)}else cg(b,f=new Xi(c,d)),Zf(a,b),Xf(a,f,!0);else f||Zf(a,b),cg(b,f=new Xi(c,d)),Xf(a,f,!0);return f}function Wi(a,b,c,d,e){return Vi(a,bg(b,c>=b[8]|(d>=b[9])<<1),c,d,e-1)}
function Xi(a,b){this.id=ag++;this[0]=b;this[1]=a}Xi.prototype.md=function(a){return this[a%2]};function Yi(){this.a=new Ui(10,180,90,0,0,!0)}n=Yi.prototype;n.Ch=0;n.Yc=function(){return this.Ch};n.N=null;n.I=function(){var a=this.N,b;!a&&(b=Vf(this.a))&&(this.N=a=new J(-b[0],b[3],-b[2],b[1]));return a};n.Cc=function(a){++this.Ch;this.N=null;return this.a.Cc(a.lng,-a.lat)};n.remove=function(a){if(a=this.a.remove(a))--this.Ch,this.N=null;return a};
n.Mf=function(a){var b=this.a,c=a.Qb(),d=a.Nb(),e=-c.lat;c=c.lng;var f=-d.lat;d=d.lng;var g;a.Gb()?g=b.Za(-180,e,d,f).concat(b.Za(c,e,180,f)):g=b.Za(c,e,d,f);return g};function Zi(a,b,c){this.c=a;this.a=b;this.f=c;this.b={}}function $i(a){return{"translucent-pattern-lines":{color:gi("strokeColor"),width:gi("lineWidth * $meters_per_pixel"),join:a?a:gi("lineJoin"),cap:gi("lineCap"),tail_cap:gi("lineTailCap"),head_cap:gi("lineHeadCap"),miter_limit:gi("miterLimit"),order:"function() { return 2 + feature.effectiveZIdx / 2; }",interactive:!0,dash:gi("lineDash"),extrude:!0,dash_phase:gi("lineDashOffset")}}};function aj(a,b,c,d){this.a=a;this.b=b;this.c=c;this.kf=d}function bj(a,b,c,d){a={type:b,uid:a.b,tiled:c,max_zoom:a.c};d&&Pa(a,d);return a};function cj(a){this.a=a};function dj(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.f=d;this.kf=e}
function ej(a){if(a.a&32&&!(a.a&16))return{};var b=new aj(a.a,a.b,a.c,a.kf);var c=new cj(a.a);a=new Zi(a.a,a.b,a.f);var d={},e=b.b;b=b.a&1?bj(b,"ObjectSource",!1,{progressiveUpdate:!0,has_volatile_data:!!(b.a&128)}):b.a&2?bj(b,"RemoteRasterTileSource",!0,{url:""}):bj(b,"ObjectTileSource",!0,{tile_size:b.kf});d[e]=b;b={};c.a&2&&(b={"translucent-raster":hi("raster","inlay",1)});c.a&28&&(e={"translucent-polygons":hi("polygons","inlay",2),"translucent-extruded-polygons":hi("polygons","translucent",3),
"translucent-pattern-lines":hi("pattern-lines","translucent",4),"translucent-overlays":hi("overlays","inlay",5),markers:hi("custom_icons","overlay",6,!1)},e["translucent-pattern-lines"].crop_by_tile=!!(c.a&64),e.markers.suppress_fade=!0,e.markers.stick=!0,Pa(b,e));a.c&2&&(a.b["tile_layer_"+a.a]=ji(a.a,"_default",{"translucent-raster":{color:[1,1,1,a.f],order:0}}));if(a.c&4){c=$i();e=a.b;var f="polygon_layer_"+a.a;var g=ji(a.a,"polygons",void 0,"function(){return sources[$source].isVisible(feature, $zoom)}");
g.flat={filter:"function(){return !feature.height && !feature.min_height;}",draw:ii(!1)};g.extruded={filter:"function(){return feature.height || feature.min_height;}",draw:ii(!0)};e[f]=g;a.b["outline_layer_"+a.a]=ji(a.a,"outlines",c,"function(){return sources[$source].isVisible(feature, $zoom)}");c=$i("round");a.b["polyline_layer_"+a.a]=ji(a.a,"polylines",c,"function(){return sources[$source].isVisible(feature, $zoom)}")}a.c&8&&(a.b["overlay_layer_"+a.a]=ji(a.a,"overlays",{"translucent-overlays":{color:[1,
1,1,a.f],order:16382,interactive:!0}},"function(){return sources[$source].isVisible(feature, $zoom)}"));a.c&16&&(a.b["marker_layer_"+a.a]=ji(a.a,"markers",{markers:{sprite:fi("icon.id"),offset:fi("icon.offset"),collide:!1,priority:16383,elevate_by_altitude:!0,interactive:!0,stick:{color:fi("icon.stick_color"),height:fi("icon.stick_height")}}},"function(){return sources[$source].isVisible(feature, $zoom)}"));return{sources:d,styles:b,layers:a.b}};function fj(a,b){fj.l.constructor.call(this);this.C=gj.INIT;this.a=null;if(b&&Mh(b))throw new D(fj,1,"Base URL must be absolute");this.b=b;if(hj.test(a))this.A=a,b||(this.b=Mh(this.A)?B:this.A);else if(ra(a))this.c=a;else if(wa(a))ij(this,Na(a));else throw new D(fj,0,jj);}w(fj,G);u("H.map.Style",fj);fj.prototype.getState=function(){return this.C};fj.prototype.getState=fj.prototype.getState;fj.prototype.Kd=function(){return this.b};fj.prototype.getBaseUrl=fj.prototype.Kd;fj.prototype.Ef=function(){return Na(this.a)};
fj.prototype.getConfig=fj.prototype.Ef;fj.prototype.load=function(){var a=this;if(this.A)this.C=gj.LOADING,(new cf("text/plain",this.A)).then(function(a){return Nh(a)}).then(function(b){ij(a,b)},function(b){kj(a,b.message)}),this.A=null;else if(this.c){this.C=gj.LOADING;try{ij(this,Nh(this.c))}catch(b){kj(this,b.message)}this.c=null}};fj.prototype.load=fj.prototype.load;
fj.prototype.Pk=function(a,b,c){var d;lj(this);a=mj(this,a,this.Pk,c);for(c=0;c<a.length;c++){var e=a[c].sb.draw;for(d in e){var f=e[d];Ph(f)&&(f.interactive=!!b)}}nj(this)};fj.prototype.setInteractive=fj.prototype.Pk;
fj.prototype.setProperty=function(a,b,c){var d,e=a.split("."),f=0,g=e.length;lj(this);if(!Lb(b))throw new D(this.setProperty,1,"value");if(d=oj(this.a,e)){if(!(d.parent instanceof Object)||d.parent instanceof Array)if(c)e.pop(),e=oj(this.a,e),d.parent=e.parent[e.Zf]={};else throw new D(this.setProperty,0,a+" property is not primitive type");d.parent[d.Zf]=b}else{for(d=this.a;f!==g-1;)d[e[f]]={},d=d[e[f++]];d[e[f]]=b}pj(this)&&nj(this)};fj.prototype.setProperty=fj.prototype.setProperty;
fj.prototype.Om=function(a){lj(this);return(a=oj(this.a,a.split(".")))?Na(a.node):void 0};fj.prototype.getProperty=fj.prototype.Om;fj.prototype.removeProperty=function(a){lj(this);(a=oj(this.a,a.split(".")))&&a.parent&&a.parent.hasOwnProperty(a.Zf)&&(delete a.parent[a.Zf],pj(this)&&nj(this))};fj.prototype.removeProperty=fj.prototype.removeProperty;fj.prototype.Rf=function(a){lj(this);if(!wa(a))throw new D(this.Rf,0,"config");ij(this,Oh(this.a,a))};fj.prototype.mergeConfig=fj.prototype.Rf;
fj.prototype.rj=function(a,b,c){var d;lj(this);var e=this.a;var f=e.layers;var g=mj(this,a,this.rj,!1);a=g.length;for(d={};a--;)Xh(d,f,g[a].id,!!b,!!c);c={};g=Object.keys(e);for(a=g.length;a--;){var h=g[a];var k=e[h];c[h]=k===f?d:Na(k)}b||nj(this);return c};fj.prototype.extractConfig=fj.prototype.rj;fj.prototype.toString=function(){return this.C===gj.READY?y.H.gl.yaml.safeDump(this.a,{lineWidth:120}):""};fj.prototype.s=function(){fj.l.s.call(this);this.a=this.c=this.A=null};
function pj(a){var b=a.a,c;if(wa(b)){var d;if(d=a.f){b=b&&b.sources;d=!1;for(var e in b)if(b[e].type===a.f){d=!0;break}d=!(b?d:1)}d&&(c="invalid source, the only valid type is "+a.f)}else c=jj;c&&kj(a,c);return!c}function kj(a,b){a.a=null;a.C=gj.ERROR;var c=qj;Fd(a.W,qa(c)?String(c):void 0)?a.dispatchEvent(new Gc(qj,b,a)):console.error(b)}function nj(a){a.dispatchEvent(new Ec(rj,a))}function ij(a,b){a.a=b;pj(a)&&(a.C=gj.READY,nj(a))}
function lj(a){if(a.C!==gj.READY)throw new nc(a.Rf,"style is not ready yet");}function mj(a,b,c,d){var e=[],f=Qb(b)?b:[b],g,h;void 0===d&&(d=!0);for(f=f.sort().reverse();g=f.pop();){b=String(g).split(".");a:{var k=a.a;for(var l=b.length;l--&&!Uh[b[l]];);if(k&&0>l&&(k=Sh(k.layers,b),Ph(k)))break a;k=Qh}if(k===Qh)throw new D(c,0,'Unresolvable layer ID "'+g+'"');e.push({id:b,sb:k});if(d)for(h in k)!Uh[h]&&Ph(k[h])&&f.push(g+"."+h)}return e}
function oj(a,b){var c=0,d;for(d=b.length;c!==d;){var e=b[c++];var f=a;a=f[e];if(!a)break}return c===d?{node:a,parent:f,Zf:e}:void 0}var hj=/^(http[s]?)?.*\.ya?ml/,jj="invalid style configuration",gj={ERROR:-1,INIT:0,LOADING:1,READY:2};fj.State=gj;var rj="change",qj="error";function li(a){var b=""+Qe(),c;li.l.constructor.call(this);a=a||{};this.min=a.min||0;this.max=a.max||22;if(c=a.uri){if(/_/.test(c))throw new D(li,0,"uri "+c);}else c=b;this.uri=c||b;this.uid=b;a.getCopyrights&&Ob(a.getCopyrights,"Function",li)&&(this.getCopyrights=a.getCopyrights);this.f=this.f.bind(this);this.ja=!0}w(li,G);u("H.map.provider.Provider",li);li.prototype.i={ie:"configchange",Fa:"update"};function sj(a,b){a.dispatchEvent(new Ec(a.i.Fa,b))}li.prototype.f=function(){this.dispatchEvent(this.i.ie)};
li.prototype.s=function(){G.prototype.s.call(this);this.c&&(this.c.removeEventListener(rj,this.f),this.c=null)};li.prototype.la=function(){return null};li.prototype.getCopyrights=li.prototype.la;li.prototype.m=function(){var a=0;this.di()&&(a|=1);this.providesRasters()&&(a|=2);this.providesSpatials()&&(a|=4);this.providesOverlays()&&(a|=8);this.providesMarkers()&&(a|=16);this.providesDomMarkers()&&(a|=32);return a};li.prototype.di=Se;li.prototype.Ue=Se;li.prototype.providesRasters=li.prototype.Ue;
li.prototype.Gc=Se;li.prototype.providesSpatials=li.prototype.Gc;li.prototype.ei=Se;li.prototype.providesOverlays=li.prototype.ei;li.prototype.Ub=Se;li.prototype.providesMarkers=li.prototype.Ub;li.prototype.Tb=Se;li.prototype.providesDomMarkers=li.prototype.Tb;li.prototype.ai=vc;li.prototype.j=1;function tj(a,b){b=ld(b,0,1);F(b)&&(b=1);a.j!==b&&(a.j=b,a.ja&&uj(a),a.f(),sj(a))}
li.prototype.yd=function(a,b){this.c&&(this.c.removeEventListener(rj,this.f),this.c.removeEventListener(qj,this.f));this.c=a;this.c.addEventListener(rj,this.f);this.c.addEventListener(qj,this.f);b||this.f();this.ja=!1};li.prototype.setStyleInternal=li.prototype.yd;li.prototype.Eb=function(){this.c||uj(this);return this.c};li.prototype.getStyleInternal=li.prototype.Eb;function uj(a){var b=new dj(a.m(),a.uid,a.max,a.j,a.tileSize);a.c=new fj(ej(b));a.ja=!0}
function vj(a){a=a.m();var b=wj;a&1?b=xj:a&2?b=null:a&28&&(b=yj);return b}li.prototype.km=function(){return!1};li.prototype.getFeatureProxy=li.prototype.km;function zj(a){var b;Mb(this,zj);zj.l.constructor.call(this,a);this.$a=a=[];for(b in yg)a[yg[b]]=new ug}w(zj,li);u("H.map.provider.ObjectProvider",zj);zj.prototype.di=Re;zj.prototype.providesByViewport=zj.prototype.di;zj.prototype.Pb=function(a){return this.$a[a||yg.ANY]};zj.prototype.getInvalidations=zj.prototype.Pb;zj.prototype.Wd=function(a,b){if(b!==vg.NONE){var c=this.$a[yg.ANY];var d=c.a+1;c.update(d,b);c=this.$a[a.type];c.update(d,b);a.Pb().update(d,b);sj(this,a)}};
zj.prototype.invalidateObject=zj.prototype.Wd;zj.prototype.requestOverlays=zj.prototype.ud;zj.prototype.requestSpatials=zj.prototype.eg;zj.prototype.requestSpatialsByTile=zj.prototype.fg;zj.prototype.jb=!1;zj.prototype.requestMarkers=zj.prototype.Ic;zj.prototype.requestDomMarkers=zj.prototype.Hc;function M(a){a=a||{};M.l.constructor.call(this,a);this.b=a=new P({provider:this,min:a.min,max:a.max});a.ba(this);this.P=new ig;this.o=new ig;this.g=new Yi;this.u=new ig;this.D=new Yi;this.G=new ig}w(M,zj);u("H.map.provider.LocalObjectProvider",M);M.prototype.m=function(){return 125};M.prototype.Eb=function(){if(!this.L){this.L=M.l.Eb.call(this);var a=new dj(this.m()|128,this.uid+"_vol",this.max,this.j,this.tileSize);this.L.Rf(ej(a))}return this.L};M.prototype.gc=function(){return this.b};
M.prototype.getRootGroup=M.prototype.gc;M.prototype.Wd=function(a,b){b&vg.SPATIAL&&this.T(a);M.l.Wd.call(this,a,b)};M.prototype.invalidateObject=M.prototype.Wd;M.prototype.T=function(a){var b;C(a,L,this.T,0);if(a.a!==this)throw new nc(this.T,"foreign object");this.La(a);var c=a.type;if(c===yg.MARKER)if((b=a.pa())instanceof I){var d=!0;c=this.g}else c=this.u;else c===yg.DOM_MARKER?(b=a.pa())instanceof I?(d=!0,c=this.D):c=this.G:c=c===yg.OVERLAY?this.P:this.o;d=d?c.Cc(b):c.Mj(a.I());d.Ji=a;a.$=d};
M.prototype.La=function(a){var b;if(a)if(a.a!==this){if(C(a,L))throw new nc(this.La,"foreign object");}else if(b=a.$){var c=a.type;c===yg.MARKER?this.g.remove(b)||this.u.remove(b):c===yg.DOM_MARKER?this.D.remove(b)||this.G.remove(b):c===yg.OVERLAY?this.P.remove(b):this.o.remove(b);delete b.Ji;delete a.$}};M.prototype.removeObject=M.prototype.La;
function Aj(a,b,c,d,e,f){var g;f=f||[];if(b.Yc())for(a=b!==a.g&&b!==a.u,e=!e,b=b.Mf(c),c=b.length,g=0;g<c;g++){var h=b[g].Ji;for(var k,l=Lc(d),m=h;(k=m.o<=l&&m.u>=l)&&(m=m.Va););k&&(e||h.Ac(!0))&&(a||1===h.Ab().getState())&&f.push(h)}return f}M.prototype.ei=function(){return 0<this.P.Yc()};M.prototype.providesOverlays=M.prototype.ei;M.prototype.ud=function(a,b,c){return Aj(this,this.P,a,b,c).filter(function(a){return a.Xc()})};M.prototype.requestOverlays=M.prototype.ud;
M.prototype.Gc=function(){return 0<this.o.Yc()};M.prototype.providesSpatials=M.prototype.Gc;M.prototype.eg=function(a,b,c){return Aj(this,this.o,a,b,c)};M.prototype.requestSpatials=M.prototype.eg;M.prototype.fg=function(a,b){return Aj(this,this.o,a.Ff(),a.zL,b)};M.prototype.requestSpatialsByTile=M.prototype.fg;M.prototype.Ub=function(){return 0<this.g.Yc()+this.u.Yc()};M.prototype.providesMarkers=M.prototype.Ub;M.prototype.Ic=function(a,b,c){var d=Aj(this,this.g,a,b,c);Aj(this,this.u,a,b,c,d);return d};
M.prototype.requestMarkers=M.prototype.Ic;M.prototype.Tb=function(){return 0<this.D.Yc()+this.G.Yc()};M.prototype.providesDomMarkers=M.prototype.Tb;M.prototype.Hc=function(a,b,c){var d=Aj(this,this.D,a,b,c);Aj(this,this.G,a,b,c,d);return d};M.prototype.requestDomMarkers=M.prototype.Hc;M.prototype.s=function(){M.l.s.call(this);this.b.ha()};var Bj={PENDING:0,ACTIVE:1,DONE:2};u("H.map.render.RenderState",Bj);function Cj(a,b){b=b||{};var c;if(!C(a,Element))throw new D(Cj,0,a);var d=a.ownerDocument.createElement("div");this.O=a;Cj.l.constructor.call(this);this.padding=new Dj(0,0,0,0);this.center=new H(0,0);this.margin=0;this.element=d;d.style.zIndex=0;d.style.height=d.style.width="100%";d.style.position="relative"===a.style.position?"absolute":"relative";this.resize();a.appendChild(d);(c=b.padding)!==B&&this.si(c.top,c.right,c.bottom,c.left);this.mi((c=b.margin)!==B?c:0)}w(Cj,G);
u("H.map.ViewPort",Cj);Cj.prototype.a={Fa:"update",ne:"sync"};Cj.prototype.mi=function(a){if(this.margin!==+a){if(F(this.margin=+a))throw new D(this.mi,0,a);Ej(this);this.dispatchEvent(this.a.Fa)}};Cj.prototype.setMargin=Cj.prototype.mi;Cj.prototype.si=function(a,b,c,d){var e=this.padding;if(e.top!==a||e.right!==b||e.bottom!==c||e.left!==d){if(F(a+b+c+d))throw new D(this.si);e.top=a;e.right=b;e.bottom=c;e.left=d;Ej(this);this.dispatchEvent(this.a.Fa)}};Cj.prototype.setPadding=Cj.prototype.si;
function Ej(a){var b=a.padding;a.center.set((a.width+b.left-b.right)/2<<0,(a.height+b.top-b.bottom)/2<<0)}Cj.prototype.resize=function(){var a=this.O.offsetWidth,b=this.O.offsetHeight;if(this.width!==a||this.height!==b)this.c=new uh(this.width,this.height),this.width=a,this.height=b,Ej(this),this.dispatchEvent(this.a.Fa)};Cj.prototype.resize=Cj.prototype.resize;function Fj(a,b){a.dispatchEvent(new Bh(a.a.ne,a.c,b,Bh.prototype.SIZE))}
Cj.prototype.s=function(){y.clearTimeout(this.b);this.b=null;this.O.removeChild(this.element);this.element=this.O=null;Cj.l.s.call(this)};Cj.prototype.oc=fc;Cj.prototype.startInteraction=Cj.prototype.oc;Cj.prototype.ic=fc;Cj.prototype.interaction=Cj.prototype.ic;Cj.prototype.zb=fc;Cj.prototype.endInteraction=Cj.prototype.zb;function Gj(a,b,c,d,e,f){var g;for(g=[];d<=e;d++)g=g.concat(Hj(a,c,d));a=g.length;si.call(this,f,a);this.j=c=[];this.f=A(this.f,this);this.c=A(this.c,this);for(this.R(1);a--;)f=g[a],c.push(Ij(b,f[0],f[1],f[2],this.f,this.c))}w(Gj,si);Gj.prototype.f=function(){vi(this,2)};Gj.prototype.c=function(){vi(this,4)};Gj.prototype.qe=function(){for(var a=this.j,b=a.length;b--;)a[b].cancel();this.j=z};function Jj(a,b){var c=this;if(!r(b))throw new D(Kj,1,b);if(!r(a.next||r(a.cycle)))throw new D(Jj,2,'Argument "mode" must implement H.util.AsyncQueue.Mode');this.b=[];this.c=[];this.g=a;this.i=b;this.j=function(){Lj(c)};this.a=null;this.f=function(){c.a||(c.a=y.setTimeout(c.j,1))}}u("H.util.AsyncQueue",Jj);Jj.prototype.push=function(a,b){if(!r(b))throw new D(this.push,1,b);a=Mj(new Nj,a,this.f,b);this.b.push(a);this.f();return a};Jj.prototype.push=Jj.prototype.push;
function Lj(a){var b=a.c,c=0,d=a.g;d.Nc=Oj();for(a.a=null;c<b.length;){var e=b[c];e.Pj?b.splice(c,1):c++}for(;e=d.next(a.b,a.c);)e.cancelled?e.done(null,"cancelled"):(b.push(e),a.i(e,e.data))}function Nj(){Mj(this,null,null,null)}Jj.Task=Nj;function Mj(a,b,c,d){a.data=b;a.cancelled=!1;a.Pj=!1;a.b=c;a.c=d;a.a=null;return a}Nj.prototype.done=function(a,b){this.Pj=!0;this.b();this.c(this,a,b)};Nj.prototype.done=Nj.prototype.done;Nj.prototype.cancel=function(){this.a&&this.a();this.cancelled=!0};
Nj.prototype.cancel=Nj.prototype.cancel;Nj.prototype.$n=function(a){this.a=a;return this};Nj.prototype.setCancelFn=Nj.prototype.$n;function Pj(a,b){Pj.l.constructor.call(this,new Qj(a),b)}w(Pj,Jj);u("H.util.SequentialQueue",Pj);function Qj(a){if(isNaN(a)||0>a)throw new D(Pj,1,'Argument "maxTime" must be a positive number');this.a=a;this.Nc=Oj()}Qj.prototype.next=function(a){return a.length&&Oj()-this.Nc<this.a?a=a.shift():null};function Rj(a){Mb(this,Rj);Rj.l.constructor.call(this,a);if(a&&"tileSize"in a){var b=Oc(+a.tileSize)/Zc;if(isNaN(b)||b%1||0>b||30<b)throw new D(Rj,0,"tileSize: "+a.tileSize);this.tileSize=+a.tileSize}}w(Rj,li);u("H.map.provider.TileProvider",Rj);function Sj(a,b){return id(a)-8-Kc(id(b))}Rj.getZoomLevelOffset=Sj;Rj.prototype.Jf=function(a,b,c){return this.uri.concat("_",a,"_",b,"_",c)};Rj.prototype.getTileKey=Rj.prototype.Jf;Rj.prototype.kf=256;Rj.prototype.tileSize=Rj.prototype.kf;function Tj(){}u("H.util.ICache",Tj);Tj.prototype.add=function(){};Tj.prototype.add=Tj.prototype.add;Tj.prototype.get=function(){};Tj.prototype.get=Tj.prototype.get;Tj.prototype.zf=function(){};Tj.prototype.drop=Tj.prototype.zf;Tj.prototype.forEach=function(){};Tj.prototype.forEach=Tj.prototype.forEach;Tj.prototype.ha=function(){};Tj.prototype.removeAll=Tj.prototype.ha;Tj.prototype.be=function(){};Tj.prototype.registerOnDrop=Tj.prototype.be;Tj.prototype.Pg=function(){};
Tj.prototype.deRegisterOnDrop=Tj.prototype.Pg;function Uj(a,b,c){this.g=[];b&&this.be(b);if(c&&!r(c))throw new D(Uj,2,c);this.b=0;this.filter=c;this.a={};this.f=this.c=null;this.oi(a)}u("H.util.Cache",Uj);Uj.prototype.add=function(a,b,c){c=+c;if(!Tb(c)||0>c)throw new D(this.add,2,c);a=String(a);var d=this.a[a];var e=!0;this.filter&&(e=this.filter(a,b,c));d?e?(this.b+=c-d.size,d.size=c,d.data=b,Vj(this,d)):Wj(this,d,!0):e&&(this.a[a]=Xj(this,{id:a,data:b,size:c,kc:null,dd:null},this.c));Yj(this);return e};Uj.prototype.add=Uj.prototype.add;
Uj.prototype.be=function(a){if(!r(a))throw new D(this.be,0,a);this.g.push(a)};Uj.prototype.registerOnDrop=Uj.prototype.be;Uj.prototype.Pg=function(a){this.g=this.g.filter(function(b){return b!==a})};Uj.prototype.deRegisterOnDrop=Uj.prototype.Pg;Uj.prototype.get=function(a,b){return(a=b?this.a[a]:Vj(this,this.a[a]))&&a.data};Uj.prototype.get=Uj.prototype.get;Uj.prototype.zf=function(a){var b;(b=this.a[a])&&Wj(this,b,!0)};Uj.prototype.drop=Uj.prototype.zf;
Uj.prototype.forEach=function(a,b,c){var d;for(d in this.a){var e=this.a[d];(c?c(d,e.data,e.size):1)&&a.call(b,d,e.data,e.size)}};Uj.prototype.forEach=Uj.prototype.forEach;Uj.prototype.ha=function(a){var b;for(b in this.a){var c=this.a[b];(a?a(b,c.data,c.size):1)&&Wj(this,this.a[b],!0)}};Uj.prototype.removeAll=Uj.prototype.ha;Uj.prototype.oi=function(a){if(!(0<+a))throw new D(Uj.prototype.oi,0,a);this.i=+a;Yj(this);return this};Uj.prototype.setMaxSize=Uj.prototype.oi;Uj.prototype.Cm=function(){return this.i};
Uj.prototype.getMaxSize=Uj.prototype.Cm;Uj.prototype.cm=function(){return this.b};Uj.prototype.getCurrentSize=Uj.prototype.cm;function Vj(a,b){b&&(a.c=Xj(a,b,a.c));return b}function Yj(a){for(;a.b>a.i&&a.f;)Wj(a,a.f,!0)}function Xj(a,b,c){if(c!==b){(b.kc||b.dd)&&Wj(a,b);if(b.kc=c)b.dd=c.dd,c.dd=b;b.dd||(a.c=b);b.kc||(a.f=b);a.b+=b.size}return b}
function Wj(a,b,c){var d=b.dd,e=b.kc;if(d||e||b==a.c&&b==a.f)if(d?d.kc=e:a.c=e,e?e.dd=d:a.f=d,a.b-=b.size,c){for(c=a.g.length;c--;)a.g[c].call(a,b.id,b.data,b.size);delete a.a[b.id]}b.kc=b.dd=null};var Zj,ak=function(){function a(){}for(var b,c,d,e=Jb("o ms moz webkit "),f=5;f--&&!b;)b=e[f],b=(c=y[b+(b?"R":"r")+"equestAnimationFrame"])&&!F(c.call(window,a))&&(d=y[b+(b?"C":"c")+"ancelAnimationFrame"]);Zj=b?function(a){return c.call(y,a)}:function(a){return y.setTimeout(a,25)};return b?function(a){return d.call(y,a)}:function(a){return y.clearTimeout(a)}}(),Oj=y.performance&&y.performance.now?function(){return y.performance.now()}:function(){return y.Date.now()};function Zg(a,b,c,d,e,f){var g,h,k=a.length,l,m;if(k)for(g=[];k--;){var p=a[k];var q=p.length;var t=0;for(l=1;l<q;l++)if(m=bk(p[l-1],p[l],c,b,d,e)){var v=m[0];var x=m[1];t&&t.da(v)?h.push(x):g.push(h=m);t=x;f&&(l=q,k=0)}}else g=a;return g}u("H.math.clipping.clipStrips",Zg);
function bk(a,b,c,d,e,f){var g=a.x;a=-a.y;var h=b.x;b=-b.y;c=-c;f=-f;if(g>h){if(h>e||g<d)return;var k=g;var l=a;g=h;a=b;h=k;b=l;k=1}else if(g>e||h<d)return;if(a>b){if(b>c||a<f)return;var m=1;a=-a;b=-b;l=f;f=-c;c=-l}else if(a>c||b<f)return;if(g<d){if((a+=(d-g)*(b-a)/(h-g))>c)return;g=d}if(a<f){if((g+=(f-a)*(h-g)/(b-a))>e)return;a=f}h>e&&(b=a+(e-g)*(b-a)/(h-g),h=e);b>c&&(h=g+(c-a)*(h-g)/(b-a),b=c);m&&(a=-a,b=-b);return k?[new H(h,-b),new H(g,-a)]:[new H(g,-a),new H(h,-b)]}
function kh(a,b,c){a=ck(a,!0);b=ck(b,!1);var d,e;var f={};var g=d=1;switch(~~(c||0)){case 1:g=d=0;break;case 2:d=0;g=1;break;case 3:d=1,g=0}c=d;var h=g;if(b&&a){b.xf=dk(b.x,b.y,null,ek(b));a.xf=dk(a.x,a.y,null,ek(a));for(g=b;g.next;g=g.next)if(!g.Za)for(d=a;d.next;d=d.next)if(!d.Za){var k=fk(g.next);var l=fk(d.next);if(e=gk(g,k,d,l,f)){e=f.wl;var m=f.xl;var p=f.qo;var q=f.ro;e=dk(p,q,null,null,null,null,!0,0,0,e);hk(e,g,k);k=dk(p,q,null,null,null,null,!0,0,0,m);hk(k,d,l);e.Qh=k;k.Qh=e}}f=nh(b,a);
c&&(f=!f);for(g=b;g;g=g.next)g.Za&&(g.Ug=f,f=!f);f=nh(a,b);h&&(f=!f);for(d=a;d.next;d=d.next)d.Za&&(d.Ug=f,f=!f);ik(b);for(ik(a);(a=jk(b))!=b;){for(c=null;!a.qg;a=a.Qh){for(f=a.Ug;;){c=dk(a.x,a.y,c);c.artificial=a.Za||a.ln;a.qg=1;a=f?a.next:a.Sb;if(!a)break;if(a.Za){a.qg=1;break}}if(!a)break}c.Rh=t;var t=c}return t}}u("H.math.clipping.clipPolygon",kh);
function dk(a,b,c,d,e,f,g,h,k,l){a={x:a,y:b,next:c||null,Sb:d||null,Rh:e||null,Qh:f||null,Za:!!g,Ug:h||0,qg:k||0,alpha:l||0};d&&(a.Sb.next=a);c&&(a.next.Sb=a);return a}function fk(a){for(;a&&a.Za;)a=a.next;return a}function ek(a){if(a)for(;a.next;)a=a.next;return a}function jk(a){var b=a;if(b){do b=b.next;while(b!=a&&(!b.Za||b.Za&&b.qg))}return b}function ik(a){var b=ek(a);b.Sb.next=a;a.Sb=b.Sb}
function gk(a,b,c,d,e){var f,g=b.x-a.x,h=b.y-a.y;var k=d.x-c.x;var l=d.y-c.y;var m=g*l-h*k;if(!m)return 0;k=((c.x-a.x)*l-(c.y-a.y)*k)/m;m=(h*(c.x-a.x)-g*(c.y-a.y))/m;if(0>k||1<k||0>m||1<m)return 0;0===k?f=a:1===k?f=b:0===m?f=c:1===m&&(f=d);if(f)return f.x+=2.480549651603763E-5,f.y+=7.321997314118067E-5,f.xf&&(f.xf.x=f.x,f.xf.y=f.y),gk(a,b,c,d,e);e.qo=a.x+k*g;e.ro=a.y+k*h;e.wl=k;e.xl=m;return 1}
function nh(a,b){var c=[];if(Array.isArray(b))c=b.reduce(function(a,b){a.push(b.x,b.y);return a},c);else for(;b;)c.push(b.x,b.y),b=b.next;return pd(a.x,a.y,c,0,!0)!==od.NONE}function hk(a,b,c){for(b=b.next;b!==c&&b.alpha<=a.alpha;)b=b.next;a.next=b;a.Sb=b.Sb;a.next.Sb=a;a.Sb.next=a}function ck(a,b){for(var c,d=null,e=0,f=a.length;e<f;e++){c=dk(a[e].x,a[e].y,d);c.ln=b;if(c.next=d)d.Sb=c;d=c}return d};function kk(a,b,c,d){this.key="";this.x=a;this.y=b;this.z=c;this.data=d;this.valid=!0}u("H.map.provider.Tile",kk);function lk(a,b,c,d){a-=c;b-=d;return a*a+b*b}function mk(a,b,c){return nk(a,b*b,c||0,0,a.length-1)}u("H.math.simplifyDP",mk);
function nk(a,b,c,d,e){var f=0,g=d,h=a[d].x,k=a[d].y,l=a[e].x,m=a[e].y,p=d+1,q=lk(h,k,l,m);if(q)for(;p<e;){var t=a[p++];var v=t.x;t=t.y;var x=((v-h)*(l-h)+(t-k)*(m-k))/q;v=0>x?lk(v,t,h,k):1<x?lk(v,t,l,m):lk(v,t,h+x*(l-h),k+x*(m-k));v>f&&(f=v,g=p-1)}else for(;p<e;)t=a[p++],v=t.x,t=t.y,v=lk(v,t,h,k),v>f&&(f=v,g=p-1);f>=b||0<c&&g-d?(--c,1<g-d?(d=nk(a,b,c,d,g),d.splice(d.length-1,1)):d=[a[d]],d=1<e-g?d.concat(nk(a,b,c,g,e)):d.concat(a.slice(g,e+1))):d=[a[d],a[e]];return d};function ok(a,b,c,d,e,f,g,h){ok.l.constructor.call(this,b,c,d,null);this.key=a;this.W=h;this.a=e;this.g=f;this.i={};this.zL=g;this.u=Mc(Cg.MAX_LINE_WIDTH/2*this.g+1)}w(ok,kk);u("H.map.provider.SpatialTile",ok);ok.prototype.c=hd;ok.prototype.o=hd;ok.prototype.b=hd;function pk(a){return a.W.getInvalidations(yg.SPATIAL)}
function qk(a){var b=pk(a),c=b.a,d=a.c,e=d===c,f;if(!(e||b.Oj(d)||b.xh(d))){e=a.f;var g=a.i;if(b.Of(d))for(f=e.length;f--;){var h=e[f];if(h.Pb().Of(d)){e.splice(f,1);var k=k||rk(a,h.eb())}}if(b.yh(d)){for(f=e.length;f--;)if(h=e[f],h.Pb().yh(d)){var l=1;if((h=g[h.eb()])&&h.a){k=1;break}}l&&e.sort(sk)}if(!k&&b.Yd(d))for(f=e.length;f--;)if(e[f].Pb().Yd(d)){var m=1;break}a.o!==d||m||(a.o=c,a.b!==d||k||(a.b=c));a.c=c;e=!0}return e}
ok.prototype.Xd=function(){var a=pk(this),b=a.a,c=this.b,d=c===b;d||(this.W.jb&&!a.Yd(c)?d=!0:qk(this)&&(d=this.b===b));return d};ok.prototype.isCanvasValid=ok.prototype.Xd;Object.defineProperty(ok.prototype,"valid",{get:function(){return this.Xd()},set:vc,configurable:!0});function tk(a,b){this.b=a;this.a=b}function rk(a,b){a=a.i;var c=a[b];if(c)return delete a[b],c.a}ok.prototype.f=Te;
function uk(a){var b=pk(a),c=a.c,d=a.f,e;if(!qk(a)){for(e=d.length;e--;){var f=d[e];var g=f.Pb();(g.Of(c)||g.xh(c))&&rk(a,f.eb())}a.f=a.W.requestSpatialsByTile(a,!1,!1).sort(sk);a.c=b.a}}function sk(a,b){return Ag(zg(a),zg(b),!1)}ok.prototype.Cb=function(){return this.f};ok.prototype.getObjects=ok.prototype.Cb;var vk={};ok.prototype.Ke=function(){var a=this.a+"_"+this.g,b=vk[a];if(!b){b=-this.u;var c=this.a-b;b=vk[a]=new Dj(b,b,c,c)}return b};ok.prototype.getPxClipRect=ok.prototype.Ke;
ok.prototype.Ff=function(){var a=this.Xa;if(!a){var b=this.Hf();a=0;var c=this.a;this.z&&(c-=a+=this.Ke().top);a=this.Xa=Pf(b.Se(new H(a,a)),b.Se(new H(c,c)))}return a};ok.prototype.getGeoClipRect=ok.prototype.Ff;ok.prototype.Hf=function(){var a=this.v;if(!a){var b=this.a;a=this.v=new Hh(B,b);a.Ea(this.z);a.x=this.x*b;a.y=this.y*b}return a};ok.prototype.getPxProj=ok.prototype.Hf;ok.prototype.fb=function(){return this.g};ok.prototype.getPixelRatio=ok.prototype.fb;
ok.prototype.$f=function(){var a=this.data;this.data=null;this.b=hd;return a};ok.prototype.releaseCanvas=ok.prototype.$f;ok.prototype.ag=function(){this.i={};delete this.f;this.c=hd};ok.prototype.releaseData=ok.prototype.ag;
ok.prototype.V=function(a){var b=a.getContext("2d"),c,d,e,f,g=0;uk(this);if(this.b<this.c){var h=this.f;if(c=h.length){a.width=a.height=this.a;b.clearRect(0,0,this.a,this.a);var k=this.i;for(d=0;d<c;d++){var l=h[d];var m=l.eb();if(f=(e=k[m])?e.b:l.getGeometriesForTile(this)){if(e)l.Pb().Yd(this.b)&&(e.a=Lg(l,f)),e=e.a;else{e=Lg(l,f);var p;var q=f;for(var t=l.j?2:0,v=q.length;v--;){var x=q[v];if(x!==Mg){var E=x.a;for(p=E.length;p--;)x=E[p],4<x.length&&(E[p]=mk(x,.6,t))}}this.i[m]=new tk(f,e)}if(e){b.save();
q=l.j?this.D:this.B;for(m=0;m<f.length;m++)q.call(this,l,f[m],l.Ia(),b);if(f=l.getLabels(this))for(l=b,m=f.length;m--;)for(t=f[m],q=t.size,l.font=q+"px "+t.font,l.fillStyle=t.color,l.textAlign="center",l.translate(t.x,t.y),l.rotate(t.angle),q=t.lineHeight||1.375*q,v=t.lines,t=v.length;t--;)l.fillText(v[t],0,t*q);b.restore()}g|=e}}}this.data=g?a:null;this.o=this.b=this.c}else this.data&&(g=1);return 0<g};ok.prototype.render=ok.prototype.V;
ok.prototype.B=function(a,b,c,d){var e;c.Me&&(wk(d,c,this.g),xk(b,d,!1,!0,!1,this.a,this.u));c.Le&&(e=a.f)&&e.Rb&&(yk(d,e),zk(this,d,b,e,c.lineWidth))};
ok.prototype.D=function(a,b,c,d){var e=c.Rb,f=c.Me,g,h=this.a,k=this.u;if(b===Mg)e&&(yk(d,c),d.fillRect(0,0,h,h));else{f&&wk(d,c,this.g);if(c.Le&&(g=a.f)){var l=c.lineWidth;g.Rb||(g=null)}a=b.c;if(a===gd){if(f||e)yk(d,c),xk(b,d,!0,f,e,h,this.u);g&&(yk(d,g),zk(this,d,b,g,l,0))}else e&&(yk(d,c),xk(b,d,!0,!1,e,h,k,0,a)),f&&xk(b,d,!1,f,!1,h,k,a),g&&(yk(d,g),zk(this,d,b,g,l,a))}};
function xk(a,b,c,d,e,f,g,h,k){var l=a.a,m=-g;g=f+g;h=h||0;k===B&&(k=l.length);if(e&&a===Mg)b.fillRect(0,0,f,f);else if(k>h){b.beginPath();for(f=h;f<k;f++){var p=l[f];var q=p.length;if(p===eh)b.moveTo(m,m),b.lineTo(m,g),b.lineTo(g,g),b.lineTo(g,m);else{var t=p[0];b.moveTo(t.x,t.y);for(h=1;h<q;h++)t=p[h],b.lineTo(t.x,t.y)}c&&b.closePath()}c&&e&&b.fill(a.b!==gd?"evenodd":"nonzero");d&&b.stroke()}}
function wk(a,b,c){var d;a.strokeStyle=b.strokeColor;a.lineWidth=b.lineWidth*c;a.lineCap=b.lineCap;a.lineJoin=b.lineJoin;a.miterLimit=b.miterLimit;a.setLineDash&&(d=b.lineDash)!==Te&&(a.setLineDash(d),a.lineDashOffset=b.lineDashOffset)}function yk(a,b){a.fillStyle=b.fillColor}
function zk(a,b,c,d,e,f){var g=e*d.width/2;e=e*d.length/2;var h=e/2;d=2*e*d.frequency;var k=Pc(Qc(e,2)+Qc(g,2));a=a.a-k;a=new Dj(k,k,a,a);c=c.a;var l,m,p,q,t,v,x,E=$c/2;f=f||0;for(k=c.length;k-- >f;){var O=0;var Y=c[k];if(m=l=Y.length){var Ga=Y;m=Ga.length;for(p=0;--m;)p+=Ga[m].bb(Ga[m-1]);m=(Ga=p)>=d}if(m)for(m=Ic(Lc(Ga/d),1E3),m=Ga/(m+1),p=m/2;--l;){for(q=(t=Y[l]).bb(v=Y[l-1]);p<=O+q;){var pa=t.x+(v.x-t.x)*(x=(p-O)/q);x=t.y+(v.y-t.y)*x;a.wf(pa,x)&&(b.save(),b.translate(pa,x),b.rotate(-Xc((v.y-t.y)/
(t.x-v.x))+(t.x<v.x?E:-E)),b.beginPath(),b.moveTo(-g,-e),b.lineTo(0,e),b.lineTo(g,-e),b.lineTo(0,-h),b.closePath(),b.fill(),b.restore());p+=m}O+=q}}}var Ak=[];
ok.prototype.Ha=function(a,b,c){for(var d=this.f,e=d.length,f,g,h,k,l,m,p=Te,q,t=this.g;e--;)if(g=d[e],g.Ac(!0)&&(h=this.i[g.eb()])&&(k=h.b)){f=g.Ia();m="none"!==f.fillColor&&g.j;q="none"===f.strokeColor?0:f.lineWidth*t;for(f=k.length;f--;){l=k[f];var v;if(!(v=m&&l===Mg)&&(v=m||q)){var x;v=a;var E=b,O=m,Y=q,Ga=l.b,pa=l.c,Ma=pa!==gd,ja=l.a,Wb=ja.length,ob=0,Uc=0,ci=!1;for(l=0;l<Wb;l++){var ye=ja[l];var Eb=l>=pa;var di=!Eb&&l>=Ga;if(ye===eh&&O)di?ob++:Uc++;else{var ei=ye.length;Ak.length=2*ei;for(x=
0;x<ei;x++){var Kf=ye[x];Ak[2*x]=Kf.x;Ak[2*x+1]=Kf.y}x=O&&!Eb;Eb=Ma&&!Eb?0:Y;if(x||Eb)if(Eb=pd(v,E,Ak,Eb,x),Eb===od.EDGE||Eb===od.VERTEX){ci=!0;break}else if(Eb===od.SURFACE)if(di)ob++;else if(Uc++,Ga===gd)break}}v=ci||0<Uc&&!(ob%2)}if(v){p===Te&&(p=[]);p.push(g);break}}if(c&&p.length)break}return p};function Bk(a,b){var c;Bk.l.constructor.call(this,b);this.D=a;this.G=a=b.pixelRatio;this.tileSize=c=1<<Kc(id((b.tileSize||256)*a));this.P=Sj(c,a);this.Fh=A(this.Fh,this);this.Th=A(this.Th,this);this.Gh=A(this.Gh,this);this.Eh=A(this.Eh,this);this.o=A(this.o,this);this.D.addEventListener(li.prototype.i.Fa,this.o,!1,this);this.b=[];this.g=new Uj(b.tileCacheSize||256,this.Fh);this.u=new Uj(b.dataCacheSize||512,this.Th);this.B=new Pj(20,this.Gh);this.a={};this.v=Oj()}w(Bk,Rj);
Bk.prototype.o=function(a){a.target.type===yg.SPATIAL&&sj(this,a.target)};Bk.prototype.ib=function(a,b,c,d){var e=this.getTileKey(a,b,c),f;if(f=this.g.get(e,d)){if(d||f.Xd())return f;d||this.g.zf(e)}if((f=this.u.get(e,d))&&(d||qk(f)))return a=this.b.pop()||document.createElement("canvas"),f.V(a)||this.b.push(a),this.g.add(e,f,1),f;d||((f=this.a[e])?f.count++:(f=this.B.push([e,a,b,c],this.Eh),f.count=1,this.a[e]=f))};Bk.prototype.requestTile=Bk.prototype.ib;Bk.prototype.jd=function(){};
Bk.prototype.Tc=function(a,b,c){this.tf(this.getTileKey(a,b,c))};Bk.prototype.cancelTile=Bk.prototype.Tc;Bk.prototype.tf=function(a){var b;if(b=this.a[a])b.count--,b.count||(b.cancel(),delete this.a[a])};Bk.prototype.cancelTileByKey=Bk.prototype.tf;n=Bk.prototype;n.Gh=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3];c=this.g.get(c)||new ok(c,d,e,f,this.tileSize,this.G,f+this.P,this.D);d=c.data||this.b.pop()||document.createElement("canvas");c.V(d)||this.b.push(d);b.push(c);a.done(c)};
n.Eh=function(a,b){a=a.data[0];b&&this.g.add(a,b,1);delete this.a[a];sj(this)};n.Fh=function(a,b){b.data&&this.b.push(b.$f());this.u.add(a,b,1)};n.Th=function(a,b){b.ag()};n.s=function(){for(var a in this.a)this.a[a].cancel();this.g.ha();this.u.ha();this.b.length=0;Bk.l.s.call(this)};function Ck(a,b){b=b||{};if(!a)throw new D(Dk,0,a);this.tileSize=a.tileSize;this.c={};ki.call(this,{min:void 0!==b.min?b.min:a.min,max:void 0!==b.max?b.max:a.max,minWorldSize:this.tileSize,projection:b.Fo,dark:b.dark,provider:a})}w(Ck,ki);u("H.map.layer.BaseTileLayer",Ck);Ck.prototype.Ae=function(a,b){var c=this.pixelProjection;if(!C(a,J))throw new D(this.Ae,0,a);if(!F(b)){var d=c.Fj();c.Ea(b)}a=Ek(c.kb(a.Qb()),c.kb(a.Nb()));!F(d)&&c.Ea(d);return a};Ck.prototype.geoRectToRect=Ck.prototype.Ae;
Ck.prototype.Ud=function(a,b){var c=Qc(2,Lc(b)),d=this.tileSize;if(!C(a,Dj))throw new D(this.Ud,0,a);if(F(b=+b))throw new D(this.Ud,1,b);b=Lc(a.left/d);b===c&&--b;var e=Lc(a.right/d);e===c&&--e;return new Dj(b,ld(Lc(a.top/d),0,c-1),e,ld(Lc(a.bottom/d),0,c-1))};Ck.prototype.getTileBounds=Ck.prototype.Ud;Ck.prototype.ib=function(a,b,c,d){return this.a.requestTile(a,b,c,d)};Ck.prototype.Tc=function(a,b,c){this.a.cancelTile(a,b,c)};Ck.prototype.cancelTile=Ck.prototype.Tc;
Ck.prototype.la=function(a,b){return this.a.getCopyrights?this.a.getCopyrights(a,b):null};Ck.prototype.getCopyrights=Ck.prototype.la;function Fk(a,b,c,d,e){d=Lc(d);var f=Qc(2,d),g=b.left,h=b.top,k=b.right;c=k+(c?f+(k===b.left?0:1):1);var l=b.bottom,m=[];if(e){var p=g+(1+k-g)/2+e.x/a.tileSize-.5;var q=h+(1+l-h)/2+e.y/a.tileSize-.5}for(;g<c;){for(h=b.top;h<=l;)a=g%f,m.push([a,h,d,e?Nc(p-g)+Nc(q-h):0]),h++;g++}return m}
function Hj(a,b,c){c=Lc(c);a.pixelProjection.Ea(c);b=a.Ae(b);var d=a.Ud(b,c);return Fk(a,d,b.left>b.right,c)}
Ck.prototype.Je=function(a,b,c,d,e,f){var g,h=[],k,l=this.a;f=null!=f?f:"__default__";var m=l.requestTile;if(!C(a,Dj))throw new D(this.Je,0,a);if(F(c=+c))throw new D(this.Je,1,c);d||(g={});b=Fk(this,a,b,c,e);if(a=b.length)for(d||b.sort(Gk),c=a;c--;)e=b[c],d||(g[l.Jf.apply(l,e)]=!0),e[3]=+d,(k=m.apply(l,e))&&h.push(k);if(!d){d=g;var p;g=this.c[f]||{};for(p in g)g.hasOwnProperty(p)&&g[p]&&!d[p]&&this.a.cancelTileByKey(p);this.c[f]=d}return{total:a,tiles:h}};Ck.prototype.getProviderTiles=Ck.prototype.Je;
function Gk(a,b){return b[3]-a[3]};function Q(a){Mb(this,Q);Q.l.constructor.call(this,a);this.g={};this.u={};this.dc=new Hk;this.hd=A(this.hd,this);this.P=Ik;this.createTileInternal=this.jd.bind(this)}w(Q,Rj);u("H.map.provider.RemoteTileProvider",Q);Q.prototype.Md=function(){return 1};Q.prototype.getEntryWeight=Q.prototype.Md;var Ik=new Uj(65536);Q.prototype.Ob=function(){return this.P};Q.prototype.getCache=Q.prototype.Ob;Q.prototype.v=ba(2);Q.prototype.hd=function(a){var b=this.uri;return!a.indexOf(b)&&"_"===a.charAt(b.length)};
Q.prototype.cacheFilter=Q.prototype.hd;Q.prototype.$a=function(a,b){b.valid=!1};Q.prototype.reload=function(a){var b,c=this.getCache();a?c.ha(this.hd):c.forEach(this.$a,this,this.hd);for(b in this.g)this.g[b].cancel(),this.u[b].cancel();this.g={};this.u={};sj(this)};Q.prototype.reload=Q.prototype.reload;Q.prototype.pe=function(){return!1};Q.prototype.canStore=Q.prototype.pe;Q.prototype.MAX_STORE_TIME=Infinity;Q.prototype.Sd=function(){return this.dc};Q.prototype.getStorage=Q.prototype.Sd;
Q.prototype.L=function(a,b){b(a)};function Ij(a,b,c,d,e,f){var g=a.Sd();d=~~d;return a.requestInternal(b,c,d,function(h,k){g.put(a.Jf(b,c,d),k&&{raw:k.raw,timestamp:y.Date.now()},e,f)},f,0)}Q.prototype.requestInternal=Q.prototype.Pa;
Q.prototype.ib=function(a,b,c,d){var e=this;var f=this.getCache();if(F(a=+a))throw new D(this.ib,0,a);if(F(b=+b))throw new D(this.ib,0,b);if(F(c=+c))throw new D(this.ib,0,c);c=~~c;var g=this.getTileKey(a,b,c);f=f.get(g);f&&f.valid||d||this.g[g]||(f=B,this.requestTileAsPromise(a,b,c,d).then(function(a){sj(e,a)},vc));return f};Q.prototype.requestTile=Q.prototype.ib;
Q.prototype.Ck=function(a,b,c,d){var e=this,f=this.getCache(),g=this.getTileKey(a,b,c),h=this.g,k=this.u,l,m=this.Sd();if(k[g])return k[g];k[g]=k=new gb(function(k,q){l=m.get(g,function(l){var p,t;var E=function(d,h){t=e.createTileInternal(a,b,c,d,h);t.key=g;f.add(g,t,e.Md(d));k(t);Jk(e,g)};l&&(p=y.Date.now()-l.timestamp);l&&p<e.MAX_STORE_TIME?e.L(l.raw,E):(p&&m.remove(g),(t=f.get(g))&&t.valid||d?k(t||null):h[g]=e.requestInternal(a,b,c,E,q))},q)});h[g]||(h[g]=l);k.then(function(){Jk(e,g)},function(){Jk(e,
g)});return k};Q.prototype.requestTileAsPromise=Q.prototype.Ck;Q.prototype.Bk=function(a,b){var c=this,d=a.id,e=a.tile.coords;return new gb(function(a,g){c.Ck(e.x,e.y,e.z,b).then(function(b){var c=z;b=b.Cb?b.Cb():b.data;for(var e=b.length,f;e--;)if(f=b[e],f.eb()===d){c=f;break}a(c)},g)})};Q.prototype.requestObjectAsPromise=Q.prototype.Bk;function Jk(a,b){delete a.g[b];delete a.u[b]}var Kk={cancel:function(){}};Q.prototype.jd=function(a,b,c,d){return new kk(a,b,c,d)};
Q.prototype.tf=function(a){var b=this.g[a];b&&(b.cancel(),this.u[a].cancel(),Jk(this,a))};Q.prototype.cancelTileByKey=Q.prototype.tf;Q.prototype.Tc=function(a,b,c){this.cancelTileByKey(this.getTileKey(a,b,c))};Q.prototype.cancelTile=Q.prototype.Tc;Q.prototype.s=function(){var a;Q.l.s.call(this);this.getCache().ha(this.hd);for(a in this.g)this.g[a].cancel(),this.u[a].cancel(),Jk(this,a)};function Hk(){}Q.NullStorage=Hk;Hk.prototype.get=function(a,b){b();return Kk};Hk.prototype.get=Hk.prototype.get;
Hk.prototype.put=function(a,b,c){c&&c()};Hk.prototype.put=Hk.prototype.put;Hk.prototype.clear=function(a){a&&a()};Hk.prototype.clear=Hk.prototype.clear;Hk.prototype.remove=function(a,b){b&&b()};Hk.prototype.remove=Hk.prototype.remove;function Kj(a){Kj.l.constructor.call(this,a);a&&(this.B={crossOrigin:a.crossOrigin||"anonymous"},this.D=a.getURL);if(!r(this.D))throw new D(Kj,0,"getURL");tj(this,a.opacity);this.a=y.URL||y.webkitURL;a=this.B.crossOrigin;if(!(a="anonymous"===a||"use-credentials"===a)){a=this.D(0,0,0);var b=window.location,c=document.createElement("a");c.href=a;a=c.hostname===b.hostname&&c.port===b.port&&c.protocol===b.protocol}(this.$=a&&!!cf.prototype.b.arraybuffer&&!!this.a)&&this.Ob().be(A(this.jb,this))}
w(Kj,Q);u("H.map.provider.ImageTileProvider",Kj);Kj.prototype.mc=function(a){tj(this,a)};Kj.prototype.setOpacity=Kj.prototype.mc;Kj.prototype.Zc=function(){return this.j};Kj.prototype.getOpacity=Kj.prototype.Zc;Kj.prototype.Ue=Re;Kj.prototype.providesRasters=Kj.prototype.Ue;Kj.prototype.Md=function(){return this.tileSize};Kj.prototype.getEntryWeight=Kj.prototype.Md;
Kj.prototype.Pa=function(a,b,c,d,e,f){var g=this,h=this.D(a,b,c),k;a=null;if(h){var l=y.setTimeout(function(){g.$?k=(new cf("arraybuffer",h,f,g.B)).then(function(a){return a.blob()}).then(function(a){var b=new Image;b.onload=A(d,null,b,{raw:a});b.onerror=A(e,null,"bad url");try{b.src=g.a.createObjectURL(a)}catch(q){}},e):k=(new cf("image",h,f,g.B)).then(d,e)},150);a={cancel:function(){k?k.cancel():y.clearTimeout(l)}}}else d(null);return a};Kj.prototype.requestInternal=Kj.prototype.Pa;
Kj.prototype.L=function(a,b){var c=new Image;c.onload=function(){b(this)};c.src=this.a.createObjectURL(a)};Kj.prototype.jb=function(a,b){(a=b.data)&&a instanceof HTMLImageElement&&this.a.revokeObjectURL(a.src)};function Dj(a,b,c,d){this.left=+a;this.top=+b;this.right=+c;this.bottom=+d}u("H.math.Rect",Dj);Dj.prototype.set=Dj;Dj.prototype.set=Dj.prototype.set;Dj.prototype.Qb=function(){return this.c||(this.c=new H(this.left,this.top))};Dj.prototype.getTopLeft=Dj.prototype.Qb;Dj.prototype.Nb=function(){return this.a||(this.a=new H(this.right,this.bottom))};Dj.prototype.getBottomRight=Dj.prototype.Nb;Dj.prototype.wf=function(a,b){return this.left<=a&&this.right>=a&&this.top<=b&&this.bottom>=b};
Dj.prototype.containsXY=Dj.prototype.wf;function Ek(a,b){return new Dj(a.x,a.y,b.x,b.y)}Dj.fromPoints=Ek;Dj.prototype.clone=function(){return new Dj(this.left,this.top,this.right,this.bottom)};Dj.prototype.clone=Dj.prototype.clone;function Dk(a,b){Ck.call(this,a,b)}w(Dk,Ck);u("H.map.layer.TileLayer",Dk);Dk.prototype.vd=function(a,b,c,d,e){if(!C(a,J))throw new D(this.vd,0,a);if(F(b=+b))throw new D(this.vd,1,b);b=Lc(b);this.pixelProjection.Ea(b);a=this.Ae(a);var f=this.Ud(a,b);return this.Je(f,a.left>a.right,b,c,d,e)};Dk.prototype.requestTiles=Dk.prototype.vd;function Lk(a,b){b=b?La(b):{};b.tileSize=b.tileSize||256;b.pixelRatio=b.pixelRatio||Fe();b.max=24;this.c=new Bk(a,b);this.f=new Dk(this.c);b.minWorldSize=this.c.tileSize;b.provider=a;Lk.l.constructor.call(this,b);this.tileSize=this.f.tileSize;this.j=A(this.j,this);this.c.addEventListener(this.c.i.Fa,this.j);a.addEventListener("update",this.j)}w(Lk,ki);u("H.map.layer.ObjectLayer",Lk);Lk.prototype.j=function(a){a.currentTarget!==this.c&&a.target.type===yg.SPATIAL||this.g()};
var Mk={markers:Te,total:0};Lk.prototype.Ic=function(a,b,c){var d=this.a,e;return d.providesMarkers()&&(e=d.requestMarkers(a,b,!0,c)).length?{markers:e,total:e.length}:Mk};Lk.prototype.requestMarkers=Lk.prototype.Ic;Lk.prototype.Hc=function(a,b,c){var d=this.a,e;return d.providesDomMarkers()&&(e=d.requestDomMarkers(a,b,!0,c)).length?{markers:e,total:e.length}:Mk};Lk.prototype.requestDomMarkers=Lk.prototype.Hc;var Nk={tiles:Te,total:0};
Lk.prototype.vd=function(a,b,c,d){if(this.a.providesSpatials()){var e=this.f.vd(a,b,c,d);c||(c=this.c,e=Oj(),33<e-c.v&&(Lj(c.B),c.v=e),e=this.f.vd(a,b,!0,d))}else e=Nk;return e};Lk.prototype.requestTiles=Lk.prototype.vd;Lk.prototype.ib=function(a,b,c,d){return this.f.ib(a,b,c,d)};Lk.prototype.requestTile=Lk.prototype.ib;Lk.prototype.Tc=function(a,b,c){this.f.Tc(a,b,c)};Lk.prototype.cancelTile=Lk.prototype.Tc;var Ok={overlays:Te,total:0};
Lk.prototype.ud=function(a,b,c){var d=this.a,e=Ok;d.providesOverlays&&d.providesOverlays()&&(a=d.requestOverlays(a,b,!0,c),b=a.length)&&(e={overlays:a,total:b});return e};Lk.prototype.requestOverlays=Lk.prototype.ud;Lk.prototype.s=function(){this.c.F();this.f.F();this.a.dispose();Lk.l.s.call(this)};function Pk(a,b,c,d){var e=new Dj(0,0,0,0);Pk.l.constructor.call(this);if(!a)throw new D(Pk,0,a);if(!b)throw new D(Pk,1,b);if(!c)throw new D(Pk,2,c);if("object"!==typeof d)throw new D(Pk,3,d+" is not an object");if("number"!==typeof d.pixelRatio)throw new D(Pk,3,d.pixelRatio+" is not a number");this.ga=d.pixelRatio;this.zoom=0;this.hb=Oc(this.ga)/Zc;this.b=new Hh;this.qc={1:e.clone(),2:e.clone(),4:e.clone()};this.c=new H(.5,.5);this.j=a;Qk(this,this.ga);this.oc=A(this.oc,this);this.ic=A(this.ic,this);
this.zb=A(this.zb,this);a.startInteraction=this.oc;a.interaction=this.ic;a.endInteraction=this.zb;a.addEventListener(a.a.Fa,this.$,!1,this);this.D=b;this.nc=A(this.nc,this);this.control=A(this.control,this);this.yb=A(this.yb,this);b.startControl=this.nc;b.control=this.control;b.endControl=this.yb;b.addEventListener(b.a.Fa,this.Ng,!1,this);this.i=c;this.Tf=A(this.Tf,this);this.Oe=A(this.Oe,this);this.Pe=A(this.Pe,this);this.Sf=A(this.Sf,this);c.addEventListener(ki.prototype.b.Fa,this.Tf,!1,this);c.addEventListener(c.b.he,
this.Oe,!1,this);c.addEventListener(c.b.le,this.Pe,!1,this);c.addEventListener(c.b.me,this.Sf,!1,this)}w(Pk,G);u("H.map.render.RenderEngine",Pk);function Qk(a,b){var c=a.j,d=c.width,e=c.height,f=c.padding,g=f.top,h=f.left,k=f.bottom;f=f.right;c=c.margin;var l=-(d+h-f)/2<<0,m=-(e+g-k)/2<<0;d+=l;e+=m;a=a.qc;a[1].set((l-c)*b,(m-c)*b,(d+c)*b,(e+c)*b);a[2].set(l*b,m*b,d*b,e*b);a[4].set((l+h)*b,(m+g)*b,(d-f)*b,(e-k)*b)}Pk.prototype.$=function(){Qk(this,this.ga)};
Pk.prototype.s=function(){var a=this.j,b=this.D,c=this.i;a.removeEventListener(a.a.Fa,this.$,!1,this);a.startInteraction===this.oc&&(a.startInteraction=Cj.prototype.oc);a.interaction===this.ic&&(a.interaction=Cj.prototype.ic);a.endInteraction===this.zb&&(a.endInteraction=Cj.prototype.zb);b.removeEventListener(b.a.Fa,this.Ng,!1,this);b.startControl===this.nc&&(b.startControl=Rk.prototype.nc);b.control===this.control&&(b.control=Rk.prototype.control);b.endControl===this.yb&&(b.endControl=Rk.prototype.yb);
c.removeEventListener(ki.prototype.b.Fa,this.Tf,!1,this);c.removeEventListener(c.b.he,this.Oe,!1,this);c.removeEventListener(c.b.le,this.Pe,!1,this);c.removeEventListener(c.b.me,this.Sf,!1,this)};Pk.prototype.control=function(){};Pk.prototype.capture=function(){return qb(Error("not implemented"))};function Sk(a,b){a.style.transition="opacity 1.5s";a.addEventListener("transitionend",b,!1);a.style.opacity=0}var Tk={ZOOM:1,HEADING:2,TILT:4,INCLINE:8,COORD:16};Pk.InteractionModifiers=Tk;n=Pk.prototype;
n.Vj={Ui:"render"};n.Tf=function(a){this.lk(a);this.ma()};n.Oe=function(a){this.Qe(a.idx,a.added)};n.Pe=function(a){this.Uh(a.idx,a.removed,a.type===this.i.b.me)};n.Sf=function(a){a.removed&&this.Pe(a);this.Oe(a)};n.lk=vc;n.Qe=function(a,b){this.th(a,b);0===a&&this.Kb();C(b,ki)&&Uk(this,b,!0);this.de();this.ma()};
n.Kb=function(){var a=this.i.ab();if(0<a.length){var b=a[0].max;this.Ag=a[0].min;this.tg=b}else a=this.getCapabilities().lookAt.zoom,b=a.max,this.Ag=a.min,this.tg=b;a=Vk(this,this.zoom);a!==this.zoom&&(this.zoom=a,this.b.Ea(a),Wk(this))};function Wk(a,b){a.P=a.pb();b&&(a.P.position=b);a.P.zoom=a.zoom-a.hb;a.P.position.alt=0}n.lo=0;n.heading=180;n.pb=function(){return Xk(this,{position:this.b.projection.Yf(this.c),zoom:this.zoom,tilt:this.lo,heading:this.heading})};
function Xk(a,b){b.tilt=Yk(a,b.tilt);b.heading=Zk(a,b.heading);b.incline=a.getCapabilities().lookAt.incline.min;return b}function Vk(a,b){var c=a.getCapabilities().lookAt.zoom;return ld(b,Jc(c.min,a.Ag),Ic(c.max,a.tg))}function Yk(a,b){a=a.getCapabilities().lookAt.tilt;return ld(b,a.min,a.max)}function Zk(a,b){a=a.getCapabilities().lookAt.heading;return ld((b%360+360)%360,a.min,a.max)}
function Uk(a,b,c){c=c?b.addEventListener:b.removeEventListener;c.call(b,b.b.Qi,a.Vh,!1,a);c.call(b,b.b.Pi,a.Vh,!1,a)}n.th=vc;n.Uh=vc;n.ao=function(a,b){this.B={aj:a,Zi:b}};Pk.prototype.setOnRenderCallbacks=Pk.prototype.ao;var $k={P2D:0,WEBGL:1};Pk.EngineType=$k;var al={lookAt:{zoom:{min:-8,max:24},tilt:{min:0,max:85},incline:{min:0,max:0},heading:{min:0,max:360}},interaction:{ZOOM:Tk.ZOOM,COORD:Tk.COORD},capture:!0};u("H.map.render.webgl.capabilities",al);function bl(a){var b,c=this,d=y.H.gl;bl.l.constructor.call(this);this.a=b=d.Scene.create(y.URL.createObjectURL($e(JSON.stringify(cl))),{viewport:a.viewport,container:a.rc,disableRenderLoop:!0,devicePixelRatio:a.devicePixelRatio,logLevel:"error"});a.Jn&&b.subscribe({load:a.Jn});b.subscribe({view_complete:function(){c.f=!0;a.nk()}});var e=b.requestRedraw;b.requestRedraw=function(){e.apply(b);a.nk()};this.g=A(this.g,this);this.dg=A(this.dg,this);this.gi=A(this.gi,this);this.i=0;this.c={};this.b={}}
w(bl,Ac);bl.prototype.f=!1;bl.prototype.V=function(){var a=y.H.gl.Task;this.a.immediateRedraw();a.setState({user_moving_view:this.a.view.user_input_active});a.processAll();if(a=this.f&&!this.a.dirty&&!this.a.building){a:{a=this.a.sources;for(c in a){var b=a[c];if(b.hasPendingCommands&&b.hasPendingCommands()){var c=!0;break a}}c=!1}a=!c}return a&&!Object.keys(this.b).length};function dl(a){a.f=!1;a.a.resetViewComplete()}function el(a){return a.a.view}
function fl(a,b){function c(){var c=b.ab(),f={},g={},h,k,l,m=++a.i,p,q;Oh(g,cl);for(k=0;k<c.length;k++){var t=c[k];if(h=t.za()){var v=h.Eb();if(v.getState()===gj.READY){var x=v.Ef();if(!Ka(x)){delete x.cameras;delete x.camera;f[k]=x=$h(x,k);C(t,Lk)||ai(x,h.uid);for(l in x.sources){var E=x.sources[l];E.max_zoom=Ic(h.max,al.lookAt.zoom.max);E.max_display_zoom=t.max;E.min_display_zoom=t.min;if(q=h.tileSize)2<=d&&256<q&&h instanceof Kj&&(q/=2),E.tile_size=q}(p=v.Kd())&&bi(x,p);Oh(g,x)}}}}Oh(g.layers.skybox.draw.skybox.color,
g.scene.sky);a.a.config=g;return a.a.updateConfig().then(function(){var b={},d,e;if(m!==a.i)return!1;a.i=0;for(e in f){t=c[+e];var g=f[e].sources;for(d in g)if(g=a.a.sources[d])b[d]=g,g.initialize&&t.getProvider()&&g.initialize(t.getProvider(),a.g,a.a.getWorkers().length,g.tiled?B:a.a.tile_manager.getWorkerForTile(z,g))}for(d in a.c)!b[d]&&a.c[d].dispose&&a.c[d].dispose();a.c=b;return!0})}var d=a.a.pixelRatio();a.a.initialized?c():a.a.load(z,{blocking:!1}).then(c)}
bl.prototype.g=function(a,b){var c=this.a.sources[a];b?!0!==this.b[a]&&(this.b[a]||(this.b[a]={}),this.b[a][b.x+"/"+b.y+"/"+b.z]=!0):this.b[a]=!0;c&&c.has_volatile_data?this.dg():(y.clearTimeout(this.j),this.j=y.setTimeout(this.dg,gl))};var gl=100;n=bl.prototype;n.gi=function(a){var b=!1,c=this.b[a.source.name];c&&(b=!0===c?!0:!!c[a.coords.key]);return b};n.dg=function(){this.a.tile_manager.removeTiles(this.gi);this.a.tile_manager.updateTilesForView();dl(this);this.b={}};n.Ef=function(){return this.a.config};
function hl(a){return a.a.screenshot(void 0).then(function(a){return new gb(function(b,d){new Ni(URL.createObjectURL(a.blob),function(a,c){1===a?b(c.getData()):d()},!1)})})}n.fb=function(){return this.a.pixelRatio()};n.s=function(){var a=this.c;bl.l.s.call(this);this.a.destroy();this.b={};a&&Object.keys(a).forEach(function(b){a[b].dispose()});y.clearTimeout(this.j);this.c=this.a=null};
var cl={scene:{background:{color:"#FFFFFF"},sky:{zenith:"#347BC0",horizon:"#EDF2F9",fog:"#FFFFFF"}},lights:{default_light:{type:"directional",name:"default_light",visible:!0}},camera:{type:"perspective"},styles:{},fonts:{},sources:{skybox:{type:"SkyBox"}},layers:{skybox:{data:{source:"skybox"},draw:{skybox:{color:{}}}}},global:{}};function il(a,b){if(F(this.x=+a))throw new D(il,0,a);if(F(this.y=+b))throw new D(il,1,b);}il.prototype.add=function(a){return new il(this.x+a.x,this.y+a.y)};il.prototype.a=function(a){if(!C(a,il))throw new D(this.a,0,a);a=this.b(a);return a.x+a.y};il.prototype.b=function(a){if(!C(a,il))throw new D(this.b,0,a);return new il(this.x*a.x,this.y*a.y)};il.prototype.Ea=function(a){return new il(this.x*a,this.y*a)};function jl(a){return Pc(a.a(a))};function kl(){this.Xa=Lb(Ue.Fn)?Ue.Fn:3;this.W=Lb(Ue.Dn)?Ue.Dn:300;this.o=Lb(Ue.po)?Ue.po:3;this.v=Lb(Ue.mo)?Ue.mo:50;this.f=[];this.clear()}kl.prototype.start=function(a,b){var c=Tk.HEADING,d=Tk.TILT;this.a&&this.clear();this.b=a;this.m=!!b;this.a=!0;this.j=!(a&(c|d))||a===c||a===d};
kl.prototype.store=function(a,b,c,d,e){var f=!1;if(this.a){a=new ll(a,b,c,d,e);f=a.c;this.u=this.c;this.c=a;if(this.g){if(this.i=!0,f){b=this.b;var g=this.j;if(!g&&this.i){e=Tk.HEADING;var h=Tk.TILT;c=Tk.COORD;d=Tk.ZOOM;var k=b&(c|h)?ml(this,!0):nl;var l=b&d?ol(this,!0):1;var m=b&e?Nc(this.i?pl(this.g,this.c):0):0;var p=Nc(k.x);var q=Nc(k.y);k=10<p||10<q;p=10<q&&q>3*p;l=.8>l||1.2<l;m=7<m;b&h&&(m||l||k&&!p?ql(this,h):p&&(ql(this,~h>>>0),g=!0));!g&&b&e&&b&(c|d)&&(l||k?(ql(this,e),g=!0):m&&(ql(this,
h),g=!0));this.j=g}}}else this.g=a,f||(this.j=!0);this.m&&this.f.push(a)}return f};kl.prototype.clear=function(){this.f.length=0;this.a=this.m=this.i=this.j=!1;this.g=this.u=this.c=void 0};function ql(a,b){a.b^=a.b&b}kl.prototype.Ka=function(){return this.a};var nl=Hb(new il(0,0));function rl(a){var b;if(a.m){var c=a.f;var d=c.length;var e=0;for(b=new il(0,0);--d&&e<a.o;)b=b.add(sl(c[d-1],c[d])),e++}else b=ml(a);a=b;c=jl(a);return 0!==c?new il(a.x/c,a.y/c):a}
function tl(a){var b=Oj(),c,d;if(a.m){var e=a.f;var f=a.f.length;var g=a.f[f-1];for(d=c=0;--f&&c<a.o;)d+=jl(sl(e[f],e[f-1])),c++;e=d/c}else g=a.c,e=jl(ml(a));return e=e>=a.Xa&&b-g.timestamp<=a.v?e>a.W?a.W:e:0}function ul(a){return a.c?vl(a.c):B}function ml(a,b){return(b=b?a.g:a.u)?sl(b,a.c):new il(0,0)}function ol(a,b){var c=1;if(a.i){var d=a.c;a=b?a.g:a.u;if(a=wl(a))if(d=wl(d))c=d/a}return c}
function ll(a,b,c,d,e){this.a=new H(a,b);c!==B&&(this.b=new H(c,d),this.c=!0);this.timestamp=e!==B?e:Oj()}ll.prototype.c=!1;function vl(a){var b=a.a;return(a=a.b)?new H(b.x-(b.x-a.x)/2,b.y-(b.y-a.y)/2):B}function xl(a,b){var c=a.a;return(a=a.b)&&a.bb(b)<c.bb(b)?a:c}function sl(a,b){var c=a.b,d=b.b;d&&c?(b=vl(b),a=vl(a)):c?(b=b.a,a=xl(a,b)):d?(a=a.a,b=xl(b,a)):(b=b.a,a=a.a);return new il(b.x-a.x,b.y-a.y)}
function pl(a,b){var c=a.b,d=b.b,e=0;c&&d&&(a=a.a,b=b.a,e-=Yc(d.y-b.y,d.x-b.x)*fd-Yc(c.y-a.y,c.x-a.x)*fd);return e}function wl(a){var b=a.b;return b?a.a.bb(b):0};var wj=1,xj=2,yj=3;function yl(){G.call(this);this.reset()}w(yl,G);yl.prototype.start=function(a,b){this.a&&this.reset();F(a-b)||(this.b=+a,this.c=+b);this.a=!0};yl.prototype.reset=function(){this.a=!1;this.b=this.c=null;this.f=new zl(0,0,0,0,0,0)};yl.prototype.Ka=function(){return this.a};yl.prototype.g={ug:"animationupdate"};function Al(a){Al.l.constructor.call(this,yl.prototype.g.ug);this.c=a}w(Al,Ec);
yl.prototype.set=function(a,b,c,d,e,f){var g=this.f;this.a&&(a=new zl(a/1E3,b/1E3,c/1E3,d/1E3,e/1E3,f/1E3),g.da(a)||(this.f=a,this.dispatchEvent(new Al(Bl(this)))))};function Bl(a){return y.Object.create(a.f)}function Cl(a){var b=Bl(a);a=Dl(Bl(a))||1;return new zl(b.tb/a,b.ub/a,b.vb/a,b.$e,b.af,b.ig)}yl.prototype.s=function(){this.reset();yl.l.s.call(this)};function zl(a,b,c,d,e,f){this.tb=a;this.ub=b;this.vb=c;this.$e=d;this.af=e;this.ig=f}
function Dl(a){return Pc(a.tb*a.tb+a.ub*a.ub+a.vb*a.vb)}zl.prototype.da=function(a){return!!a&&this.tb===a.tb&&this.ub===a.ub&&this.vb===a.vb&&this.$e===a.$e&&this.af===a.af&&this.ig===a.ig};function El(a,b,c,d){El.l.constructor.call(this);this.rc=a;this.ga=d;this.a=a.appendChild(this.createElement(a.ownerDocument));Fl(this,b,c)}w(El,Ac);n=El.prototype;n.J=function(){return this.a};function Fl(a,b,c){a.size?(a.size.w=b,a.size.h=c):a.size=new uh(b,c);a.Tk(a.a,a.a.style,b,c,a.ga)}n.Db=function(){return this.size};n.fb=function(){return this.ga};n.Rj=!0;n.wb=function(a){a!==this.Rj&&(this.a.style.display=a?"block":"none",this.Rj=a)};n.Hh=1;
n.mc=function(a){this.Hh!==a&&(this.Wj(a),this.Hh=a)};n.Zc=function(){return this.Hh};n.ff=function(a){this.a.style.zIndex=a};n.Ej=function(){return+this.a.style.zIndex};n.Wc=function(){};n.clear=function(){};n.s=function(){this.clear();this.rc.removeChild(this.a);Fl(this,0,0);this.a=this.rc=null;El.l.s.call(this)};n.yk=0;n.hg=function(){++this.yk};n.release=function(){--this.yk||this.F()};function Gl(a,b,c,d){Gl.l.constructor.apply(this,arguments)}w(Gl,El);n=Gl.prototype;n.Ld=function(){return"dom"};n.createElement=function(a){a=a.createElement("DIV");a.style.position="absolute";return a};n.Tk=function(a,b,c,d){b.width=c+"px";b.height=d+"px"};n.Wj=function(a){this.a.style.opacity=a};n.Wc=function(a,b,c){var d=this.ga,e=a.style;e[jf("transform")]="matrix(1,0,0,1,"+b/d+","+c/d+")";a.parentNode!==this.a&&(e.position="absolute",this.a.appendChild(a))};
n.clear=function(a){a?this.a.removeChild(a):this.a.innerHTML=""};function Hl(a,b,c,d,e,f){var g=e||"2d";Hl.l.constructor.apply(this,arguments);this.b=this.a.getContext(g,f);this.c="2d"===g;this.f=g;this.un=f}w(Hl,El);n=Hl.prototype;n.createElement=function(a){a=a.createElement("canvas");var b=a.style;b.position="absolute";b.top=b.left="0";return a};n.Tk=function(a,b,c,d,e){a.width=Jc(c,1);a.height=Jc(d,1);b.width=Kc(c/e)+"px";b.height=Kc(d/e)+"px"};n.Wj=function(a){this.b.globalAlpha=a};n.Wc=function(a,b,c,d,e){this.c&&this.b.drawImage(a,b,c,d,e)};n.Ld=function(){return this.f};
n.clear=function(a){var b,c;this.c&&(a?this.b.clearRect(b=a.left,c=a.top,a.right-b,a.bottom-c):this.a.width=this.size.w)};n.s=function(){this.a.width=this.a.height=0;this.b=z;Hl.l.s.call(this)};function Il(a){this.sb=a}w(Il,Ac);Il.prototype.Bb=function(){return this.sb};Il.prototype.ef=function(a){var b=this.Ib;a!==b&&(this.Ib=a,a.hg(),b&&b.release())};Il.prototype.s=function(){this.Ib.release()};Il.prototype.Td=function(){};function Jl(a){var b="dom";Jl.l.constructor.call(this,a);C(this.sb,Kl)&&(b="2d"===a.Ld()?"2d":"webgl");this.a=b}w(Jl,Il);Jl.prototype.V=function(a,b,c,d,e,f,g,h){g=this.sb;var k=this.Ib,l=!(C(k,Hl)&&"2d"===k.Ld());if(d>=g.min&&d<=g.max)return l&&k.wb(!0),g.V(k.J(),{boundingBox:a,zoom:d,screenCenter:b,priorityCenter:f,projection:c,cacheOnly:e,size:k.Db(),pixelRatio:k.fb(),cameraMatrix:h});l&&k.wb(!1);return Bj.DONE};Jl.prototype.Td=function(){return this.a};u("H.util.animation.ease.LINEAR",function(a){return a});u("H.util.animation.ease.EASE_IN_QUAD",function(a){return a*a});function Ll(a){return-a*(a-2)}u("H.util.animation.ease.EASE_OUT_QUAD",Ll);u("H.util.animation.ease.EASE_IN_OUT_QUINT",function(a){a*=2;return 1>a?Qc(a,5)/2:(a-=2,Qc(a,5)/2+1)});u("H.util.animation.ease.EASE_OUT_CIRC",function(a){return Pc(2*a-a*a)});function Ml(a,b,c,d){if(!r(this.i=a))throw new D(Ml,0,a);if(F(this.g=+b))throw new D(Ml,1,b);if(!r(this.f=c)&&null!=c)throw new D(Ml,2,c);if(!r(this.c=d)&&null!=d)throw new D(Ml,3,d);this.id=Nl.next();this.a=!1}u("H.util.animation.Animation",Ml);var Nl=new Oe;Ml.prototype.start=function(){var a=this,b=Zj;var c=function(){var e=Oj(),f=e-a.Nc,g=f/a.g;if(1<=g){g=1;var h=!0}a.c&&(g=a.c(g));a.i(g,f,e-d,e);d=e;h?a.stop():a.b=b(c)};a.Nc=Oj();var d=a.Nc;a.a=!0;a.b=b(c)};Ml.prototype.start=Ml.prototype.start;
Ml.prototype.stop=function(a){ak(this.b);this.a=!1;a||this.f&&this.f(this)};Ml.prototype.stop=Ml.prototype.stop;Ml.prototype.Ka=function(){return this.a};Ml.prototype.isRunning=Ml.prototype.Ka;function Ol(a,b){Ol.l.constructor.call(this,a);this.tc=!(!b||!b.tc);this.c={}}w(Ol,Il);Ol.prototype.ef=function(a){Ol.l.ef.call(this,a);this.f=a.rc.ownerDocument};var Pl=function(a,b){b=b.pa();return C(b,Tg)?b.sa:(a[0]=b,a)}.bind(null,[]);
Ol.prototype.V=function(a,b,c,d,e,f,g){var h=this.sb,k,l,m,p;this.j=b=this.c;this.c=c={};if(d>=h.min&&d<=h.max){var q=this.sj(a,d,e,f);var t=q.markers;if(a=t.length){d=[];e=this.Ib;for(f=0;f<a;f++){h=t[f];var v=Pl(h);for(k=v.length;k--;)if(l=g(v[k]))(p=b[m=h.eb()+"_"+k])?delete b[m]:p={gk:h},c[m]=p,d.push([p,h,h.Ab(),e,l.x,l.y])}d.sort(Ql);a=d.length;for(f=0;f<a;f++)this.Ak.apply(this,d[f])}}return!q||q.requested&&q.requested===q.total||!q.requested&&t.length===q.total?Bj.DONE:Bj.PENDING};
function Ql(a,b){var c=zg(a[1]),d=zg(b[1]);return Ag(c,d,!0)||a[5]-b[5]||Ag(c,d,!1)}Ol.prototype.Ha=function(){};function Rl(a,b){Rl.l.constructor.apply(this,arguments);this.b=0;this.a=[];this.Wg=A(this.Wg,this)}w(Rl,Ol);n=Rl.prototype;n.sj=function(){return this.sb.Hc.apply(this.sb,arguments)};n.V=function(a,b,c,d,e,f,g){this.Wg();this.i=0;var h=Rl.l.V.apply(this,arguments);var k=this.Ib,l=this.j,m;for(m in l)Sl(this,k,l[m]);return 0===this.a.length&&h?Bj.DONE:Bj.PENDING};n.ef=function(a){Rl.l.ef.call(this,a);this.g=a.fb()};
n.Wg=function(){for(var a=this.a.length,b,c,d;a--;)d=this.a[a],b=d.lf,c=d.lf.Ab(),c.Sh(d,c,b);this.a.length=0};n.Ak=function(a,b,c,d,e,f){var g;var h=d.fb();var k=b.Pb();e*=h;f*=h;this.tc||(e=Kc(e),f=Kc(f));a.detail&&(k.Yd(a.jn)?Sl(this,d,a):g=a.detail);g||(a.detail=g=c.uj(this.f),this.b++,r(c.Sh)&&this.a.push(g));a.jn=k.a;g.style.zIndex=this.i++;g.lf=b;d.Wc(g,e,f,0,0)};var Tl,Ul="pointer-events",Vl;
if(Le){var Wl;Le&&oc!==z&&(oc=(Wl=/(MSIE\s+|rv:)([^\);]+)(\)|;)/.exec(navigator.userAgent))?+Wl[2]:z);Vl=oc;9===Vl?Ul="display":10===Vl&&(Ul="visibility")}Tl=Ul;
Rl.prototype.Ha=function(a,b,c){var d=this.g,e=Te,f,g,h,k,l;if(this.b){a/=d;b/=d;d=this.f;var m=d.documentElement;var p=this.Ib.J();var q=p.getBoundingClientRect();a+=q.left;for(b+=q.top;(g=h=d.elementFromPoint(a,b))&&g!==p&&g!==m&&h!==t;){for(;(k=g.parentNode)&&(!r(k.contains)||!k.contains(p));)g=k;if(k===p&&(g!==h||"svg"!==g.nodeName)&&0>e.indexOf(l=g.lf)&&(e===Te&&(e=[]),e.push(l),c))break;f||(f=[]);var t=g.style;f.push({fj:t.getPropertyValue(Tl),hn:t.getPropertyPriority(Tl),style:t});t.setProperty(Tl,
"visibility"===Tl?"hidden":"none","important");t=h}if(f)for(b=f.length;b--;)a=f[b],a.style.removeProperty(Tl),ra(a.fj)&&a.style.setProperty(Tl,a.fj,a.hn)}return e};Rl.prototype.Td=function(){return"dom"};function Sl(a,b,c){b.clear(b=c.detail);delete b.lf;a.b--;c=(a=c.gk).Ab();c.b&&c.b(b,c,a)}Rl.prototype.s=function(){this.a.length=0;var a=this.Ib,b=this.c,c;for(c in b)Sl(this,a,b[c]);this.Ib.F();Rl.l.s.call(this)};function Kl(a,b){var c=b||{},d=c.contextType;c=c.contextAttributes;Kl.l.constructor.call(this,b);Ob(a,"Function",Kl,0,"invalid render callback");if(d){if(-1===Xl.indexOf(d))throw new D(Kl,1,"invalid context type");this.f=d}c&&(this.m=c);this.j=a}w(Kl,ki);u("H.map.layer.CanvasLayer",Kl);var Xl=["2d","webgl","webgl2","experimental-webgl"];Kl.prototype.f="2d";Kl.prototype.Ld=function(){return this.f};
Kl.prototype.V=function(a,b){this.c&&this.c.canvas===a||(this.c=a.getContext(this.f,this.m));return this.j(this.c,b)};Kl.prototype.s=function(){Kl.l.s.call(this);this.c=B};function Yl(a,b){Yl.l.constructor.call(this,b);Ob(a,"Function",Yl,0,"invalid render callback");this.c=a}w(Yl,ki);u("H.map.layer.DomLayer",Yl);Yl.prototype.V=function(a,b){return this.c(a,b)};function Zl(a,b){if(F(this.b=+a))throw new D(Zl,0,a);this.a=0;b&&this.Ok(b)}u("H.util.kinetics.KineticMove",Zl);Zl.prototype.Ok=function(a){this.a=a;return this};Zl.prototype.setInitialSpeed=Zl.prototype.Ok;Zl.prototype.fm=function(){return Math.abs(this.a/this.b)};Zl.prototype.getDuration=Zl.prototype.fm;Zl.prototype.Ee=function(a){return this.a+this.b*a};Zl.prototype.getCurrentSpeed=Zl.prototype.Ee;Zl.prototype.bm=function(a){return this.a*a+this.b*a*a/2};Zl.prototype.getCurrentPath=Zl.prototype.bm;function $l(a,b){this.a=a;this.b=b}
function am(a,b,c){var d=[],e={rc:a.a,width:b.w,height:b.h,ga:a.b};for(a=0;a<c.length;a++){b=c[a];var f=b.Td();var g={};Pa(g,e);var h=b.Ib;switch(f){case "2d":C(b.Bb(),Kl)&&(g.Lg=b.Bb().m);if(f=m&&"2d"===m.Ld()){f=g.Lg;var k=m.un;f=k===f?!0:k&&!f?!k.alpha&&!k.willReadFrequently:f&&!k?!f.alpha&&!f.willReadFrequently:!f.alpha===!f.alpha&&!k.willReadFrequently===!f.willReadFrequently}if(f)var l=!1;else if(h&&!l){var m=h;l=!1}else m=new Hl(g.rc,g.width,g.height,g.ga,"2d",g.Lg),l=!0;break;case "dom":m=
h||new Gl(g.rc,g.width,g.height,g.ga);l=!h;break;default:m=h||new Hl(g.rc,g.width,g.height,g.ga,b.Bb().Ld(),g.Lg),l=!h}d[d.length-1]!==m&&(m.ff(d.length),d.push(m));b.ef(m)}return d};u("H.util.events.listenOnce",pe);u("H.util.events.dispatchEvent",function(a,b){return a.dispatchEvent(b)});u("H.util.events.fireListeners",function(a,b,c,d){return xd(a)?a.kd(b,c,d):ze(a,b,c,d)});u("H.util.events.listen",oe);u("H.util.events.unlisten",we);var bm=Ae;
Ae=function(a,b){var c,d,e=!0;var f=b[b.currentTarget===b.target?"AT_TARGET":a.capture?"CAPTURING_PHASE":(c=!0,"BUBBLING_PHASE")];if(!c||"pointerenter"!==(d=b.type)&&"pointerleave"!==d)b.eventPhase=f,e=bm(a,b),c&&a.src&&a.src.fc&&null===a.src.fc()&&delete b.eventPhase;return e};function Rk(){Rk.l.constructor.call(this);this.c={};this.b={position:new I(0,0),zoom:0,heading:180,incline:0,tilt:0,bounds:new N(qg([90,-180,90,0,90,180,-90,180,-90,-180]))}}w(Rk,G);u("H.map.ViewModel",Rk);Rk.prototype.a={Fa:"update",ne:"sync"};
Rk.prototype.Yb=function(a,b){var c=cm;if(!a)throw new D(this.Yb,0,a);var d=a[c.ac];if(Lb(d)&&!If(d))throw new D(this.Yb,0,c.ac);d=a[c.Rc];if(Lb(d)&&F(+d))throw new D(this.Yb,0,c.Rc);d=a[c.zd];if(Lb(d)&&!C(d,Hf))throw new D(this.Yb,0,c.zd);a=y.Object.assign({},a);c=dm(a,this.c,this.b);em(this,this.c,a);this.dispatchEvent(new fm(this.c,c,b));return this};Rk.prototype.setLookAtData=Rk.prototype.Yb;Rk.prototype.pb=function(){var a={};a[gm]=Jf(this.b[gm]);em(this,a,this.b,!0);return a};
Rk.prototype.getLookAtData=Rk.prototype.pb;var gm="position",cm={ac:gm,Rc:"zoom",pc:"heading",bc:"tilt",ke:"incline",zd:"bounds"},hm=Object.keys(cm).map(function(a){return cm[a]});
function em(a,b,c,d){a.i={};a.g={};a.f=[];for(var e=a.m,f=a.j,g=hm.length,h,k,l,m;g--;)if(h=hm[g],m=c[h],k=b[h],null==k||!d)if(null!=m){Lb(e)&&e.call(a,h,k,m);l=h;var p;(p="position"!==h)||(p=m,p=!p||F(p.lat)||F(p.lng)?!1:!0);b[l]=p?m:Jf(m);if(Lb(f)){switch(h){case "position":l=m&&k&&(m.lat!==k.lat||m.lng!==k.lng);break;case "bounds":l=m&&k&&!m.da(k);break;default:l=m!==k}l&&f.call(a,h,k,m)}}else delete b[h]}Rk.prototype.m=function(a,b,c){this.i[a]=b;this.g[a]=c};Rk.prototype.j=function(a){this.f.push(im[a])};
var im=hm.reduce(function(a,b){a[b]=Bh.prototype[b.toUpperCase()];return a},{});function dm(a,b,c){var d=cm,e=im,f=0;[d.bc,d.ke,d.pc,d.Rc].forEach(function(d){if(F(a[d])){var g=F(b[d])?c[d]:b[d];a[d]=g}else f|=e[d]});[d.ac,d.zd].forEach(function(d){a[d]?f|=e[d]:a[d]=b[d]||c[d]});return f}function jm(a,b){var c={},d={};em(a,a.b,b);a.c={};c.lookAt=a.g;d.lookAt=a.i;b=a.f;b=b.length?b.reduce(km):0;a.dispatchEvent(new Bh(a.a.ne,c,d,b))}function km(a,b){return a|b}
Rk.prototype.gf=function(a,b){if(F(a=+a))throw new D(this.gf,0,"zoom");this.Yb({zoom:a},b)};Rk.prototype.qb=function(){return this.b.zoom};Rk.prototype.nc=fc;Rk.prototype.startControl=Rk.prototype.nc;Rk.prototype.control=fc;Rk.prototype.control=Rk.prototype.control;Rk.prototype.yb=fc;Rk.prototype.endControl=Rk.prototype.yb;function fm(a,b,c){fm.l.constructor.call(this,Rk.prototype.a.Fa,a,null,b);this.b=!!c}w(fm,Bh);function R(a,b,c,d){R.l.constructor.call(this,a,b,c,d);this.Dd=new Uj(100);this.X=new H(0,0);this.Bf=!!d.enableSubpixelRendering;this.cc=lm;this.u=new kl;this.m=d=new yl;this.dc=A(this.dc,this);d.addEventListener(d.g.ug,this.dc);d=a.element;this.L=a=d.ownerDocument.createElement("div");a.style.position="absolute";a.style.width=a.style.height="100%";a.style.zIndex=0;d.insertBefore(a,d.firstChild);this.Ed=new $l(this.L,this.ga);a=y.H.gl;if(!a)throw new nc(R,'"H-webgl" module is missing');this.a=
new bl({viewport:this.j,rc:this.L,devicePixelRatio:this.ga,nk:A(this.ma,this)});a.WorkerBroker.addTarget("model",ni);mm(this);this.Qc=A(this.Qc,this);this.Jh=A(this.Jh,this);this.Ga=A(this.Ga,this);c.addEventListener(ki.prototype.b.ie,this.Qc);this.C=nm;this.Ye();this.zoom=Vk(this,this.D.qb());this.Kb();this.b.Ea(this.zoom);this.c=this.b.projection.Mb(b.pb().position);this.b.x=this.b.w*this.c.x;this.b.y=this.b.h*this.c.y;this.$()}w(R,Pk);u("H.map.render.webgl.RenderEngine",R);
R.prototype.Qc=function(a){a=(a=a.target.za())&&a.Eb();(a&&a.getState())===gj.INIT?a.load():(dl(this.a),fl(this.a,this.i),this.ma())};R.prototype.type=$k.WEBGL;R.prototype.type=R.prototype.type;var nm=2;R.prototype.getState=function(){return this.C};R.prototype.getState=R.prototype.getState;function om(a,b,c){b=c-b;return Nc(b)<a.b.w/2?b:b-a.b.w*c/Nc(c)}
R.prototype.Ng=function(a){var b=a.newValue,c=a.modifiers,d=el(this.a);pm(this);this.X.set(0,0);var e=qm(this,b);rm(this);hm.forEach(function(b){c&a[b.toUpperCase()]||delete e[b]});a.b?sm(this,e,a):d.setLookAtData(e);tm(this);dl(this.a);this.ma()};
function sm(a,b,c){var d=[],e=c.modifiers,f=el(a.a),g=f.getLookAtData(),h,k,l,m=0,p={},q=f.setLookAtData.bind(f);hm.forEach(function(a){switch(a){case "heading":case "tilt":case "incline":if(e&(c.pc|c.bc|c.ke)){var f=b[a]-g[a];p[a]=-180<f&&180>=f?f:180<f?f-360:f+360;p[a]&&d.push(a)}break;case "zoom":e&c.Rc&&(p[a]=b[a]-g[a],p[a]&&d.push(a));break;case "position":if(e&c.ac){h=Jf(g.position);var m=b.position;f=m.lat*ed;var q=h.lat*ed,t=m.lng*ed-h.lng*ed;m=Sc(t)*Vc(f);f=Vc(q)*Sc(f)-Sc(q)*Vc(f)*Vc(t);
f=Math.atan2(m,f);l=(0<=f?f:cd+f)*fd;(k=h.bb(b.position))&&d.push(a)}}delete g.bounds});d.length?um(a,function(a){var b=a-m,f={};e&(c.pc|c.bc|c.ke|c.Rc)&&d.forEach(function(a){Tb(p[a])&&(g[a]+=p[a]*b,f[a]=g[a])});e&c.ac&&(f.position=h.rg(l,k*a,!0));q(f);dl(this.a);this.ma();m=a}.bind(a),a.ja,function(){q(b);dl(this.a);this.ma()}.bind(a),a.ca):q(b)}R.prototype.ja=300;R.prototype.bf=function(a){var b=Tb(a);if(!b||b&&0>a)throw new D(this.bf,1,"positive number required");this.ja=a};
R.prototype.setAnimationDuration=R.prototype.bf;R.prototype.Yg=function(){return this.ja};R.prototype.getAnimationDuration=R.prototype.Yg;R.prototype.ca=Ll;R.prototype.cf=function(a){if(!r(a))throw new D(this.cf,1,"function required");this.ca=a};R.prototype.setAnimationEase=R.prototype.cf;R.prototype.Zg=function(){return this.ca};R.prototype.getAnimationEase=R.prototype.Zg;R.prototype.Ye=function(){this.ca=Ll;this.ja=300};R.prototype.resetAnimationDefaults=R.prototype.Ye;n=R.prototype;
n.lk=function(){dl(this.a);this.ma()};n.Qe=function(a,b){R.l.Qe.call(this,a,b);vm(b)&&(dl(this.a),(a=(a=b.za())&&a.Eb())&&a.getState()===gj.INIT&&a.load())};n.Uh=function(a,b,c){var d;this.jb=Oj();if(b.requestDomMarkers||C(b,Kl)||C(b,Yl)){var e=this.G.na;for(d=e.length;d--;){var f=e[d];if(f.Bb()===b){e.splice(d,1);f.F();break}}}vm(b)&&fl(this.a,this.i);this.f=this.i.ab();0===a&&(Uk(this,b,!1),this.Kb());am(this.Ed,wm(this),xm(this));this.de();c||this.ma()};
function vm(a){return!(C(a,Yl)||C(a,Kl))}function mm(a){var b=a.i.ab(),c=0,d=b.length;[a.G={}].forEach(function(a){a.Vc=[];a.na=[]});for(a.f=b;c<d;c++){var e=b[c];a.Qe(c,e);Uk(a,e,!0)}a.Kb()}n.Vh=function(){this.Kb()};n.Kb=function(){R.l.Kb.call(this);var a=this.getCapabilities().lookAt.zoom;el(this.a).setZoomConstraints(Jc(a.min,this.Ag),Ic(a.max,this.tg))};
n.th=function(a,b,c){var d;if(b){var e={tc:this.Bf,hb:this.hb};b.V?C(b,Kl)?d=new Jl(b):C(b,Yl)&&(d=new Jl(b)):b.requestDomMarkers&&(d=new Rl(b,e));d&&(this.G.na.splice(a,c||0,d),am(this.Ed,wm(this),xm(this)));vm(b)&&fl(this.a,this.i)}this.f=this.i.ab()};function xm(a){var b=[];b=b.concat(a.G.na);return b=b.filter(Lb)}function qm(a,b){var c=b.position;return Xk(a,{zoom:Vk(a,b.zoom),position:new I(c.lat,c.lng),tilt:b.tilt,heading:b.heading,bounds:b.bounds})}
function tm(a){var b=a.b,c=el(a.a).getLookAtData();b.Ea(c.zoom);a.zoom=c.zoom;a.c=b.projection.Mb(c.position);b.x=b.w*a.c.x;b.y=b.h*a.c.y}n.Ga=function(a){return el(this.a).geoToPixel(a)};R.prototype.geoToScreen=R.prototype.Ga;R.prototype.Wa=function(a,b){return el(this.a).xyToGeo(a,b)};R.prototype.screenToGeo=R.prototype.Wa;R.prototype.jg=function(a,b){a=this.Wa(a,b);b=this.D.pb();b.position=a;return b};
R.prototype.xe=function(a,b,c,d,e,f){var g,h,k,l=0,m;var p=function(){0===--l&&e(d)};if(f&&f.features)for(l=k=f.features.length,m=0;m<k;m++){var q=f.features[m];var t=q.id;if(g=this.a.a.sources[q.source_name]){var v=g.provider;var x=vj(v);if(x===xj){var E=q.source_layer;"overlays"===E?ym(this,a,b,c,d,g,q.properties.overlays_config):(h=g.getMapObjectById(t))&&("markers"!==E||zm(this,a,b,h))&&d.push(h);l--}else if(x===wj){g=q.tile.coords;var O=v.getFeatureProxy(q.properties,g,function(a){if(a){for(var b=
a,c=v,e;b&&(e=b.fc())&&e!==c;)b=e;e||b.ba(c);d.push(a)}p()});O||(h=this.Dd.get(t),h||(h=new tg(q),h.ba(v),this.Dd.add(t,h,1)),d.push(h),l--)}else x===yj&&(O=!0,v.Bk(q,!1).then(function(c){c&&(c instanceof xh?zm(this,a,b,c):1)&&d.push(c);p()},function(){p()},this))}}x&&(O||0!==l)||e(d)};function ym(a,b,c,d,e,f,g){var h=g.length;b=a.Wa(b,c);for(c=0;c<h&&!((a=f.getMapObjectById(g[c].id))&&a.I().Gd(b)&&(e.push(a),d));c++);}
function zm(a,b,c,d){var e=d.Ab(),f=e.g,g,h=!f;if(f)if(e=e.ld(),b+=e.x,c+=e.y,e=d.pa(),C(e,th))for(d=e.sa,g=d.length;g--&&!h;)e=a.Ga(d[g]),h=f.Lf(b-e.x,c-e.y,0)!==od.NONE;else e=a.Ga(e),h=f.Lf(b-e.x,c-e.y,0)!==od.NONE;return h}
R.prototype.Ha=function(a,b,c,d){for(var e=[],f=this.G.na,g=a*this.ga,h=b*this.ga,k=f.length,l;k--&&!((l=f[k])&&l.Ha&&(e=e.concat(l.Ha(g,h,c)),e.length&&c)););c&&e.length?d(e):this.a.a.initialized?(f=this.a,g=f.a.getFeatureAt({x:a,y:b},{radius:Am,top_most_only:c}),f.a.update(),g.then(this.xe.bind(this,a,b,c,e,d))):d(e)};R.prototype.getObjectsAt=R.prototype.Ha;R.prototype.Ya=z;function wm(a){a=a.qc[2];return{w:a.right-a.left,h:a.bottom-a.top}}
R.prototype.$=function(){var a=this.G.na.length;Qk(this,this.ga);this.X.set(0,0);var b=wm(this);var c=b.w;var d=b.h;for(this.a.a.handleViewportUpdate();a--;){b=this.G.na[a].Ib;var e=b.Db();e.w===c&&e.h===d||Fl(b,c,d)}this.Ya=new uh(c,d);dl(this.a);this.ma()};R.prototype.getCapabilities=function(){return al};R.prototype.getCapabilities=R.prototype.getCapabilities;function Bm(a){Oj()-a.jb<a.cc&&!a.v?a.zg=Zj(a.Jh):(a.v&&(a.de(),Cm(a)),a.C=nm)}n=R.prototype;n.de=function(){this.G.Vc.length=0};
n.Jh=function(){this.B&&this.B.aj();var a=el(this.a);var b=a.getLookAtData(!1);var c=a.getLookAtData(!0);a=this.j.center.clone();c=c.bounds.I();var d=this.zoom;var e=this.X;var f=this.f;var g=f.length;for(this.cc=lm;g--;){var h=f[g];C(h,ki)&&h.za()&&h.za().ai(c,d)}f=this.v=this.a.V();g=this.G;h=g.na.length;var k=!0,l;for(l=0;l<h;l++){var m=g.na[l];var p=g.Vc;if(m){var q=m.V(c,a,void 0,d,!1,e,this.Ga,this.a.a.getCameraMatrix());q===Bj.ACTIVE&&(this.cc=Infinity);q!==Bj.DONE||p[l]||(Cm(this,m.Bb()),
p[l]=!0);p[l]||(k=!1)}}this.v=f&k;jm(this.D,b);this.Ya&&(Fj(this.j,this.Ya),this.Ya=z);this.B&&this.B.Zi();Bm(this)};function Cm(a,b){setTimeout(A(a.dispatchEvent,a,{type:a.Vj.Ui,target:b||a}),1)}n.s=function(){var a=this.i.ab()[0],b=this.j;ak(this.zg);rm(this,!0);a&&Uk(this,a,!1);xm(this).forEach(function(a){a.F()});b.element&&b.element.removeChild(this.L);this.L=null;this.C=3;this.a.F();R.l.s.call(this)};n.ma=function(){this.jb=Oj();this.C===nm&&(this.v=!1,this.C=1,Bm(this))};
function Dm(a,b,c){el(a.a).applyPxOffset([b,c]);tm(a);a.X.set(0,0);dl(a.a);a.ma()}n.ge=function(a,b,c){a=Vk(this,Vk(this,a));Em(this,a,b,c)};R.prototype.zoomAt=R.prototype.ge;function Em(a,b,c,d){el(a.a).setLookAtData({zoom:b},Tb(c)&&Tb(c)?[c,d]:B);tm(a);dl(a.a);a.ma()}function pm(a){rm(a,!0);a.m.Ka()&&a.yb(!0);a.u.Ka()&&a.zb(!0);rm(a,!0)}function Fm(a,b){if(b){var c={};c.Te=b.power;c.Jd=b.ease;c.duration=b.duration;a.o=c}}
R.prototype.oc=function(a,b){var c=!!(b||a&(Tk.HEADING|Tk.TILT));pm(this);Fm(this,b);this.u.start(a,c)};R.prototype.startInteraction=R.prototype.oc;
R.prototype.ic=function(a,b,c,d,e){var f=this.u;var g=!1;if(f.Ka()){var h=el(this.a);var k=h.getLookAtData();var l=this.j.center;l=[l.x,l.y];b=f.store(a,b,c,d,e);c=ul(f);a=ml(f);d=ol(this.u);e=this.u;e=e.i?pl(e.u,e.c):0;f.j&&(0<(f.b&Tk.TILT)&&(h.setLookAtData({tilt:Yk(this,k.tilt+a.y/this.j.height*-180)},l),g=!0),b&&1!==d&&0<(f.b&Tk.ZOOM)&&(g=ul(f),d=Oc(Qc(2,this.zoom)*d)/Zc,Em(this,Vk(this,d),g.x,g.y),g=!0),0<(f.b&Tk.COORD)&&0<jl(a)&&(Dm(this,-a.x,-a.y),g=!0),0<(f.b&Tk.HEADING)&&(b?h.setLookAtData({heading:k.heading+
Zk(this,e)},[c.x,c.y]):a.x&&h.setLookAtData({heading:Zk(this,k.heading+a.x/this.j.width*360)},l),g=!0),g&&(dl(this.a),this.ma()))}};R.prototype.interaction=R.prototype.ic;R.prototype.zb=function(a){var b=this;if(this.u.Ka()&&!a){if(this.o){a=tl(this.u);var c=rl(this.u);var d=this.o.duration;var e=(this.o.Te||1)*a;var f=new Zl(-e/(0<d?d:1),e);!F(c.x)&&!F(c.y)&&0<e&&0<(b.u.b&Tk.COORD)&&um(this,function(a){e=f.Ee(a*d);F(e)||Dm(b,Kc(-c.x*e),Kc(-c.y*e))},d,void 0,this.o.Jd)}this.o=null;this.u.clear()}};
R.prototype.endInteraction=R.prototype.zb;R.prototype.nc=function(a,b,c){pm(this);this.m.start(b,c);Fm(this,a)};R.prototype.startControl=R.prototype.nc;R.prototype.control=function(a,b,c,d,e,f){for(var g=0,h;g<arguments.length;g++)if(h=+arguments[g],h!==h)throw new D(this.control,g,h);this.m.Ka()&&this.m.set(a,b,c,d,e,f)};R.prototype.control=R.prototype.control;
R.prototype.yb=function(a,b){var c=this,d;if(this.m.Ka()){rm(this,!0);var e=Oj();var f=e-this.$a;if(1<=f){var g=Bl(this.m);Gm(this,g,f)}if(!this.o||a||b)"function"===typeof b&&(a=el(this.a),a=a.getLookAtData(),b(a),Hm(this,a));else{b=Dl(Bl(this.m));var h=Cl(this.m);var k=this.o.duration;var l=(this.o.Te||1)*b;var m=new Zl(-l/(0<k?k:1),l);!F(h.tb)&&!F(h.ub)&&0<l&&um(this,function(a,b,f,g){e&&(f=g-e,e=0);l=m.Ee(a*k)*f;F(l)||((d=h.vb*l)&&Em(c,Vk(c,c.zoom+d),c.m.b,c.m.c),Dm(c,Kc(h.tb*l),Kc(h.ub*l)))},
k,void 0,this.o.Jd)}this.m.reset()}};R.prototype.endControl=R.prototype.yb;
function Hm(a,b){var c=a.c,d=a.b.projection.Mb(b.position),e=a.b.cd(d);d=e.y;e=e.x;var f=b.zoom;c=a.b.cd(c);b=c.y;var g=c.x;c=a.zoom;var h=Dl(Bl(a.m)),k=a.m.b,l=a.m.c,m=0;e=om(a,g,e);e-=g;d-=b;c=f-c;b=Pc(e*e+d*d+c*c);if(0!==h&&0!==b){var p=e/b;var q=d/b;var t=c/b;var v=h*h/(2*b);um(a,function(b,c){var d;if(1!==b){b=h*c-v*c*c/2;c=b-m;if(d=t*c)d=Vk(a,a.zoom+d),Em(a,d,k,l);Dm(a,Kc(p*c),Kc(q*c));m=b}else Em(a,Vk(a,f),k,l),a.ma()},2*b/h)}}
R.prototype.dc=function(a){var b=this,c=a.c;this.X.set(0,0);c.tb||c.ub||c.vb||c.$e||c.af||c.ig?(this.$a=Oj(),um(this,function(a,e,f,g){b.$a=g;Gm(b,c,f)},gd)):rm(this,!0)};function Gm(a,b,c){c=c||0;var d=a.m,e=el(a.a),f=e.getLookAtData();b.vb&&Em(a,Vk(a,f.zoom+b.vb*c),d.b,d.c);e.setLookAtData({heading:Zk(a,f.heading+b.af*c),tilt:Yk(a,f.tilt+b.$e*c)});tm(a);Dm(a,b.tb*c,b.ub*c)}function um(a,b,c,d,e){a.g&&a.g.Ka()&&a.g.stop(!0);a.g=new Ml(b,c,d,e);a.g.start()}
function rm(a,b){a.g&&a.g.Ka()&&a.g.stop(b)}R.prototype.Tg=function(){};R.prototype.enter=R.prototype.Tg;R.prototype.Af=function(a){Sk(this.L,a)};R.prototype.exit=R.prototype.Af;R.prototype.capture=function(a,b,c,d){var e=this;return hl(e.a).then(function(f){var g=e.L.ownerDocument.createElement("canvas"),h=e.ga,k=g.getContext("2d"),l=e.a.fb()/h,m=(c-a)*h;h*=d-b;g.width=m;g.height=h;k.drawImage(f,a*l,b*l,m*l,h*l,0,0,m,h);return g})};R.prototype.Pl=function(a){return el(this.a).geoToMeters(a)};
R.prototype.geoToMeters=R.prototype.Pl;R.prototype.En=function(a){return el(this.a).metersToGeo(a)};R.prototype.metersToGeo=R.prototype.En;var lm=5E3,Am=2.575;function S(a,b,c){var d={};S.l.constructor.call(this);this.P=A(S.prototype.P,this);this.i=Im(c,S);this.b=c=new Rk;this.v=!1;c.addEventListener(c.a.ne,this.ca,!1,this);if(!C(a,Element))throw new D(S,0,a);c=this.O=a.ownerDocument.createElement("div");var e=c.style;e.position="relative";e.height=c.style.width="100%";e.overflow="hidden";e.webkitTapHighlightColor="transparent";"transparent"!==e.webkitTapHighlightColor&&(e.webkitTapHighlightColor="rgba(0,0,0,0)");a.appendChild(c);this.Ba=new Cj(this.O,
this.i);this.Ba.addEventListener(this.Ba.a.ne,this.ca,!1,this);a=this.a=new ni(this.i.layers);a.addEventListener(a.b.me,this.L,!1,this);a.addEventListener(a.b.he,this.L,!1,this);a.addEventListener(a.b.le,this.L,!1,this);!this.c&&Jm(this);this.g=null;this.a.add(b,0);this.f=this.B(null!=this.i.engineType?this.i.engineType:Km.WEBGL,this.i);this.D=A(this.D,this);this.G=A(this.G,this);b=this.i.imprint;if(b!==B&&"object"!==typeof b)throw new D(S,1,"imprint");this.m=null===b?b:new xi(this,b);b=this.i.autoColor;
this.$=b===B||!!b;Lm(this);(b=this.i.zoom)&&(d.zoom=b);(b=this.i.bounds)&&(d.bounds=b);(b=this.i.center)&&(d.position=b);this.b.Yb(d)}w(S,G);u("H.Map",S);function Im(a,b){if(a){var c=a.pixelRatio;if(c===B)a.pixelRatio=Fe();else if(!(0<c))throw new D(b,0,"pixelRatio: "+c);}else a={},a.pixelRatio=Fe();a.renderBaseBackground||(a.renderBaseBackground={lower:3,higher:2});return a}
S.prototype.s=function(){this.$=!1;this.m&&this.m.F();this.f.F();this.b.F();this.Ba.F();this.c.F();this.j.F();this.a.F();var a=this.O;a.parentNode.removeChild(a);this.O=null;G.prototype.s.call(this)};S.prototype.J=function(){return this.O};S.prototype.getElement=S.prototype.J;S.prototype.fb=function(){return this.i.pixelRatio};S.prototype.getPixelRatio=S.prototype.fb;function Lm(a){a.m&&a.$&&a.m.ri({invert:a.g&&a.g.Fl})}
S.prototype.L=function(a){var b=a.added,c=a.removed;b&&b.za()&&b.za().ba(this);c&&c.za()&&c.za().ba(null);c===this.c&&(this.j=this.c=null);c===this.g&&(this.g=null);0===a.idx&&(this.dispatchEvent(new wg(this.u.mf,this.g=a.type!==this.a.b.le?b:0<this.a.a.length?this.a.get(0):z,a.type!==this.a.b.he?c:1<this.a.a.length?this.a.get(1):z)),Lm(this))};
S.prototype.ca=function(a){a.modifiers&&(this.v||(Mm(this,"start"),this.v=!0),Mm(this,"",a));this.v&&(this.ja&&y.clearTimeout(this.ja),this.ja=y.setTimeout(this.G,333))};function Mm(a,b,c){a.dispatchEvent(c?new Bh(a.u.Ni,c.newValue,c.oldValue,c.modifiers):a.u.Ni+b)}S.prototype.G=function(){Mm(this,"end");this.v=!1};S.prototype.kg=function(a,b){this.f.getCapabilities().lookAt&&this.b.Yb({position:a},!!b);return this};S.prototype.setCenter=S.prototype.kg;
S.prototype.lb=function(){var a=this.b.pb();return a?a.position:z};S.prototype.getCenter=S.prototype.lb;S.prototype.gf=function(a,b){this.b.gf(a,!!b);return this};S.prototype.setZoom=S.prototype.gf;S.prototype.qb=function(){return this.b.qb()};S.prototype.getZoom=S.prototype.qb;S.prototype.ge=function(a,b,c){this.f.ge(a,b,c)};S.prototype.zoomAt=S.prototype.ge;S.prototype.bn=function(){return this.Ba};S.prototype.getViewPort=S.prototype.bn;S.prototype.an=function(){return this.b};
S.prototype.getViewModel=S.prototype.an;S.prototype.vm=function(){return this.a};S.prototype.getLayers=S.prototype.vm;S.prototype.qm=function(){return this.m};S.prototype.getImprint=S.prototype.qm;
S.prototype.capture=function(a,b,c,d,e,f){function g(a,b){q?a.cancel():(x.save(),b.capture(v,m,function(b){x.restore();a.done(b)},function(b){a.done(null,b);h(null)}))}function h(b){q||(q=!0,a(b))}var k=this.vc(),l=k.getCapabilities(),m=this.i.pixelRatio,p=this.Ba,q=!1,t=this,v,x;if(!r(a))throw new D(this.capture,0,a);c=c||0;d=d||0;e=e||p.width;f=f||p.height;var E=Jc(0,Ic(c,e));var O=Jc(0,Ic(d,f));c=Ic(p.width,Jc(c,e));d=Ic(p.height,Jc(d,f));l.capture?k.capture(E,O,c,d).then(function(a){var c=t.m,
d=b||[];v=a;x=v.getContext("2d");v.style.width=v.width/m+"px";v.style.height=v.height/m+"px";var e=new Pj(10,g);d=d.concat(c).filter(function(a){return r(a&&a.capture)});d.length?(a=d.pop(),d.forEach(function(a){e.push(a,vc)}),e.push(a,A(h,t,v)),Lj(e)):h(v)},function(){h(z)}):a(null)};S.prototype.capture=S.prototype.capture;S.prototype.vc=function(){return this.o||this.f};S.prototype.getEngine=S.prototype.vc;
S.prototype.Mk=function(a){this.f.type===a||this.X||(this.X=!0,this.o=this.B(a),this.o.addEventListener("render",this.D));return this};S.prototype.setEngineType=S.prototype.Mk;S.prototype.D=function(a){a.target===this.o&&(this.o.removeEventListener("render",this.D),this.f.Af(this.P))};S.prototype.P=function(){var a=this.f.type;this.f.F();this.f=this.o;this.o=B;this.X=!1;this.dispatchEvent(new wg(this.u.kl,this.f.type,a))};
S.prototype.B=function(a,b){b=b?Im(b,this.B):this.i;if(a===Km.P2D)return Lm(this),new y.H.map.render.p2d.RenderEngine(this.Ba,this.b,this.a,b);if(a===Km.WEBGL)return Lm(this),new R(this.Ba,this.b,this.a,b);throw new D(this.Mk,0,a);};
S.prototype.pg=function(a,b,c,d,e){var f;b=Lb(b)?C(b,J,this.pg,1,b)&&b:this.b.pb().bounds.I();c=Lb(c)?+c:this.qb();d=Lb(d)?+d:this.qb();if(!(c<=d))throw new D(this.pg,B,"!(min <= max)");e=e||this.g;if(!C(e,Ck))throw new D(this.pg,4);if(!(f=e.za())||!C(f,Q)||!f.pe())throw new nc(this.constructor,"Storing is not supported");return new Gj(e,f,b,c,d,a)};S.prototype.storeContent=S.prototype.pg;function Nm(a){si.call(this,a)}w(Nm,si);Nm.prototype.f=function(){vi(this,2)};
Nm.prototype.c=function(){vi(this,4)};S.prototype.El=function(a){a=new Nm(a);yc().clear(A(a.f,a),A(a.c,a));return a};S.prototype.clearContent=S.prototype.El;S.prototype.Yi=function(a,b){var c=this.a,d=c.indexOf(a),e=b!==+b;b=e?c.a.length-1:b;0>d?c.add(a,b):d-b&&(c.lc(d),c.add(a,e?b-1:b));return this};S.prototype.addLayer=S.prototype.Yi;S.prototype.cg=function(a){var b=this.a.indexOf(a);a!==this.g&&a!==this.c&&-1!==b&&this.a.lc(b);return this};S.prototype.removeLayer=S.prototype.cg;
S.prototype.xd=function(a){this.g!==a&&(this.a.a.length&&this.a.get(0)!==this.c?this.a.set(0,a):this.a.add(a,0),this.g=a);return this};S.prototype.setBaseLayer=S.prototype.xd;S.prototype.Wl=function(){return this.g};S.prototype.getBaseLayer=S.prototype.Wl;S.prototype.Ga=function(a){if(!If(a))throw new D(this.Ga,0,a);return(a=this.f.Ga(a))?hf(a):z};S.prototype.geoToScreen=S.prototype.Ga;
S.prototype.Wa=function(a,b){var c;if(c=+F(a)||2*F(b))throw new D(this.Wa,c-1,arguments[c-1]);return(c=this.f.Wa(a,b))?Jf(c):z};S.prototype.screenToGeo=S.prototype.Wa;S.prototype.jg=function(a,b){return this.f.jg(a,b)};S.prototype.screenToLookAtData=S.prototype.jg;S.prototype.T=function(a){if(!C(a,L))throw new D(this.T,0,a);!this.c&&Jm(this);this.j.gc().T(a);return a};S.prototype.addObject=S.prototype.T;
S.prototype.La=function(a){if(!C(a,L))throw new D(this.La,0,a);!this.c&&Jm(this);this.j.gc().La(a);return a};S.prototype.removeObject=S.prototype.La;S.prototype.Cb=function(a){!this.c&&Jm(this);return this.j.gc().Cb(a)};S.prototype.getObjects=S.prototype.Cb;S.prototype.gd=function(a){var b;Qb(a,this.gd,0,a);!this.c&&Jm(this);var c=a.length;for(b=0;b<c;b++)this.T(a[b]);return this};S.prototype.addObjects=S.prototype.gd;
S.prototype.td=function(a){var b;Qb(a,this.td,0,a);!this.c&&Jm(this);var c=a.length;for(b=0;b<c;b++)this.La(a[b]);return this};S.prototype.removeObjects=S.prototype.td;S.prototype.Qd=function(a,b,c){var d;if(d=+F(a)||2*F(b))throw new D(this.Qd,d-1,arguments[d-1]);this.f.Ha(a,b,!0,function(a){c(a[0])})};S.prototype.getObjectAt=S.prototype.Qd;S.prototype.Ha=function(a,b,c){var d;if(d=+F(a)||2*F(b))throw new D(this.Qd,d-1,arguments[d-1]);this.f.Ha(a,b,!1,c)};S.prototype.getObjectsAt=S.prototype.Ha;
function Jm(a){a.j=new M({max:24});a.c=new Lk(a.j,a.i);a.a.add(a.c)}var Km={P2D:$k.P2D,WEBGL:$k.WEBGL};S.EngineType=Km;S.prototype.u={xo:"mapviewchangestart",Ni:"mapviewchange",Oi:"mapviewchangeend",mf:"baselayerchange",kl:"enginechange"};function Om(a,b){Om.l.constructor.call(this,a,b)}w(Om,xh);u("H.map.Marker",Om);n=Om.prototype;n.type=yg.MARKER;n.sg=1;n.Aa=function(a){if(a!==vg.VISUAL||1===this.wk||1===this.icon.getState())var b=Om.l.Aa.call(this,a);return b||!1};n.wk=0;n.Qj=function(a){return C(a,Si)};n.wh=!1;n.kk=function(){this.Aa(vg.VISUAL)};
n.ed=function(a){var b=this.icon;this.wh&&(b.removeEventListener("statechange",this.kk,!1,this),delete this.wh);b&&(this.wk=b.getState());Om.l.ed.call(this,a);0===a.getState()&&(this.wh=!0,pe(a,"statechange",this.kk,!1,this));return this};Om.prototype.setIcon=Om.prototype.ed;Om.prototype.c=function(a){return new Si(a.svg,a)};Om.prototype.U=function(){var a=this.getIcon(),b=a.io||0,c=Om.l.forWorkerMessage.call(this),d=c.properties.icon;d&&0<b&&Pa(d,{stick_color:a.ho,stick_height:b});return c};
Om.prototype.forWorkerMessage=Om.prototype.U;function Pm(a,b){Pm.l.constructor.call(this,Sg,b);this.ee(a)}w(Pm,fh);u("H.map.Rect",Pm);Pm.prototype.ee=function(a){if(!C(a,J))throw new D(this.ee,0,a);a.da(this.P)||(this.P=this.N=a,this.cb!==z&&Pm.l.fa.call(this,ah(a)))};Pm.prototype.setBoundingBox=Pm.prototype.ee;Pm.prototype.I=function(){return this.N};Pm.prototype.getBoundingBox=Pm.prototype.I;Pm.prototype.fa=function(){return this};Pm.prototype.setGeometry=Pm.prototype.fa;
Pm.prototype.pa=function(){this.cb||Pm.l.fa.call(this,ah(this.P));return this.cb};Pm.prototype.getGeometry=Pm.prototype.pa;function Qm(a,b,c){var d="anonymous",e=1;this.c=A(this.c,this);L.call(this,c);this.ee(a);c&&(a="crossOrigin",a in c&&(d=c[a]),a="opacity",a in c&&(e=c[a]));this.Lk(b,d);this.mc(e)}w(Qm,L);u("H.map.Overlay",Qm);Qm.prototype.type=yg.OVERLAY;Qm.prototype.I=function(){return this.N};Qm.prototype.getBoundingBox=Qm.prototype.I;Qm.prototype.ee=function(a){var b=this.N,c=!b;C(a,J,Qm,0,a);if(c||!b.da(a))this.N=a,c||this.Aa(vg.SPATIAL);return this};Qm.prototype.setBoundingBox=Qm.prototype.ee;
Qm.prototype.Xc=function(){return this.b.getData()};Qm.prototype.getBitmap=Qm.prototype.Xc;Qm.prototype.Lk=function(a,b){var c=this.b;c&&1!==c.getState()&&c.cancel();this.b=new Ni(a,this.c,!0,B,b);return this};Qm.prototype.setBitmap=Qm.prototype.Lk;Qm.prototype.c=function(a,b){this.b=b;1===a&&this.Aa(vg.VISUAL)};Qm.prototype.Zc=function(){return this.f};Qm.prototype.getOpacity=Qm.prototype.Zc;
Qm.prototype.mc=function(a){var b=this.f,c=2>b;if(0<=a&&1>=a)a!==b&&(this.f=a,c&&this.Aa(vg.VISUAL));else throw new D(this.mc,0);return this};Qm.prototype.setOpacity=Qm.prototype.mc;Qm.prototype.U=function(){var a=Qm.l.U.call(this);a.geometry=ah(this.N).U();a.properties.overlay=!0;return a};Qm.prototype.forWorkerMessage=Qm.prototype.U;function Rm(a){if(!a||!r(a.requestData))throw new D(Rm,0,"options.requestData");Rm.l.constructor.call(this,a);this.G=a.requestData;this.B=!!a.providesDomMarkers}w(Rm,Q);u("H.map.provider.MarkerTileProvider",Rm);Rm.prototype.Md=function(a){return a?a.length+1:1};Rm.prototype.getEntryWeight=Rm.prototype.Md;
Rm.prototype.Pa=function(a,b,c,d,e){var f=this;return this.G(a,b,c,function(e){for(var g=[],k,l,m=e.length;m--;)l=e[m],l.ko=f.getTileKey(a,b,c),l.ba(f),k=l.Ab(),(C(l,Ah)||1===k.getState())&&g.push(e[m]);d(g)},e)};Rm.prototype.requestInternal=Rm.prototype.Pa;Rm.prototype.Wd=function(a,b){b===vg.VISUAL&&(a=this.Ob().get(a.ko))&&(a.valid=!1,sj(this,a))};Rm.prototype.invalidateObject=Rm.prototype.Wd;Rm.prototype.Tb=function(){return this.B};Rm.prototype.providesDomMarkers=Rm.prototype.Tb;
Rm.prototype.Ub=Re;Rm.prototype.providesMarkers=Rm.prototype.Ub;function Sm(a,b){Sm.l.constructor.call(this,a,b)}w(Sm,Ck);u("H.map.layer.MarkerTileLayer",Sm);var Tm={markers:[],total:0,requested:0};function Um(a,b,c,d,e){var f=Lc(c);a.pixelProjection.Ea(f);b=a.Ud(a.Ae(b),f);c=a.Je(b,b.left>b.right,~~c,d,e);a=c.tiles;c=c.total;d=a.length;e=[];var g;for(g=0;g<d;g++)for(b=a[g],f=b.data.length;f--;)e.push(b.data[f]);return{markers:e,total:a.length,requested:c}}Sm.prototype.Ic=function(a,b,c,d){return this.a.providesDomMarkers()?Tm:Um(this,a,b,c,d)};
Sm.prototype.requestMarkers=Sm.prototype.Ic;Sm.prototype.Hc=function(a,b,c,d){return this.a.providesDomMarkers()?Um(this,a,b,c,d):Tm};Sm.prototype.requestDomMarkers=Sm.prototype.Hc;function Vm(a,b,c){var d,e=6;if(b){for(d=' expected close to: "'+b;e--;)b=a.a.next(),-1!==b&&(d+=String.fromCharCode(b));d+='"'}throw new D(Wm,0,"- Malformed WKT: "+(d?c+d:"unexpected end of stream"));}var Xm={ql:" ",nl:"(",ol:")",jl:",",ll:""};Object.keys(Xm).reduce(function(a,b){a[Xm[b]]=!0;return a},Fb());function Ym(a,b){var c=a.next();b=b?")":"(";c!==b&&Vm(a,c,'"'+b+'"')}function Zm(a){return","===$m(a)?(a.next(),!0):!1}
function an(a,b,c,d,e){var f,g,h=2+b+c;for(g=1;g<=h;g++)(c=a.next())?(f=+c)!==f?Vm(a,c,"number"):1===g?d[e+1]=f:2===g?d[e]=f:3===g&&(d[e+2]=f):Vm(a,c);b||(d[e+2]=0)}var bn=[];function cn(a,b,c,d){d||Ym(a,0);an(a,b,c,bn,0);d||Ym(a,1);return new I(bn[0],bn[1],b?bn[2]:B)}function dn(a,b,c){var d=[];Ym(a,0);do an(a,b,c,d,d.length);while(Zm(a));Ym(a,1);return new K(d)}function en(a,b,c){Ym(a,0);var d=dn(a,b,c);if(Zm(a)){var e=[];do e.push(dn(a,b,c));while(Zm(a))}Ym(a,1);return new N(d,e)}
var fn=[],gn=[en],hn=[cn],jn={POINT:hn,LINESTRING:[dn],POLYGON:gn,MULTIPOINT:[cn,th],MULTILINESTRING:[dn,Vg],MULTIPOLYGON:[en,dh],GEOMETRY:fn,GEOMETRYCOLLECTION:fn,CIRCULARSTRING:fn,COMPOUNDCURVE:fn,CURVEPOLYGON:fn,MULTICURVE:fn,MULTISURFACE:fn,CURVE:fn,SURFACE:fn,POLYHEDRALSURFACE:fn,TIN:fn,TRIANGLE:fn},kn={Z:1,M:2,ZM:3};
function Wm(a){a=new ln(a);var b;var c=a.next();(b=jn[c.toUpperCase()])||Vm(a,c,"type name");if(b!==fn){c=$m(a);c=kn[c.toUpperCase()];var d=c&1;var e=c>>1;d|e&&a.next();c=$m(a);if("EMPTY"===c)if(a.next(),d=b[1])var f=new d([]);else b!==hn&&(f=new K([]),b===gn&&(f=new N(f)));else if("("===c){f=b[0];b=b[1];if(b){var g=[];Ym(a,0);if(f===cn){var h="("!==$m(a);do g.push(f(a,d,e,h));while(Zm(a))}else{do g.push(f(a,d,e));while(Zm(a))}Ym(a,1);d=new b(g)}else d=f(a,d,e);f=d}else Vm(a,c,'"Z", "M", "ZM", "(" or "EMPTY"');
a.next()&&Vm(a,c,"end of stream")}return f||z}function ln(a){this.a=a}function $m(a){var b=a.b;if(b===B){for(b=a.a;b.a()===mn;)b.next();if(nn[b.a()])b=b.next(),b=b===on?"":String.fromCharCode(b);else{b.f();do b.next();while(!nn[b.a()]);b=String.fromCharCode.apply(null,b.b())}a.b=b}return b}ln.prototype.next=function(){var a=$m(this);""!==a&&delete this.b;return a};var mn=32,on=-1,pn={ql:mn,nl:40,ol:41,jl:44,ll:on},nn=Object.keys(pn).reduce(function(a,b){a[pn[b]]=!0;return a},Fb());function qn(){}u("H.util.ICharStream",qn);qn.prototype.next=function(){};qn.prototype.f=function(){};qn.prototype.b=function(){};qn.prototype.a=function(){};function rn(a){this.i=String(a);this.j=0;this.c=[];this.g=!1}u("H.util.CharStream",rn);rn.prototype.next=function(){var a=this.i.charCodeAt(this.j++);a=isNaN(a)?-1:a;this.g&&this.c.push(a);return a};rn.prototype.f=function(){this.g=!0;this.c=[]};rn.prototype.b=function(){var a=this.c.slice();this.g=!1;this.c=[];return a};rn.prototype.a=function(){var a=this.i.charCodeAt(this.j);return isNaN(a)?-1:a};u("H.util.wkt.toGeometry",function(a){return Wm(new rn(a))});function sn(){return qf("mapsjs-core","1.8.1","55a4702")}u("H.buildInfo",sn);var tn=function(){var a="maps"+eval('"js-"');var b=y.document.querySelector('script[src*="'+a+'"]');if(!b){var c=y.document.getElementsByTagName("script");var d=new RegExp("^.*"+a);var e=0;for(a=c.length;e<a;e++)if(d.test(c[e].src)){b=c[e];break}}return b?b.src.replace(/\/[^\/]*$/,"/"):""}();u("H.getScriptPath",function(){return tn});
}).call(window);
H.__bootstrap__="var l,p=this;function aa(a){return\"string\"==typeof a}function ca(a,b,c){a=a.split(\".\");c=c||p;a[0]in c||!c.execScript||c.execScript(\"var \"+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b}function da(){}\nfunction ea(a){var b=typeof a;if(\"object\"==b)if(a){if(a instanceof Array)return\"array\";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(\"[object Window]\"==c)return\"object\";if(\"[object Array]\"==c||\"number\"==typeof a.length&&\"undefined\"!=typeof a.splice&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"splice\"))return\"array\";if(\"[object Function]\"==c||\"undefined\"!=typeof a.call&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"call\"))return\"function\"}else return\"null\";\nelse if(\"function\"==b&&\"undefined\"==typeof a.call)return\"object\";return b}function r(a){return\"function\"==ea(a)}function fa(a){var b=typeof a;return\"object\"==b&&null!=a||\"function\"==b}var ia=\"closure_uid_\"+(1E9*Math.random()>>>0),ja=0;function ka(a,b,c){return a.call.apply(a.bind,arguments)}\nfunction ma(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function na(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf(\"native code\")?na=ka:na=ma;return na.apply(null,arguments)}\nfunction pa(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}}function t(a,b){ca(a,b,void 0)}function qa(a,b){function c(){}c.prototype=b.prototype;a.U=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Xb=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};function x(){}t(\"H.util.ICache\",x);x.prototype.add=function(){};x.prototype.add=x.prototype.add;x.prototype.get=function(){};x.prototype.get=x.prototype.get;x.prototype.qa=function(){};x.prototype.drop=x.prototype.qa;x.prototype.forEach=function(){};x.prototype.forEach=x.prototype.forEach;x.prototype.S=function(){};x.prototype.removeAll=x.prototype.S;x.prototype.$=function(){};x.prototype.registerOnDrop=x.prototype.$;x.prototype.oa=function(){};x.prototype.deRegisterOnDrop=x.prototype.oa;function ra(){var a=sa,b;for(b in a)return!1;return!0}function ta(a){var b={},c;for(c in a)b[c]=a[c];return b}var ua=\"constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf\".split(\" \");function va(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<ua.length;f++)c=ua[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var z=this;function wa(a){if(Error.captureStackTrace)Error.captureStackTrace(this,wa);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}qa(wa,Error);wa.prototype.name=\"CustomError\";var xa=Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b,void 0)}:function(a,b){if(aa(a))return aa(b)&&1==b.length?a.indexOf(b,0):-1;for(var c=0;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};var ya=na,za=String,Aa=z.Object.freeze||function(a){return a},A=self.eval(\"undefined\"),Ba=self.eval(\"null\");function Ca(a){return za(a).split(\",\"!==A?\",\":\" \")}var Da=\"prototype constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf\".split(\" \");function Ea(a,b,c,d){if(!(b=a instanceof b)&&c)throw new B(c,d,void 0!==A?void 0:a);return b}function Ha(a,b,c,d){var e;if(!(e=\"Array\"===Ia(a))&&b)throw new B(b,c,d!==A?d:a);return e}\nt(\"H.lang.isArray\",function(a,b,c,d){return Ha(a,b,c,d)});t(\"H.lang.isString\",aa);var Ja=isNaN;function Ka(a){return a===+a}t(\"H.lang.isNumber\",Ka);t(\"H.lang.isInteger\",Number.isInteger?Number.isInteger:function(a){return\"number\"===typeof a&&0===a%1});function Ia(a){var b=Object[Da[0]][Da[6]].call(a).match(/^\\[object (\\w+)\\]$/);return b?b[1]:typeof a}var La=[];0>La.indexOf(La)&&La.push(La);\nfunction Ma(a,b,c,d){var e=\"\",f=2>arguments.length,g;f&&(b={H:z.H},c=\"\",d=La.slice());Na(b,!0,function(b,f){try{if(g=b[f],f=Oa(b,g),!(fa(g)&&g.window===g&&g.self===g||fa(g)&&0<g.nodeType&&r(g.cloneNode))&&fa(g)){if(g===a)return e=c+\".\"+f,!0;if(0>d.indexOf(g)&&(d.push(g),e=Ma(a,g,c+\".\"+f,d)))return!0}}catch(m){}});f&&(e=e?e.substr(1).replace(\".\"+Da[0]+\".\",\"#\"):\"~\"+(r(a)?Pa(a)+\"()\":Ia(a)));return e}\nfunction Oa(a,b){var c=[];Na(a,!1,function(a,e){a[e]===b&&c.push(e)});return c.sort(Qa)[0]}function Qa(a,b){return b.length-a.length}var Ra=Object[Da[0]][Da[2]];function Na(a,b,c){var d;if(a){for(e in a)if((!b||Ra.call(a,e))&&c(a,e,!0))return;for(d=Da.length;d--;){var e=Da[d];if((!b||Ra.call(a,e))&&c(a,e,!1))break}}}function Pa(a){return(a=/^\\s*function ([^\\( ]+)/.exec(a))?a[1]:\"anonymous\"}function Sa(a,b,c){c[b]=\"#\"+b};function D(a,b,c){this.g=[];b&&this.$(b);if(c&&!r(c))throw new B(D,2,c);this.b=0;this.filter=c;this.a={};this.f=this.c=null;this.Da(a)}t(\"H.util.Cache\",D);D.prototype.add=function(a,b,c){c=+c;if(!Ka(c)||0>c)throw new B(this.add,2,c);a=String(a);var d=this.a[a];var e=!0;this.filter&&(e=this.filter(a,b,c));d?e?(this.b+=c-d.size,d.size=c,d.data=b,Ta(this,d)):Ua(this,d,!0):e&&(this.a[a]=Va(this,{id:a,data:b,size:c,A:null,D:null},this.c));Wa(this);return e};D.prototype.add=D.prototype.add;\nD.prototype.$=function(a){if(!r(a))throw new B(this.$,0,a);this.g.push(a)};D.prototype.registerOnDrop=D.prototype.$;D.prototype.oa=function(a){this.g=this.g.filter(function(b){return b!==a})};D.prototype.deRegisterOnDrop=D.prototype.oa;D.prototype.get=function(a,b){return(a=b?this.a[a]:Ta(this,this.a[a]))&&a.data};D.prototype.get=D.prototype.get;D.prototype.qa=function(a){var b;(b=this.a[a])&&Ua(this,b,!0)};D.prototype.drop=D.prototype.qa;\nD.prototype.forEach=function(a,b,c){var d;for(d in this.a){var e=this.a[d];(c?c(d,e.data,e.size):1)&&a.call(b,d,e.data,e.size)}};D.prototype.forEach=D.prototype.forEach;D.prototype.S=function(a){var b;for(b in this.a){var c=this.a[b];(a?a(b,c.data,c.size):1)&&Ua(this,this.a[b],!0)}};D.prototype.removeAll=D.prototype.S;D.prototype.Da=function(a){if(!(0<+a))throw new B(D.prototype.Da,0,a);this.i=+a;Wa(this);return this};D.prototype.setMaxSize=D.prototype.Da;D.prototype.ob=function(){return this.i};\nD.prototype.getMaxSize=D.prototype.ob;D.prototype.kb=function(){return this.b};D.prototype.getCurrentSize=D.prototype.kb;function Ta(a,b){b&&(a.c=Va(a,b,a.c));return b}function Wa(a){for(;a.b>a.i&&a.f;)Ua(a,a.f,!0)}function Va(a,b,c){if(c!==b){(b.A||b.D)&&Ua(a,b);if(b.A=c)b.D=c.D,c.D=b;b.D||(a.c=b);b.A||(a.f=b);a.b+=b.size}return b}\nfunction Ua(a,b,c){var d=b.D,e=b.A;if(d||e||b==a.c&&b==a.f)if(d?d.A=e:a.c=e,e?e.D=d:a.f=d,a.b-=b.size,c){for(c=a.g.length;c--;)a.g[c].call(a,b.id,b.data,b.size);delete a.a[b.id]}b.A=b.D=null};function E(){}t(\"H.service.extension.dataView.ITable\",E);E.prototype.ta=function(){};E.prototype.getMeta=E.prototype.ta;E.prototype.ua=function(){};E.prototype.getRowCount=E.prototype.ua;E.prototype.ha=function(){};E.prototype.getRow=E.prototype.ha;E.prototype.C=function(){};E.prototype.getColumnNames=E.prototype.C;E.prototype.sa=function(){};E.prototype.getColumn=E.prototype.sa;E.prototype.s=function(){};E.prototype.getCell=E.prototype.s;E.prototype.concat=function(){};E.prototype.concat=E.prototype.concat;function $a(){}t(\"H.service.extension.dataView.IRow\",$a);$a.prototype.C=function(){};$a.prototype.getColumnNames=$a.prototype.C;$a.prototype.s=function(){};$a.prototype.getCell=$a.prototype.s;$a.prototype.va=function(){};$a.prototype.getTable=$a.prototype.va;function ab(a,b){this.a=a;this.b=b}t(\"H.service.extension.dataView.ObjRow\",ab);ab.prototype.C=function(){return this.a.C()};ab.prototype.getColumnNames=ab.prototype.C;ab.prototype.s=function(a){return this.a.s(this.b,a)};ab.prototype.getCell=ab.prototype.s;ab.prototype.va=function(){return this.a};ab.prototype.getTable=ab.prototype.va;function bb(){}t(\"H.service.extension.dataView.IColumn\",bb);bb.prototype.s=function(){};bb.prototype.getCell=bb.prototype.s;function cb(a,b){this.b=a;this.a=b}t(\"H.service.extension.dataView.ObjColumn\",cb);cb.prototype.s=function(a){return this.b.s(a,this.a)};cb.prototype.getCell=cb.prototype.s;function B(a,b,c){var d=arguments.length;b=1<d?+b:b;d=2<d?za(c):\"\";if(b!==A){var e=(e=/^.*?\\(([^\\)]+)/.exec((\"\"+a).replace(/(\\/\\*([\\s\\S]*?)\\*\\/)|(\\/\\/(.*)$)/gm,\"\")))?Ca(e[1].replace(/\\s+/g,\"\")):[];e.forEach(Sa);e=e[b]||\"#\"+b}this.message=(a?Ma(a):\"\")+(e||d?\" (\":\"\")+(e?\"Argument \"+e:\"\")+(d?(e?\" \":\"\")+d:\"\")+(e||d?\")\":\"\");this.stack=Error().stack}t(\"H.lang.InvalidArgumentError\",B);B.prototype=Error();B.prototype.name=\"InvalidArgumentError\";function F(a,b,c){var d;b=b||(a&&a.length?Object.keys(a[0]):A);this.F=a;if(b)for(this.M=b,this.na=a=Object.create(Ba,void 0),d=b.length;d--;)a[b[d]]=!0;c!==A&&(this.ya=c)}t(\"H.service.extension.dataView.ObjTable\",F);l=F.prototype;l.ya=A;l.F=A;l.M=A;l.na=A;l.ta=function(){return this.ya};F.prototype.getMeta=F.prototype.ta;F.prototype.ua=function(){return this.F?this.F.length:0};F.prototype.getRowCount=F.prototype.ua;F.prototype.ha=function(a){var b=this.F;return b&&b[a]?new ab(this,a):A};\nF.prototype.getRow=F.prototype.ha;F.prototype.C=function(){return this.M||db};F.prototype.getColumnNames=F.prototype.C;F.prototype.sa=function(a){return this.na[a]?new cb(this,a):A};F.prototype.getColumn=F.prototype.sa;F.prototype.s=function(a,b){var c=this.F;return(a=c&&this.na[b]&&c[a])&&a[b]};F.prototype.getCell=F.prototype.s;\nF.prototype.concat=function(){var a=arguments.length,b,c=this.M,d=\"\"+this.M,e=(this.F||[]).slice();for(b=0;b<a;b++){var f=arguments[b];if(!(f instanceof F))throw new B(this.concat,b);if(f.F){if(c&&\"\"+f.M!==d)throw new B(this.concat,b,\"Incompatible columns!\");e=e.concat(f.F)}}return new F(e,this.M,this.ya)};F.prototype.concat=F.prototype.concat;function G(a,b){this.x=+a;this.y=+b}t(\"H.math.Point\",G);G.prototype.set=G;G.prototype.set=G.prototype.set;G.prototype.clone=function(a){a?(a.x=this.x,a.y=this.y):a=new G(this.x,this.y);return a};G.prototype.clone=G.prototype.clone;G.prototype.add=function(a){this.x+=a.x;this.y+=a.y;return this};G.prototype.add=G.prototype.add;G.prototype.sub=function(a){this.x-=a.x;this.y-=a.y;return this};G.prototype.sub=G.prototype.sub;G.prototype.scale=function(a,b){this.x*=a;this.y*=void 0===b?a:b;return this};\nG.prototype.scale=G.prototype.scale;G.prototype.round=function(){this.x=eb(this.x);this.y=eb(this.y);return this};G.prototype.round=G.prototype.round;G.prototype.floor=function(){this.x=fb(this.x);this.y=fb(this.y);return this};G.prototype.floor=G.prototype.floor;G.prototype.ceil=function(){this.x=gb(this.x);this.y=gb(this.y);return this};G.prototype.ceil=G.prototype.ceil;G.prototype.G=function(a){return!(!a||this.x!==a.x||this.y!==a.y)};G.prototype.equals=G.prototype.G;\nG.prototype.pb=function(a,b){var c=b.x-a.x,d=b.y-a.y,e=a;if(c||d){var f=((this.x-a.x)*c+(this.y-a.y)*d)/(c*c+d*d);0>=f?e=a:1<=f?e=b:e=new G(a.x+f*c,a.y+f*d)}return e};G.prototype.getNearest=G.prototype.pb;G.prototype.pa=function(a){return hb(ib(this.x-a.x,2)+ib(this.y-a.y,2))};G.prototype.distance=G.prototype.pa;G.fromIPoint=function(a){if(!a)throw Error(\"invalid argument\");return a instanceof G?a:new G(a.x,a.y)};var H=Math,jb=H.min,kb=H.max,eb=H.round,fb=H.floor,gb=H.ceil,lb=H.abs,mb=H.log,hb=H.sqrt,ib=H.pow,nb=H.exp,ob=H.sin,pb=H.asin,qb=H.cos,rb=H.tan,sb=H.atan,tb=H.atan2,ub=H.LN2,J=H.PI,vb=J/2,wb=J/4,xb=2*J,zb=3*J,Ab=J/180,Bb=180/J,Cb=1/0;ib(-2,53);function Db(a,b){var c;return 0>(c=a%b)===0>b?c:c+b}t(\"H.math.normalize\",function(a,b,c){b-=c=c||0;a-=c;return a-fb(a/b)*b+c});function Eb(a,b,c){return a>c?c:a<b?b:a}t(\"H.math.clamp\",Eb);\nfunction Fb(a,b,c,d){d||(d=0);return b<c?a>=b-d&&a<=c+d:a>=c-d&&a<=b+d}function Gb(a,b,c,d,e,f){return hb(ib((a-e)*(d-f)-(b-f)*(c-e),2)/(ib(c-e,2)+ib(d-f,2)))}var Hb={NONE:0,VERTEX:1,EDGE:2,SURFACE:3};t(\"H.math.CoverType\",Hb);\nfunction Ib(a,b,c,d,e){for(var f=c.length,g=f,h,k,m,q=c[0],n=0,u=0,C=0,y=d/2||0,v=e?1:3;1!=n&&g>v;){h=c[--g];d=c[--g];m=c[g?g-1:(f+(g-1))%f];k=c[g?g-2:(f+(g-2))%f];if(d>=a-y&&d<=a+y&&h>=b-y&&h<=b+y||k>=a-y&&k<=a+y&&m>=b-y&&m<=b+y)n=1;else if(!n&&d===a)k===a&&(h<b&&m>b||h>b&&m<b)||(q<=a&&k>a||q>=a&&k<a)&&(h>=b?++u:++C),n=Fb(b,h,m,y)&&Gb(a,b,d,h,k,m)<=y?2:0;else if(!n&&Fb(a,d,k,y)){if(d<a&&k>a||d>a&&k<a)q=h+(a-d)/(k-d)*(m-h),u+=q>b,C+=q<b;n=Fb(b,h,m,y)&&Gb(a,b,d,h,k,m)<=y?2:0}q=d}!n&&e&&0!==C&&0!==\nu%2&&(n=3);return n}t(\"H.math.isCoveredBy\",Ib);function Jb(a,b,c,d,e,f){var g,h,k=a.length,m,q;if(k)for(g=[];k--;){var n=a[k];var u=n.length;var C=0;for(m=1;m<u;m++)if(q=Kb(n[m-1],n[m],c,b,d,e)){var y=q[0];var v=q[1];C&&C.G(y)?h.push(v):g.push(h=q);C=v;f&&(m=u,k=0)}}else g=a;return g}t(\"H.math.clipping.clipStrips\",Jb);\nfunction Kb(a,b,c,d,e,f){var g=a.x;a=-a.y;var h=b.x;b=-b.y;c=-c;f=-f;if(g>h){if(h>e||g<d)return;var k=g;var m=a;g=h;a=b;h=k;b=m;k=1}else if(g>e||h<d)return;if(a>b){if(b>c||a<f)return;var q=1;a=-a;b=-b;m=f;f=-c;c=-m}else if(a>c||b<f)return;if(g<d){if((a+=(d-g)*(b-a)/(h-g))>c)return;g=d}if(a<f){if((g+=(f-a)*(h-g)/(b-a))>e)return;a=f}h>e&&(b=a+(e-g)*(b-a)/(h-g),h=e);b>c&&(h=g+(c-a)*(h-g)/(b-a),b=c);q&&(a=-a,b=-b);return k?[new G(h,-b),new G(g,-a)]:[new G(g,-a),new G(h,-b)]}\nfunction Lb(a,b,c){a=Mb(a,!0);b=Mb(b,!1);var d,e;var f={};var g=d=1;switch(~~(c||0)){case 1:g=d=0;break;case 2:d=0;g=1;break;case 3:d=1,g=0}c=d;var h=g;if(b&&a){b.ea=Nb(b.x,b.y,null,Ob(b));a.ea=Nb(a.x,a.y,null,Ob(a));for(g=b;g.next;g=g.next)if(!g.B)for(d=a;d.next;d=d.next)if(!d.B){var k=Pb(g.next);var m=Pb(d.next);if(e=Qb(g,k,d,m,f)){e=f.Za;var q=f.$a;var n=f.Rb;var u=f.Sb;e=Nb(n,u,null,null,null,null,!0,0,0,e);Rb(e,g,k);k=Nb(n,u,null,null,null,null,!0,0,0,q);Rb(k,d,m);e.za=k;k.za=e}}f=Sb(b,a);c&&\n(f=!f);for(g=b;g;g=g.next)g.B&&(g.ra=f,f=!f);f=Sb(a,b);h&&(f=!f);for(d=a;d.next;d=d.next)d.B&&(d.ra=f,f=!f);Tb(b);for(Tb(a);(a=Ub(b))!=b;){for(c=null;!a.ma;a=a.za){for(f=a.ra;;){c=Nb(a.x,a.y,c);c.artificial=a.B||a.Ab;a.ma=1;a=f?a.next:a.u;if(!a)break;if(a.B){a.ma=1;break}}if(!a)break}c.Ra=C;var C=c}return C}}t(\"H.math.clipping.clipPolygon\",Lb);\nfunction Nb(a,b,c,d,e,f,g,h,k,m){a={x:a,y:b,next:c||null,u:d||null,Ra:e||null,za:f||null,B:!!g,ra:h||0,ma:k||0,alpha:m||0};d&&(a.u.next=a);c&&(a.next.u=a);return a}function Pb(a){for(;a&&a.B;)a=a.next;return a}function Ob(a){if(a)for(;a.next;)a=a.next;return a}function Ub(a){var b=a;if(b){do b=b.next;while(b!=a&&(!b.B||b.B&&b.ma))}return b}function Tb(a){var b=Ob(a);b.u.next=a;a.u=b.u}\nfunction Qb(a,b,c,d,e){var f,g=b.x-a.x,h=b.y-a.y;var k=d.x-c.x;var m=d.y-c.y;var q=g*m-h*k;if(!q)return 0;k=((c.x-a.x)*m-(c.y-a.y)*k)/q;q=(h*(c.x-a.x)-g*(c.y-a.y))/q;if(0>k||1<k||0>q||1<q)return 0;0===k?f=a:1===k?f=b:0===q?f=c:1===q&&(f=d);if(f)return f.x+=2.480549651603763E-5,f.y+=7.321997314118067E-5,f.ea&&(f.ea.x=f.x,f.ea.y=f.y),Qb(a,b,c,d,e);e.Rb=a.x+k*g;e.Sb=a.y+k*h;e.Za=k;e.$a=q;return 1}\nfunction Sb(a,b){var c=[];if(Array.isArray(b))c=b.reduce(function(a,b){a.push(b.x,b.y);return a},c);else for(;b;)c.push(b.x,b.y),b=b.next;return Ib(a.x,a.y,c,0,!0)!==Hb.NONE}function Rb(a,b,c){for(b=b.next;b!==c&&b.alpha<=a.alpha;)b=b.next;a.next=b;a.u=b.u;a.next.u=a;a.u.next=a}function Mb(a,b){for(var c,d=null,e=0,f=a.length;e<f;e++){c=Nb(a[e].x,a[e].y,d);c.Ab=b;if(c.next=d)d.u=c;d=c}return d};function Vb(a,b){var c=[];a&&c.push(Ma(a));1<arguments.length&&c.push(b);this.message=c.join(\" \");this.stack=Error().stack}qa(Vb,Error);t(\"H.lang.IllegalOperationError\",Vb);Vb.prototype=Error();Vb.prototype.name=\"IllegalOperationError\";function Wb(){if(!aa(\"STATIC_DB\"))throw new B(this.constructor,0);this.i=z.indexedDB||z.webkitIndexedDB||z.mozIndexedDB||z.msIndexedDB;if(!this.i)throw new Vb(this.constructor,\"This browser does not support IndexedDB\");this.a=[];this.c=[];this.g=ya(this.g,this)}var Xb,Yb;Wb.prototype.get=function(a,b,c){var d;if(!aa(a)&&!Ka(a))throw new B(this.get,0);if(!r(b))throw new B(this.get,1);Zb(this,function(e){d=e.get(a);$b(d,b,c)},c);return{cancel:function(){d&&(d.onsuccess=ac)}}};\nWb.prototype.g=function(){var a=this.b.result;a.objectStoreNames.contains(\"data\")||a.createObjectStore(\"data\")};\nfunction bc(a,b,c){if(a.b)a.a?(a.a.push(b),c&&a.c.push(c)):a.f?c&&c(a.f):b(a.b.result);else{a.b=a.i.open(cc+\"STATIC_DB\",1);a.b.onupgradeneeded=a.g;var d=a.b.onerror=function(){clearTimeout(a.v);a.f=this.error;a.c.forEach(function(b){b(a.f)});a.a=a.c=null};a.v=setTimeout(function(){d.call({error:Error(\"DbOpenTimeoutError\")})},500);a.b.onsuccess=function(){clearTimeout(a.v);a.a?(a.a.forEach(function(a){a(this.result)},this),a.a=a.c=null):(a.b=a.f=null,a.a=[],a.c=[])};a.a.push(b);c&&a.c.push(c)}}\nfunction Zb(a,b,c){bc(a,function(a){a=a.transaction([\"data\"],\"readwrite\");b(a.objectStore(\"data\"))},c)}function $b(a,b,c){b&&(a.onsuccess=function(){b(this.result)});c&&(a.onerror=function(){c(this.error)})}t(\"H.util.IndexedDBStorage.getInstance\",function(){Xb||(Xb=new Wb);return Xb});var cc=\"H_\";\nt(\"H.util.IndexedDBStorage.isSupported\",function(){if(Yb===A)if(\"file:\"===window.location.protocol&&-1<navigator.userAgent.toLowerCase().indexOf(\"firefox\")&&128<=window.location.href.length)Yb=!1;else{var a=z.indexedDB||z.webkitIndexedDB||z.mozIndexedDB||z.msIndexedDB;var b=cc+\"TEST_DB\";try{var c=a&&a.open(b,1)}catch(d){}Yb=!!c&&null===c.onupgradeneeded;c&&a.deleteDatabase&&a.deleteDatabase(b)}return Yb});function K(){0!=dc&&(ec[this[ia]||(this[ia]=++ja)]=this);this.c=this.c;this.a=this.a}var dc=0,ec={};K.prototype.c=!1;K.prototype.N=function(){if(!this.c&&(this.c=!0,this.fa(),0!=dc)){var a=this[ia]||(this[ia]=++ja);if(0!=dc&&this.a&&0<this.a.length)throw Error(this+\" did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.\");delete ec[a]}};\nK.prototype.L=function(a,b){this.c?void 0!==b?a.call(b):a():(this.a||(this.a=[]),this.a.push(void 0!==b?na(a,b):a))};K.prototype.fa=function(){if(this.a)for(;this.a.length;)this.a.shift()()};function L(a,b){this.type=a;this.currentTarget=this.target=b;this.a=!1;this.Ta=!0}L.prototype.stopPropagation=function(){this.a=!0};L.prototype.c=function(){this.Ta=!1};t(\"H.util.Event\",L);L.prototype.stopPropagation=L.prototype.stopPropagation;L.prototype.stopPropagation=L.prototype.stopPropagation;L.prototype.CAPTURING_PHASE=1;L.prototype.CAPTURING_PHASE=L.prototype.CAPTURING_PHASE;L.prototype.AT_TARGET=2;L.prototype.AT_TARGET=L.prototype.AT_TARGET;L.prototype.BUBBLING_PHASE=3;L.prototype.BUBBLING_PHASE=L.prototype.BUBBLING_PHASE;L.prototype.eventPhase=0;L.prototype.eventPhase=L.prototype.eventPhase;function fc(a,b,c){fc.U.constructor.call(this,a,c);this.data=b}qa(fc,L);t(\"H.util.DataEvent\",fc);function gc(a,b,c){gc.U.constructor.call(this,a,c);this.message=b}qa(gc,L);t(\"H.util.ErrorEvent\",gc);function hc(a,b){this.c=a;this.f=b;this.b=0;this.a=null}hc.prototype.get=function(){if(0<this.b){this.b--;var a=this.a;this.a=a.next;a.next=null}else a=this.c();return a};function ic(a,b){a.f(b);100>a.b&&(a.b++,b.next=a.a,a.a=b)};function jc(){this.b=this.a=null}var nc=new hc(function(){return new kc},function(a){a.reset()});jc.prototype.add=function(a,b){var c=nc.get();c.set(a,b);this.b?this.b.next=c:this.a=c;this.b=c};function oc(){var a=pc,b=null;a.a&&(b=a.a,a.a=a.a.next,a.a||(a.b=null),b.next=null);return b}function kc(){this.next=this.b=this.a=null}kc.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};kc.prototype.reset=function(){this.next=this.b=this.a=null};var qc=String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\\s\\xa0]*([\\s\\S]*?)[\\s\\xa0]*$/.exec(a)[1]};function rc(a,b){return a<b?-1:a>b?1:0};var sc;a:{var tc=p.navigator;if(tc){var uc=tc.userAgent;if(uc){sc=uc;break a}}sc=\"\"}function M(a){return-1!=sc.indexOf(a)};function vc(a){p.setTimeout(function(){throw a;},0)}var wc;\nfunction xc(){var a=p.MessageChannel;\"undefined\"===typeof a&&\"undefined\"!==typeof window&&window.postMessage&&window.addEventListener&&!M(\"Presto\")&&(a=function(){var a=document.createElement(\"IFRAME\");a.style.display=\"none\";a.src=\"\";document.documentElement.appendChild(a);var b=a.contentWindow;a=b.document;a.open();a.write(\"\");a.close();var c=\"callImmediate\"+Math.random(),d=\"file:\"==b.location.protocol?\"*\":b.location.protocol+\"//\"+b.location.host;a=na(function(a){if((\"*\"==d||a.origin==d)&&a.data==\nc)this.port1.onmessage()},this);b.addEventListener(\"message\",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if(\"undefined\"!==typeof a&&!M(\"Trident\")&&!M(\"MSIE\")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(void 0!==c.next){c=c.next;var a=c.Ia;c.Ia=null;a()}};return function(a){d.next={Ia:a};d=d.next;b.port2.postMessage(0)}}return\"undefined\"!==typeof document&&\"onreadystatechange\"in document.createElement(\"SCRIPT\")?function(a){var b=document.createElement(\"SCRIPT\");\nb.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){p.setTimeout(a,0)}};function yc(a,b){zc||Ac();Bc||(zc(),Bc=!0);pc.add(a,b)}var zc;function Ac(){if(-1!=String(p.Promise).indexOf(\"[native code]\")){var a=p.Promise.resolve(void 0);zc=function(){a.then(Cc)}}else zc=function(){var a=Cc;!r(p.setImmediate)||p.Window&&p.Window.prototype&&!M(\"Edge\")&&p.Window.prototype.setImmediate==p.setImmediate?(wc||(wc=xc()),wc(a)):p.setImmediate(a)}}var Bc=!1,pc=new jc;function Cc(){for(var a;a=oc();){try{a.a.call(a.b)}catch(b){vc(b)}ic(nc,a)}Bc=!1};function O(a){this.a=Dc;this.v=void 0;this.f=this.b=this.c=null;this.g=this.i=!1;if(a!=da)try{var b=this;a.call(void 0,function(a){Ec(b,Fc,a)},function(a){Ec(b,Gc,a)})}catch(c){Ec(this,Gc,c)}}var Dc=0,Fc=2,Gc=3;function Hc(){this.next=this.c=this.b=this.f=this.a=null;this.g=!1}Hc.prototype.reset=function(){this.c=this.b=this.f=this.a=null;this.g=!1};var Ic=new hc(function(){return new Hc},function(a){a.reset()});function Jc(a,b,c){var d=Ic.get();d.f=a;d.b=b;d.c=c;return d}\nfunction Kc(a,b,c){Lc(a,b,c,null)||yc(pa(b,a))}function Mc(a){return new O(function(b,c){var d=a.length,e=[];if(d)for(var f=function(a,c){d--;e[a]=c;0==d&&b(e)},g=function(a){c(a)},h=0,k;h<a.length;h++)k=a[h],Kc(k,pa(f,h),g);else b(e)})}function Nc(){var a,b,c=new O(function(c,e){a=c;b=e});return new Oc(c,a,b)}O.prototype.then=function(a,b,c){return Pc(this,r(a)?a:null,r(b)?b:null,c)};O.prototype.then=O.prototype.then;O.prototype.$goog_Thenable=!0;\nO.prototype.cancel=function(a){this.a==Dc&&yc(function(){var b=new Qc(a);Rc(this,b)},this)};function Rc(a,b){if(a.a==Dc)if(a.c){var c=a.c;if(c.b){for(var d=0,e=null,f=null,g=c.b;g&&(g.g||(d++,g.a==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(c.a==Dc&&1==d?Rc(c,b):(f?(d=f,d.next==c.f&&(c.f=d),d.next=d.next.next):Sc(c),Tc(c,e,Gc,b)))}a.c=null}else Ec(a,Gc,b)}function Uc(a,b){a.b||a.a!=Fc&&a.a!=Gc||Vc(a);a.f?a.f.next=b:a.b=b;a.f=b}\nfunction Pc(a,b,c,d){var e=Jc(null,null,null);e.a=new O(function(a,g){e.f=b?function(c){try{var e=b.call(d,c);a(e)}catch(m){g(m)}}:a;e.b=c?function(b){try{var e=c.call(d,b);void 0===e&&b instanceof Qc?g(b):a(e)}catch(m){g(m)}}:g});e.a.c=a;Uc(a,e);return e.a}O.prototype.xa=function(a){this.a=Dc;Ec(this,Fc,a)};O.prototype.Aa=function(a){this.a=Dc;Ec(this,Gc,a)};\nfunction Ec(a,b,c){a.a==Dc&&(a===c&&(b=Gc,c=new TypeError(\"Promise cannot resolve to itself\")),a.a=1,Lc(c,a.xa,a.Aa,a)||(a.v=c,a.a=b,a.c=null,Vc(a),b!=Gc||c instanceof Qc||Wc(a,c)))}function Lc(a,b,c,d){if(a instanceof O)return Uc(a,Jc(b||da,c||null,d)),!0;if(a)try{var e=!!a.$goog_Thenable}catch(g){e=!1}else e=!1;if(e)return a.then(b,c,d),!0;if(fa(a))try{var f=a.then;if(r(f))return Xc(a,f,b,c,d),!0}catch(g){return c.call(d,g),!0}return!1}\nfunction Xc(a,b,c,d,e){function f(a){h||(h=!0,d.call(e,a))}function g(a){h||(h=!0,c.call(e,a))}var h=!1;try{b.call(a,g,f)}catch(k){f(k)}}function Vc(a){a.i||(a.i=!0,yc(a.R,a))}function Sc(a){var b=null;a.b&&(b=a.b,a.b=b.next,b.next=null);a.b||(a.f=null);return b}O.prototype.R=function(){for(var a;a=Sc(this);)Tc(this,a,this.a,this.v);this.i=!1};\nfunction Tc(a,b,c,d){if(c==Gc&&b.b&&!b.g)for(;a&&a.g;a=a.c)a.g=!1;if(b.a)b.a.c=null,Yc(b,c,d);else try{b.g?b.f.call(b.c):Yc(b,c,d)}catch(e){Zc.call(null,e)}ic(Ic,b)}function Yc(a,b,c){b==Fc?a.f.call(a.c,c):a.b&&a.b.call(a.c,c)}function Wc(a,b){a.g=!0;yc(function(){a.g&&Zc.call(null,b)})}var Zc=vc;function Qc(a){wa.call(this,a)}qa(Qc,wa);Qc.prototype.name=\"cancel\";function Oc(a,b,c){this.a=a;this.b=b;this.reject=c};function $c(a,b,c){this.type=a;this.data=b;this.a=Nc();this.Pa=ya(this.Pa,this);this.reject=ya(this.reject,this);this.b=ad;c!==A&&(this.b=c);this.c().add(this)}var ad=1,bd={Ub:0,Vb:ad,Tb:2};l=$c.prototype;l.then=function(a,b,c){return this.a.a.then(a,b,c)};l.Pa=function(a){this.X=3;this.a.b(a)};l.reject=function(a){this.X=5;this.a.reject(a)};l.X=0;l.cancel=function(){this.a.a.cancel();if(3>this.X){this.f();var a=this.c(),b=this.b,c=a.a[b].indexOf(this);-1<c&&a.a[b].splice(c,1);this.X=4}};function cd(a){var b;this.a={};for(b in bd)this.a[bd[b]]=[];this.la=a;this.la.addEventListener(\"allocatable\",ya(this.b,this))}t(\"H.util.JobManager\",cd);var dd=Object.keys(bd).map(function(a){return bd[a]}).sort().reverse();cd.prototype.add=function(a){Ea(a,$c,this.add,0);this.a[a.b].push(a);this.b()};cd.prototype.contains=function(a){return-1<this.a[a.b].indexOf(a)};\ncd.prototype.b=function(){dd.forEach(function(a){this.a[a]=this.a[a].filter(function(a){var b;if((b=this.la.Wb(a))!==Ba){var d=ya(this.la.Yb,this.la,b,a);a.then(d,d);a.X=a.Zb(b)?1:5}else return!0},this)},this)};function ed(a,b,c){var d=[];1<arguments.length&&d.push(b);2<arguments.length&&d.push(\"out of [\"+c[0]+\"...\"+c[1]+\"]\");this.message=(a?Ma(a):\"\")+(d.length?\" (\"+d.join(\" \")+\")\":\"\");this.stack=Error().stack}t(\"H.lang.OutOfRangeError\",ed);ed.prototype=Error();ed.prototype.name=\"OutOfRangeError\";var fd=\"closure_listenable_\"+(1E6*Math.random()|0),gd=0;function hd(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.ia=e;this.key=++gd;this.T=this.ba=!1}function id(a){a.T=!0;a.listener=null;a.proxy=null;a.src=null;a.ia=null};function jd(a){this.src=a;this.a={};this.b=0}jd.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.a[f];a||(a=this.a[f]=[],this.b++);var g=kd(a,b,d,e);-1<g?(b=a[g],c||(b.ba=!1)):(b=new hd(b,this.src,f,!!d,e),b.ba=c,a.push(b));return b};function ld(a,b){var c=b.type;if(c in a.a){var d=a.a[c],e=xa(d,b),f;(f=0<=e)&&Array.prototype.splice.call(d,e,1);f&&(id(b),0==a.a[c].length&&(delete a.a[c],a.b--))}}\njd.prototype.S=function(a){a=a&&a.toString();var b=0,c;for(c in this.a)if(!a||c==a){for(var d=this.a[c],e=0;e<d.length;e++)++b,id(d[e]);delete this.a[c];this.b--}return b};function kd(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.T&&f.listener==b&&f.capture==!!c&&f.ia==d)return e}return-1};function md(a){md[\" \"](a);return a}md[\" \"]=da;var nd=M(\"Opera\"),od=M(\"Trident\")||M(\"MSIE\"),pd=M(\"Edge\"),qd=M(\"Gecko\")&&!(-1!=sc.toLowerCase().indexOf(\"webkit\")&&!M(\"Edge\"))&&!(M(\"Trident\")||M(\"MSIE\"))&&!M(\"Edge\"),rd=-1!=sc.toLowerCase().indexOf(\"webkit\")&&!M(\"Edge\");function sd(){var a=p.document;return a?a.documentMode:void 0}var td;\na:{var ud=\"\",vd=function(){var a=sc;if(qd)return/rv:([^\\);]+)(\\)|;)/.exec(a);if(pd)return/Edge\\/([\\d\\.]+)/.exec(a);if(od)return/\\b(?:MSIE|rv)[: ]([^\\);]+)(\\)|;)/.exec(a);if(rd)return/WebKit\\/(\\S+)/.exec(a);if(nd)return/(?:Version)[ \\/]?(\\S+)/.exec(a)}();vd&&(ud=vd?vd[1]:\"\");if(od){var wd=sd();if(null!=wd&&wd>parseFloat(ud)){td=String(wd);break a}}td=ud}var xd={},yd;var zd=p.document;yd=zd&&od?sd()||(\"CSS1Compat\"==zd.compatMode?parseInt(td,10):5):void 0;var Ad;(Ad=!od)||(Ad=9<=Number(yd));var Bd=Ad,Cd;\nif(Cd=od){var Dd;if(Object.prototype.hasOwnProperty.call(xd,\"9\"))Dd=xd[\"9\"];else{for(var Ed=0,Fd=qc(String(td)).split(\".\"),Gd=qc(\"9\").split(\".\"),Hd=Math.max(Fd.length,Gd.length),Id=0;0==Ed&&Id<Hd;Id++){var Jd=Fd[Id]||\"\",Kd=Gd[Id]||\"\";do{var Ld=/(\\d*)(\\D*)(.*)/.exec(Jd)||[\"\",\"\",\"\",\"\"],Md=/(\\d*)(\\D*)(.*)/.exec(Kd)||[\"\",\"\",\"\",\"\"];if(0==Ld[0].length&&0==Md[0].length)break;Ed=rc(0==Ld[1].length?0:parseInt(Ld[1],10),0==Md[1].length?0:parseInt(Md[1],10))||rc(0==Ld[2].length,0==Md[2].length)||rc(Ld[2],Md[2]);\nJd=Ld[3];Kd=Md[3]}while(0==Ed)}Dd=xd[\"9\"]=0<=Ed}Cd=!Dd}var Nd=Cd,Od=function(){if(!p.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},\"passive\",{get:function(){a=!0}});p.addEventListener(\"test\",da,b);p.removeEventListener(\"test\",da,b);return a}();function Pd(a,b){L.call(this,a?a.type:\"\");this.relatedTarget=this.currentTarget=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=0;this.key=\"\";this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.pointerId=0;this.pointerType=\"\";this.b=null;if(a){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.currentTarget=b;if(b=a.relatedTarget){if(qd){a:{try{md(b.nodeName);var e=!0;break a}catch(f){}e=!1}e||(b=null)}}else\"mouseover\"==\nc?b=a.fromElement:\"mouseout\"==c&&(b=a.toElement);this.relatedTarget=b;null===d?(this.clientX=void 0!==a.clientX?a.clientX:a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0);this.button=a.button;this.key=a.key||\"\";this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=\na.metaKey;this.pointerId=a.pointerId||0;this.pointerType=aa(a.pointerType)?a.pointerType:Qd[a.pointerType]||\"\";this.b=a;a.defaultPrevented&&this.c()}}qa(Pd,L);var Qd={2:\"touch\",3:\"pen\",4:\"mouse\"};Pd.prototype.stopPropagation=function(){Pd.U.stopPropagation.call(this);this.b.stopPropagation?this.b.stopPropagation():this.b.cancelBubble=!0};\nPd.prototype.c=function(){Pd.U.c.call(this);var a=this.b;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Nd)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var Rd=\"closure_lm_\"+(1E6*Math.random()|0),Sd={},Td=0;function Ud(a,b,c,d,e){if(d&&d.once)Vd(a,b,c,d,e);else if(\"array\"==ea(b))for(var f=0;f<b.length;f++)Ud(a,b[f],c,d,e);else c=Wd(c),a&&a[fd]?a.b.add(String(b),c,!1,fa(d)?!!d.capture:!!d,e):Xd(a,b,c,!1,d,e)}\nfunction Xd(a,b,c,d,e,f){if(!b)throw Error(\"Invalid event type\");var g=fa(e)?!!e.capture:!!e,h=Yd(a);h||(a[Rd]=h=new jd(a));c=h.add(b,c,d,g,f);if(!c.proxy){d=Zd();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)Od||(e=g),void 0===e&&(e=!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent($d(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error(\"addEventListener and attachEvent are unavailable.\");Td++}}\nfunction Zd(){var a=ae,b=Bd?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b}function Vd(a,b,c,d,e){if(\"array\"==ea(b))for(var f=0;f<b.length;f++)Vd(a,b[f],c,d,e);else c=Wd(c),a&&a[fd]?a.b.add(String(b),c,!0,fa(d)?!!d.capture:!!d,e):Xd(a,b,c,!0,d,e)}\nfunction be(a,b,c,d,e){if(\"array\"==ea(b))for(var f=0;f<b.length;f++)be(a,b[f],c,d,e);else(d=fa(d)?!!d.capture:!!d,c=Wd(c),a&&a[fd])?(a=a.b,b=String(b).toString(),b in a.a&&(f=a.a[b],c=kd(f,c,d,e),-1<c&&(id(f[c]),Array.prototype.splice.call(f,c,1),0==f.length&&(delete a.a[b],a.b--)))):a&&(a=Yd(a))&&(b=a.a[b.toString()],a=-1,b&&(a=kd(b,c,d,e)),(c=-1<a?b[a]:null)&&ce(c))}\nfunction ce(a){if(\"number\"!=typeof a&&a&&!a.T){var b=a.src;if(b&&b[fd])ld(b.b,a);else{var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent($d(c),d):b.addListener&&b.removeListener&&b.removeListener(d);Td--;(c=Yd(b))?(ld(c,a),0==c.b&&(c.src=null,b[Rd]=null)):id(a)}}}function $d(a){return a in Sd?Sd[a]:Sd[a]=\"on\"+a}\nfunction de(a,b,c,d){var e=!0;if(a=Yd(a))if(b=a.a[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.capture==c&&!f.T&&(f=fe(f,d),e=e&&!1!==f)}return e}function fe(a,b){var c=a.listener,d=a.ia||a.src;a.ba&&ce(a);return c.call(d,b)}\nfunction ae(a,b){if(a.T)return!0;if(!Bd){if(!b)a:{b=[\"window\",\"event\"];for(var c=p,d=0;d<b.length;d++)if(c=c[b[d]],null==c){b=null;break a}b=c}d=b;b=new Pd(d,this);c=!0;if(!(0>d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.currentTarget;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;!b.a&&0<=e;e--){b.currentTarget=d[e];var f=de(d[e],a,!0,b);c=c&&f}for(e=0;!b.a&&e<d.length;e++)b.currentTarget=\nd[e],f=de(d[e],a,!1,b),c=c&&f}return c}return fe(a,new Pd(b,this))}function Yd(a){a=a[Rd];return a instanceof jd?a:null}var ge=\"__closure_events_fn_\"+(1E9*Math.random()>>>0);function Wd(a){if(r(a))return a;a[ge]||(a[ge]=function(b){return a.handleEvent(b)});return a[ge]};function Q(){K.call(this);this.b=new jd(this);this.v=this;this.i=null}qa(Q,K);Q.prototype[fd]=!0;l=Q.prototype;l.I=function(){return this.i};l.Ea=function(a){this.i=a};l.addEventListener=function(a,b,c,d){Ud(this,a,b,c,d)};l.removeEventListener=function(a,b,c,d){be(this,a,b,c,d)};\nl.dispatchEvent=function(a){var b,c=this.I();if(c)for(b=[];c;c=c.I())b.push(c);c=this.v;var d=a.type||a;if(aa(a))a=new L(a,c);else if(a instanceof L)a.target=a.target||c;else{var e=a;a=new L(d,c);va(a,e)}e=!0;if(b)for(var f=b.length-1;!a.a&&0<=f;f--){var g=a.currentTarget=b[f];e=g.O(d,!0,a)&&e}a.a||(g=a.currentTarget=c,e=g.O(d,!0,a)&&e,a.a||(e=g.O(d,!1,a)&&e));if(b)for(f=0;!a.a&&f<b.length;f++)g=a.currentTarget=b[f],e=g.O(d,!1,a)&&e;return e};\nl.fa=function(){Q.U.fa.call(this);this.b&&this.b.S(void 0);this.i=null};l.O=function(a,b,c){a=this.b.a[String(a)];if(!a)return!0;a=a.concat();for(var d=!0,e=0;e<a.length;++e){var f=a[e];if(f&&!f.T&&f.capture==b){var g=f.listener,h=f.ia||f.src;f.ba&&ld(this.b,f);d=!1!==g.call(h,c)&&d}}return d&&0!=c.Ta};t(\"H.util.EventTarget\",Q);Q.prototype.Ea=Q.prototype.Ea;Q.prototype.setParentEventTarget=Q.prototype.Ea;Q.prototype.I=Q.prototype.I;Q.prototype.getParentEventTarget=Q.prototype.I;Q.prototype.addEventListener=Q.prototype.addEventListener;Q.prototype.addEventListener=Q.prototype.addEventListener;Q.prototype.removeEventListener=Q.prototype.removeEventListener;Q.prototype.removeEventListener=Q.prototype.removeEventListener;Q.prototype.dispatchEvent=Q.prototype.dispatchEvent;\nQ.prototype.dispatchEvent=Q.prototype.dispatchEvent;Q.prototype.N=Q.prototype.N;Q.prototype.dispose=Q.prototype.N;Q.prototype.L=Q.prototype.L;Q.prototype.addOnDisposeCallback=Q.prototype.L;Q.prototype.R=Q.prototype.O;\nQ.prototype.O=function(a,b,c){var d,e,f=!0;var g=c[c.currentTarget===c.target?\"AT_TARGET\":b?\"CAPTURING_PHASE\":(d=!0,\"BUBBLING_PHASE\")];if(!d||\"pointerenter\"!==(e=c.type)&&\"pointerleave\"!==e)c.eventPhase=g,f=Q.prototype.R.apply(this,arguments),d&&this.I&&null===this.I()&&delete c.eventPhase;return f};function T(a){a=a||{};var b=a.callback;this.g=a.label;r(b)&&(this.callback=b);this.f=!!a.disabled;T.U.constructor.call(this)}qa(T,Q);t(\"H.util.ContextItem\",T);T.prototype.mb=function(){return this.g};T.prototype.getLabel=T.prototype.mb;T.prototype.Nb=function(a){this.g!==a&&(this.g=a,this.dispatchEvent(\"update\"));return this};T.prototype.setLabel=T.prototype.Nb;T.prototype.Bb=function(){return this.f};T.prototype.isDisabled=T.prototype.Bb;\nT.prototype.Mb=function(a){a^this.f&&(this.f=a,this.dispatchEvent(\"update\"));return this};T.prototype.setDisabled=T.prototype.Mb;var he=new T;T.SEPARATOR=he;function ie(){if(z.document){var a=document.createElement(\"canvas\");a.width=a.height=1;a.getContext(\"2d\")}}t(\"H.util.getPixelRatio\",function(){return window.devicePixelRatio||1});Object.create(Ba,void 0);t(\"H.util.eval\",function(a){return eval(a)});t(\"H.util.provide\",function(a){ca(a,void 0)});function je(){this.A=0}je.prototype.next=function(a){if(9007199254740992===this.A)throw new ed(a,this.A,[0,9007199254740991]);return this.A++};var ke=new je;ya(ke.next,ke);function ac(){}\nvar db=Aa([]);Aa({});ie();ie();function le(a,b,c){var d=Eb(+a,-90,90);if(b&&Ja(d))throw new B(b,c,a);return d}function me(a,b,c){var d=+a;if(-180>d||180<d)d=Db(d+180,360)-180;if(b&&Ja(d))throw new B(b,c,a);return d}function ne(a,b,c){var d;if(a!==A&&Ja(d=+a)&&b)throw new B(b,c,a);return d}t(\"H.geo.isDBC\",function(a,b){return 0!==(0>a^0>b)&&180<lb(b-a)});function oe(){var a=oe;if(!0===(Ea(this,a)&&this.constructor===a))throw new TypeError(\"Illegal constructor \"+Ma(a));}t(\"H.geo.AbstractGeometry\",oe);oe.prototype.getBoundingBox=oe.prototype.ga;oe.prototype.equals=oe.prototype.G;oe.prototype.f=\"\";oe.prototype.toString=function(){return this.g([this.f.toUpperCase(),\" \"]).join(\"\")};oe.prototype.toString=oe.prototype.toString;function U(a,b,c){this.lat=le(a,U,0);this.lng=me(b,U,1);c!==A&&(this.alt=ne(c,U,2))}qa(U,oe);t(\"H.geo.Point\",U);U.prototype.G=function(a){return this===a||!!a&&this.lat===a.lat&&this.lng===a.lng&&(this.alt||0)===(a.alt||0)};U.prototype.equals=U.prototype.G;U.prototype.pa=function(a){if(this===a||this.lat===a.lat&&this.lng===a.lng)a=0;else{var b=this.lat*Ab;var c=a.lat*Ab;a=1.274200158E7*pb(jb(1,hb(ib(ob((b-c)/2),2)+qb(b)*qb(c)*ib(ob((this.lng*Ab-a.lng*Ab)/2),2))))}return a};\nU.prototype.distance=U.prototype.pa;\nU.prototype.Qb=function(a,b,c){if(c){if(b/=6371000.79){a*=Ab;var d=Ab*this.lat;var e=ob(d);var f=ob(b);var g=qb(b);var h=Ab*this.lng;var k=qb(d);d=pb(k*qb(a)*f+e*g);a=tb(ob(a)*k*f,g-e*ob(d));a=(h+a+J)%(2*J)-J;k=a*Bb}return b?new U(d*Bb,(k+540)%360-180):this}a=(a%360+360)%360;if(0===(a+90)%180)return d=this.lng+b/(6371000.79*xb*qb(this.lat*Ab))*(270===a?-360:360),new U(this.lat,(d+540)%360-180);if(b/=6371000.79){a*=Ab;h=this.lat*Ab;e=this.lng*Ab;f=h+b*qb(a);g=f-h;d=mb(rb(f/2+wb)/rb(h/2+wb));d=Ja(g/\nd)?qb(h):g/d;var m=b*ob(a)/d;lb(f)>vb&&(f=0<f?J-f:-(J+f))}return b?new U(f*Bb,((e+m+zb+(lb(h+g)>vb?J:0))%xb-J)*Bb):this};U.prototype.walk=U.prototype.Qb;U.prototype.ga=function(){return new V(this.lat,this.lng,this.lat,this.lng)};U.prototype.getBoundingBox=U.prototype.ga;function pe(a,b,c){var d=fa(a)&&!(Ja(a.lat=le(a.lat))||Ja(a.lng=me(a.lng))||a.alt!==A&&Ja(a.alt=ne(a.alt)));if(!d&&b)throw new B(b,c,a);return d}U.validate=pe;\nfunction qe(a){if(!a)throw new B(qe,0,a);return new U(a.lat,a.lng,a.alt)}U.fromIPoint=qe;U.prototype.f=\"Point\";U.prototype.g=function(a){a.push(\"(\",this.lng,\" \",this.lat,\")\");return a};var W={};t(\"H.geo.mercator\",W);W.a=function(a){return jb(1,kb(0,.5-mb(rb(wb+vb*a/180))/J/2))};W.b=function(a){return a/360+.5};W.ja=function(a,b,c){c?(c.x=W.b(b),c.y=W.a(a)):c=new G(W.b(b),W.a(a));return c};W.latLngToPoint=W.ja;W.hb=function(a,b){return W.ja(a.lat,a.lng,b)};W.geoToPoint=W.hb;W.f=function(a){return 0>=a?90:1<=a?-90:Bb*(2*sb(nb(J*(1-2*a)))-vb)};W.c=function(a){return 360*(1===a?1:Db(a,1))-180};W.V=function(a,b,c){c?(c.lat=W.f(b),c.lng=W.c(a)):c=new U(W.f(b),W.c(a));return c};\nW.xyToGeo=W.V;W.Gb=function(a,b){return W.V(a.x,a.y,b)};W.pointToGeo=W.Gb;t(\"H.util.constants.DEFAULT_MIN_ZOOM_LEVEL\",0);t(\"H.util.constants.DEFAULT_MAX_ZOOM_LEVEL\",22);function Y(a,b){this.projection=a||W;this.b=0;this.a=this.exp=mb(b||256)/ub;re(this);this.y=this.x=0}t(\"H.geo.PixelProjection\",Y);var se=lb(24)+lb(-8);Y.prototype.aa=function(a){if(Ja(a))throw new B(this.aa,0,a);var b=this.x/this.w;var c=this.y/this.h;this.b=a;this.a=this.exp+a;re(this);this.x=b*this.w;this.y=c*this.h};Y.prototype.rescale=Y.prototype.aa;function re(a){a.a>se&&(a.a=se);a.w=ib(2,a.a);a.h=ib(2,a.a)}Y.prototype.Ma=function(){return this.b||0};Y.prototype.getZoomScale=Y.prototype.Ma;\nY.prototype.gb=function(a,b){a=this.projection.ja(a.lat,a.lng,b);a.x=a.x*this.w-this.x;a.y=a.y*this.h-this.y;return a};Y.prototype.geoToPixel=Y.prototype.gb;Y.prototype.Ba=function(a,b){return this.projection.V((a.x+this.x)/this.w,(a.y+this.y)/this.h,b)};Y.prototype.pixelToGeo=Y.prototype.Ba;Y.prototype.V=function(a,b,c){return this.projection.V((a+this.x)/this.w,(b+this.y)/this.h,c)};Y.prototype.xyToGeo=Y.prototype.V;\nY.prototype.wa=function(a,b,c){a=this.projection.ja(a,b,c);a.x=a.x*this.w-this.x;a.y=a.y*this.h-this.y;return a};Y.prototype.latLngToPixel=Y.prototype.wa;Y.prototype.Hb=function(a){return new G(a.x*this.w-this.x,a.y*this.h-this.y)};Y.prototype.pointToPixel=Y.prototype.Hb;t(\"H.util.Disposable\",K);K.prototype.L=K.prototype.L;K.prototype.addOnDisposeCallback=K.prototype.L;t(\"H.util.dispose\",function(a){a&&\"function\"==typeof a.N&&a.N()});function te(a,b,c,d){this.key=\"\";this.x=a;this.y=b;this.b=c;this.W=d;this.a=Nc()}te.prototype.then=function(a,b,c){return this.a.a.then(a,b,c)};te.prototype.reject=function(a){this.a.reject(a)};te.prototype.cancel=function(){this.a.a.cancel()};function Z(a,b,c,d,e,f){if(a&&b)this.Wa(a),this.Ca(b),this.Fa(c),this.Va(e),this.Ua(f),this.Ga(d);else throw Error('Parameters \"scheme\" and \"host\" must be specified');}t(\"H.service.Url\",Z);\nfunction ue(a,b){var c=z.document,d,e=c&&c.createElement(\"a\"),f=\"\";if(c){if(b){var g=(d=c.getElementsByTagName(\"base\")[0])&&d.href;var h=c.head;var k=d||h.appendChild(c.createElement(\"base\"));k.href=b}e.href=a;f=e.href;b&&(d?d.href=g:h.removeChild(k))}else/[\\w]+:\\/\\//.test(a)&&(f=a);g=/(?:(\\w+):\\/\\/)?(?:([^:]+):([^@/]*)@)?([^/:]+)?(?:[:]{1}([0-9]+))?(\\/[^?#]*)?(\\?[^#]+)?(#.*)?/.exec(f);a=g[1];k=g[4];b=g[5];h=g[6];c=g[7];d=g[8];!g[2]&&k&&/@/.test(k)&&(k=k.split(\"@\")[1]);g=k;h=h&&0<h.length?h.substr(1):\n\"\";k={};if(c)for(e=/([?&]?([^=&+]+))(=([^&]+))?/g;f=e.exec(c);)k[decodeURIComponent(f[2])]=f[4]?decodeURIComponent(f[4]):void 0;return new Z(a,g,h,k,isNaN(+b)?void 0:+b,d&&0<d.length?d.substr(1):\"\")}Z.parse=ue;var ve=0;Z.prototype.clone=function(){ve++;var a={},b;for(b in this.a)a[b]=this.a[b];return new Z(this.i,this.f,this.b,a,this.g,this.c)};Z.prototype.clone=Z.prototype.clone;\nZ.prototype.Wa=function(a){if(!a||\"string\"!==typeof a)throw Error('The \"scheme\" parameter must be a non-empty string.');this.i=a;return this};Z.prototype.setScheme=Z.prototype.Wa;Z.prototype.ub=function(){return this.i};Z.prototype.getScheme=Z.prototype.ub;Z.prototype.Ca=function(a){if(!a||\"string\"!==typeof a||\"-\"===a.charAt(0)||\".\"===a.charAt(0)||\".\"===a.charAt(a.length-1))throw Error('The \"host\" parameter is not a valid host name.');this.f=a;return this};Z.prototype.setHost=Z.prototype.Ca;\nZ.prototype.lb=function(){return this.f};Z.prototype.getHost=Z.prototype.lb;Z.prototype.Fa=function(a){this.b=a||void 0;return this};Z.prototype.setPath=Z.prototype.Fa;Z.prototype.qb=function(){return this.b};Z.prototype.getPath=Z.prototype.qb;Z.prototype.Ga=function(a){if(a)if(\"object\"==typeof a)this.a=a;else throw Error('Parameter \"params\" must be an object.');else this.a={};return this};Z.prototype.setQuery=Z.prototype.Ga;Z.prototype.wb=function(){return!we(this)};Z.prototype.hasQuery=Z.prototype.wb;\nZ.prototype.sb=function(){return this.a};Z.prototype.getQuery=Z.prototype.sb;Z.prototype.Va=function(a){if(a&&isNaN(parseInt(a,10)))throw Error('Parameter \"port\" must be a number or undefined');this.g=+a||void 0;return this};Z.prototype.setPort=Z.prototype.Va;Z.prototype.rb=function(){return this.g};Z.prototype.getPort=Z.prototype.rb;Z.prototype.Ua=function(a){this.c=a||void 0;return this};Z.prototype.setAnchor=Z.prototype.Ua;Z.prototype.ib=function(){return this.c};Z.prototype.getAnchor=Z.prototype.ib;\nZ.prototype.Y=function(a){if(\"object\"!==typeof a)throw Error('Parameter \"other\" must be an object.');var b=this.a,c;for(c in a)a.hasOwnProperty(c)&&\"function\"!==typeof a[c]&&(b[c]=a[c]);return this};Z.prototype.mergeQuery=Z.prototype.Y;Z.prototype.Xa=function(a){if(!a||\"string\"!==typeof a)throw Error('Parameter \"subDomain\" must be a non-empty string');\".\"===a.substr(a.length-1)&&(a=a.substr(0,a.length-1));return this.Ca(a+\".\"+this.f)};Z.prototype.addSubDomain=Z.prototype.Xa;\nZ.prototype.Ya=function(a){if(!a||\"string\"!==typeof a)throw Error('Parameter \"subPath\" must be a non-empty string');return this.Fa((this.b?this.b+\"/\":\"\")+a)};Z.prototype.addSubPath=Z.prototype.Ya;Z.prototype.toString=function(){return[this.i+\"://\",this.f,this.g?\":\"+this.g:\"\",this.b||!we(this)||this.c?\"/\":\"\",this.b?encodeURI(this.b):\"\",xe(this),this.c?\"#\"+encodeURIComponent(this.c):\"\"].join(\"\")};Z.prototype.toString=Z.prototype.toString;\nfunction xe(a){var b=[],c,d=a.a;for(c in d)if(d.hasOwnProperty(c)&&\"function\"!==typeof d[c]){var e=a.a[c];b.push(encodeURIComponent(c)+(void 0===e?\"\":\"=\"+encodeURIComponent(e)))}return 0<b.length?\"?\"+b.join(\"&\"):\"\"}function we(a){var b,c=0;for(b in a.a)if(a.a.hasOwnProperty(b)&&\"function\"!==typeof a.a[b]&&(c++,0<c))break;return!c};var ye={};function ze(a){try{importScripts.apply(self,arguments)}catch(b){this.postError(\"invalid_script\")}}function Ae(a){ye[a]=null;this.postMessage(a)}function Be(a,b,c){if(r(b))var d=b;else try{d=self.eval(\"(\"+b+\")\"),r(d)||(d=null)}catch(e){}d?(ye[a]=d,c||this.postMessage(a)):this.postError(\"invalid_processor\")}function Ce(a){this.b=a&&a[0];this.a=a&&a[1];this.c=a&&a[2]||[]}Ce.prototype.postError=function(a){this.postMessage(a,A,0)};\nCe.prototype.postMessage=function(a,b,c){self.postMessage({processor:this.b,taskId:this.a,type:c===A?1:c,data:a},b||A)};function De(a,b,c){if(!aa(a))throw new B(De,0,\"InvalidArgument\");if(!r(b))throw new B(De,1,\"InvalidArgument\");var d=Ee++;Fe[d]={mimeType:c||Ge,ab:b};(new Ce([\"3\",d,[]])).postMessage(a,[],2)}var Fe={},Ee=0;\nfunction He(a,b){var c=a;if(Fe[this.a]){var d=Fe[this.a];var e=d.ab;delete Fe[this.a];if(b)e(null,b);else{if(d.mimeType===Ie){a=new Uint8Array(a);b=a.byteLength;d=\"\";c=0;for(var f,g,h,k;c<b;)f=a[c++],192>f||(g=a[c++],224>f?f=(f&31)<<6|g&63:(h=a[c++],240>f?f=(f&15)<<12|(g&63)<<6|h&63:(k=a[c++],f=(f&7)<<18|(g&63)<<12|(h&63)<<6|k&63))),65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode((f>>10)+55296,(f&1023)+56320));c=d}e(c)}}}var Ge=0,Ie=1;function V(a,b,c,d){Je(this,le(a,V,0),me(b,V,1),le(c,V,2),me(d,V,3))}qa(V,oe);t(\"H.geo.Rect\",V);V.prototype.f=\"Polygon\";V.prototype.g=function(a){var b=this.o,c=this.j,d=this.m,e=this.l;a.push(\"(\",\"(\",c,\" \",b,\",\",e,\" \",b,\",\",e,\" \",d,\",\",c,\" \",d,\",\",c,\" \",b,\")\",\")\");return a};V.prototype.G=function(a){return this===a||!!a&&this.o===a.o&&this.j===a.j&&this.m===a.m&&this.l===a.l};V.prototype.equals=V.prototype.G;V.prototype.clone=function(){return new V(this.o,this.j,this.m,this.l)};\nV.prototype.clone=V.prototype.clone;function Je(a,b,c,d,e){a.j=c;a.l=e;b<d&&(c=b,b=d,d=c);a.o=b;a.m=d;a.c=a.a=a.b=null;return a}V.prototype.La=function(){this.c||(this.c=new U(this.o,this.j));return this.c};V.prototype.getTopLeft=V.prototype.La;V.prototype.Ka=function(){this.a||(this.a=new U(this.m,this.l));return this.a};V.prototype.getBottomRight=V.prototype.Ka;V.prototype.vb=function(){return this.o};V.prototype.getTop=V.prototype.vb;V.prototype.jb=function(){return this.m};\nV.prototype.getBottom=V.prototype.jb;V.prototype.nb=function(){return this.j};V.prototype.getLeft=V.prototype.nb;V.prototype.tb=function(){return this.l};V.prototype.getRight=V.prototype.tb;V.prototype.H=function(){this.b||(this.b=new U(this.m+(this.o-this.m)/2,Ke(this.j,this.J())));return this.b};V.prototype.getCenter=V.prototype.H;V.prototype.J=function(){return Le(this.j,this.l)};V.prototype.getWidth=V.prototype.J;V.prototype.P=function(){return this.o-this.m};V.prototype.getHeight=V.prototype.P;\nV.prototype.zb=function(){return this.j>this.l};V.prototype.isCDB=V.prototype.zb;V.prototype.Cb=function(){return!this.J()&&!this.P()};V.prototype.isEmpty=V.prototype.Cb;V.prototype.ga=function(){return new V(this.o,this.j,this.m,this.l)};V.prototype.getBoundingBox=V.prototype.ga;V.prototype.ca=function(a,b,c){var d=this.H();c||(a=le(a,this.ca,0),b=me(b,this.ca,1));b=this.K(a,b,c);a=b.H();return a.lat===d.lat&&a.lng===d.lng&&this.P()===b.P()&&this.J()===b.J()};V.prototype.containsLatLng=V.prototype.ca;\nV.prototype.da=function(a,b){b||pe(a,this.da,0);return this.ca(a.lat,a.lng,b)};V.prototype.containsPoint=V.prototype.da;V.prototype.Ja=function(a,b){var c=this.H();if(!b&&!Ea(a,V))throw new B(this.Ja,0,a);b=this.ka(a,b);a=b.H();return a.lat===c.lat&&a.lng===c.lng&&this.P()===b.P()&&this.J()===b.J()};V.prototype.containsRect=V.prototype.Ja;\nV.prototype.K=function(a,b,c,d){if(!c){if(Ja(a=le(a)))throw new B(this.K,0,a);if(Ja(b=me(b)))throw new B(this.K,1,b);}return Me(this.o,this.j,this.m,this.l,a,b,a,b,d)};V.prototype.mergeLatLng=V.prototype.K;V.prototype.Qa=function(a,b,c){b||pe(a,this.Qa,0);return this.K(a.lat,a.lng,b,c)};V.prototype.mergePoint=V.prototype.Qa;V.prototype.ka=function(a,b,c){if(!b&&!Ea(a,V))throw new B(this.ka,0,a);return Me(this.o,this.j,this.m,this.l,a.o,a.j,a.m,a.l,c)};V.prototype.mergeRect=V.prototype.ka;\nV.prototype.Z=function(a,b,c,d,e,f){e||(a=le(a,this.Z,0),b=me(b,this.Z,1),c=le(c,this.Z,2),d=me(d,this.Z,3));return Me(this.o,this.j,this.m,this.l,a,b,c,d,f)};V.prototype.mergeTopLeftBottomRight=V.prototype.Z;V.prototype.Oa=function(a,b){var c=this.j<=this.l,d=a.j<=a.l,e=this.j<a.l,f=a.j<this.l;if(!b&&!Ea(a,V))throw new B(this.Oa,0,a);return this.m<=a.o&&a.m<=this.o&&(!c&&(!d||e||f)||!d&&(e||f)||e&&f)};V.prototype.intersects=V.prototype.Oa;function Le(a,b){a=b-a;return a+(0>a?360:0)}\nfunction Ke(a,b){a+=b/2;return a-(180<a?360:0)}function Me(a,b,c,d,e,f,g,h,k){c=jb(c,g);a=kb(a,e);e=Le(b,d);var m=Ke(b,e);g=Le(f,h);var q=Ke(f,g)-m;q+=0>q-1E-6?360:0;if(180>q-1E-6){m=b;var n=h}else q=360-q,m=f,n=d;q=q+e/2+g/2;360<=q+5E-7?(m=-180,n=180):q-5E-7<e?(m=b,n=d):q-5E-7<g&&(m=f,n=h);return k?Je(k,a,m,c,n):new V(a,m,c,n)}V.merge=Me;function Ne(a,b,c){c||(pe(a,Ne,0),pe(b,Ne,1));return new V(a.lat,a.lng,b.lat,b.lng)}V.fromPoints=Ne;\nfunction Oe(a,b){var c=1,d=a.length,e=null;var f=ea(a);if(\"array\"!=f&&(\"object\"!=f||\"number\"!=typeof a.length))throw new B(Oe,0,a);if(0<d)for(f=a[0],e=Ne(f,f,b);c<d;c++)f=a[c],e.K(f.lat,f.lng,b,e);return e}V.coverPoints=Oe;function Pe(a,b){var c=3,d=a.length,e;if(!(b||a&&null!=a.length))throw new B(Pe,0,a);if(0<d)for(e=new V(a[0],a[1],a[0],a[1]);c<d;c+=3)e.K(a[c],a[c+1],b,e);return e}V.coverLatLngAlts=Pe;\nfunction Qe(a,b){var c=1,d=a.length,e;if(b&&(!a||null==a.length))throw new B(Qe,0,a);if(0<d)for(e=new V(a[0].o,a[0].j,a[0].m,a[0].l);c<d;c++)e.ka(a[c],b,e);return e}V.coverRects=Qe;\nV.prototype.Sa=function(a,b){var c=this.j,d=this.o,e=this.l,f=this.m,g=this.H().lng;pe(a,this.Sa,0);var h=a.lat-f-(d-f)/2;var k=a.lng-g;k=180<k||-180>k?-(g+a.lng):k;a=c+(0>k?2*k:0);a=-180>a?360+a:a;e+=0<k?2*k:0;e=180<e?e-360:e;d=0<h?d+2*h:d;90<=d&&(d=90);f=0>h?f+2*h:f;-90>=f&&(f=-90);return b?Je(b,d,a,f,e):new V(d,a,f,e)};V.prototype.resizeToCenter=V.prototype.Sa;function Re(a,b,c,d){var e=!!c,f,g=0,h=0,k=0,m=0,q=0,n,u=-1;var C=z.Float32Array;var y,v=[];if(b){b=Ca(b);a=Ca(a);e&&(f=Ca(c));c=b.length;d=d?1E-7:1E-5;for(y=new C(3*c);g<c;){C=b[g];var I=+C;var la=+a[g];e&&(n=+f[g]);Se.test(C)?0<=u&&(0<g-u&&v.push(u,g+1),u=-1):0>u&&(u=g);g++;m=y[h++]=m+la*d;k=y[h++]=k+I*d;e&&(q=y[h]=q+n);h++}0<=u&&1<c-u&&v.push(u,c)}else y=new C(0);return{path:y,outlineIndices:v}}var Se=/^-?0\\d/;\nfunction Te(a,b){for(var c=0,d=a.length/3,e=new z.Array(d),f=0;c<d;)e[c++]=b.wa(a[f],a[++f]),f+=2;return e};function Ue(a,b){b=180/(1<<b);var c=a.lat+90;a=(a.lng+180)%360;var d=0;180==c&&d--;d+=Math.floor(c/b);return[d,Math.floor(a/b)]}var Ve=1/Math.pow(10,10);function We(a,b){var c=[],d=a.La();a=a.Ka();var e;180==a.lng&&(a.lng-=Ve);d=Ue(d,b);a=Ue(a,b);for(e=d[0];e>=a[0];e--)for(b=d[1];b<=a[1];b++)c.push(e,b);return c};function Xe(a,b){var c=a.tileSize||256;this.b={};this.v=ue(a.serverUrl);this.g=b;this.Aa=a.layerConfigs||[];this.i=a.projected;this.R=c;this.xa=!1!==a.batchTiles;this.Lb=a.onlyOutline;this.Pb=new Y(Ba,c);this.f=new Y(Ba,c);this.f.aa(22-Math.log(c)/Math.LN2+8)}qa(Xe,K);l=Xe.prototype;l.Kb=function(a,b,c){var d=this.R,e={x:a*d,y:b*d};d={x:a*d+(d-1),y:b*d+(d-1)};var f=this.Pb;f.aa(c);e=f.Ba(e);d=f.Ba(d);return Ye(this,new V(e.lat,e.lng,d.lat,d.lng),this.Aa,{x:a,y:b,z:c})};\nl.Jb=function(a,b,c,d,e){return Ye(this,new V(a,b,c,d),e)};\nfunction Ye(a,b,c,d){var e=Ze(c),f=e.length,g={},h,k=a.b,m=[],q=[];for(c=0;c<f;c++){var n=e[c];var u=n.layerId;var C=n.level;g[u]=n.columns;n=We(b,C);var y=n.length-1;for(h=0;h<y;h+=2){var v=[u,n[h+1],n[h],C].join(\"_\");var I=k[v]||a.g.get(v);I||(I=new te(n[h+1],n[h],C,u),I.key=v,k[v]=I,q.push(I));m.push(I)}}q.length&&(a.xa?$e(a,q):af(a,q));return Mc(m.map(function(a){return a.then(ya(this.eb,this,a.W,bf(e))).then(ya(this.Ib,this,a,d||{})).then(ya(this.fb,this,g[a.W]))},a))}\nl.eb=function(a,b,c){var d=c.Rows,e=d.length,f,g;if(e&&(f=b[a])){b=new F(c.Rows);var h=[];for(g=0;g<e;g++){var k=d[g];f(b.ha(g),a)&&h.push(k)}a={Rows:h};if(c=c.Meta)a.Meta=c}else a=c;return a};function af(a,b){function c(b,c,d){d?(delete a.b[b.key],b.reject(d)):cf(a,b,c)}var d,e=b.length,f=a.v;for(d=0;d<e;d++){var g=b[d];var h=f.clone().Y({tilex:g.x}).Y({tiley:g.y}).Y({level:g.b}).Y({layer:g.W});new De(h.toString(),ya(c,null,g),Ie)}}\nfunction $e(a,b){var c=b.length,d;for(d=0;d<c;d+=15){var e=b.slice(d,d+15);df(a,e)}}function df(a,b){var c=a.v.clone(),d=[],e=[],f=[],g=c.a;b.length&&(b.forEach(function(a){d.push(a.x,a.y);e.push(a.b);f.push(a.W)}),g.tilexy=d.join(\",\"),g.layers=f.join(\",\"),g.levels=e.join(\",\"),c.Ga(g),new De(c.toString(),function(c,d){d?b.forEach(function(b){delete a.b[b.key];b.reject(\"error\")}):cf(a,b,c)},Ie))}\nfunction cf(a,b,c){var d=b.length,e;if(Ha(b,void 0,void 0,void 0)){var f=c.indexOf(\"[\")+1;for(e=0;e<d;e++){var g=c.indexOf(\"]},{\",f+3)+2;g<f&&(g=c.lastIndexOf(\"]}\"));var h=c.substr(f,g-f);f=g+1;ef(a,b[e],h)}}else ef(a,b,c)}function ef(a,b,c){try{var d=c.length;var e=b.key;delete a.b[e];a.g.add(e,b,2*d);var f=JSON.parse(c);b.a.b(f)}catch(g){b.reject(g.message)}}\nfunction bf(a){var b={},c,d=a.length;for(c=0;c<d;c++){var e=a[c];if(e.rowFilter){var f=e.layerId;f=f!==A?f:e.layer;b[f]=ya(e.rowFilter,e.rowFilterContext)}}return b}function ff(a,b,c,d,e){return e?[new G(a,b),new G(c,b),new G(c,d),new G(a,d),new G(a,b)]:[a,b,c,b,c,d,a,d]}\nl.Ib=function(a,b,c){var d=this.f.Ma()-b.z,e=this.R<<d,f=50<<d,g=b.x*e;b=b.y*e;var h=g+e;e=b+e;var k=g-f,m=b-f,q=h+f;f=e+f;var n,u,C=c.Rows,y=C.length,v,I=/^ADAS/.test(a.W),la=this.f,oa=this.Lb,P,Xa=[],Fa=[],Ga=[],Ya=[];for(a=0;a<y;a++){var w=v=C[a];var N=(P=I)?\"HPY\":\"LAT\";var R=P?\"HPX\":\"LON\";var ba=P?\"HPZ\":\"ZLEVEL\";if(w[N]){var S=Re(w[N],w[R],w[ba],P);w.geometry=S;delete w[N];delete w[R];delete w[ba];if(w.INNER_LAT)for(N=w.INNER_LAT.split(\";\"),S=w.INNER_LON.split(\";\"),delete w.INNER_LAT,delete w.INNER_LON,\nw.interiors=ba=[],R=N.length,w=0;w<R;w++)ba.push(Re(N[w],S[w],\"\",P))}if(this.i){P=void 0;R=v;S=la;N=R.$$projected$$;if(!N){var X=R.geometry;w=Te(X.path,S);v=[w];R.$$projected$$=N={Fb:v};R=(ba=R.interiors)?ba.length:0;v.length+=R;P|=gf(v,w,X.outlineIndices);if(R)for(N.xb=1,n=0;n<R;n++)X=ba[n],w=Te(X.path,S),v[1+n]=w,P|=gf(v,w,X.outlineIndices);P&&(N.Db=1+R)}w=N;P=w.Fb;v=w.xb;var lc=w.Db;S=[];N=R=Cb;var Za=ba=A;w=P[0];if(1===w.length){var mc=mc||(mc=ff(g,b,h,e,!1));v=w[0];Ib(v.x,v.y,mc,0,!0)&&S.push(hf(w,\ng,b,d))}else{var ee=P.length;for(X=oa?lc:0;X<ee&&(oa||!X||S.length);X++)if(w=P[X],X>=lc){X===lc&&(N=S.length);var ha=Jb([w],k,m,q,f,!1);jf(ha,g,b,d,S)}else{var yb=yb||(yb=ff(k,m,q,f,!0));if(X>=v)if(X===v&&(R=S.length),Za)for(n=Za.length;n--;){if(ha=kf(Za[n],w),u=ha.length){for(ba=ba||[];u--;)ba.push(n);jf(ha,g,b,d,S)}}else ha=kf(yb,w),jf(ha,g,b,d,S);else if(ha=kf(yb,w),jf(ha,g,b,d,S),1<ha.length&&v<ee)for(Za=[],n=ha.length;n--;)Za[n]=ha[n]}}S.length&&(Xa[a]=S,Fa[a]=R,Ga[a]=ba,Ya[a]=N)}}return{Ob:c,\nbb:Xa,yb:Fa,cb:Ga,Eb:Ya}};function gf(a,b,c){for(var d=c.length,e=0,f,g,h=b.length;e<d;)f=c[e++],g=c[e++],a.push(g-f===h?b:b.slice(f,g));return 0<c.length}function kf(a,b){var c,d=[];if(c=Lb(a,b)){do{a=[];b=c;do a.push(b);while(b=b.next);d.push(a)}while(c=c.Ra)}else lf(b[0],a)?d.push(b):lf(a[0],b)&&d.push(a);return d}function lf(a,b){for(var c=b.length,d=new Int32Array(2*c),e,f;c--;)e=b[c],f=c<<1,d[f]=e.x,d[f+1]=e.y;return Ib(a.x,a.y,d,0,!0)!=Hb.NONE}\nfunction jf(a,b,c,d,e){for(var f=0,g=a.length;f<g;f++)e.push(hf(a[f],b,c,d))}function hf(a,b,c,d){var e,f=a.length,g=new Int32Array(2*f),h=0;for(e=0;e<f;e++){var k=a[e];g[h++]=k.x-b>>d;g[h++]=k.y-c>>d}return g}\nl.fb=function(a,b){var c=b.Ob,d=b.bb,e=b.yb,f=b.Eb;b=b.cb;for(var g=[],h,k={Rows:g},m,q=a?a.length:0,n=0,u,C=c.Rows,y=C.length,v;n<y;n+=1)if(d[n]||!this.i){h={};u=C[n];if(q)for(m=0;m<q;m++)u.hasOwnProperty(a[m])&&(h[a[m]]=u[a[m]]);else for(v in u)\"$$projected$$\"!==v&&(h[v]=u[v]);u.geometry&&(h.geometry=u.geometry);m=void 0;var I,la=h,oa=d[n],P=e[n],Xa=b[n],Fa=f[n],Ga=g;if(oa){var Ya=oa.length;if(Xa)for(I=P;I--;){if(I){var w={};for(m in la)w[m]=la[m]}else w=la;u=[oa[I]];var N=jb(Ya,Fa)-P;for(h=0;h<\nN;h++)Xa[h]===I&&u.push(oa[P+h]);N=u.length;if(!I)for(h=Fa;h<Ya;h++)u.push(oa[h]);w.$HProjGeometry={paths:u,interiorsIndex:1,outlinesIndex:N};Ga.push(w)}else la.$HProjGeometry={paths:oa,interiorsIndex:P,outlinesIndex:Fa},Ga.push(la)}else Ga.push(la)}c.Meta&&(k.Meta=c.Meta);return k};l.fa=function(){var a,b=this.b;for(a in b)b.hasOwnProperty(a)&&(b[a].reject(\"disposed\"),delete b[a])};\nfunction Ze(a){for(var b=[],c,d=a.length,e=0;e<d;e++){c=ta(a[e]);if(c.rowFilter&&(c.rowFilter=eval(\"(\"+c.rowFilter+\")\"),!r(c.rowFilter)))throw Error(\"Invalid row filter for layer \"+c.layerId);b.push(c)}return b};t(\"H.service.extension.worker.processor\",function(a,b,c){function d(a){e.postMessage(a)}var e=this,f=sa[a];var g=function(a){e.postError(a.toString())};if(0===b)f||(sa[a]=new Xe(c,mf)),this.postMessage();else if(f)switch(b){case 1:try{f.Kb.apply(f,c).then(d,g)}catch(h){this.postError(h.message)}break;case 2:try{f.Jb.apply(f,c).then(d,g)}catch(h){this.postError(h.message)}break;case 3:f.N();delete sa[a];ra()&&mf.S();break;default:e.postError(\"Unsupported command\")}else e.postError(\"TileProvider is not initialized\")});\nvar mf=new D(26214400),sa=Object.create(Ba,void 0);function nf(a,b,c){var d=a[b];a=a[b+1];this.Na=[];this.Ha=0;this.b=b;this.a=[a-c,d-c,a+c,d+c]}nf.prototype.da=function(a,b){var c=a[b];a=a[b+1];b=this.a;return b[1]<=c&&c<=b[3]&&b[0]<=a&&a<=b[2]};nf.prototype.H=function(){return this.b};var of=new G(0,0);function pf(a,b,c,d,e){d[e]=b;d[e+1]=a}var qf=new Y;function rf(a,b,c,d,e){qf.wa(a,b,of);d[e]=of.x;d[e+1]=of.y}\nt(\"H.clustering.dynamicgrid.worker\",function(a,b,c,d,e){var f=e?pf:rf,g=0;e=!!self.ArrayBuffer;var h=a.byteLength?new Float64Array(a):a,k=h.length/3;a=[];var m=[],q=[],n=e?new Float64Array(2*k):[];k=0;var u=0;for(qf.aa(d);g<h.length;){var C=h[g++];var y=h[g++];var v=h[g++];f(v,y,d,n,u);for(v=a.length;v--;)if(y=a[v],y.da(n,u)){var I=y;break}I||(I=new nf(n,u,b),a.push(I));v=u/2;I.Ha+=C||1;I.Na.push(v);I=null;u+=2}for(v=a.length;v--;)y=a[v],b=y.Ha>=c,f=y.Na,d=f.length,b?(m.push(d),m=m.concat(f)):\n(k+=d,q=q.concat(f));c=[k].concat(q).concat(m);c=e?(new Uint32Array(c)).buffer:c;this.postMessage(c,[c])});self.addEventListener(\"message\",function(a){a=new Ce(a.data);var b=ye[a.b];if(b)try{b.apply(a,a.c)}catch(c){a.postError(c.message)}else a.postError(\"processor_not_found\")});(function(){var a=new Ce;var b=function(b,d){Be.apply(a,[b,d,!0])};b(\"0\",ze);b(\"1\",Be);b(\"2\",Ae);b(\"3\",He)})();\n";
!function(){var e=function(){if(("undefined"==typeof self||!("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope))&&("undefined"!=typeof module&&module.exports||"undefined"!=typeof window))var sp=e.toString(),lp="",up="undefined"!=typeof document&&document.currentScript instanceof HTMLScriptElement?document.currentScript.src:"";!function(){"use strict";function n(e){return t.call(e).slice(8,-1)}var t={}.toString,e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e,t){return e(t={exports:{}},t.exports),t.exports}function r(e){return e&&e.Math==Math&&e}function o(e){try{return!!e()}catch(e){return!0}}function a(e){return"object"==typeof e?null!==e:"function"==typeof e}function s(e){return y?g.createElement(e):{}}function f(e){if(!a(e))throw TypeError(String(e)+" is not an object");return e}function l(e,t){if(!a(e))return e;var i,r;if(t&&"function"==typeof(i=e.toString)&&!a(r=i.call(e)))return r;if("function"==typeof(i=e.valueOf)&&!a(r=i.call(e)))return r;if(!t&&"function"==typeof(i=e.toString)&&!a(r=i.call(e)))return r;throw TypeError("Can't convert object to primitive value")}function m(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}function c(t,i){try{T(p,t,i)}catch(e){p[t]=i}return i}function u(e){return"Symbol(".concat(void 0===e?"":e,")_",(++k+E).toString(36))}function h(e){return R[e]||(R[e]=M&&S[e]||(M?S:u)("Symbol."+e))}function d(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),P))?i:z?n(t):"Object"==(r=n(t))&&"function"==typeof t.callee?"Arguments":r}var _="object",p=r(typeof globalThis==_&&globalThis)||r(typeof window==_&&window)||r(typeof self==_&&self)||r(typeof e==_&&e)||Function("return this")(),v=!o(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),g=p.document,y=a(g)&&a(g.createElement),x=!v&&!o(function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}),b=Object.defineProperty,A={f:v?b:function(e,t,i){if(f(e),t=l(t,!0),f(i),x)try{return b(e,t,i)}catch(e){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},T=v?function(e,t,i){return A.f(e,t,m(1,i))}:function(e,t,i){return e[t]=i,e},w=i(function(e){var t="__core-js_shared__",i=p[t]||c(t,{});(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.1.0",mode:"global",copyright:"\xa9 2019 Denis Pushkarev (zloirock.ru)"})}),k=0,E=Math.random(),M=!o(function(){return!String(Symbol())}),R=w("wks"),S=p.Symbol,P=h("toStringTag"),z="Arguments"==n(function(){return arguments}()),N={};N[h("toStringTag")]="z";function O(e,t){return j.call(e,t)}function I(e){return V[e]||(V[e]=u(e))}var L,C,F,D="[object z]"!==String(N)?function(){return"[object "+d(this)+"]"}:N.toString,j={}.hasOwnProperty,U=w("native-function-to-string",Function.toString),G=p.WeakMap,B="function"==typeof G&&/native code/.test(U.call(G)),V=w("keys"),q={},Y=p.WeakMap;if(B){var W=new Y,X=W.get,Z=W.has,K=W.set;L=function(e,t){return K.call(W,e,t),t},C=function(e){return X.call(W,e)||{}},F=function(e){return Z.call(W,e)}}else{var J=I("state");q[J]=!0,L=function(e,t){return T(e,J,t),t},C=function(e){return O(e,J)?e[J]:{}},F=function(e){return O(e,J)}}var $={set:L,get:C,has:F,enforce:function(e){return F(e)?C(e):L(e,{})},getterFor:function(i){return function(e){var t;if(!a(e)||(t=C(e)).type!==i)throw TypeError("Incompatible receiver, "+i+" required");return t}}},Q=i(function(e){var t=$.get,s=$.enforce,l=String(U).split("toString");w("inspectSource",function(e){return U.call(e)}),(e.exports=function(e,t,i,r){var n=!!r&&!!r.unsafe,o=!!r&&!!r.enumerable,a=!!r&&!!r.noTargetGet;"function"==typeof i&&("string"!=typeof t||O(i,"name")||T(i,"name",t),s(i).source=l.join("string"==typeof t?t:"")),e!==p?(n?!a&&e[t]&&(o=!0):delete e[t],o?e[t]=i:T(e,t,i)):o?e[t]=i:c(t,i)})(Function.prototype,"toString",function(){return"function"==typeof this&&t(this).source||U.call(this)})}),ee=Object.prototype;D!==ee.toString&&Q(ee,"toString",D,{unsafe:!0});function te(e){return isNaN(e=+e)?0:(0<e?_e:de)(e)}function ie(e){if(null==e)throw TypeError("Can't call method on "+e);return e}function re(e){return ye(ie(e))}function ne(e){return 0<e?Ae(te(e),9007199254740991):0}function oe(e,t){var i,r=re(e),n=0,o=[];for(i in r)!O(q,i)&&O(r,i)&&o.push(i);for(;t.length>n;)O(r,i=t[n++])&&(~ke(o,i)||o.push(i));return o}function ae(e,t){for(var i=ze(t),r=A.f,n=be.f,o=0;o<i.length;o++){var a=i[o];O(e,a)||r(e,a,n(t,a))}}function se(e,t){var i=Ie[Oe(e)];return i==Ce||i!=Le&&("function"==typeof t?o(t):!!t)}function le(e,t){var i,r,n,o,a,s=e.target,l=e.global,u=e.stat;if(i=l?p:u?p[s]||c(s,{}):(p[s]||{}).prototype)for(r in t){if(o=t[r],n=e.noTargetGet?(a=De(i,r))&&a.value:i[r],!Fe(l?r:s+(u?".":"#")+r,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;ae(o,n)}(e.sham||n&&n.sham)&&T(o,"sham",!0),Q(i,r,o,e)}}var ue,ce,he,fe,de=Math.ceil,_e=Math.floor,pe={}.propertyIsEnumerable,ve=Object.getOwnPropertyDescriptor,me={f:ve&&!pe.call({1:2},1)?function(e){var t=ve(this,e);return!!t&&t.enumerable}:pe},ge="".split,ye=o(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return"String"==n(e)?ge.call(e,""):Object(e)}:Object,xe=Object.getOwnPropertyDescriptor,be={f:v?xe:function(e,t){if(e=re(e),t=l(t,!0),x)try{return xe(e,t)}catch(e){}if(O(e,t))return m(!me.f.call(e,t),e[t])}},Ae=Math.min,Te=Math.max,we=Math.min,ke=(ue=!1,function(e,t,i){var r,n=re(e),o=ne(n.length),a=function(e,t){var i=te(e);return i<0?Te(i+t,0):we(i,t)}(i,o);if(ue&&t!=t){for(;a<o;)if((r=n[a++])!=r)return!0}else for(;a<o;a++)if((ue||a in n)&&n[a]===t)return ue||a||0;return!ue&&-1}),Ee=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Me=Ee.concat("length","prototype"),Re={f:Object.getOwnPropertyNames||function(e){return oe(e,Me)}},Se={f:Object.getOwnPropertySymbols},Pe=p.Reflect,ze=Pe&&Pe.ownKeys||function(e){var t=Re.f(f(e)),i=Se.f;return i?t.concat(i(e)):t},Ne=/#|\.prototype\./,Oe=se.normalize=function(e){return String(e).replace(Ne,".").toLowerCase()},Ie=se.data={},Le=se.NATIVE="N",Ce=se.POLYFILL="P",Fe=se,De=be.f,je=!o(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Ue=I("IE_PROTO"),Ge=Object.prototype,Be=je?Object.getPrototypeOf:function(e){return e=function(e){return Object(ie(e))}(e),O(e,Ue)?e[Ue]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Ge:null},Ve=h("iterator"),qe=!1;[].keys&&("next"in(fe=[].keys())?(he=Be(Be(fe)))!==Object.prototype&&(ce=he):qe=!0),null==ce&&(ce={}),O(ce,Ve)||T(ce,Ve,function(){return this});function He(){}var Ye={IteratorPrototype:ce,BUGGY_SAFARI_ITERATORS:qe},We=Object.keys||function(e){return oe(e,Ee)},Xe=v?Object.defineProperties:function(e,t){f(e);for(var i,r=We(t),n=r.length,o=0;o<n;)A.f(e,i=r[o++],t[i]);return e},Ze=p.document,Ke=Ze&&Ze.documentElement,Je=I("IE_PROTO"),$e="prototype",Qe=function(){var e,t=s("iframe"),i=Ee.length,r="script";for(t.style.display="none",Ke.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write("<script>document.F=Object</"+r+">"),e.close(),Qe=e.F;i--;)delete Qe[$e][Ee[i]];return Qe()},et=Object.create||function(e,t){var i;return null!==e?(He[$e]=f(e),i=new He,He[$e]=null,i[Je]=e):i=Qe(),void 0===t?i:Xe(i,t)};q[Je]=!0;function tt(e,t,i){e&&!O(e=i?e:e.prototype,at)&&ot(e,at,{configurable:!0,value:t})}function it(){return this}function rt(){return this}function nt(e,t,i,r,n,o,a){function s(e){if(e===n&&p)return p;if(!ft&&e in d)return d[e];switch(e){case"keys":case dt:case _t:return function(){return new i(this,e)}}return function(){return new i(this)}}!function(e,t,i){var r=t+" Iterator";e.prototype=et(lt,{next:m(1,i)}),tt(e,r,!1),st[r]=it}(i,t,r);var l,u,c,h=t+" Iterator",f=!1,d=e.prototype,_=d[ct]||d["@@iterator"]||n&&d[n],p=!ft&&_||s(n),v="Array"==t&&d.entries||_;if(v&&(l=Be(v.call(new e)),ht!==Object.prototype&&l.next&&(Be(l)!==ht&&(ut?ut(l,ht):"function"!=typeof l[ct]&&T(l,ct,rt)),tt(l,h,!0))),n==dt&&_&&_.name!==dt&&(f=!0,p=function(){return _.call(this)}),d[ct]!==p&&T(d,ct,p),st[t]=p,n)if(u={values:s(dt),keys:o?p:s("keys"),entries:s(_t)},a)for(c in u)!ft&&!f&&c in d||Q(d,c,u[c]);else le({target:t,proto:!0,forced:ft||f},u);return u}var ot=A.f,at=h("toStringTag"),st={},lt=Ye.IteratorPrototype,ut=Object.setPrototypeOf||("__proto__"in{}?function(){var i,r=!1,e={};try{(i=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(e,[]),r=e instanceof Array}catch(e){}return function(e,t){return function(e,t){if(f(e),!a(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(e,t),r?i.call(e,t):e.__proto__=t,e}}():void 0),ct=h("iterator"),ht=Ye.IteratorPrototype,ft=Ye.BUGGY_SAFARI_ITERATORS,dt="values",_t="entries",pt="String Iterator",vt=$.set,mt=$.getterFor(pt);nt(String,"String",function(e){vt(this,{type:pt,string:String(e),index:0})},function(){var e,t=mt(this),i=t.string,r=t.index;return r>=i.length?{value:void 0,done:!0}:(e=function(e,t,i){var r,n,o=String(ie(e)),a=te(t),s=o.length;return a<0||s<=a?i?"":void 0:(r=o.charCodeAt(a))<55296||56319<r||a+1===s||(n=o.charCodeAt(a+1))<56320||57343<n?i?o.charAt(a):r:i?o.slice(a,a+2):n-56320+(r-55296<<10)+65536}(i,r,!0),t.index+=e.length,{value:e,done:!1})});var gt={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},yt=h("unscopables"),xt=Array.prototype;null==xt[yt]&&T(xt,yt,et(null));function bt(e){xt[yt][e]=!0}var At="Array Iterator",Tt=$.set,wt=$.getterFor(At),kt=nt(Array,"Array",function(e,t){Tt(this,{type:At,target:re(e),index:0,kind:t})},function(){var e=wt(this),t=e.target,i=e.kind,r=e.index++;return!t||r>=t.length?{value:e.target=void 0,done:!0}:"keys"==i?{value:r,done:!1}:"values"==i?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}},"values");st.Arguments=st.Array,bt("keys"),bt("values"),bt("entries");var Et=h("iterator"),Mt=h("toStringTag"),Rt=kt.values;for(var St in gt){var Pt=p[St],zt=Pt&&Pt.prototype;if(zt){if(zt[Et]!==Rt)try{T(zt,Et,Rt)}catch(e){zt[Et]=Rt}if(zt[Mt]||T(zt,Mt,St),gt[St])for(var Nt in kt)if(zt[Nt]!==kt[Nt])try{T(zt,Nt,kt[Nt])}catch(e){zt[Nt]=kt[Nt]}}}function Ot(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}function It(r,n,e){if(Ot(r),void 0===n)return r;switch(e){case 0:return function(){return r.call(n)};case 1:return function(e){return r.call(n,e)};case 2:return function(e,t){return r.call(n,e,t)};case 3:return function(e,t,i){return r.call(n,e,t,i)}}return function(){return r.apply(n,arguments)}}function Lt(t,e,i,r){try{return r?e(f(i)[0],i[1]):e(i)}catch(e){var n=t.return;throw void 0!==n&&f(n.call(t)),e}}var Ct=h("iterator"),Ft=Array.prototype,Dt=h("iterator"),jt=i(function(e){var h={};(e.exports=function(e,t,i,r,n){var o,a,s,l,u,c=It(t,i,r?2:1);if(n)o=e;else{if("function"!=typeof(a=function(e){if(null!=e)return e[Dt]||e["@@iterator"]||st[d(e)]}(e)))throw TypeError("Target is not iterable");if(function(e){return void 0!==e&&(st.Array===e||Ft[Ct]===e)}(a)){for(s=0,l=ne(e.length);s<l;s++)if((r?c(f(u=e[s])[0],u[1]):c(e[s]))===h)return h;return}o=a.call(e)}for(;!(u=o.next()).done;)if(Lt(o,c,u.value,r)===h)return h}).BREAK=h}),Ut=h("iterator"),Gt=!1;try{var Bt=0;({next:function(){return{done:!!Bt++}},return:function(){Gt=!0}})[Ut]=function(){return this}}catch(e){}function Vt(e,t){var i,r=f(e).constructor;return void 0===r||null==(i=f(r)[Jt])?t:Ot(i)}function qt(e){if(oi.hasOwnProperty(e)){var t=oi[e];delete oi[e],t()}}function Ht(e){return function(){qt(e)}}function Yt(e){qt(e.data)}function Wt(e){p.postMessage(e+"",$t.protocol+"//"+$t.host)}var Xt,Zt,Kt,Jt=h("species"),$t=p.location,Qt=p.setImmediate,ei=p.clearImmediate,ti=p.process,ii=p.MessageChannel,ri=p.Dispatch,ni=0,oi={},ai="onreadystatechange";Qt&&ei||(Qt=function(e){for(var t=[],i=1;i<arguments.length;)t.push(arguments[i++]);return oi[++ni]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},Xt(ni),ni},ei=function(e){delete oi[e]},"process"==n(ti)?Xt=function(e){ti.nextTick(Ht(e))}:ri&&ri.now?Xt=function(e){ri.now(Ht(e))}:ii?(Kt=(Zt=new ii).port2,Zt.port1.onmessage=Yt,Xt=It(Kt.postMessage,Kt,1)):!p.addEventListener||"function"!=typeof postMessage||p.importScripts||o(Wt)?Xt=ai in s("script")?function(e){Ke.appendChild(s("script"))[ai]=function(){Ke.removeChild(this),qt(e)}}:function(e){setTimeout(Ht(e),0)}:(Xt=Wt,p.addEventListener("message",Yt,!1)));var si,li,ui,ci,hi,fi,di,_i={set:Qt,clear:ei},pi=p.navigator,vi=pi&&pi.userAgent||"",mi=be.f,gi=_i.set,yi=p.MutationObserver||p.WebKitMutationObserver,xi=p.process,bi=p.Promise,Ai="process"==n(xi),Ti=mi(p,"queueMicrotask"),wi=Ti&&Ti.value;wi||(si=function(){var e,t;for(Ai&&(e=xi.domain)&&e.exit();li;){t=li.fn,li=li.next;try{t()}catch(e){throw li?ci():ui=void 0,e}}ui=void 0,e&&e.enter()},ci=Ai?function(){xi.nextTick(si)}:yi&&!/(iphone|ipod|ipad).*applewebkit/i.test(vi)?(hi=!0,fi=document.createTextNode(""),new yi(si).observe(fi,{characterData:!0}),function(){fi.data=hi=!hi}):bi&&bi.resolve?(di=bi.resolve(void 0),function(){di.then(si)}):function(){gi.call(p,si)});function ki(e){var i,r;this.promise=new e(function(e,t){if(void 0!==i||void 0!==r)throw TypeError("Bad Promise constructor");i=e,r=t}),this.resolve=Ot(i),this.reject=Ot(r)}function Ei(e,t){if(f(e),a(t)&&t.constructor===e)return t;var i=Gi.f(e);return(0,i.resolve)(t),i.promise}function Mi(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}function Ri(e){return"function"==typeof e?e:void 0}function Si(e,t){return arguments.length<2?Ri(Bi[e])||Ri(p[e]):Bi[e]&&Bi[e][t]||p[e]&&p[e][t]}function Pi(e){var t;return!(!a(e)||"function"!=typeof(t=e.then))&&t}function zi(c,h,i){if(!h.notified){h.notified=!0;var r=h.reactions;Ui(function(){for(var l=h.value,u=1==h.state,e=0,t=function(e){var t,i,r,n=u?e.ok:e.fail,o=e.resolve,a=e.reject,s=e.domain;try{n?(u||(2===h.rejection&&fr(c,h),h.rejection=1),!0===n?t=l:(s&&s.enter(),t=n(l),s&&(s.exit(),r=!0)),t===e.promise?a(Ji("Promise-chain cycle")):(i=Pi(t))?i.call(t,o,a):o(t)):a(l)}catch(e){s&&!r&&s.exit(),a(e)}};r.length>e;)t(r[e++]);h.reactions=[],h.notified=!1,i&&!h.rejection&&cr(c,h)})}}function Ni(e,t,i){var r,n;ar?((r=$i.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),p.dispatchEvent(r)):r={promise:t,reason:i},(n=p["on"+e])?n(r):e===sr&&function(e,t){var i=p.console;i&&i.error&&(1===arguments.length?i.error(e):i.error(e,t))}("Unhandled promise rejection",i)}function Oi(t,i,r,n){return function(e){t(i,r,e,n)}}function Ii(e,t,i,r){t.done||(t.done=!0,r&&(t=r),t.value=i,t.state=2,zi(e,t,!0))}var Li,Ci,Fi,Di,ji,Ui=wi||function(e){var t={fn:e,next:void 0};ui&&(ui.next=t),li||(li=t,ci()),ui=t},Gi={f:function(e){return new ki(e)}},Bi=p,Vi=h("species"),qi="Promise",Hi=_i.set,Yi=h("species"),Wi=$.get,Xi=$.set,Zi=$.getterFor(qi),Ki=p[qi],Ji=p.TypeError,$i=p.document,Qi=p.process,er=p.fetch,tr=Qi&&Qi.versions,ir=tr&&tr.v8||"",rr=Gi.f,nr=rr,or="process"==n(Qi),ar=!!($i&&$i.createEvent&&p.dispatchEvent),sr="unhandledrejection",lr=Fe(qi,function(){function t(){}var e=Ki.resolve(1),i=(e.constructor={})[Yi]=function(e){e(t,t)};return!((or||"function"==typeof PromiseRejectionEvent)&&e.then(t)instanceof i&&0!==ir.indexOf("6.6")&&-1===vi.indexOf("Chrome/66"))}),ur=lr||!function(e,t){if(!t&&!Gt)return!1;var i=!1;try{var r={};r[Ut]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(e){}return i}(function(e){Ki.all(e).catch(function(){})}),cr=function(i,r){Hi.call(p,function(){var e,t=r.value;if(hr(r)&&(e=Mi(function(){or?Qi.emit("unhandledRejection",t,i):Ni(sr,i,t)}),r.rejection=or||hr(r)?2:1,e.error))throw e.value})},hr=function(e){return 1!==e.rejection&&!e.parent},fr=function(e,t){Hi.call(p,function(){or?Qi.emit("rejectionHandled",e):Ni("rejectionhandled",e,t.value)})},dr=function(i,r,e,t){if(!r.done){r.done=!0,t&&(r=t);try{if(i===e)throw Ji("Promise can't be resolved itself");var n=Pi(e);n?Ui(function(){var t={done:!1};try{n.call(e,Oi(dr,i,t,r),Oi(Ii,i,t,r))}catch(e){Ii(i,t,e,r)}}):(r.value=e,r.state=1,zi(i,r,!1))}catch(e){Ii(i,{done:!1},e,r)}}};lr&&(Ki=function(e){!function(e,t,i){if(!(e instanceof t))throw TypeError("Incorrect "+(i?i+" ":"")+"invocation")}(this,Ki,qi),Ot(e),Li.call(this);var t=Wi(this);try{e(Oi(dr,this,t),Oi(Ii,this,t))}catch(e){Ii(this,t,e)}},(Li=function(e){Xi(this,{type:qi,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=function(e,t,i){for(var r in t)Q(e,r,t[r],i);return e}(Ki.prototype,{then:function(e,t){var i=Zi(this),r=rr(Vt(this,Ki));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=or?Qi.domain:void 0,i.parent=!0,i.reactions.push(r),0!=i.state&&zi(this,i,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),Ci=function(){var e=new Li,t=Wi(e);this.promise=e,this.resolve=Oi(dr,e,t),this.reject=Oi(Ii,e,t)},Gi.f=rr=function(e){return e===Ki||e===Fi?new Ci(e):nr(e)},"function"==typeof er&&le({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Ei(Ki,er.apply(p,arguments))}})),le({global:!0,wrap:!0,forced:lr},{Promise:Ki}),tt(Ki,qi,!1),Di=Si(qi),ji=A.f,v&&Di&&!Di[Vi]&&ji(Di,Vi,{configurable:!0,get:function(){return this}}),Fi=Bi[qi],le({target:qi,stat:!0,forced:lr},{reject:function(e){var t=rr(this);return t.reject.call(void 0,e),t.promise}}),le({target:qi,stat:!0,forced:lr},{resolve:function(e){return Ei(this,e)}}),le({target:qi,stat:!0,forced:ur},{all:function(e){var s=this,t=rr(s),l=t.resolve,u=t.reject,i=Mi(function(){var r=Ot(s.resolve),n=[],o=0,a=1;jt(e,function(e){var t=o++,i=!1;n.push(void 0),a++,r.call(s,e).then(function(e){i||(i=!0,n[t]=e,--a||l(n))},u)}),--a||l(n)});return i.error&&u(i.value),t.promise},race:function(e){var i=this,r=rr(i),n=r.reject,t=Mi(function(){var t=Ot(i.resolve);jt(e,function(e){t.call(i,e).then(r.resolve,n)})});return t.error&&n(t.value),r.promise}}),le({target:"Promise",proto:!0,real:!0},{finally:function(t){var i=Vt(this,Si("Promise")),e="function"==typeof t;return this.then(e?function(e){return Ei(i,t()).then(function(){return e})}:t,e?function(e){return Ei(i,t()).then(function(){throw e})}:t)}});var _r;Bi.Promise;if("function"!=typeof Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(null!=r)for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])}return t}),Math.hypot=Math.hypot||function(){for(var e=0,t=arguments.length,i=0;i<t;i++){if(arguments[i]===1/0||arguments[i]===-1/0)return 1/0;e+=arguments[i]*arguments[i]}return Math.sqrt(e)},Math.log2=Math.log2||function(e){return Math.log(e)*Math.LOG2E},"undefined"!=typeof window?("performance"in window==!1&&(window.performance={}),_r=window.performance):"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&("performance"in self==!1&&(self.performance={}),_r=self.performance),_r&&"function"!=typeof _r.now){var pr=+new Date;_r.now=function(){return+new Date-pr}}function vr(e){return(vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function mr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gr(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yr(e,t,i){return t&&gr(e.prototype,t),i&&gr(e,i),e}function xr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function br(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Tr(e,t)}function Ar(e){return(Ar=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Tr(e,t){return(Tr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wr(e,t,i){return(wr=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return i&&Tr(n,i.prototype),n}).apply(null,arguments)}function kr(e){var i="function"==typeof Map?new Map:void 0;return(kr=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,t)}function t(){return wr(e,arguments,Ar(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Tr(t,e)})(e)}function Er(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Er(e):t}function Rr(e,t,i){return(Rr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ar(e)););return e}(e,t);if(r){var n=Object.getOwnPropertyDescriptor(r,t);return n.get?n.get.call(i):n.value}})(e,t,i||e)}function Sr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=[],r=!0,n=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(i.push(a.value),!t||i.length!==t);r=!0);}catch(e){n=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(n)throw o}}return i}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Pr(e){return function(e){if(Array.isArray(e)){for(var t=0,i=new Array(e.length);t<e.length;t++)i[t]=e[t];return i}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var zr,Nr,Or=!1,Ir=!1;try{window.document!==HTMLDocument&&(Ir=!0)}catch(e){void 0!==self&&(Or=!0,self.window={document:{}},self.document=self.window.document)}var Lr={get is_fake_worker(){return self.is_fake_worker},get is_worker(){return void 0!==Nr?Nr:Or||self.is_fake_worker},set is_worker(e){Nr=e},get is_main(){return void 0!==zr?zr:Ir&&!self.is_fake_worker},set is_main(e){zr=e},is_native_worker:Or},Cr={},Fr=0,Dr={},jr={},Ur={};function Gr(e,t,i){var r=2<arguments.length&&void 0!==i?i:jr,n=[];if("string"==typeof e&&(e=(n=e.split(".")).pop()),Lr.is_main&&t&&1===n.length&&"self"===n[0])r=t;else for(var o=0;o<n.length;o++){if(!r[n[o]])return[];r=r[n[o]]}return[e,r]}Cr.addTarget=function(e,t){Lr.is_fake_worker?Ur[e]=t:jr[e]=t},Cr.removeTarget=function(e){delete jr[e],delete Ur[e]};var Br=" No object with that name is registered on main thread.",Vr=" Object has no method with that name.",qr="_worker_broker_error_not_set_";function Hr(e){Array.isArray(e)&&e.filter(function(e){return e.parent&&e.property}).forEach(function(e){return delete e.parent[e.property]})}Cr.withTransferables=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(this instanceof Cr.withTransferables))return wr(Cr.withTransferables,t);this.value=t,this.transferables=function i(r){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:[];if(!r)return n;if(Array.isArray(r))r.forEach(function(e,t){return i(e,r,t,n)});else if("object"===vr(r))if(r instanceof ArrayBuffer)n.push({object:r,parent:e,property:t});else if(r.buffer instanceof ArrayBuffer)n.push({object:r.buffer,parent:e,property:t});else for(var o in r)i(r[o],r,o,n);return n}(this.value)},Lr.is_main&&(Cr.postMessage=function(e,i){for(var t=arguments.length,r=new Array(2<t?t-2:0),n=2;n<t;n++)r[n-2]=arguments[n];if(Array.isArray(e))return Promise.all(e.map(function(e){return Cr.postMessage.apply(Cr,[e,i].concat(Pr(r)))}));var o,a={};"object"===vr(i)&&(i=(a=i).method);var s="main_send";"string"==typeof e?(i=e,r=Array.prototype.slice.call(arguments,1),o=!0,s="worker_send"):e.init&&(o=!0);var l,u=[];if(r&&1===r.length&&r[0]instanceof Cr.withTransferables&&(u=r[0].transferables,r=r[0].value),l={type:s,message_id:++Fr,method:i,message:r},o)return function(r,e){var t=r.type,i=Sr(Gr(r.method,e,"main_send"===t?Ur:jr),2),n=i[0],o=i[1],a="Worker broker could not dispatch message type ".concat(r.method," on target ").concat(r.target,".");if(!o)throw Error(a+Br);var s="function"==typeof o[n]&&o[n];if(!s)throw Error(a+Vr);return new Promise(function(t,i){var e;try{e=s.apply(o,r.message)}catch(e){return void i(e)}e instanceof Promise?e.then(function(e){e instanceof Cr.withTransferables&&(e=e.value[0]),t(e)},function(e){i(e instanceof Error?"".concat(e.message,": ").concat(e.stack):e)}):(e instanceof Cr.withTransferables&&(e=e.value[0]),t(e))})}(l,e&&e.init?e:void 0);var c=new Promise(function(e,t){Dr[Fr]={method:i,message:r,resolve:e,reject:t}});return a.stringify&&(l=JSON.stringify(l)),e.postMessage(l,u.map(function(e){return e.object})),Hr(u),c},Cr.addWorker=function(f){if(!(f instanceof Worker))throw Error("Worker broker could not add non-Worker object",f);f.addEventListener("message",function(e){var t="string"==typeof e.data?JSON.parse(e.data):e.data,i=t.message_id;if("worker_reply"===t.type)Dr[i]&&(t.error?Dr[i].reject(t.error):Dr[i].resolve(t.message),delete Dr[i]);else if("worker_send"===t.type&&null!=i){var r=Sr(Gr(t.method),2),n=r[0],o=r[1],a="Worker broker could not dispatch message type ".concat(t.method," on target ").concat(t.target,".");if(!o)throw Error(a+Br);var s="function"==typeof o[n]&&o[n];if(!s)throw Error(a+Vr);var l,u=qr;try{l=s.apply(o,t.message)}catch(e){u=e}var c,h=[];l&&"function"==typeof l.then?l.then(function(e){e instanceof Cr.withTransferables&&(h=e.transferables,e=e.value[0]),c={type:"main_reply",message_id:i,message:e},f.postMessage(c,h.map(function(e){return e.object})),Hr(h)},function(e){f.postMessage({type:"main_reply",message_id:i,error:e instanceof Error?"".concat(e.message,": ").concat(e.stack):e})}):(l instanceof Cr.withTransferables&&(h=l.transferables,l=l.value[0]),c={type:"main_reply",message_id:i,message:l,error:u instanceof Error?"".concat(u.message,": ").concat(u.stack):u},f.postMessage(c,h.map(function(e){return e.object})),Hr(h))}})},Cr.getMessages=function(){return Dr},Cr.getMessageId=function(){return Fr}),Lr.is_worker&&(Cr.postMessage=function(i){for(var e=arguments.length,r=new Array(1<e?e-1:0),t=1;t<e;t++)r[t-1]=arguments[t];var n={};"object"===vr(i)&&(i=(n=i).method);var o,a=new Promise(function(e,t){Dr[Fr]={method:i,message:r,resolve:e,reject:t}}),s=[];return r&&1===r.length&&r[0]instanceof Cr.withTransferables&&(s=r[0].transferables,r=r[0].value),o={type:"worker_send",message_id:Fr,method:i,message:r},n.stringify&&(o=JSON.stringify(o)),self.postMessage(o,s.map(function(e){return e.object})),Hr(s),Fr++,a},self.addEventListener("message",function(e){var t="string"==typeof e.data?JSON.parse(e.data):e.data,i=t.message_id;if("main_reply"===t.type)Dr[i]&&(t.hasOwnProperty("error")&&t.error!==qr?Dr[i].reject(t.error):Dr[i].resolve(t.message),delete Dr[i]);else if("main_send"===t.type&&null!=i){var r=Sr(Gr(t.method),2),n=r[0],o=r[1],a="Worker broker could not dispatch message type ".concat(t.method," on target ").concat(t.target,".");if(!o)throw Error(a+Br);var s,l,u="function"==typeof o[n]&&o[n];if(!u)throw Error(a+Vr);try{s=u.apply(o,t.message)}catch(e){l=e}var c,h=[];s instanceof Promise?s.then(function(e){e instanceof Cr.withTransferables&&(h=e.transferables,e=e.value[0]),c={type:"worker_reply",message_id:i,message:e},self.postMessage(c,h.map(function(e){return e.object})),Hr(h)},function(e){self.postMessage({type:"worker_reply",message_id:i,error:e instanceof Error?"".concat(e.message,": ").concat(e.stack):e})}):(s instanceof Cr.withTransferables&&(h=s.transferables,s=s.value[0]),c={type:"worker_reply",message_id:i,message:s,error:l instanceof Error?"".concat(l.message,": ").concat(l.stack):l},self.postMessage(c,h.map(function(e){return e.object})),Hr(h))}}));var Yr,Wr={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},Xr={},Zr={};function Kr(e){var t="object"===vr(e)?e.level:e;if(Wr[t]<=Wr[Kr.level]){for(var i=arguments.length,r=new Array(1<i?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];if(Lr.is_native_worker)Cr.postMessage.apply(Cr,[{method:"_logProxy",stringify:!0},e].concat(r));else{if("object"===vr(e)&&!0===e.once){if(Zr[JSON.stringify(r)])return;Zr[JSON.stringify(r)]=!0}var o=function(e){return Xr[e]=Xr[e]||(console[e]?console[e]:console.log).bind(console),Xr[e]}(t);1<r.length?o.apply(void 0,["Tangram [".concat(t,"]: ").concat(r[0])].concat(Pr(r.slice(1)))):o("Tangram [".concat(t,"]: ").concat(r[0]))}}}Kr.level="info",Kr.workers=null,Kr.setLevel=function(e){Kr.level=e,Lr.is_main&&Array.isArray(Kr.workers)&&Cr.postMessage(Kr.workers,"_logSetLevelProxy",e)},Lr.is_main&&(Kr.setWorkers=function(e){Kr.workers=e},Kr.reset=function(){Zr={}}),Cr.addTarget("_logProxy",Kr),Cr.addTarget("_logSetLevelProxy",Kr.setLevel);var Jr=Yr={};Yr.default_source_max_zoom=18,Yr.default_view_max_zoom=20,Yr.tile_size=256,Yr.half_circumference_meters=20037508.342789244,Yr.circumference_meters=2*Yr.half_circumference_meters,Yr.min_zoom_meters_per_pixel=Yr.circumference_meters/Yr.tile_size;var $r=[];Yr.metersPerPixel=function(e){return $r[e]=$r[e]||Yr.min_zoom_meters_per_pixel/Math.pow(2,e),$r[e]};var Qr=[];Yr.metersPerTile=function(e){return Qr[e]=Qr[e]||Yr.circumference_meters/Math.pow(2,e),Qr[e]},Yr.tile_scale=4096,Yr.units_per_pixel=Yr.tile_scale/Yr.tile_size,Yr.height_scale=16;var en=[];Yr.unitsPerMeter=function(e){return en[e]=en[e]||Yr.tile_scale/(Yr.tile_size*Yr.metersPerPixel(e)),en[e]},Yr.metersForTile=function(e){return{x:e.x*Yr.circumference_meters/Math.pow(2,e.z)-Yr.half_circumference_meters,y:-(e.y*Yr.circumference_meters/Math.pow(2,e.z)-Yr.half_circumference_meters)}},Yr.tileForMeters=function(e,t){var i=Sr(e,2),r=i[0],n=i[1];return{x:Math.floor((r+Yr.half_circumference_meters)/(Yr.circumference_meters/Math.pow(2,t))),y:Math.floor((-n+Yr.half_circumference_meters)/(Yr.circumference_meters/Math.pow(2,t))),z:t}},Yr.metersToExactTileCoords=function(e,t){var i=Sr(e,2),r=i[0],n=i[1];return{x:Math.pow(2,t-1)*(1+r/Yr.half_circumference_meters),y:Math.pow(2,t-1)*(1-n/Yr.half_circumference_meters),z:t}},Yr.wrapTile=function(e){var t=e.x,i=e.y,r=e.z,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{x:!0,y:!1},o=(1<<r)-1;return n.x&&(t&=o),n.y&&(i&=o),{x:t,y:i,z:r}},Yr.metersToLatLng=function(e){var t=Sr(e,2),i=t[0],r=t[1];return i/=Yr.half_circumference_meters,r/=Yr.half_circumference_meters,r=(2*Math.atan(Math.exp(r*Math.PI))-Math.PI/2)/Math.PI,[i*=180,r*=180]},Yr.latLngToMeters=function(e){var t=Sr(e,2),i=t[0],r=t[1];return r=Math.log(Math.tan(r*Math.PI/360+Math.PI/4))/Math.PI,r*=Yr.half_circumference_meters,r=Math.min(Math.max(r,-Yr.half_circumference_meters),Yr.half_circumference_meters),[i*=Yr.half_circumference_meters/180,r]},Yr.tileSpaceToMeters=function(e,t,i){var r=Sr(e,2),n=r[0],o=r[1],a=Yr.unitsPerMeter(t);return[n/a+i.x,o/a+i.y]},Yr.tileSpaceToLatlng=function(e,t,n){var o=Yr.unitsPerMeter(t);return Yr.transformGeometry(e,function(e){e[0]=e[0]/o+n.x,e[1]=e[1]/o+n.y;var t=Sr(Yr.metersToLatLng(e),2),i=t[0],r=t[1];e[0]=i,e[1]=r}),e},Yr.copyGeometry=function(e){if(null!=e){var t={type:e.type};return"Point"===e.type?t.coordinates=[e.coordinates[0],e.coordinates[1]]:"LineString"===e.type||"MultiPoint"===e.type?t.coordinates=e.coordinates.map(function(e){return[e[0],e[1]]}):"Polygon"===e.type||"MultiLineString"===e.type?t.coordinates=e.coordinates.map(function(e){return e.map(function(e){return[e[0],e[1]]})}):"MultiPolygon"===e.type&&(t.coordinates=e.coordinates.map(function(e){return e.map(function(e){return e.map(function(e){return[e[0],e[1]]})})})),t}},Yr.transformGeometry=function(e,t){null!=e&&("Point"===e.type?t(e.coordinates):"LineString"===e.type||"MultiPoint"===e.type?e.coordinates.forEach(t):"Polygon"===e.type||"MultiLineString"===e.type?e.coordinates.forEach(function(e){return e.forEach(t)}):"MultiPolygon"===e.type&&e.coordinates.forEach(function(e){e.forEach(function(e){return e.forEach(t)})}))},Yr.boxIntersect=function(e,t){return!(t.sw.x>e.ne.x||t.ne.x<e.sw.x||t.sw.y>e.ne.y||t.ne.y<e.sw.y)},Yr.findBoundingBox=function(e){for(var t=1/0,i=-1/0,r=1/0,n=-1/0,o=e[0].length,a=0;a<o;a++){var s=e[0][a];s[0]<t&&(t=s[0]),s[1]<r&&(r=s[1]),s[0]>i&&(i=s[0]),s[1]>n&&(n=s[1])}return[t,r,i,n]},Yr.geometryType=function(e){return"Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},Yr.centroid=function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];if(e&&0!==e.length){var i,r=0,n=0,o=0,a=e[0],s=a.length;t&&(i=a[0],a=a.map(function(e){return[e[0]-i[0],e[1]-i[1]]}));for(var l=0,u=s-1;l<s;u=l,l++){var c=a[l],h=a[u],f=c[1]*h[0]-h[1]*c[0];r+=(c[0]+h[0])*f,n+=(c[1]+h[1])*f,o+=3*f}var d=[r/o,n/o];return t&&(d[0]+=i[0],d[1]+=i[1]),d}},Yr.multiCentroid=function(e){for(var t=e.length,i=[0,0],r=0;r<e.length;r++){var n=Yr.centroid(e[r]);i[0]+=n[0],i[1]+=n[1]}return i[0]/=t,i[1]/=t,i},Yr.signedPolygonRingAreaSum=function(e){for(var t=0,i=e.length,r=0;r<i-1;r++){var n=e[r],o=e[r+1];t+=n[0]*o[1]-o[0]*n[1]}return t+=e[i-1][0]*e[0][1]-e[0][0]*e[i-1][1]},Yr.polygonRingArea=function(e){return Math.abs(Yr.signedPolygonRingAreaSum(e))/2},Yr.polygonArea=function(e){if(e)return Yr.polygonRingArea(e[0])},Yr.multiPolygonArea=function(e){for(var t=0,i=0;i<e.length;i++)t+=Yr.polygonArea(e[i]);return t},Yr.ringWinding=function(e){var t=Yr.signedPolygonRingAreaSum(e);return 0<t?"CW":t<0?"CCW":void 0};var tn,rn=function(){function i(e){var t;return mr(this,i),(t=Mr(this,Ar(i).call(this))).name="MethodNotImplemented",t.message="Method "+e+" must be implemented in subclass",t}return br(i,kr(Error)),i}();function nn(r,n,o){var a,s;return o=o||0,function(){var e=this,t=arguments;function i(){s=0,r.apply(e,t)}clearTimeout(a),s&&o&&Date.now()-s>=o?i():(s||(s=Date.now()),a=setTimeout(function(){i()},n))}}var on=tn={};Cr.addTarget("Utils",tn),tn.isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},tn.isMicrosoft=function(){return/(Trident\/7.0|Edge[ /](\d+[\.\d]+))/i.test(navigator.userAgent)},tn._requests={},tn._proxy_requests={},tn.io=function(i){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:6e4,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"text",o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"GET",e=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},t=5<arguments.length&&void 0!==arguments[5]?arguments[5]:null,a=6<arguments.length&&void 0!==arguments[6]&&arguments[6];if(Lr.is_worker&&tn.isMicrosoft())return Kr("debug","Proxying request for URL to worker",i),t&&(tn._proxy_requests[t]=!0),Cr.postMessage("Utils.io",i,r,n,o,e,t,!0);var s=new XMLHttpRequest,l=new Promise(function(e,t){s.open(o,i,!0),s.timeout=r,s.responseType=n,s.onload=function(){200===s.status?-1<["text","json"].indexOf(s.responseType)?e(s.responseText):e(s.response):t(Error("Request error with a status of "+s.statusText))},s.onerror=function(e){t(Error("There was a network error"+e.toString()))},s.ontimeout=function(e){t(Error("timeout "+e.toString()))},s.send()});return l=l.then(function(e){return t&&delete tn._requests[t],a?Cr.withTransferables(e):e}),t&&(tn._requests[t]=s),l},tn.cancelRequest=function(e){if(Lr.is_worker&&tn._proxy_requests[e])return Cr.postMessage("Utils.cancelRequest",e);tn._requests[e]?(Kr("trace","Cancelling network request key '".concat(e,"'")),tn._requests[e].abort(),delete tn._requests[e]):Kr("trace","Could not find network request key '".concat(e,"'"))},tn.requestAnimationFramePolyfill=function(){"function"!=typeof window.requestAnimationFrame&&(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)})},tn.serializeWithFunctions=function(e){return"function"==typeof e?e.toString():JSON.stringify(e,function(e,t){return"function"==typeof t?t.toString():t})},tn.stringsToFunctions=function(e,t){if("string"==typeof e)e=tn.stringToFunction(e,t);else if(null!=e&&"object"===vr(e))for(var i in e)e[i]=tn.stringsToFunctions(e[i],t);return e},tn._use_count=0,tn._function_cache={};var an,sn,ln=nn(function(){Kr("trace","Cleared cached ".concat(Object.keys(tn._function_cache).length," functions (reused ").concat(tn._use_count," times)")),tn._use_count=0,tn._function_cache={}},1e4),un=/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m;function cn(e){if("string"!=typeof e||-1!==e.search(/^(data|blob):/))return"";var t=e.indexOf("?");-1<t&&(e=e.substr(0,t));var i=e.indexOf("#");return-1<i&&(e=e.substr(0,i)),e.substr(0,e.lastIndexOf("/")+1)||""}function hn(e){if("string"==typeof e)return!(-1<e.search(/^(http|https|data|blob):/)||"//"===e.substr(0,2))}function fn(e){return void 0===an&&"function"!=typeof(an=window.URL&&window.URL.createObjectURL||window.webkitURL&&window.webkitURL.createObjectURL)&&(an=null,Kr("warn","window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs")),an?an(e):e}function dn(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))}tn.stringToFunction=function(t,e){var i=t;e&&(i+=e.toString());var r=tn._function_cache[i];if(ln(),r)return tn._use_count++,r;var n="string"==typeof t&&t.match(un);if(n&&2<n.length)try{var o=n[2],a=0<n[1].length&&n[1].split(",").map(function(e){return e.trim()}).filter(function(e){return e});a=0<a.length?a:["context"];var s=new Function(a.toString(),"function"==typeof e?e(o):o);return tn._function_cache[i]=s}catch(e){return t}return t},tn.device_pixel_ratio=1,tn.isPowerOf2=function(e){return 0==(e&e-1)},tn.getNextPowerOf2=function(e){if(e<=0)return 0;if(1===e)return 1;var t=2;for(e--;e>>=1;)t<<=1;return t},tn.interpolate=function(e,t,i){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var r,n,o,a,s;if(e<=t[0][0])a=t[0][1],"function"==typeof i&&(a=i(a));else if(e>=t[t.length-1][0])a=t[t.length-1][1],"function"==typeof i&&(a=i(a));else for(var l=0;l<t.length-1;l++)if(e>=t[l][0]&&e<t[l+1][0]){if(r=t[l][0],n=t[l+1][0],Array.isArray(t[l][1])){a=[];for(var u=0;u<t[l][1].length;u++)"function"==typeof i?(s=i(t[l][1][u]),o=i(t[l+1][1][u])-s,a[u]=o*(e-r)/(n-r)+s):(o=t[l+1][1][u]-t[l][1][u],a[u]=o*(e-r)/(n-r)+t[l][1][u])}else a="function"==typeof i?(s=i(t[l][1]),(o=i(t[l+1][1])-s)*(e-r)/(n-r)+s):(o=t[l+1][1]-t[l][1])*(e-r)/(n-r)+t[l][1];break}return a},tn.toCSSColor=function(e){return 1===e[3]?"rgb(".concat(e.slice(0,3).map(function(e){return Math.round(255*e)}).join(", "),")"):"rgba(".concat(e.map(function(e,t){return t<3&&Math.round(255*e)||e}).join(", "),")")},tn.pointInTile=function(e){return 0<=e[0]&&e[1]>-Jr.tile_scale&&e[0]<Jr.tile_scale&&e[1]<=0},tn.zoomToTileLevel=function(e){return Math.floor(e)};var _n=function(){function u(e,t){var i=this;mr(this,u),this.config=e,this.sources=t,this.id=e.id,this.name=e.name,this.pad_scale=e.pad_scale||1e-4,this.default_winding=null,this.rasters=[],Array.isArray(e.rasters)&&e.rasters.forEach(function(e){-1===i.rasters.indexOf(e)&&i.rasters.push(e)}),this.preprocess=e.preprocess,"function"==typeof this.preprocess&&this.preprocess.bind(this),this.transform=e.transform,"function"==typeof this.transform&&this.transform.bind(this),this.extra_data=e.extra_data,this.scripts=e.scripts,this.max_zoom=null!=e.max_zoom?e.max_zoom:Jr.default_source_max_zoom,this.setTileSize(e.tile_size),this.max_coord_zoom=this.max_zoom+this.zoom_bias,this.min_display_zoom=null!=e.min_display_zoom?e.min_display_zoom:0,this.max_display_zoom=null!=e.max_display_zoom?e.max_display_zoom:null,this._has_volatile_data=!!e.has_volatile_data}return yr(u,[{key:"load",value:function(e){var r=this;e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=Pr(this.rasters);return this._load(e,function(e){for(var t in e.source_data.layers){var i=e.source_data.layers[t];i&&i.features&&i.features.forEach(function(e){Jr.transformGeometry(e.geometry,function(e){e[1]=-e[1],r.pad_scale&&(e[0]=Math.round(e[0]*(1+r.pad_scale)-Jr.tile_scale*r.pad_scale/2),e[1]=Math.round(e[1]*(1+r.pad_scale)-Jr.tile_scale*r.pad_scale/2))}),r.updateDefaultWinding(e.geometry)})}return e.default_winding=r.default_winding||"CCW",e})}},{key:"_load",value:function(e,t){throw new rn("_load")}},{key:"setTileSize",value:function(e){this.tile_size=e||256,("number"!=typeof this.tile_size||this.tile_size<256||!on.isPowerOf2(this.tile_size))&&(Kr({level:"warn",once:!0},"Data source '".concat(this.name,"': 'tile_size' parameter must be a number that is a power of 2 greater than or equal to 256, but was '").concat(e,"'")),this.tile_size=256),this.zoom_bias=Math.log2(this.tile_size)-8}},{key:"updateDefaultWinding",value:function(e){return null==this.default_winding&&("Polygon"===e.type?this.default_winding=Jr.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=Jr.ringWinding(e.coordinates[0][0]))),this.default_winding}},{key:"includesTile",value:function(e,t){if(e.z<this.min_display_zoom||null!=this.max_display_zoom&&t>this.max_display_zoom)return!1;for(var i=0;i<this.rasters.length;i++){var r=this.rasters[i];if(this.sources[r]&&this.sources[r]!==this&&!this.sources[r].includesTile(e,e.z))return!1}return!0}},{key:"has_volatile_data",get:function(){return this._has_volatile_data},set:function(e){var t=0<arguments.length&&void 0!==e&&e;this._has_volatile_data=t}}],[{key:"create",value:function(e,t){for(var i in t)if(!u.changed(t[i],{config:e}))return t[i];if(u.types[e.type])return new u.types[e.type](e,t)}},{key:"changed",value:function(e,t){if(!e||!t)return!0;var i=Object.assign({},e.config,{id:null}),r=Object.assign({},t.config,{id:null});return JSON.stringify(i)!==JSON.stringify(r)}},{key:"coordsToMeters",value:function(e){var t=Sr(Jr.latLngToMeters(e),2),i=t[0],r=t[1];e[0]=i,e[1]=r}},{key:"projectData",value:function(e){for(var t in e.layers)for(var i=e.layers[t].features.length,r=0;r<i;r++){var n=e.layers[t].features[r];Jr.transformGeometry(n.geometry,u.coordsToMeters)}}},{key:"metersToTileUnits",value:function(e,t,i){i[0]=Math.round((i[0]-t.x)*e),i[1]=-1*Math.round((i[1]-t.y)*e)}},{key:"scaleData",value:function(e,t){var i=t.coords.z,r=t.min,n=(t.max,u.metersToTileUnits.bind(this,Jr.unitsPerMeter(i),r));for(var o in e.layers)for(var a=e.layers[o].features.length,s=0;s<a;s++){var l=e.layers[o].features[s];Jr.transformGeometry(l.geometry,n)}}},{key:"register",value:function(e,t){e&&t&&(u.types[t]=e)}}]),u}();_n.types={};var pn=0,vn=function(){function a(n,e){var o;mr(this,a),(o=Mr(this,Ar(a).call(this,n,e))).response_type="";var t=Sr(function(e,t){if(!t||0===Object.keys(t).length)return[e,[]];var i=e.indexOf("?"),r=e.indexOf("#"),n="";-1<r&&(n=e.slice(r),e=e.slice(0,r)),-1===i&&(i=e.length,e+="?"),i++;var o="",a=[];for(var s in t)""===dn(s,e)?o+="".concat(s,"=").concat(t[s],"&"):a.push([s,t[s]]);return[e=e.slice(0,i)+o+e.slice(i)+n,a]}(n.url,n.url_params),2),i=t[0],r=t[1];if(o.url=i,r.forEach(function(e){var t=Sr(e,2),i=t[0],r=t[1];Kr({level:"warn",once:!0},"Data source '".concat(o.name,"': parameter '").concat(i,"' already present in URL '").concat(n.url,"', ")+"skipping value '".concat(i,"=").concat(r,"' specified in 'url_params'"))}),"string"!=typeof o.url)throw Error("Network data source must provide a string `url` property");return o}return br(a,_n),yr(a,[{key:"_load",value:function(n,o){var a=this,s=this.formatUrl(this.url,n),l=n.source_data;return l.url=s,new Promise(function(t,e){l.error=null;var i=pn+++"-"+s,r=on.io(s,6e4,a.response_type,"GET",{},i);l.request_id=i,r.then(function(e){"function"==typeof a.preprocess&&(e=a.preprocess(e)),(e=e instanceof Promise?e:Promise.resolve(e)).then(function(e){a.parseSourceData(n,l,e),o(n),t(n)})},function(e){l.error=e.stack,o(n),t(n)})})}},{key:"formatUrl",value:function(e,t){throw new rn("formatUrl")}},{key:"parseSourceData",value:function(e,t,i){throw new rn("parseSourceData")}}]),a}(),mn=function(){function r(e,t){var i;return mr(this,r),(i=Mr(this,Ar(r).call(this,e,t))).tiled=!0,i.parseBounds(e),i.builds_geometry_tiles=!1,i.tms=!0===e.tms,-1<i.url.search("{s}")&&(Array.isArray(e.url_subdomains)&&0<e.url_subdomains.length?(i.url_subdomains=e.url_subdomains,i.next_url_subdomain=0):Kr({level:"warn",once:!0},"Data source '".concat(i.name,"': source URL includes '{s}' subdomain marker ('").concat(i.url,"'), but no subdomains ")+"were specified in 'url_subdomains' parameter")),i}return br(r,vn),yr(r,[{key:"parseBounds",value:function(e){if(Array.isArray(e.bounds)&&4===e.bounds.length){this.bounds=e.bounds;var t=Sr(this.bounds,4),i=t[0],r=t[1],n=t[2],o=t[3];this.bounds_meters={min:Jr.latLngToMeters([i,o]),max:Jr.latLngToMeters([n,r])},this.bounds_tiles={min:{},max:{}}}}},{key:"checkBounds",value:function(e){if(this.bounds){e=Jr.wrapTile(e,{x:!0});var t=this.bounds_tiles.min[e.z];t||(t=this.bounds_tiles.min[e.z]=Jr.tileForMeters(this.bounds_meters.min,e.z));var i=this.bounds_tiles.max[e.z];if(i||(i=this.bounds_tiles.max[e.z]=Jr.tileForMeters(this.bounds_meters.max,e.z)),e.x<t.x||e.x>i.x||e.y<t.y||e.y>i.y)return!1}return!0}},{key:"includesTile",value:function(e,t){return!!Rr(Ar(r.prototype),"includesTile",this).call(this,e,t)&&!!this.checkBounds(e)}},{key:"formatUrl",value:function(e,t){var i=Jr.wrapTile(t.coords,{x:!0});this.tms&&(i.y=Math.pow(2,i.z)-1-i.y);var r=e.replace("{x}",i.x).replace("{y}",i.y).replace("{z}",i.z);return null!=this.url_subdomains&&(r=r.replace("{s}",this.url_subdomains[this.next_url_subdomain]),this.next_url_subdomain=(this.next_url_subdomain+1)%this.url_subdomains.length),r}},{key:"urlHasTilePattern",value:function(e){return e&&-1<e.search("{x}")&&-1<e.search("{y}")&&-1<e.search("{z}")}}]),r}(),gn=yn;function yn(e,t){this.x=e,this.y=t}yn.prototype={clone:function(){return new yn(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=t*this.x-i*this.y,n=i*this.x+t*this.y;return this.x=r,this.y=n,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.x+i*(this.x-t.x)-r*(this.y-t.y),o=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=n,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},yn.convert=function(e){return e instanceof yn?e:Array.isArray(e)?new yn(e[0],e[1]):e};var xn=bn;function bn(e,t,i,r,n){this.properties={},this.extent=i,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=n,e.readFields(An,this,t)}function An(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){var i=e.readVarint()+e.pos;for(;e.pos<i;){var r=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[r]=n}}(i,t):3==e?t.type=i.readVarint():4==e&&(t._geometry=i.pos)}function Tn(e){for(var t,i,r=0,n=0,o=e.length,a=o-1;n<o;a=n++)t=e[n],r+=((i=e[a]).x-t.x)*(t.y+i.y);return r}bn.types=["Unknown","Point","LineString","Polygon"],bn.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,i=e.readVarint()+e.pos,r=1,n=0,o=0,a=0,s=[];e.pos<i;){if(!n){var l=e.readVarint();r=7&l,n=l>>3}if(n--,1===r||2===r)o+=e.readSVarint(),a+=e.readSVarint(),1===r&&(t&&s.push(t),t=[]),t.push(new gn(o,a));else{if(7!==r)throw new Error("unknown command "+r);t&&t.push(t[0].clone())}}return t&&s.push(t),s},bn.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;e.pos<t;){if(!r){var c=e.readVarint();i=7&c,r=c>>3}if(r--,1===i||2===i)(n+=e.readSVarint())<a&&(a=n),s<n&&(s=n),(o+=e.readSVarint())<l&&(l=o),u<o&&(u=o);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,u]},bn.prototype.toGeoJSON=function(e,t,i){var r,n,o=this.extent*Math.pow(2,i),a=this.extent*e,s=this.extent*t,l=this.loadGeometry(),u=bn.types[this.type];function c(e){for(var t=0;t<e.length;t++){var i=e[t],r=180-360*(i.y+s)/o;e[t]=[360*(i.x+a)/o-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(r=0;r<l.length;r++)h[r]=l[r][0];c(l=h);break;case 2:for(r=0;r<l.length;r++)c(l[r]);break;case 3:for(l=function(e){var t=e.length;if(t<=1)return[e];for(var i,r,n=[],o=0;o<t;o++){var a=Tn(e[o]);0!==a&&(void 0===r&&(r=a<0),r===a<0?(i&&n.push(i),i=[e[o]]):i.push(e[o]))}i&&n.push(i);return n}(l),r=0;r<l.length;r++)for(n=0;n<l[r].length;n++)c(l[r][n])}1===l.length?l=l[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(f.id=this.id),f};var wn=kn;function kn(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(En,this,t),this.length=this._features.length}function En(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){var t=null,i=e.readVarint()+e.pos;for(;e.pos<i;){var r=e.readVarint()>>3;t=1==r?e.readString():2==r?e.readFloat():3==r?e.readDouble():4==r?e.readVarint64():5==r?e.readVarint():6==r?e.readSVarint():7==r?e.readBoolean():null}return t}(i))}function Mn(e,t,i){if(3===e){var r=new wn(i,i.readVarint()+i.pos);r.length&&(t[r.name]=r)}}kn.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new xn(this._pbf,t,this.extent,this._keys,this._values)};var Rn=function(e,t){this.layers=e.readFields(Mn,{},t)},Sn=xn;Sn.prototype.loadGeometry=function(e){var t=this._pbf;t.pos=this._geometry;for(var i,r=t.readVarint()+t.pos,n=1,o=0,a=0,s=0,l=[];t.pos<r;){if(o<=0){var u=t.readVarint();n=7&u,o=u>>3}if(o--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(i&&l.push(i),i=[]),i.push([a*e,s*e]);else{if(7!==n)throw new Error("unknown command "+n);i&&i.push(i[0].slice())}}return i&&l.push(i),l};var Pn={UNKNOWN:0,POINT:1,LINESTRING:2,POLYGON:3};function zn(e){var t=[],i=e&&e.features;if(i)for(var r=0,n=i.length;r<n;r++){var o=i[r],a=o.type,s=void 0;switch(a){case Pn.POINT:s={type:"MultiPoint",coordinates:o.geometry.map(function(e){return e.slice()})};break;case Pn.LINESTRING:case Pn.POLYGON:if(s={type:"MultiLineString",coordinates:o.geometry.map(function(e){return e.map(function(e){return e.slice()})})},a===Pn.POLYGON&&null==(s=Nn(s)))continue;break;default:continue}t.push({id:o.id,type:"Feature",geometry:s,properties:o.tags})}return{type:"FeatureCollection",features:t}}function Nn(e){for(var t,i=[],r=[],n=0,o=e.coordinates.length;n<o;n++){var a=e.coordinates[n],s=Jr.ringWinding(a);null!=s&&(s===(t=t||s)&&r.length&&(i.push(r),r=[]),r.push(a))}return 0<r.length&&i.push(r),1===i.length?(e.type="Polygon",e.coordinates=i[0]):1<i.length?(e.type="MultiPolygon",e.coordinates=i):e=null,e}function On(e,t,i,r,n,o){var a=n-i,s=o-r;if(0!==a||0!==s){var l=((e-i)*a+(t-r)*s)/(a*a+s*s);1<l?(i=n,r=o):0<l&&(i+=a*l,r+=s*l)}return(a=e-i)*a+(s=t-r)*s}function In(e,t,i,r){var n={id:void 0===e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)Ln(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<t.length;r++)Ln(e,t[r]);else if("MultiPolygon"===i)for(r=0;r<t.length;r++)for(var n=0;n<t[r].length;n++)Ln(e,t[r][n])}(n),n}function Ln(e,t){for(var i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function Cn(e,t,i,r){if(t.geometry){var n=t.geometry.coordinates,o=t.geometry.type,a=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),s=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===o)Fn(n,s);else if("MultiPoint"===o)for(var u=0;u<n.length;u++)Fn(n[u],s);else if("LineString"===o)Dn(n,s,a,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(u=0;u<n.length;u++)s=[],Dn(n[u],s,a,!1),e.push(In(l,"LineString",s,t.properties));return}jn(n,s,a,!1)}else if("Polygon"===o)jn(n,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"!==o)throw new Error("Input data is not a valid GeoJSON object.");for(u=0;u<t.geometry.geometries.length;u++)Cn(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},i,r);return}for(u=0;u<n.length;u++){var c=[];jn(n[u],c,a,!0),s.push(c)}}e.push(In(l,o,s,t.properties))}}function Fn(e,t){t.push(Un(e[0])),t.push(Gn(e[1])),t.push(0)}function Dn(e,t,i,r){for(var n,o,a=0,s=0;s<e.length;s++){var l=Un(e[s][0]),u=Gn(e[s][1]);t.push(l),t.push(u),t.push(0),0<s&&(a+=r?(n*u-l*o)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-o,2))),n=l,o=u}var c=t.length-3;t[2]=1,function e(t,i,r,n){for(var o,a=n,s=r-i>>1,l=r-i,u=t[i],c=t[i+1],h=t[r],f=t[r+1],d=i+3;d<r;d+=3){var _=On(t[d],t[d+1],u,c,h,f);if(a<_)o=d,a=_;else if(_===a){var p=Math.abs(d-s);p<l&&(o=d,l=p)}}n<a&&(3<o-i&&e(t,i,o,n),t[o+2]=a,3<r-o&&e(t,o,r,n))}(t,0,c,i),t[2+c]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function jn(e,t,i,r){for(var n=0;n<e.length;n++){var o=[];Dn(e[n],o,i,r),t.push(o)}}function Un(e){return e/360+.5}function Gn(e){var t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:1<i?1:i}function Bn(e,t,i,r,n,o,a,s){if(r/=t,(i/=t)<=o&&a<r)return e;if(a<i||r<=o)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],h=c.geometry,f=c.type,d=0===n?c.minX:c.minY,_=0===n?c.maxX:c.maxY;if(i<=d&&_<r)l.push(c);else if(!(_<i||r<=d)){var p=[];if("Point"===f||"MultiPoint"===f)Vn(h,p,i,r,n);else if("LineString"===f)qn(h,p,i,r,n,!1,s.lineMetrics);else if("MultiLineString"===f)Yn(h,p,i,r,n,!1);else if("Polygon"===f)Yn(h,p,i,r,n,!0);else if("MultiPolygon"===f)for(var v=0;v<h.length;v++){var m=[];Yn(h[v],m,i,r,n,!0),m.length&&p.push(m)}if(p.length){if(s.lineMetrics&&"LineString"===f){for(v=0;v<p.length;v++)l.push(In(c.id,f,p[v],c.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===p.length?(f="LineString",p=p[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===p.length?"Point":"MultiPoint"),l.push(In(c.id,f,p,c.tags))}}}return l.length?l:null}function Vn(e,t,i,r,n){for(var o=0;o<e.length;o+=3){var a=e[o+n];i<=a&&a<=r&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function qn(e,t,i,r,n,o,a){for(var s,l,u=Hn(e),c=0===n?Xn:Zn,h=e.start,f=0;f<e.length-3;f+=3){var d=e[f],_=e[f+1],p=e[f+2],v=e[f+3],m=e[f+4],g=0===n?d:_,y=0===n?v:m,x=!1;a&&(s=Math.sqrt(Math.pow(d-v,2)+Math.pow(_-m,2))),g<i?i<y&&(l=c(u,d,_,v,m,i),a&&(u.start=h+s*l)):r<g?y<r&&(l=c(u,d,_,v,m,r),a&&(u.start=h+s*l)):Wn(u,d,_,p),y<i&&i<=g&&(l=c(u,d,_,v,m,i),x=!0),r<y&&g<=r&&(l=c(u,d,_,v,m,r),x=!0),!o&&x&&(a&&(u.end=h+s*l),t.push(u),u=Hn(e)),a&&(h+=s)}var b=e.length-3;d=e[b],_=e[b+1],p=e[b+2],i<=(g=0===n?d:_)&&g<=r&&Wn(u,d,_,p),b=u.length-3,o&&3<=b&&(u[b]!==u[0]||u[b+1]!==u[1])&&Wn(u,u[0],u[1],u[2]),u.length&&t.push(u)}function Hn(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Yn(e,t,i,r,n,o){for(var a=0;a<e.length;a++)qn(e[a],t,i,r,n,o,!1)}function Wn(e,t,i,r){e.push(t),e.push(i),e.push(r)}function Xn(e,t,i,r,n,o){var a=(o-t)/(r-t);return e.push(o),e.push(i+(n-i)*a),e.push(1),a}function Zn(e,t,i,r,n,o){var a=(o-i)/(n-i);return e.push(t+(r-t)*a),e.push(o),e.push(1),a}function Kn(e,t){for(var i=[],r=0;r<e.length;r++){var n,o=e[r],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)n=Jn(o.geometry,t);else if("MultiLineString"===a||"Polygon"===a){n=[];for(var s=0;s<o.geometry.length;s++)n.push(Jn(o.geometry[s],t))}else if("MultiPolygon"===a)for(n=[],s=0;s<o.geometry.length;s++){for(var l=[],u=0;u<o.geometry[s].length;u++)l.push(Jn(o.geometry[s][u],t));n.push(l)}i.push(In(o.id,a,n,o.tags))}return i}function Jn(e,t){var i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(var r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function $n(e,t){if(e.transformed)return e;var i,r,n,o=1<<e.z,a=e.x,s=e.y;for(i=0;i<e.features.length;i++){var l=e.features[i],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(r=0;r<u.length;r+=2)l.geometry.push(Qn(u[r],u[r+1],t,o,a,s));else for(r=0;r<u.length;r++){var h=[];for(n=0;n<u[r].length;n+=2)h.push(Qn(u[r][n],u[r][n+1],t,o,a,s));l.geometry.push(h)}}return e.transformed=!0,e}function Qn(e,t,i,r,n,o){return[Math.round(i*(e*r-n)),Math.round(i*(t*r-o))]}function eo(e,t,i,r,n){for(var o=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<e.length;s++){a.numFeatures++,to(a,e[s],o,n);var l=e[s].minX,u=e[s].minY,c=e[s].maxX,h=e[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function to(e,t,i,r){var n=t.geometry,o=t.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s<n.length;s+=3)a.push(n[s]),a.push(n[s+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)io(a,n,e,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<n.length;s++)io(a,n[s],e,i,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(var l=0;l<n.length;l++){var u=n[l];for(s=0;s<u.length;s++)io(a,u[s],e,i,!0,0===s)}if(a.length){var c=t.tags||null;if("LineString"===o&&r.lineMetrics){for(var h in c={},t.tags)c[h]=t.tags[h];c.mapbox_clip_start=n.start/n.size,c.mapbox_clip_end=n.end/n.size}var f={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==t.id&&(f.id=t.id),e.features.push(f)}}function io(e,t,i,r,n,o){var a=r*r;if(0<r&&t.size<(n?a:r))i.numPoints+=t.length/3;else{for(var s=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>a)&&(i.numSimplified++,s.push(t[l]),s.push(t[l+1])),i.numPoints++;n&&function(e,t){for(var i=0,r=0,n=e.length,o=n-2;r<n;o=r,r+=2)i+=(e[r]-e[o])*(e[r+1]+e[o+1]);if(0<i===t)for(r=0,n=e.length;r<n/2;r+=2){var a=e[r],s=e[r+1];e[r]=e[n-2-r],e[r+1]=e[n-1-r],e[n-2-r]=a,e[n-1-r]=s}}(s,o),e.push(s)}}function ro(e,t){return new no(e,t)}function no(e,t){var i=(t=this.options=function(e,t){for(var i in t)e[i]=t[i];return e}(Object.create(this.options),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||24<t.maxZoom)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var r=0;r<e.features.length;r++)Cn(i,e.features[r],t,r);else"Feature"===e.type?Cn(i,e,t):Cn(i,{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(r=function(e,t){var i=t.buffer/t.extent,r=e,n=Bn(e,1,-1-i,i,0,-1,2,t),o=Bn(e,1,1-i,2+i,0,-1,2,t);return(n||o)&&(r=Bn(e,1,-i,1+i,0,-1,2,t)||[],n&&(r=Kn(n,1).concat(r)),o&&(r=r.concat(Kn(o,-1)))),r}(r,t)).length&&this.splitTile(r,0,0,0),i&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function oo(e,t,i){return 32*((1<<e)*i+t)+e}no.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},no.prototype.splitTile=function(e,t,i,r,n,o,a){for(var s=[e,t,i,r],l=this.options,u=l.debug;s.length;){r=s.pop(),i=s.pop(),t=s.pop(),e=s.pop();var c=1<<t,h=oo(t,i,r),f=this.tiles[h];if(!f&&(1<u&&console.time("creation"),f=this.tiles[h]=eo(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),u)){1<u&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var d="z"+t;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(f.source=e,n){if(t===l.maxZoom||t===n)continue;var _=1<<n-t;if(i!==Math.floor(o/_)||r!==Math.floor(a/_))continue}else if(t===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue;if(f.source=null,0!==e.length){1<u&&console.time("clipping");var p,v,m,g,y,x,b=.5*l.buffer/l.extent,A=.5-b,T=.5+b,w=1+b;p=v=m=g=null,y=Bn(e,c,i-b,i+T,0,f.minX,f.maxX,l),x=Bn(e,c,i+A,i+w,0,f.minX,f.maxX,l),e=null,y&&(p=Bn(y,c,r-b,r+T,1,f.minY,f.maxY,l),v=Bn(y,c,r+A,r+w,1,f.minY,f.maxY,l),y=null),x&&(m=Bn(x,c,r-b,r+T,1,f.minY,f.maxY,l),g=Bn(x,c,r+A,r+w,1,f.minY,f.maxY,l),x=null),1<u&&console.timeEnd("clipping"),s.push(p||[],t+1,2*i,2*r),s.push(v||[],t+1,2*i,2*r+1),s.push(m||[],t+1,2*i+1,2*r),s.push(g||[],t+1,2*i+1,2*r+1)}}},no.prototype.getTile=function(e,t,i){var r=this.options,n=r.extent,o=r.debug;if(e<0||24<e)return null;var a=1<<e,s=oo(e,t=(t%a+a)%a,i);if(this.tiles[s])return $n(this.tiles[s],n);1<o&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var l,u=e,c=t,h=i;!l&&0<u;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[oo(u,c,h)];return l&&l.source?(1<o&&console.log("found parent tile z%d-%d-%d",u,c,h),1<o&&console.time("drilling down"),this.splitTile(l.source,u,c,h,e,t,i),1<o&&console.timeEnd("drilling down"),this.tiles[s]?$n(this.tiles[s],n):null):null};var ao=function(){function n(e,t){var i;return mr(this,n),(i=Mr(this,Ar(n).call(this,e,t))).load_data=null,i.tile_indexes={},i.max_zoom=Math.max(i.max_zoom||0,15),i.setTileSize(512),i.pad_scale=0,i}return br(n,vn),yr(n,[{key:"_load",value:function(t){var r=this;return this.load_data||(this.load_data=Rr(Ar(n.prototype),"_load",this).call(this,{source_data:{layers:{}}}).then(function(e){e.source_data.error&&Kr("warn","data source load error(s) for source '".concat(r.name,"', URL '").concat(r.url,"': ").concat(e.source_data.error));var t=e.source_data.layers;for(var i in t)r.tile_indexes[i]=ro(t[i],{maxZoom:r.max_zoom,tolerance:1.5,extent:Jr.tile_scale,buffer:1e-4});return r.loaded=!0,e})),this.load_data.then(function(){for(var e in r.tile_indexes)t.source_data.layers[e]=r.getTileFeatures(t,e);return t})}},{key:"getTileFeatures",value:function(e,t){var i,r=Jr.wrapTile(e.coords,{x:!0}),n=this.tile_indexes[t].getTile(r.z,r.x,r.y);if(n&&n.features){i={type:"FeatureCollection",features:[]};for(var o=0;o<n.features.length;o++){var a=n.features[o],s={type:"Feature",geometry:{},properties:a.tags};if(1===a.type)s.geometry.coordinates=a.geometry.map(function(e){return[e[0],e[1]]}),s.geometry.type="MultiPoint";else{if(2!==a.type&&3!==a.type)continue;if(s.geometry.coordinates=a.geometry.map(function(e){return e.map(function(e){return[e[0],e[1]]})}),2===a.type)s.geometry.type="MultiLineString";else if(s.geometry=Nn(s.geometry),null==s.geometry)continue}i.features.push(s)}}return i}},{key:"formatUrl",value:function(e){return this.url}},{key:"parseSourceData",value:function(e,t,i){var r="string"==typeof i?JSON.parse(i):i,n=this.getLayers(r);t.layers=this.preprocessLayers(n)}},{key:"preprocessLayers",value:function(e){for(var t in e){var i=e[t];i.features=this.preprocessFeatures(i.features)}return"function"==typeof this.transform&&(1===Object.keys(e).length&&e._default?e._default=this.transform(e._default,this.extra_data):e=this.transform(e,this.extra_data)),e}},{key:"preprocessFeatures",value:function(e){if(e=e.filter(function(e){return null!=e.geometry}),this.config.generate_label_centroids){var s=[],l={label_placement:!0};e.forEach(function(e){var t,i;switch(e.geometry.type){case"Polygon":i=lo(t=e.geometry.coordinates,e.properties,l),s.push(i);break;case"MultiPolygon":t=e.geometry.coordinates;for(var r=-1/0,n=0,o=0;o<t.length;o++){var a=Jr.polygonArea(t[o]);r<a&&(r=a,n=o)}i=lo(t[n],e.properties,l),s.push(i)}}),s=s.filter(function(e){return e}),Array.prototype.push.apply(e,s)}return e}},{key:"getLayers",value:function(e){return"Feature"===e.type?{_default:{type:"FeatureCollection",features:[e]}}:"FeatureCollection"===e.type?{_default:e}:e}}]),n}(),so=function(){function r(e,t){var i;return mr(this,r),(i=Mr(this,Ar(r).call(this,e,t))).urlHasTilePattern(i.url)?Mr(i,Er(i)):"GeoJSON"===e.type?Mr(i,new ao(e)):Mr(i,null)}return br(r,mn),yr(r,[{key:"parseSourceData",value:function(e,t,i){var r="string"==typeof i?JSON.parse(i):i;this.prepareGeoJSON(r,e,t)}},{key:"prepareGeoJSON",value:function(e,t,i){"function"==typeof this.transform&&(e=this.transform(e,this.extra_data)),i.layers=ao.prototype.getLayers(e);var r={coords:t.coords,min:Jr.metersForTile(Jr.wrapTile(t.coords,{x:!0}))};_n.projectData(i),_n.scaleData(i,r)}}]),r}();function lo(e,t,i){var r=Jr.centroid(e);if(r){var n={};return Object.assign(n,t,i),{type:"Feature",properties:n,geometry:{type:"Point",coordinates:r}}}}_n.register(so,"GeoJSON");var uo=function(){function r(e,t){var i;return mr(this,r),(i=Mr(this,Ar(r).call(this,e,t))).target_name="MapsJsSource"+e.uid,i.tiled=!!e.tiled,Cr.addTarget(i.target_name,Er(i)),Lr.is_worker&&Cr.postMessage(i.target_name+".onWorkerInitialized"),Lr.is_main&&(i._workers_left=0),i}return br(r,_n),yr(r,[{key:"initialize",value:function(e,t,i,r){this._main_initialized||(this.provider=e,this.worker=r,this._workers_left+=i,this._on_update=t,this._main_initialized=!0,this._onProviderUpdate=this._onProviderUpdate.bind(this),e.addEventListener("update",this._onProviderUpdate),this._isReady()&&this.onReady())}},{key:"onWorkerInitialized",value:function(){--this._workers_left,this._isReady()&&this.onReady()}},{key:"onReady",value:function(){}},{key:"_isReady",value:function(){return this._main_initialized&&!this._workers_left}},{key:"_onProviderUpdate",value:function(e){this._isReady()&&this.onProviderUpdate(e)}},{key:"onProviderUpdate",value:function(e){this.dispatchUpdate()}},{key:"dispatchUpdate",value:function(e){this._on_update(this.name,e)}},{key:"dispose",value:function(){Cr.removeTarget(this.target_name),this.provider.removeEventListener("update",this._onProviderUpdate)}},{key:"isVisible",value:function(e,t){return!0}}]),r}(),co=function(e,t,i,r,n){var o,a,s=8*n-r-1,l=(1<<s)-1,u=l>>1,c=-7,h=i?n-1:0,f=i?-1:1,d=e[t+h];for(h+=f,o=d&(1<<-c)-1,d>>=-c,c+=s;0<c;o=256*o+e[t+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;0<c;a=256*a+e[t+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=u}return(d?-1:1)*a*Math.pow(2,o-r)},ho=function(e,t,i,r,n,o){var a,s,l,u=8*o-n-1,c=(1<<u)-1,h=c>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,_=r?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),2<=(t+=1<=a+h?f/l:f*Math.pow(2,1-h))*l&&(a++,l/=2),c<=a+h?(s=0,a=c):1<=a+h?(s=(t*l-1)*Math.pow(2,n),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,n),a=0));8<=n;e[i+d]=255&s,d+=_,s/=256,n-=8);for(a=a<<n|s,u+=n;0<u;e[i+d]=255&a,d+=_,a/=256,u-=8);e[i+d-_]|=128*p},fo=_o;function _o(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}_o.Varint=0,_o.Fixed64=1,_o.Bytes=2,_o.Fixed32=5;var po=4294967296,vo=1/po;function mo(e){return e.type===_o.Bytes?e.readVarint()+e.pos:e.pos+1}function go(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function yo(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;e<=n;n--)i.buf[n+r]=i.buf[n]}function xo(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function bo(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function Ao(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function To(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function wo(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function ko(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function Eo(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function Mo(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function Ro(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function So(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function Po(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function zo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}_o.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,e(n,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=So(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=zo(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=So(this.buf,this.pos)+So(this.buf,this.pos+4)*po;return this.pos+=8,e},readSFixed64:function(){var e=So(this.buf,this.pos)+zo(this.buf,this.pos+4)*po;return this.pos+=8,e},readFloat:function(){var e=co(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=co(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(n=o[i.pos++],r=(112&n)>>4,n<128)return go(e,r,t);if(n=o[i.pos++],r|=(127&n)<<3,n<128)return go(e,r,t);if(n=o[i.pos++],r|=(127&n)<<10,n<128)return go(e,r,t);if(n=o[i.pos++],r|=(127&n)<<17,n<128)return go(e,r,t);if(n=o[i.pos++],r|=(127&n)<<24,n<128)return go(e,r,t);if(n=o[i.pos++],r|=(1&n)<<31,n<128)return go(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=function(e,t,i){var r="",n=t;for(;n<i;){var o,a,s,l=e[n],u=null,c=239<l?4:223<l?3:191<l?2:1;if(i<n+c)break;1===c?l<128&&(u=l):2===c?128==(192&(o=e[n+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(o=e[n+1],a=e[n+2],128==(192&o)&&128==(192&a)&&((u=(15&l)<<12|(63&o)<<6|63&a)<=2047||55296<=u&&u<=57343)&&(u=null)):4===c&&(o=e[n+1],a=e[n+2],s=e[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||1114112<=u)&&(u=null)),null===u?(u=65533,c=1):65535<u&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),n+=c}return r}(this.buf,this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){var i=mo(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=mo(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=mo(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=mo(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=mo(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=mo(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=mo(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=mo(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=mo(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===_o.Varint)for(;127<this.buf[this.pos++];);else if(t===_o.Bytes)this.pos=this.readVarint()+this.pos;else if(t===_o.Fixed32)this.pos+=4;else{if(t!==_o.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),Po(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Po(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Po(this.buf,-1&e,this.pos),Po(this.buf,Math.floor(e*vo),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Po(this.buf,-1&e,this.pos),Po(this.buf,Math.floor(e*vo),this.pos+4),this.pos+=8},writeVarint:function(e){268435455<(e=+e||0)||e<0?function(e,t){var i,r;0<=e?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:r=r+1|(i=0));if(0x10000000000000000<=e||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e}(i,0,t),function(e,t){var i=(7&e)<<4;if(t.buf[t.pos++]|=i|((e>>>=3)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;t.buf[t.pos++]=127&e}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(127<e?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(127<e?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(127<e?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,o=0;o<t.length;o++){if(55295<(r=t.charCodeAt(o))&&r<57344){if(!n){56319<r||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;128<=i&&yo(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),ho(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),ho(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;128<=r&&yo(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,_o.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){this.writeMessage(e,xo,t)},writePackedSVarint:function(e,t){this.writeMessage(e,bo,t)},writePackedBoolean:function(e,t){this.writeMessage(e,wo,t)},writePackedFloat:function(e,t){this.writeMessage(e,Ao,t)},writePackedDouble:function(e,t){this.writeMessage(e,To,t)},writePackedFixed32:function(e,t){this.writeMessage(e,ko,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,Eo,t)},writePackedFixed64:function(e,t){this.writeMessage(e,Mo,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,Ro,t)},writeBytesField:function(e,t){this.writeTag(e,_o.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,_o.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,_o.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,_o.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,_o.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,_o.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,_o.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,_o.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,_o.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,_o.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var No={type:"FeatureCollection",features:[]},Oo=function(){function e(){return mr(this,e),Mr(this,Ar(e).apply(this,arguments))}return br(e,uo),yr(e,[{key:"fetchTile",value:function(e,t,i){return this.provider?this.provider.requestTileAsPromise(e,t,i).then(function(e){return e.data}):Promise.resolve()}},{key:"_parseSourceData",value:function(e,t,i){var r=new Uint8Array(i),n=new fo(r);t.layers=function(e){var t={};for(var i in e.layers){for(var r=e.layers[i],n=[],o=Jr.tile_scale/r.extent,a=0,s=r.length;a<s;a++){var l,u=r.feature(a),c=Sn.types[u.type];l=u.loadGeometry(o);var h=null;switch(c){case"Point":h={type:c,coordinates:l[0][0]};break;case"LineString":h=1===l.length?{type:c,coordinates:l[0]}:{type:"MultiLineString",coordinates:l};break;case"Polygon":h=Nn({coordinates:l})}h&&h.coordinates&&n.push({type:"Feature",geometry:h,properties:u.properties})}t[i]={type:"FeatureCollection",features:n}}return t}(new Rn(n)),"function"==typeof this.transform&&(t.layers=this.transform(t.layers,this.extra_data))}},{key:"_load",value:function(t,i){var r=this,e=Jr.wrapTile(t.coords,{x:!0,y:!0}),n=e.x,o=e.y,a=e.z;return Cr.postMessage(this.target_name+".fetchTile",n,o,a).then(function(e){return e instanceof ArrayBuffer?r._parseSourceData(t,t.source_data,e):e?t.source_data.error=e:t.source_data.layers={_default:No},i(t),t})}},{key:"onReady",value:function(){this.dispatchUpdate()}}]),e}();_n.register(Oo,"MVT"),_n.register(Oo,"OMV");function Io(e){return Math.max(e,0)}function Lo(e){return isNaN(e)?0:e}function Co(e){return Array.isArray(e)?e.map(parseFloat).map(Lo):Lo(parseFloat(e))}function Fo(e){return Array.isArray(e)?e.map(Co).map(Io):Io(Co(e))}var Do=i(function(e,t){var d={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function _(e){return(e=Math.round(e))<0?0:255<e?255:e}function i(e){return e<0?0:1<e?1:e}function p(e){return"%"===e[e.length-1]?_(parseFloat(e)/100*255):_(parseInt(e))}function v(e){return"%"===e[e.length-1]?i(parseFloat(e)/100):i(parseFloat(e))}function m(e,t,i){return i<0?i+=1:1<i&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{t.parseCSSColor=function(e){var t,i=e.replace(/ /g,"").toLowerCase();if(i in d)return d[i].slice();if("#"===i[0])return 4===i.length?0<=(t=parseInt(i.substr(1),16))&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===i.length&&0<=(t=parseInt(i.substr(1),16))&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var r=i.indexOf("("),n=i.indexOf(")");if(-1!==r&&n+1===i.length){var o=i.substr(0,r),a=i.substr(r+1,n-(r+1)).split(","),s=1;switch(o){case"rgba":if(4!==a.length)return null;s=v(a.pop());case"rgb":return 3!==a.length?null:[p(a[0]),p(a[1]),p(a[2]),s];case"hsla":if(4!==a.length)return null;s=v(a.pop());case"hsl":if(3!==a.length)return null;var l=(parseFloat(a[0])%360+360)%360/360,u=v(a[1]),c=v(a[2]),h=c<=.5?c*(u+1):c+u-c*u,f=2*c-h;return[_(255*m(f,h,l+1/3)),_(255*m(f,h,l)),_(255*m(f,h,l-1/3)),s];default:return null}}return null}}catch(e){}}),jo=(Do.parseCSSColor,{});Object.assign(jo,{clampPositive:Io,noNaN:Lo,parseNumber:Co,parsePositiveNumber:Fo}),jo.wrapFunction=function(e){return"\n        var feature = context.feature.properties;\n        var global = context.global;\n        var $zoom = context.zoom;\n        var $layer = context.layer;\n        var $source = context.source;\n        var sources = context.sources;\n        var $geometry = context.geometry;\n        var $meters_per_pixel = context.meters_per_pixel;\n\n        var val = (function(){ ".concat(e," }());\n\n        if (typeof val === 'number' && isNaN(val)) {\n            val = null; // convert NaNs to nulls\n        }\n\n        return val;\n    ")},jo.zeroPair=Object.freeze([0,0]),jo.defaults={color:[1,1,1,1],width:1,size:1,extrude:!1,height:20,min_height:0,order:0,z:0,outline:{color:[0,0,0,0],width:0},material:{ambient:1,diffuse:1}},jo.macros={"Style.color.pseudoRandomColor":function(){return[parseInt(feature.id,16)/100%1*.7,parseInt(feature.id,16)/1e4%1*.7,parseInt(feature.id,16)/1e6%1*.7,1]},"Style.color.randomColor":function(){return[.7*Math.random(),.7*Math.random(),.7*Math.random(),1]}},jo.getFeatureParseContext=function(e,t,i,r){return{feature:e,tile:t,global:i,sources:r,zoom:t.style_zoom,geometry:Jr.geometryType(e.geometry.type),meters_per_pixel:t.meters_per_pixel,meters_per_pixel_sq:t.meters_per_pixel_sq,units_per_meter_overzoom:t.units_per_meter_overzoom}};var Uo={STATIC:0,DYNAMIC:1,ZOOM:2};jo.CACHE_TYPE=Uo,jo.createPropertyCache=function(e){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(null!=e){if(e.value)return{value:e.value,zoom:e.zoom?{}:null,type:e.type};var t={value:e,type:Uo.STATIC};return Array.isArray(t.value)&&Array.isArray(t.value[0])?(t.zoom={},t.type=Uo.ZOOM):"function"==typeof t.value&&(t.type=Uo.DYNAMIC),"function"==typeof i&&(t.zoom?t.value=t.value.map(function(e,t){return[e[0],i(e[1],t)]}):"function"!=typeof t.value&&(t.value=i(t.value,0))),t}},jo.createColorPropertyCache=function(e){return jo.createPropertyCache(e,function(e){return"Style.color.pseudoRandomColor"===e?on.stringToFunction(jo.wrapFunction(jo.macros["Style.color.pseudoRandomColor"])):"Style.color.randomColor"===e?jo.macros["Style.color.randomColor"]:e})};function Go(e){return"string"==typeof e&&"%"===e[e.length-1]}function Bo(e){return"auto"===e}function Vo(e){return Go(e)||Bo(e)}var qo="'size' can specify either width or height as derived from aspect ratio, but not both";jo.createPointSizePropertyCache=function(e){var t=null,i=null;if(Go(e))t=[!0];else if(Array.isArray(e))if(Array.isArray(e[0])){if(e.some(function(e){return Array.isArray(e[1])?e[1].some(function(e){return Vo(e)}):Go(e[1])})&&(t=e.map(function(e){return Array.isArray(e[1])?e[1].map(function(e){return Go(e)}):Go(e[1])}),(i=e.map(function(e){return Array.isArray(e[1])&&e[1].map(function(e){return Bo(e)})})).some(function(e){return Array.isArray(e)&&e.every(function(e){return e})})))throw qo}else if(e.some(Vo)&&(t=[e.map(Go)],(i=[e.map(Bo)])[0].every(function(e){return e})))throw qo;return t?((e={value:e}).has_pct=t,e.has_ratio=i,e.sprites={}):e=jo.createPropertyCache(e,Fo),e},jo.evalCachedPointSizeProperty=function(r,n,e){return r.has_pct||r.has_ratio?n?(r.sprites[n.sprite]||(r.sprites[n.sprite]=jo.createPropertyCache(r.value,function(t,i){return Array.isArray(t)?(t=t.map(function(e,t){return r.has_ratio[i][t]?e:Fo(e)}).map(function(e,t){return r.has_pct[i][t]?n.css_size[t]*e/100:e}),r.has_ratio[i][0]?t[0]=t[1]*n.aspect:r.has_ratio[i][1]&&(t[1]=t[0]/n.aspect)):(t=Fo(t),t=r.has_pct[i]?n.css_size.map(function(e){return e*t/100}):[t,t]),t})),jo.evalCachedProperty(r.sprites[n.sprite],e)):void 0:jo.evalCachedProperty(r,e)},jo.evalCachedProperty=function(e,t){if(null!=e)return e.dynamic?e.dynamic(t):e.static?e.static:e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"!=typeof e.value?Array.isArray(e.value)&&Array.isArray(e.value[0])?(e.zoom=e.zoom||{},e.zoom[t.zoom]=on.interpolate(t.zoom,e.value),e.zoom[t.zoom]):(e.static=e.value,e.static):(e.dynamic=e.value,e.dynamic(t))},jo.convertUnits=function(e,t){if(null!=e.val)return"px"===e.units?e.val*Jr.metersPerPixel(t.zoom):e.val;if("string"==typeof e)"px"===e.trim().slice(-2)?(e=Co(e),e*=Jr.metersPerPixel(t.zoom)):e=Co(e);else if(Array.isArray(e))return Array.isArray(e[0])?e.map(function(e){return[e[0],jo.convertUnits(e[1],t)]}):e.map(function(e){return jo.convertUnits(e,t)});return e},jo.parseUnits=function(e){var t={val:Co(e)};return 0!==t.val&&"string"==typeof e&&"px"===e.trim().slice(-2)&&(t.units="px"),t},jo.evalCachedDistanceProperty=function(e,t){return e.dynamic?e.dynamic(t):e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"!=typeof e.value?e.zoom?(e.zoom[t.zoom]=on.interpolate(t.zoom,e.value,function(e){return jo.convertUnits(e,t)}),e.zoom[t.zoom]):jo.convertUnits(e.value,t):(e.dynamic=e.value,e.dynamic(t))},jo.string_colors={},jo.colorForString=function(e){if(jo.string_colors[e])return jo.string_colors[e];var t=null;return"none"!==e&&((t=Do.parseCSSColor(e))&&4===t.length?(t[0]/=255,t[1]/=255,t[2]/=255):t=jo.defaults.color),jo.string_colors[e]=t},jo.evalCachedColorProperty=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(e.dynamic){var i=e.dynamic(t);return"string"==typeof i&&(i=jo.colorForString(i)),i&&null==i[3]&&(i[3]=1),i}if(e.static)return e.static;if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;var r=e.dynamic(t);return"string"==typeof r&&(r=jo.colorForString(r)),r&&null==r[3]&&(r[3]=1),r}if("string"==typeof e.value)return e.static=jo.colorForString(e.value),e.static;if(e.zoom){if(!e.zoom_preprocessed){for(var n=0;n<e.value.length;n++){var o=e.value[n];o&&"string"==typeof o[1]&&(o[1]=jo.colorForString(o[1]))}e.zoom_preprocessed=!0}return e.zoom[t.zoom]=on.interpolate(t.zoom,e.value),e.zoom[t.zoom][3]=e.zoom[t.zoom][3]||1,e.zoom[t.zoom]}return e.static=e.value.map(function(e){return e}),e.static&&null==e.static[3]&&(e.static[3]=1),e.static},jo.parseColor=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("function"==typeof e&&(e=e(t)),"string"==typeof e)e=jo.colorForString(e);else if(Array.isArray(e)&&Array.isArray(e[0])){for(var i=0;i<e.length;i++){var r=e[i];"string"==typeof r[1]&&(r[1]=jo.colorForString(r[1]))}t.zoom&&(e=on.interpolate(t.zoom,e))}return Array.isArray(e)?null==(e=e.map(function(e){return e}))[3]&&(e[3]=1):e=[0,0,0,1],e},jo.calculateOrder=function(e,t){return"function"==typeof e?e=e(t):"string"==typeof e&&(e=t.feature.properties[e]?t.feature.properties[e]:Fo(e)),e},jo.evalProperty=function(e,t){return"function"==typeof e?e(t):e};var Ho=function(){function r(e,t){mr(this,r),this.key=e,this.repeat_dist=t,this.repeat_dist_sq=this.repeat_dist*this.repeat_dist,this.positions=[]}return yr(r,[{key:"check",value:function(e){for(var t=e.position,i=0;i<this.positions.length;i++){var r=this.positions[i],n=t[0]-r[0],o=t[1]-r[1],a=n*n+o*o;if(a<this.repeat_dist_sq)return{dist_sq:a,repeat_dist_sq:this.repeat_dist_sq}}}},{key:"add",value:function(e){e&&e.position&&this.positions.push(e.position)}}],[{key:"clear",value:function(e){this.groups[e]={}}},{key:"check",value:function(e,t,i){if(t.repeat_distance&&t.repeat_group&&this.groups[i][t.repeat_group])return this.groups[i][t.repeat_group].check(e)}},{key:"add",value:function(e,t,i){t.repeat_distance&&t.repeat_group&&(null==this.groups[i][t.repeat_group]&&(this.groups[i][t.repeat_group]=new r(t.repeat_group,t.repeat_distance*t.repeat_scale)),this.groups[i][t.repeat_group].add(e))}}]),r}();Ho.groups={};var Yo=function(){function a(e,t,i){mr(this,a);var r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(var o=0;o<this.xCellCount*this.yCellCount;o++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}return yr(a,[{key:"keysLength",value:function(){return this.boxKeys.length+this.circleKeys.length}},{key:"insert",value:function(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}},{key:"insertCircle",value:function(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}},{key:"insertCircleList",value:function(e,t){for(var i=0;i<t.length-2;i+=3)this.insertCircle("".concat(e,"/").concat(i),t[i],t[i+1],t[i+2])}},{key:"_insertBoxCell",value:function(e,t,i,r,n,o){this.boxCells[n].push(o)}},{key:"_insertCircleCell",value:function(e,t,i,r,n,o){this.circleCells[n].push(o)}},{key:"_query",value:function(e,t,i,r,n,o){if(i<0||e>this.width||r<0||t>this.height)return!n&&[];var a=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return!0;for(var s=0;s<this.boxKeys.length;s++)a.push({key:this.boxKeys[s],x1:this.bboxes[4*s],y1:this.bboxes[4*s+1],x2:this.bboxes[4*s+2],y2:this.bboxes[4*s+3]});for(var l=0;l<this.circleKeys.length;l++){var u=this.circles[3*l],c=this.circles[3*l+1],h=this.circles[3*l+2];a.push({key:this.circleKeys[l],x1:u-h,y1:c-h,x2:u+h,y2:c+h})}return o?a.filter(o):a}var f={hitTest:n,seenUids:{box:{},circle:{}}};return this._forEachCell(e,t,i,r,this._queryCell,a,f,o),n?0<a.length:a}},{key:"_queryCircle",value:function(e,t,i,r,n){var o=e-i,a=e+i,s=t-i,l=t+i;if(a<0||o>this.width||l<0||s>this.height)return!r&&[];var u=[],c={hitTest:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(o,s,a,l,this._queryCellCircle,u,c,n),r?0<u.length:u}},{key:"query",value:function(e,t,i,r,n){return this._query(e,t,i,r,!1,n)}},{key:"hitTest",value:function(e,t,i,r,n){return this._query(e,t,i,r,!0,n)}},{key:"hitTestCircle",value:function(e,t,i,r){return this._queryCircle(e,t,i,!0,r)}},{key:"hitTestCircleList",value:function(e,t){for(var i=0;i<e.length-2;i+=3)if(this.hitTestCircle(e[i],e[i+1],e[i+2],t))return!0;return!1}},{key:"_queryCell",value:function(e,t,i,r,n,o,a,s){var l=a.seenUids,u=this.boxCells[n];if(null!==u){var c=this.bboxes,h=!0,f=!1,d=void 0;try{for(var _,p=u[Symbol.iterator]();!(h=(_=p.next()).done);h=!0){var v=_.value;if(!l.box[v]){l.box[v]=!0;var m=4*v;if(e<=c[2+m]&&t<=c[3+m]&&i>=c[0+m]&&r>=c[1+m]&&(!s||s(this.boxKeys[v]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[v],x1:c[m],y1:c[1+m],x2:c[2+m],y2:c[3+m]})}}}}catch(e){f=!0,d=e}finally{try{h||null==p.return||p.return()}finally{if(f)throw d}}}var g=this.circleCells[n];if(null!==g){var y=this.circles,x=!0,b=!1,A=void 0;try{for(var T,w=g[Symbol.iterator]();!(x=(T=w.next()).done);x=!0){var k=T.value;if(!l.circle[k]){l.circle[k]=!0;var E=3*k;if(this._circleAndRectCollide(y[E],y[1+E],y[2+E],e,t,i,r)&&(!s||s(this.circleKeys[k]))){if(a.hitTest)return o.push(!0),!0;var M=y[E],R=y[1+E],S=y[2+E];o.push({key:this.circleKeys[k],x1:M-S,y1:R-S,x2:M+S,y2:R+S})}}}}catch(e){b=!0,A=e}finally{try{x||null==w.return||w.return()}finally{if(b)throw A}}}}},{key:"_queryCellCircle",value:function(e,t,i,r,n,o,a,s){var l=a.circle,u=a.seenUids,c=this.boxCells[n];if(null!==c){var h=this.bboxes,f=!0,d=!1,_=void 0;try{for(var p,v=c[Symbol.iterator]();!(f=(p=v.next()).done);f=!0){var m=p.value;if(!u.box[m]){u.box[m]=!0;var g=4*m;if(this._circleAndRectCollide(l.x,l.y,l.radius,h[0+g],h[1+g],h[2+g],h[3+g])&&(!s||s(this.boxKeys[m])))return o.push(!0),!0}}}catch(e){d=!0,_=e}finally{try{f||null==v.return||v.return()}finally{if(d)throw _}}}var y=this.circleCells[n];if(null!==y){var x=this.circles,b=!0,A=!1,T=void 0;try{for(var w,k=y[Symbol.iterator]();!(b=(w=k.next()).done);b=!0){var E=w.value;if(!u.circle[E]){u.circle[E]=!0;var M=3*E;if(this._circlesCollide(x[M],x[1+M],x[2+M],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[E])))return o.push(!0),!0}}}catch(e){A=!0,T=e}finally{try{b||null==k.return||k.return()}finally{if(A)throw T}}}}},{key:"_forEachCell",value:function(e,t,i,r,n,o,a,s){for(var l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),c=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r),f=l;f<=c;f++)for(var d=u;d<=h;d++){var _=this.xCellCount*d+f;if(n.call(this,e,t,i,r,_,o,a,s))return}}},{key:"_convertToXCellCoord",value:function(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}},{key:"_convertToYCellCoord",value:function(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}},{key:"_circlesCollide",value:function(e,t,i,r,n,o){var a=r-e,s=n-t,l=i+o;return a*a+s*s<l*l}},{key:"_circleAndRectCollide",value:function(e,t,i,r,n,o,a){var s=(o-r)/2,l=Math.abs(e-(r+s));if(s+i<l)return!1;var u=(a-n)/2,c=Math.abs(t-(n+u));if(u+i<c)return!1;if(l<=s||c<=u)return!0;var h=l-s,f=c-u;return h*h+f*f<=i*i}}]),a}(),Wo=function(e,t,i,r){var n;if(r&&(n=function(e){return e!==r.id}),!t){if("point"===e.type&&!e.angle){var o=e.getAABB(),a=o.left,s=o.top,l=o.right,u=o.bottom;if(i.hitTest(a,-s,l,-u,n)){if(Array.isArray(e.layout.anchor))for(var c=1;c<e.layout.anchor.length;c++){e.setAnchor(e.layout.anchor[c]);var h=e.getAABB(),f=h.left,d=h.top,_=h.right,p=h.bottom;if(!i.hitTest(f,-d,_,-p,n))return!1}return!0}return!1}var v=e.getBoundingCircles();return i.hitTestCircleList(v,n)}if(t){if("point"===e.type&&!e.isFlat()){var m=e.getScreenSpaceBoundingBox(),g=m.left,y=m.top,x=m.right,b=m.bottom;return i.hitTest(g,y,x,b,n)}var A=e.getBoundingCircles();return i.hitTestCircleList(A,n)}return!1},Xo=function(e,t,i){var r=e.id;if(e.placed=!0,!t)if("point"!==e.type||e.angle){var n=e.getBoundingCircles();i.insertCircleList(r,n)}else{var o=e.getAABB(),a=o.left,s=o.top,l=o.right,u=o.bottom;i.insert(r,a,-s,l,-u)}if(t)if("point"!==e.type||e.isFlat()){var c=e.getBoundingCircles();i.insertCircleList(r,c)}else{var h=e.getScreenSpaceBoundingBox(),f=h.left,d=h.top,_=h.right,p=h.bottom;i.insert(r,f,d,_,p)}},Zo={tiles:{},startTile:function(e,t){var i=1<arguments.length&&void 0!==t?t:{},r=i.apply_repeat_groups,n=void 0===r||r,o=i.return_hidden,a=void 0!==o&&o,s=i.grid_index,l=void 0===s?null:s,u=this.tiles[e]={grid_index:l||new Yo(Jr.tile_scale,Jr.tile_scale,240),objects:{},labels:{},styles:{},repeat:n,return_hidden:a};null==u.complete&&(u.complete=new Promise(function(e,t){u.resolve=e,u.reject=t}))},resetTile:function(e){delete this.tiles[e]},abortTile:function(e){this.tiles[e]&&this.tiles[e].resolve&&this.tiles[e].resolve([]),this.resetTile(e)},addStyle:function(e,t){this.tiles[t].styles[e]=!0},collide:function(e,t,i){var r=this.tiles[i];if(!r)return Promise.resolve([]);for(var n=r.objects,o=0;o<e.length;o++){var a=e[o],s=a.label.layout.priority;n[s]=n[s]||{},n[s][t]=n[s][t]||[],n[s][t].push(a)}return delete r.styles[t],0===Object.keys(r.styles).length&&this.endTile(i),r.complete.then(function(){return r.resolve=null,r.labels[t]||[]})},endTile:function(e){var t=this.tiles[e],i=t.labels;t.repeat&&Ho.clear(e);for(var r=Object.keys(t.objects).sort(function(e,t){return e-t}),n=0;n<r.length;n++){var o=t.objects[r[n]];if(o)for(var a in o){var s=o[a];i[a]=i[a]||[];for(var l=0;l<s.length;l++){var u=s[l];this.canBePlaced(u,e,u.linked,t)?u.linked?this.canBePlaced(u.linked,e,u,t)?(u.show=!0,(u.label.breach||u.linked.label.breach)&&(u.label.breach=!0,u.linked.label.breach=!0),i[a].push(u),this.place(u,e,t),this.place(u.linked,e,t)):t.return_hidden&&(u.show=!1,i[a].push(u)):(u.show=!0,i[a].push(u),this.place(u,e,t)):t.return_hidden&&(u.show=!1,i[a].push(u))}}}delete this.tiles[e],t.resolve()},canBePlaced:function(e,t,i,r){var n=2<arguments.length&&void 0!==i?i:null,o=(3<arguments.length&&void 0!==r?r:{}).repeat,a=void 0===o||o,s=e.label,l=e.label.layout;if(null!==s.placed)return s.placed;var u=this.tiles[t].grid_index;if(l.collide&&Wo(s,"main"===t,u,n&&n.label))l.collide&&(s.placed=!1);else{if(!(a&&Ho.check(s,l,t)))return!0;s.placed=!1}return s.placed},place:function(e,t,i){var r=e.label,n=i.repeat,o=void 0===n||n;null===r.placed&&(o&&Ho.add(r,r.layout,t),Xo(r,"main"===t,this.tiles[t].grid_index))}},Ko={id:0,queue:[],max_time:20,start_time:null,state:{},add:function(i){i.id=Ko.id++,i.max_time=i.max_time||Ko.max_time,i.pause_factor=i.pause_factor||1;var e=new Promise(function(e,t){i.resolve=e,i.reject=t});return i.promise=e,i.total_elapsed=0,i.stats={calls:0},this.queue.push(i),this.start_time=this.start_time||performance.now(),this.elapsed=performance.now()-this.start_time,this.elapsed<Ko.max_time&&this.process(i),i.promise},remove:function(e){var t=this.queue.indexOf(e);-1<t&&this.queue.splice(t,1)},process:function(e){if(!this.state.user_moving_view||!1!==e.user_moving_view)return e.pause?(e.pause--,!0):(e.stats.calls++,e.start_time=performance.now(),e.run(e))},processAll:function(){this.start_time=this.start_time||performance.now();for(var e=0;e<this.queue.length;e++){var t=this.queue[e];if(!0!==this.process(t)&&(t.pause||(t.pause=t.elapsed>t.max_time?t.pause_factor:0),t.total_elapsed+=t.elapsed),this.elapsed=performance.now()-this.start_time,this.elapsed>=Ko.max_time){this.start_time=null;break}}},finish:function(e,t){return e.elapsed=performance.now()-e.start_time,e.total_elapsed+=e.elapsed,this.remove(e),e.resolve(t),e.promise},cancel:function(e){var t;e.cancel instanceof Function&&(t=e.cancel(e)),e.resolve(t||{})},shouldContinue:function(e){return e.elapsed=performance.now()-e.start_time,this.elapsed=performance.now()-this.start_time,e.elapsed<e.max_time&&this.elapsed<Ko.max_time},removeForTile:function(e){for(var t=this.queue.length-1;0<=t;t--)this.queue[t].tile_id===e&&(this.cancel(this.queue[t]),this.queue.splice(t,1))},setState:function(e){this.state=e}};function Jo(e){var n=[];return Object.assign(e,{subscribe:function(e){-1===n.indexOf(e)&&n.push(e)},unsubscribe:function(e){var t=n.indexOf(e);-1<t&&n.splice(t,1)},unsubscribeAll:function(){n=[]},trigger:function(t){for(var e=arguments.length,i=new Array(1<e?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];n.forEach(function(e){if("function"==typeof e[t])try{e[t].apply(e,i)}catch(e){Kr("warn","Caught exception in listener for event '".concat(t,"':"),e)}})},hasSubscribersFor:function(t){var i=!1;return n.forEach(function(e){"function"==typeof e[t]&&(i=!0)}),i}})}var $o=function(){function o(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};mr(this,o),i=o.sliceOptions(i),this.gl=e,this.texture=e.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=t,this.retain_count=0,this.config_type=null,this.loading=null,this.loaded=!1,this.filtering=i.filtering,this.density=i.density||1,this.sprites=i.sprites,this.texcoords={},this.sizes={},this.css_sizes={},this.aspects={},this.setData(1,1,new Uint8Array([0,0,0,0]),{filtering:"nearest"}),this.loaded=!1,o.textures[this.name]&&(this.retain_count=o.textures[this.name].retain_count,o.textures[this.name].retain_count=0,o.textures[this.name].destroy()),o.textures[this.name]=this,o.texture_configs[this.name]=JSON.stringify(Object.assign({name:t},i)),this.load(i),Kr("trace","creating Texture ".concat(this.name))}return yr(o,[{key:"destroy",value:function(e){var t=(0<arguments.length&&void 0!==e?e:{}).force;0<this.retain_count&&!t?Kr("error","Texture '".concat(this.name,"': destroying texture with retain count of '").concat(this.retain_count,"'")):this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,delete this.data,this.data=null,delete o.textures[this.name],delete o.texture_configs[this.name],this.valid=!1,Kr("trace","destroying Texture ".concat(this.name)))}},{key:"retain",value:function(){this.retain_count++}},{key:"release",value:function(){this.retain_count<=0&&Kr("error","Texture '".concat(this.name,"': releasing texture with retain count of '").concat(this.retain_count,"'")),this.retain_count--,this.retain_count<=0&&this.destroy()}},{key:"bind",value:function(e){var t=0<arguments.length&&void 0!==e?e:0;this.valid&&(o.activeUnit!==t&&(this.gl.activeTexture(this.gl.TEXTURE0+t),o.activeUnit=t,o.boundTexture=null),o.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),o.boundTexture=this.texture))}},{key:"load",value:function(e){var t=this;return e?(this.loading=null,"string"==typeof e.url?(this.config_type="url",this.setUrl(e.url,e)):e.element?(this.config_type="element",this.setElement(e.element,e)):e.data&&e.width&&e.height&&(this.config_type="data",this.setData(e.width,e.height,e.data,e)),this.loading=this.loading&&this.loading.then(function(){return t.calculateSprites(),t})||Promise.resolve(this),this.loading):this.loading||Promise.resolve(this)}},{key:"setUrl",value:function(e,t){var r=this,n=1<arguments.length&&void 0!==t?t:{};if(this.valid)return this.url=e,this.loading=new Promise(function(t,e){var i=new Image;i.onload=function(){try{r.setElement(i,n)}catch(e){r.loaded=!1,Kr("warn","Texture '".concat(r.name,"': failed to load url: '").concat(r.url,"'"),e,n),o.trigger("warning",{message:"Failed to load texture from ".concat(r.url),error:e,texture:n})}r.loaded=!0,t(r)},i.onerror=function(e){r.loaded=!1,Kr("warn","Texture '".concat(r.name,"': failed to load url: '").concat(r.url,"'"),e,n),o.trigger("warning",{message:"Failed to load texture from ".concat(r.url),error:e,texture:n}),t(r)},on.isSafari()&&"data:"===r.url.slice(0,5)||(i.crossOrigin="anonymous"),i.src=r.url}),this.loading}},{key:"setData",value:function(e,t,i,r){var n=3<arguments.length&&void 0!==r?r:{};return this.width=e,this.height=t,Array.isArray(i)&&(i=new Uint8Array(i)),this.update(i,n),this.setFiltering(n),this.loaded=!0,this.loading=Promise.resolve(this),this.loading}},{key:"setElement",value:function(e,t){var i=e;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement)this.update(e,t),this.setFiltering(t);else{this.loaded=!1;var r="the 'element' parameter (`element: ".concat(JSON.stringify(i),"`) must be a CSS ");r+="selector string, or a <canvas>, <image> or <video> object",Kr("warn","Texture '".concat(this.name,"': ").concat(r),t),o.trigger("warning",{message:"Failed to load texture because ".concat(r),texture:t})}return this.loaded=!0,this.loading=Promise.resolve(this),this.loading}},{key:"update",value:function(e,t){var i=1<arguments.length&&void 0!==t?t:{};this.valid&&(this.bind(),e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLImageElement&&e.complete?(this.width=e.width,this.height=e.height,this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1!==i.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)):(this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)),o.trigger("update",this))}},{key:"setFiltering",value:function(e){var t=0<arguments.length&&void 0!==e?e:{};if(this.valid){t.filtering=t.filtering||"linear";var i=this.gl;this.bind(),on.isPowerOf2(this.width)&&on.isPowerOf2(this.height)?(this.power_of_2=!0,i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t.TEXTURE_WRAP_S||t.repeat&&i.REPEAT||i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t.TEXTURE_WRAP_T||t.repeat&&i.REPEAT||i.CLAMP_TO_EDGE),"mipmap"===t.filtering?(this.filtering="mipmap",i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR_MIPMAP_LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.generateMipmap(i.TEXTURE_2D)):"linear"===t.filtering?(this.filtering="linear",i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR)):"nearest"===t.filtering&&(this.filtering="nearest",i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST))):(this.power_of_2=!1,i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),"nearest"===t.filtering?(this.filtering="nearest",i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST)):(this.filtering="linear",i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR))),o.trigger("update",this)}}},{key:"calculateSprites",value:function(){if(this.sprites)for(var e in this.sprites){var t=this.sprites[e];this.texcoords[e]=o.getTexcoordsForSprite([t[0],t[1]],[t[2],t[3]],[this.width,this.height]),this.sizes[e]=[t[2],t[3]],this.css_sizes[e]=[t[2]/this.density,t[3]/this.density],this.aspects[e]=t[2]/t[3]}}}]),o}();$o.matchers_=[],$o.register=function(e,t){var i=$o.matchers_;if(!(e instanceof Function&&t instanceof Function))throw"Invalid texture constructor or matcher";$o.deRegister(e),i.push([e,t])},$o.deRegister=function(e){for(var t=$o.matchers_,i=0;i<t.length;i++)t[i][0]===e&&t.splice(i,1)},$o.create=function(e,t,i){for(var r in $o.matchers_){var n=Sr($o.matchers_[r],2),o=n[0],a=n[1];if(a&&a(i))return new o(e,t,i)}return new $o(e,t,i)},$o.retain=function(e){$o.textures[e]&&$o.textures[e].retain()},$o.release=function(e){$o.textures[e]&&$o.textures[e].release()},$o.destroy=function(i){Object.keys($o.textures).forEach(function(e){var t=$o.textures[e];e!==$o.default&&t.gl===i&&t.destroy({force:!0})})},$o.getSpriteInfo=function(e,t){var i=$o.textures[e];return i&&{size:i.sizes[t],css_size:i.css_sizes[t],aspect:i.aspects[t],texcoords:i.texcoords[t]}},$o.getTexcoordsForSprite=function(e,t,i){var r=i[1]-e[1]-t[1];return[e[0]/i[0],r/i[1],(t[0]+e[0])/i[0],(t[1]+r)/i[1]]},$o.createFromObject=function(e,t){var i=[];if(t)for(var r in t){var n=t[r];if($o.changed(r,n)){var o=$o.create(e,r,n);i.push(o.loading)}}return Promise.all(i)},$o.default="__default",$o.createDefault=function(e){return $o.create(e,$o.default)},$o.sliceOptions=function(e){return{coords:e.coords,uid:e.uid,filtering:e.filtering,sprites:e.sprites,url:e.url,element:e.element,data:e.data,width:e.width,height:e.height,density:e.density,repeat:e.repeat,TEXTURE_WRAP_S:e.TEXTURE_WRAP_S,TEXTURE_WRAP_T:e.TEXTURE_WRAP_T,UNPACK_FLIP_Y_WEBGL:e.UNPACK_FLIP_Y_WEBGL,UNPACK_PREMULTIPLY_ALPHA_WEBGL:e.UNPACK_PREMULTIPLY_ALPHA_WEBGL}},$o.changed=function(e,t){var i=$o.textures[e];if(i){if("element"===i.config_type||null!=t.element)return!0;if(t=$o.sliceOptions(t),$o.texture_configs[e]===JSON.stringify(Object.assign({name:e},t)))return!1}return!0},$o.getInfo=function(e){if(e||(e=Object.keys($o.textures)),Array.isArray(e))return Promise.all(e.map(function(e){return $o.getInfo(e)}));var t=$o.textures[e];return t?(t.loading||Promise.resolve(t)).then(function(){return{name:t.name,width:t.width,height:t.height,density:t.density,sprites:t.sprites,texcoords:t.texcoords,sizes:t.sizes,css_sizes:t.css_sizes,aspects:t.aspects,filtering:t.filtering,power_of_2:t.power_of_2,valid:t.valid}}):Promise.resolve(null)},$o.syncTexturesToWorker=function(e){return Lr.is_main?Promise.all(e.map(function(e){var t=$o.textures[e];return t&&t.loading||Promise.resolve()})).then(function(){return $o.textures}):Cr.postMessage("Texture.getInfo",e).then(function(e){return e.forEach(function(e){$o.textures[e.name]=e}),$o.textures})},$o.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},$o.textures={},$o.texture_configs={},$o.boundTexture=null,$o.activeUnit=null,Cr.addTarget("Texture",$o),Jo($o);var Qo=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e};var ea={fromValues:function(e,t,i){var r=new Float64Array(3);return r[0]=e,r[1]=t,r[2]=i,r},transformMat4:function(e,t,i){var r=t[0],n=t[1],o=t[2],a=i[3]*r+i[7]*n+i[11]*o+i[15];return a=a||1,e[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/a,e[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/a,e[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/a,e}},ta={normalFromMat4:function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],f=t[10],d=t[11],_=t[12],p=t[13],v=t[14],m=t[15],g=i*s-r*a,y=i*l-n*a,x=i*u-o*a,b=r*l-n*s,A=r*u-o*s,T=n*u-o*l,w=c*p-h*_,k=c*v-f*_,E=c*m-d*_,M=h*v-f*p,R=h*m-d*p,S=f*m-d*v,P=g*S-y*R+x*M+b*E-A*k+T*w;return P?(P=1/P,e[0]=(s*S-l*R+u*M)*P,e[1]=(l*E-a*S-u*k)*P,e[2]=(a*R-s*E+u*w)*P,e[3]=(n*R-r*S-o*M)*P,e[4]=(i*S-n*E+o*k)*P,e[5]=(r*E-i*R-o*w)*P,e[6]=(p*T-v*A+m*b)*P,e[7]=(v*x-_*T-m*y)*P,e[8]=(_*A-p*x+m*g)*P,e):null},invert:function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=c*a-s*u,f=-c*o+s*l,d=u*o-a*l,_=i*h+r*f+n*d;return _?(_=1/_,e[0]=h*_,e[1]=(-c*r+n*u)*_,e[2]=(s*r-n*a)*_,e[3]=f*_,e[4]=(c*i-n*l)*_,e[5]=(-s*i+n*o)*_,e[6]=d*_,e[7]=(-u*i+r*l)*_,e[8]=(a*i-r*o)*_,e):null},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}},ia={multiply:function(e,t,i){var r=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=t[9],d=t[10],_=t[11],p=t[12],v=t[13],m=t[14],g=t[15],y=i[0],x=i[1],b=i[2],A=i[3];return e[0]=y*r+x*s+b*h+A*p,e[1]=y*n+x*l+b*f+A*v,e[2]=y*o+x*u+b*d+A*m,e[3]=y*a+x*c+b*_+A*g,y=i[4],x=i[5],b=i[6],A=i[7],e[4]=y*r+x*s+b*h+A*p,e[5]=y*n+x*l+b*f+A*v,e[6]=y*o+x*u+b*d+A*m,e[7]=y*a+x*c+b*_+A*g,y=i[8],x=i[9],b=i[10],A=i[11],e[8]=y*r+x*s+b*h+A*p,e[9]=y*n+x*l+b*f+A*v,e[10]=y*o+x*u+b*d+A*m,e[11]=y*a+x*c+b*_+A*g,y=i[12],x=i[13],b=i[14],A=i[15],e[12]=y*r+x*s+b*h+A*p,e[13]=y*n+x*l+b*f+A*v,e[14]=y*o+x*u+b*d+A*m,e[15]=y*a+x*c+b*_+A*g,e},translate:function(e,t,i){var r,n,o,a,s,l,u,c,h,f,d,_,p=i[0],v=i[1],m=i[2];t===e?(e[12]=t[0]*p+t[4]*v+t[8]*m+t[12],e[13]=t[1]*p+t[5]*v+t[9]*m+t[13],e[14]=t[2]*p+t[6]*v+t[10]*m+t[14],e[15]=t[3]*p+t[7]*v+t[11]*m+t[15]):(r=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=t[9],d=t[10],_=t[11],e[0]=r,e[1]=n,e[2]=o,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=f,e[10]=d,e[11]=_,e[12]=r*p+s*v+h*m+t[12],e[13]=n*p+l*v+f*m+t[13],e[14]=o*p+u*v+d*m+t[14],e[15]=a*p+c*v+_*m+t[15]);return e},scale:function(e,t,i){var r=i[0],n=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},perspective:function(e,t,i,r,n){var o=1/Math.tan(t/2),a=1/(r-n);return e[0]=o/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(n+r)*a,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*n*r*a,e[15]=0,e},lookAt:function(e,t,i,r){var n,o,a,s,l,u,c,h,f,d,_=t[0],p=t[1],v=t[2],m=r[0],g=r[1],y=r[2],x=i[0],b=i[1],A=i[2];if(Math.abs(_-x)<1e-6&&Math.abs(p-b)<1e-6&&Math.abs(v-A)<1e-6)return Qo(e);c=_-x,h=p-b,f=v-A,d=1/Math.sqrt(c*c+h*h+f*f),n=g*(f*=d)-y*(h*=d),o=y*(c*=d)-m*f,a=m*h-g*c,(d=Math.sqrt(n*n+o*o+a*a))?(n*=d=1/d,o*=d,a*=d):a=o=n=0;s=h*a-f*o,l=f*n-c*a,u=c*o-h*n,(d=Math.sqrt(s*s+l*l+u*u))?(s*=d=1/d,l*=d,u*=d):u=l=s=0;return e[0]=n,e[1]=s,e[2]=c,e[3]=0,e[4]=o,e[5]=l,e[6]=h,e[7]=0,e[8]=a,e[9]=u,e[10]=f,e[11]=0,e[12]=-(n*_+o*p+a*v),e[13]=-(s*_+l*p+u*v),e[14]=-(c*_+h*p+f*v),e[15]=1,e},identity:Qo,copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},invert:function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],f=t[10],d=t[11],_=t[12],p=t[13],v=t[14],m=t[15],g=i*s-r*a,y=i*l-n*a,x=i*u-o*a,b=r*l-n*s,A=r*u-o*s,T=n*u-o*l,w=c*p-h*_,k=c*v-f*_,E=c*m-d*_,M=h*v-f*p,R=h*m-d*p,S=f*m-d*v,P=g*S-y*R+x*M+b*E-A*k+T*w;return P?(P=1/P,e[0]=(s*S-l*R+u*M)*P,e[1]=(n*R-r*S-o*M)*P,e[2]=(p*T-v*A+m*b)*P,e[3]=(f*A-h*T-d*b)*P,e[4]=(l*E-a*S-u*k)*P,e[5]=(i*S-n*E+o*k)*P,e[6]=(v*x-_*T-m*y)*P,e[7]=(c*T-f*x+d*y)*P,e[8]=(a*R-s*E+u*w)*P,e[9]=(r*E-i*R-o*w)*P,e[10]=(_*A-p*x+m*g)*P,e[11]=(h*x-c*A-d*g)*P,e[12]=(s*k-a*M-l*w)*P,e[13]=(i*M-r*k+n*w)*P,e[14]=(p*y-_*b-v*g)*P,e[15]=(c*b-h*y+f*g)*P,e):null}},ra={transformMat4:function(e,t,i){var r=t[0],n=t[1],o=t[2],a=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*a,e[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*a,e[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*a,e[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*a,e},normalize:function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=i*i+r*r+n*n+o*o;0<a&&(a=1/Math.sqrt(a),e[0]=i*a,e[1]=r*a,e[2]=n*a,e[3]=o*a);return e},scale:function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}},na=0,oa=0,aa=function(){function T(e){var t=e.coords,i=e.style_zoom,r=e.source,n=e.worker,o=e.view;mr(this,T),this.id=na++,this.worker=n,this.view=o,this.source=r,this.generation=null,this.valid=!0,this.visible=!1,this.proxy_for=null,this.proxy_depth=0,this.proxied_as=null,this.fade_in=!0,this.loading=!1,this.loaded=!1,this.built=!1,this.labeled=!1,this.error=null,this.style_zoom=i,this.coords=T.normalizedCoordinate(t,this.source,this.style_zoom),this.key=T.key(this.coords,this.source,this.style_zoom),this.overzoom=Math.max(this.style_zoom-this.coords.z,0),this.overzoom2=Math.pow(2,this.overzoom),this.min=Jr.metersForTile(this.coords),this.max=Jr.metersForTile({x:this.coords.x+1,y:this.coords.y+1,z:this.coords.z}),this.span={x:this.max.x-this.min.x,y:this.max.y-this.min.y},this.bounds={sw:{x:this.min.x,y:this.max.y},ne:{x:this.max.x,y:this.min.y}},this.center_dist=0,this.meters_per_pixel=Jr.metersPerPixel(this.style_zoom),this.meters_per_pixel_sq=this.meters_per_pixel*this.meters_per_pixel,this.units_per_pixel=Jr.units_per_pixel/this.overzoom2,this.units_per_meter_overzoom=Jr.unitsPerMeter(this.coords.z)*this.overzoom2,this.meshes={},this.new_mesh_styles=[]}return yr(T,[{key:"freeResources",value:function(){for(var e in this.meshes)this.meshes[e].forEach(function(e){return e.destroy()});this.meshes={}}},{key:"destroy",value:function(){Ko.removeForTile(this.id),this.workerMessage("self.removeTile",this.id),this.freeResources(),this.worker=null,this.valid=!1}},{key:"buildAsMessage",value:function(){return{id:this.id,key:this.key,source:this.source.name,coords:this.coords,min:this.min,max:this.max,units_per_pixel:this.units_per_pixel,meters_per_pixel:this.meters_per_pixel,meters_per_pixel_sq:this.meters_per_pixel_sq,units_per_meter_overzoom:this.units_per_meter_overzoom,style_zoom:this.style_zoom,overzoom:this.overzoom,overzoom2:this.overzoom2,generation:this.generation}}},{key:"workerMessage",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Cr.postMessage.apply(Cr,[this.worker].concat(t))}},{key:"build",value:function(e,t){var i=(1<arguments.length&&void 0!==t?t:{}).fade_in,r=void 0===i||i;return this.generation=e,this.fade_in=r,this.loaded||(this.loading=!0,this.built=!1,this.labeled=!1),this.workerMessage("self.buildTile",{tile:this.buildAsMessage()})}},{key:"buildMeshes",value:function(e,t){if(!this.error){this.build_id=oa++;var i={},r=this.mesh_data;if(r)for(var n in r){for(var o in r[n].meshes){var a=r[n].meshes[o];if(a.vertex_data){if(!e[n]){Kr("warn","Could not create mesh because style '".concat(n,"' not found, for tile ").concat(this.key,", aborting tile"));break}var s=Object.assign({},r[n]);s.uniforms=Object.assign({},s.uniforms,a.uniforms),s.variant=a.variant,a.textures&&(s.textures=a.textures),a.labels&&(s.retain=!0);var l=e[n].makeMesh(a.vertex_data,a.vertex_elements,s);l.variant=s.variant,l.labels=a.labels,i[n]=i[n]||[],i[n].push(l),null==l.variant.order&&(l.variant.order=i[n].length-1)}}i[n]&&i[n].sort(function(e,t){var i=e.variant.order,r=t.variant.order;return null==i?1:null==r?-1:i<r?-1:1})}for(var u in delete this.mesh_data,i)this.meshes[u]&&this.meshes[u].forEach(function(e){return e.destroy()}),this.meshes[u]=i[u],this.new_mesh_styles.push(u);if(t.done){for(var c in this.meshes)-1===this.new_mesh_styles.indexOf(c)&&(this.meshes[c].forEach(function(e){return e.destroy()}),delete this.meshes[c]);this.new_mesh_styles=[]}}}},{key:"setProxyFor",value:function(e){e?(this.visible=!0,this.proxy_for=this.proxy_for||[],this.proxy_for.push(e),this.proxy_depth=1,e.proxied_as=e.style_zoom>this.style_zoom?"child":"parent"):(this.proxy_for=null,this.proxy_depth=0)}},{key:"isProxy",value:function(){return null!=this.proxy_for}},{key:"shouldProxyForStyle",value:function(t){return!this.proxy_for||this.proxy_for.some(function(e){return null==e.meshes[t]})}},{key:"setupProgram",value:function(e,t){var i=e.model,r=e.model32;t.uniform("4fv","u_tile_origin",[this.min.x,this.min.y,this.style_zoom,this.coords.z]),t.uniform("1f","u_tile_proxy_depth",this.proxy_depth),ia.identity(i),ia.translate(i,i,ea.fromValues(this.min.x,this.min.y,0)),ia.scale(i,i,ea.fromValues(this.span.x/Jr.tile_scale,-1*this.span.y/Jr.tile_scale,1)),ia.copy(r,i),t.uniform("Matrix4fv","u_model",r),t.uniform("1i","u_tile_fade_in",this.fade_in&&"child"!==this.proxied_as)}},{key:"merge",value:function(e){return this.loading=e.loading,this.loaded=e.loaded,this.generation=e.generation,this.error=e.error,this.mesh_data=e.mesh_data,this.selection_data?Object.assign(this.selection_data,e.selection_data):this.selection_data=e.selection_data,this}}],[{key:"coord",value:function(e){return{x:e.x,y:e.y,z:e.z,key:T.coordKey(e)}}},{key:"coordKey",value:function(e){return e.x+"/"+e.y+"/"+e.z}},{key:"key",value:function(e,t,i){if(!(e.y<0||e.y>=1<<e.z||e.z<0))return[t.name,i,e.x,e.y,e.z].join("/")}},{key:"normalizedKey",value:function(e,t,i){return T.key(T.normalizedCoordinate(e,t,i),t,i)}},{key:"normalizedCoordinate",value:function(e,t,i){return t.zoom_bias&&(e=T.coordinateAtZoom(e,Math.max(0,e.z-t.zoom_bias))),T.coordinateWithMaxZoom(e,t.max_zoom)}},{key:"coordinateAtZoom",value:function(e,t){var i=e.x,r=e.y,n=e.z;if(n!==t){var o=Math.pow(2,n-t);i=Math.floor(i/o),r=Math.floor(r/o),n=t}return T.coord({x:i,y:r,z:n})}},{key:"coordinateWithMaxZoom",value:function(e,t){var i=e.x,r=e.y,n=e.z;return void 0!==t&&t<n?T.coordinateAtZoom({x:i,y:r,z:n},t):T.coord({x:i,y:r,z:n})}},{key:"childrenForCoordinate",value:function(e){var t=e.x,i=e.y,r=e.z,n=e.key;return T.coord_children[n]||(r++,t*=2,i*=2,T.coord_children[n]=[T.coord({x:t,y:i,z:r}),T.coord({x:t+1,y:i,z:r}),T.coord({x:t,y:i+1,z:r}),T.coord({x:t+1,y:i+1,z:r})]),T.coord_children[n]}},{key:"isDescendant",value:function(e,t){if(t.z>e.z){var i=T.coordinateAtZoom(t,e.z),r=i.x,n=i.y;return e.x===r&&e.y===n}return!1}},{key:"cancel",value:function(e){e&&(e.canceled=!0,e.source_data&&e.source_data.request_id&&(on.cancelRequest(e.source_data.request_id),e.source_data.request_id=null),T.abortBuild(e))}},{key:"buildGeometry",value:function(e,t){var i=t.scene_id,r=t.layers,n=t.styles,o=t.global,a=t.sources,s=e.source_data;for(var l in Zo.startTile(e.id,{apply_repeat_groups:!0}),r){var u=r[l];if(u&&u.config_data){if(u.config_data.source===e.source)for(var c=T._getDataForSource(s,u.config_data,l),h=0;h<c.length;h++){var f=c[h],d=f.geom;if(d)for(var _=0;_<d.features.length;_++){var p=d.features[_];if(null!=p.geometry){var v=jo.getFeatureParseContext(p,e,o,a);v.winding=e.default_winding,v.source=e.source,v.layer=f.layer;var m=u.buildDrawGroups(v,!0);if(m)for(var g in m){var y=m[g],x=y.style||g,b=n[x];b?null!=(y=b.preprocess(y,e.source))&&!1!==y.visible&&(v.layers=y.layers,b.addFeature(p,y,v)):Kr("warn","Style '".concat(x,"' not found, skipping layer '").concat(l,"':"),y,p)}}}}}else Kr("warn","Layer ".concat(l," was defined without a geometry data source and will not be rendered."))}var A=T._stylesForTile(e,n);T._sendStyleGroups(e,A,{scene_id:i},function(e){return e.collision?"collision":"non-collision"})}},{key:"_stylesForTile",value:function(e,t){var i=[];for(var r in t)t[r].hasDataForTile(e)&&i.push(t[r]);return i}},{key:"_sendStyleGroups",value:function(r,e,t,i){var n=t.scene_id,o={};e.forEach(function(e){var t=i(e);o[t]=o[t]||[],o[t].push(e)}),0<Object.keys(o).length?function(){var i={start:!0};r.mesh_data={};function e(t){var e=o[t];Promise.all(e.map(function(e){return e.endData(r)})).then(function(){Kr("trace","Finished style group '".concat(t,"' for tile ").concat(r.key)),o[t]=[],Object.keys(o).every(function(e){return 0===o[e].length})&&(i.done=!0),Cr.postMessage("TileManager_".concat(n,".buildTileStylesCompleted"),Cr.withTransferables({tile:T.slice(r,["mesh_data","selection_data"]),progress:i})),i.start=null,r.mesh_data={},r.selection_data={},i.done&&Zo.resetTile(r.id)},function(e){Kr("error","Error for style group '".concat(t,"' for tile ").concat(r.key),e)})}for(var t in o)e(t)}():(Cr.postMessage("TileManager_".concat(n,".buildTileStylesCompleted"),Cr.withTransferables({tile:T.slice(r),progress:{start:!0,done:!0}})),Zo.resetTile(r.id))}},{key:"_getDataForSource",value:function(t,e,i){var r=2<arguments.length&&void 0!==i?i:null,n=[];return null!=e&&null!=t&&null!=t.layers&&(!e.layer&&t.layers._default?n.push({geom:t.layers._default}):"string"==typeof e.layer&&!t.layers[e.layer]&&new RegExp("^\\d+_"+e.layer+"$").test(r)&&t.layers._default?n.push({geom:t.layers._default}):!e.layer&&r?n.push({layer:r,geom:t.layers[r]}):"string"==typeof e.layer?n.push({layer:e.layer,geom:t.layers[e.layer]}):Array.isArray(e.layer)&&e.layer.forEach(function(e){t.layers[e]&&t.layers[e].features&&n.push({layer:e,geom:t.layers[e]})})),n}},{key:"abortBuild",value:function(i){if(Ko.removeForTile(i.id),Zo.abortTile(i.id),i.mesh_data)for(var e in i.mesh_data){var t=i.mesh_data[e].textures;t&&t.forEach(function(e){var t=$o.textures[e];t&&(Kr("trace","releasing texture ".concat(e," for tile ").concat(i.key)),t.release())})}}},{key:"slice",value:function(e,t){var i=["id","key","loading","loaded","generation","error","debug"];Array.isArray(t)&&i.push.apply(i,Pr(t));for(var r={},n=0;n<i.length;n++){var o=i[n];r[o]=e[o]}return r}}]),T}();aa.coord_children={};var sa=function(){function r(e,t){var i;return mr(this,r),-1===(i=Mr(this,Ar(r).call(this,e,t))).rasters.indexOf(i.name)&&i.rasters.unshift(i.name),i.filtering=e.filtering,i.textures={},i}return br(r,mn),yr(r,[{key:"load",value:function(e){e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=Pr(this.rasters);var t=Jr.tile_scale;return e.source_data.layers={_default:{type:"FeatureCollection",features:[{geometry:{type:"Polygon",coordinates:[[[0,0],[t,0],[t,-t],[0,-t],[0,0]]]},properties:{}}]}},e.default_winding="CW",Promise.resolve(e)}},{key:"tileTexture",value:function(e){var t=e.coords.key;if(!this.textures[t]){var i=aa.coordinateWithMaxZoom(e.coords,this.max_zoom),r=this.formatUrl(this.url,{coords:i});this.textures[t]={url:r,filtering:this.filtering,coords:i}}return this.textures[t]}}]),r}();function la(e){return e}function ua(t,e){return"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map(function(e){return ca(t,e)})}:ca(t,e)}function ca(e,t){var i=t.id,r=t.bbox,n=null==t.properties?{}:t.properties,o=function(e,t){var o=function(e){if(null==(t=e.transform))return la;var t,i,r,n=t.scale[0],o=t.scale[1],a=t.translate[0],s=t.translate[1];return function(e,t){return t||(i=r=0),e[0]=(i+=e[0])*n+a,e[1]=(r+=e[1])*o+s,e}}(e),a=e.arcs;function n(e,t){t.length&&t.pop();for(var i=a[e<0?~e:e],r=0,n=i.length;r<n;++r)t.push(o(i[r].slice(),r));e<0&&function(e,t){for(var i,r=e.length,n=r-t;n<--r;)i=e[n],e[n++]=e[r],e[r]=i}(t,n)}function s(e){return o(e.slice())}function l(e){for(var t=[],i=0,r=e.length;i<r;++i)n(e[i],t);return t.length<2&&t.push(t[0].slice()),t}function i(e){for(var t=l(e);t.length<4;)t.push(t[0].slice());return t}function u(e){return e.map(i)}return function e(t){var i,r=t.type;switch(r){case"GeometryCollection":return{type:r,geometries:t.geometries.map(e)};case"Point":i=s(t.coordinates);break;case"MultiPoint":i=t.coordinates.map(s);break;case"LineString":i=l(t.arcs);break;case"MultiLineString":i=t.arcs.map(l);break;case"Polygon":i=u(t.arcs);break;case"MultiPolygon":i=t.arcs.map(u);break;default:return null}return{type:r,coordinates:i}}(t)}(e,t);return null==i&&null==r?{type:"Feature",properties:n,geometry:o}:null==r?{type:"Feature",id:i,properties:n,geometry:o}:{type:"Feature",id:i,bbox:r,properties:n,geometry:o}}_n.register(sa,"Raster");var ha=function(){function o(){return mr(this,o),Mr(this,Ar(o).apply(this,arguments))}return br(o,ao),yr(o,[{key:"parseSourceData",value:function(e,t,i){var r="string"==typeof i?JSON.parse(i):i;r=this.toGeoJSON(r);var n=this.getLayers(r);Rr(Ar(o.prototype),"preprocessLayers",this).call(this,n),t.layers=n}},{key:"toGeoJSON",value:function(e){if(e.objects&&1===Object.keys(e.objects).length){var t=Object.keys(e.objects)[0];e=fa(e,e.objects[t])}else{var i={};for(var r in e.objects)i[r]=fa(e,e.objects[r]);e=i}return e}}]),o}();function fa(e,t){var i=ua(e,t);return"Feature"===i.type&&(i={type:"FeatureCollection",features:[i]}),i}var da,_a=function(){function r(e,t){var i;return mr(this,r),(i=Mr(this,Ar(r).call(this,e,t))).urlHasTilePattern(i.url)?i:Mr(i,new ha(e))}return br(r,so),yr(r,[{key:"parseSourceData",value:function(e,t,i){var r="string"==typeof i?JSON.parse(i):i;r=ha.prototype.toGeoJSON(r),this.prepareGeoJSON(r,e,t)}}]),r}();_n.register(_a,"TopoJSON");var pa=da={};function va(e,t){this.items=[],this.algorithm=e;var i=void 0===(t=t||{}).sort||t.sort;this.sort=i}da.deepClone=function(e){return Array.isArray(e)?e.map(da.deepClone):e},va.prototype={addItem:function(e){this.items.push(e)},normalizeCoordinates:function(){var e=this.items,i=1/0,r=1/0;e.forEach(function(e){var t=e;i=Math.min(i,t.x),r=Math.min(r,t.y)}),e.forEach(function(e){var t=e;t.x-=i,t.y-=r})},getStats:function(){var e=this.items.map(function(e){return e}),t=e.map(function(e){return e.x}),i=e.map(function(e){return e.y}),r=e.map(function(e){return e.x+e.width}),n=e.map(function(e){return e.y+e.height});return{minX:Math.max.apply(Math,t),minY:Math.max.apply(Math,i),maxX:Math.max.apply(Math,r),maxY:Math.max.apply(Math,n)}},getItems:function(){return this.items},processItems:function(){var e=this.items;return this.sort&&(e=this.algorithm.sort(e)),e=this.algorithm.placeItems(e),this.items=e},exportItems:function(){return this.processItems(),this.normalizeCoordinates(),this.items},export:function(){var e=this.exportItems(),t=this.getStats();return{height:t.maxY,width:t.maxX,items:e}}};var ma=va,ga="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},ya=[],xa=[],ba="undefined"!=typeof Uint8Array?Uint8Array:Array,Aa=!1;function Ta(){Aa=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,i=e.length;t<i;++t)ya[t]=e[t],xa[e.charCodeAt(t)]=t;xa["-".charCodeAt(0)]=62,xa["_".charCodeAt(0)]=63}function wa(e){var t,i,r,n,o;Aa||Ta();var a=e.length;if(0<a%4)throw new Error("Invalid string. Length must be a multiple of 4");n="="===e[a-2]?2:"="===e[a-1]?1:0,o=new ba(3*a/4-n),i=0<n?a-4:a;var s=0;for(t=0;t<i;t+=4,3)r=xa[e.charCodeAt(t)]<<18|xa[e.charCodeAt(t+1)]<<12|xa[e.charCodeAt(t+2)]<<6|xa[e.charCodeAt(t+3)],o[s++]=r>>16&255,o[s++]=r>>8&255,o[s++]=255&r;return 2==n?(r=xa[e.charCodeAt(t)]<<2|xa[e.charCodeAt(t+1)]>>4,o[s++]=255&r):1==n&&(r=xa[e.charCodeAt(t)]<<10|xa[e.charCodeAt(t+1)]<<4|xa[e.charCodeAt(t+2)]>>2,o[s++]=r>>8&255,o[s++]=255&r),o}function ka(e,t,i){for(var r,n,o=[],a=t;a<i;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(ya[(n=r)>>18&63]+ya[n>>12&63]+ya[n>>6&63]+ya[63&n]);return o.join("")}function Ea(e){var t;Aa||Ta();for(var i=e.length,r=i%3,n="",o=[],a=0,s=i-r;a<s;a+=16383)o.push(ka(e,a,s<a+16383?s:a+16383));return 1==r?(t=e[i-1],n+=ya[t>>2],n+=ya[t<<4&63],n+="=="):2==r&&(t=(e[i-2]<<8)+e[i-1],n+=ya[t>>10],n+=ya[t>>4&63],n+=ya[t<<2&63],n+="="),o.push(n),o.join("")}function Ma(e,t,i,r,n){var o,a,s=8*n-r-1,l=(1<<s)-1,u=l>>1,c=-7,h=i?n-1:0,f=i?-1:1,d=e[t+h];for(h+=f,o=d&(1<<-c)-1,d>>=-c,c+=s;0<c;o=256*o+e[t+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;0<c;a=256*a+e[t+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=u}return(d?-1:1)*a*Math.pow(2,o-r)}function Ra(e,t,i,r,n,o){var a,s,l,u=8*o-n-1,c=(1<<u)-1,h=c>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,_=r?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),2<=(t+=1<=a+h?f/l:f*Math.pow(2,1-h))*l&&(a++,l/=2),c<=a+h?(s=0,a=c):1<=a+h?(s=(t*l-1)*Math.pow(2,n),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,n),a=0));8<=n;e[i+d]=255&s,d+=_,s/=256,n-=8);for(a=a<<n|s,u+=n;0<u;e[i+d]=255&a,d+=_,a/=256,u-=8);e[i+d-_]|=128*p}var Sa={}.toString,Pa=Array.isArray||function(e){return"[object Array]"==Sa.call(e)};Ia.TYPED_ARRAY_SUPPORT=void 0===ga.TYPED_ARRAY_SUPPORT||ga.TYPED_ARRAY_SUPPORT;var za=Na();function Na(){return Ia.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Oa(e,t){if(Na()<t)throw new RangeError("Invalid typed array length");return Ia.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Ia.prototype:(null===e&&(e=new Ia(t)),e.length=t),e}function Ia(e,t,i){if(!(Ia.TYPED_ARRAY_SUPPORT||this instanceof Ia))return new Ia(e,t,i);if("number"!=typeof e)return La(this,e,t,i);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Fa(this,e)}function La(e,t,i,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,i,r){if(t.byteLength,i<0||t.byteLength<i)throw new RangeError("'offset' is out of bounds");if(t.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===i&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,i):new Uint8Array(t,i,r);Ia.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Ia.prototype:e=Da(e,t);return e}(e,t,i,r):"string"==typeof t?function(e,t,i){"string"==typeof i&&""!==i||(i="utf8");if(!Ia.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Ga(t,i),n=(e=Oa(e,r)).write(t,i);n!==r&&(e=e.slice(0,n));return e}(e,t,i):function(e,t){if(Ua(t)){var i=0|ja(t.length);return 0===(e=Oa(e,i)).length||t.copy(e,0,0,i),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||function(e){return e!=e}(t.length)?Oa(e,0):Da(e,t);if("Buffer"===t.type&&Pa(t.data))return Da(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Ca(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Fa(e,t){if(Ca(t),e=Oa(e,t<0?0:0|ja(t)),!Ia.TYPED_ARRAY_SUPPORT)for(var i=0;i<t;++i)e[i]=0;return e}function Da(e,t){var i=t.length<0?0:0|ja(t.length);e=Oa(e,i);for(var r=0;r<i;r+=1)e[r]=255&t[r];return e}function ja(e){if(e>=Na())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Na().toString(16)+" bytes");return 0|e}function Ua(e){return!(null==e||!e._isBuffer)}function Ga(e,t){if(Ua(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var i=e.length;if(0===i)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return us(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return cs(e).length;default:if(r)return us(e).length;t=(""+t).toLowerCase(),r=!0}}function Ba(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function Va(e,t,i,r,n){if(0===e.length)return-1;if("string"==typeof i?(r=i,i=0):2147483647<i?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(n)return-1;i=e.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof t&&(t=Ia.from(t,r)),Ua(t))return 0===t.length?-1:qa(e,t,i,r,n);if("number"==typeof t)return t&=255,Ia.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):qa(e,[t],i,r,n);throw new TypeError("val must be string, number or Buffer")}function qa(e,t,i,r,n){var o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s/=a=2,l/=2,i/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){var c=-1;for(o=i;o<s;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(s<i+l&&(i=s-l),o=i;0<=o;o--){for(var h=!0,f=0;f<l;f++)if(u(e,o+f)!==u(t,f)){h=!1;break}if(h)return o}return-1}function Ha(e,t,i,r){i=Number(i)||0;var n=e.length-i;r?n<(r=Number(r))&&(r=n):r=n;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");o/2<r&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[i+a]=s}return a}function Ya(e,t,i,r){return hs(function(e){for(var t=[],i=0;i<e.length;++i)t.push(255&e.charCodeAt(i));return t}(t),e,i,r)}function Wa(e,t,i){return 0===t&&i===e.length?Ea(e):Ea(e.slice(t,i))}function Xa(e,t,i){i=Math.min(e.length,i);for(var r=[],n=t;n<i;){var o,a,s,l,u=e[n],c=null,h=239<u?4:223<u?3:191<u?2:1;if(n+h<=i)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[n+1]))&&127<(l=(31&u)<<6|63&o)&&(c=l);break;case 3:o=e[n+1],a=e[n+2],128==(192&o)&&128==(192&a)&&2047<(l=(15&u)<<12|(63&o)<<6|63&a)&&(l<55296||57343<l)&&(c=l);break;case 4:o=e[n+1],a=e[n+2],s=e[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&65535<(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)&&l<1114112&&(c=l)}null===c?(c=65533,h=1):65535<c&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),n+=h}return function(e){var t=e.length;if(t<=Za)return String.fromCharCode.apply(String,e);var i="",r=0;for(;r<t;)i+=String.fromCharCode.apply(String,e.slice(r,r+=Za));return i}(r)}Ia.poolSize=8192,Ia._augment=function(e){return e.__proto__=Ia.prototype,e},Ia.from=function(e,t,i){return La(null,e,t,i)},Ia.TYPED_ARRAY_SUPPORT&&(Ia.prototype.__proto__=Uint8Array.prototype,Ia.__proto__=Uint8Array),Ia.alloc=function(e,t,i){return function(e,t,i,r){return Ca(t),t<=0?Oa(e,t):void 0!==i?"string"==typeof r?Oa(e,t).fill(i,r):Oa(e,t).fill(i):Oa(e,t)}(null,e,t,i)},Ia.allocUnsafe=function(e){return Fa(null,e)},Ia.allocUnsafeSlow=function(e){return Fa(null,e)},Ia.isBuffer=fs,Ia.compare=function(e,t){if(!Ua(e)||!Ua(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var i=e.length,r=t.length,n=0,o=Math.min(i,r);n<o;++n)if(e[n]!==t[n]){i=e[n],r=t[n];break}return i<r?-1:r<i?1:0},Ia.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Ia.concat=function(e,t){if(!Pa(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Ia.alloc(0);var i;if(void 0===t)for(i=t=0;i<e.length;++i)t+=e[i].length;var r=Ia.allocUnsafe(t),n=0;for(i=0;i<e.length;++i){var o=e[i];if(!Ua(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,n),n+=o.length}return r},Ia.byteLength=Ga,Ia.prototype._isBuffer=!0,Ia.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Ba(this,t,t+1);return this},Ia.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Ba(this,t,t+3),Ba(this,t+1,t+2);return this},Ia.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Ba(this,t,t+7),Ba(this,t+1,t+6),Ba(this,t+2,t+5),Ba(this,t+3,t+4);return this},Ia.prototype.toString=function(){var e=0|this.length;return 0==e?"":0===arguments.length?Xa(this,0,e):function(e,t,i){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return $a(this,t,i);case"utf8":case"utf-8":return Xa(this,t,i);case"ascii":return Ka(this,t,i);case"latin1":case"binary":return Ja(this,t,i);case"base64":return Wa(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qa(this,t,i);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},Ia.prototype.equals=function(e){if(!Ua(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Ia.compare(this,e)},Ia.prototype.inspect=function(){var e="";return 0<this.length&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length&&(e+=" ... ")),"<Buffer "+e+">"},Ia.prototype.compare=function(e,t,i,r,n){if(!Ua(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),t<0||i>e.length||r<0||n>this.length)throw new RangeError("out of range index");if(n<=r&&i<=t)return 0;if(n<=r)return-1;if(i<=t)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(r>>>=0),a=(i>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,n),u=e.slice(t,i),c=0;c<s;++c)if(l[c]!==u[c]){o=l[c],a=u[c];break}return o<a?-1:a<o?1:0},Ia.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},Ia.prototype.indexOf=function(e,t,i){return Va(this,e,t,i,!0)},Ia.prototype.lastIndexOf=function(e,t,i){return Va(this,e,t,i,!1)},Ia.prototype.write=function(e,t,i,r){if(void 0===t)r="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)r=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var n=this.length-t;if((void 0===i||n<i)&&(i=n),0<e.length&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o,a,s,l,u,c,h,f,d,_=!1;;)switch(r){case"hex":return Ha(this,e,t,i);case"utf8":case"utf-8":return f=t,d=i,hs(us(e,(h=this).length-f),h,f,d);case"ascii":return Ya(this,e,t,i);case"latin1":case"binary":return Ya(this,e,t,i);case"base64":return l=this,u=t,c=i,hs(cs(e),l,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a=t,s=i,hs(function(e,t){for(var i,r,n,o=[],a=0;a<e.length&&!((t-=2)<0);++a)i=e.charCodeAt(a),r=i>>8,n=i%256,o.push(n),o.push(r);return o}(e,(o=this).length-a),o,a,s);default:if(_)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),_=!0}},Ia.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Za=4096;function Ka(e,t,i){var r="";i=Math.min(e.length,i);for(var n=t;n<i;++n)r+=String.fromCharCode(127&e[n]);return r}function Ja(e,t,i){var r="";i=Math.min(e.length,i);for(var n=t;n<i;++n)r+=String.fromCharCode(e[n]);return r}function $a(e,t,i){var r=e.length;(!t||t<0)&&(t=0),(!i||i<0||r<i)&&(i=r);for(var n="",o=t;o<i;++o)n+=ls(e[o]);return n}function Qa(e,t,i){for(var r=e.slice(t,i),n="",o=0;o<r.length;o+=2)n+=String.fromCharCode(r[o]+256*r[o+1]);return n}function es(e,t,i){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(i<e+t)throw new RangeError("Trying to access beyond buffer length")}function ts(e,t,i,r,n,o){if(!Ua(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(n<t||t<o)throw new RangeError('"value" argument is out of bounds');if(i+r>e.length)throw new RangeError("Index out of range")}function is(e,t,i,r){t<0&&(t=65535+t+1);for(var n=0,o=Math.min(e.length-i,2);n<o;++n)e[i+n]=(t&255<<8*(r?n:1-n))>>>8*(r?n:1-n)}function rs(e,t,i,r){t<0&&(t=4294967295+t+1);for(var n=0,o=Math.min(e.length-i,4);n<o;++n)e[i+n]=t>>>8*(r?n:3-n)&255}function ns(e,t,i,r){if(i+r>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function os(e,t,i,r,n){return n||ns(e,0,i,4),Ra(e,t,i,r,23,4),i+4}function as(e,t,i,r,n){return n||ns(e,0,i,8),Ra(e,t,i,r,52,8),i+8}Ia.prototype.slice=function(e,t){var i,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),t<e&&(t=e),Ia.TYPED_ARRAY_SUPPORT)(i=this.subarray(e,t)).__proto__=Ia.prototype;else{var n=t-e;i=new Ia(n,void 0);for(var o=0;o<n;++o)i[o]=this[o+e]}return i},Ia.prototype.readUIntLE=function(e,t,i){e|=0,t|=0,i||es(e,t,this.length);for(var r=this[e],n=1,o=0;++o<t&&(n*=256);)r+=this[e+o]*n;return r},Ia.prototype.readUIntBE=function(e,t,i){e|=0,t|=0,i||es(e,t,this.length);for(var r=this[e+--t],n=1;0<t&&(n*=256);)r+=this[e+--t]*n;return r},Ia.prototype.readUInt8=function(e,t){return t||es(e,1,this.length),this[e]},Ia.prototype.readUInt16LE=function(e,t){return t||es(e,2,this.length),this[e]|this[e+1]<<8},Ia.prototype.readUInt16BE=function(e,t){return t||es(e,2,this.length),this[e]<<8|this[e+1]},Ia.prototype.readUInt32LE=function(e,t){return t||es(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Ia.prototype.readUInt32BE=function(e,t){return t||es(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Ia.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||es(e,t,this.length);for(var r=this[e],n=1,o=0;++o<t&&(n*=256);)r+=this[e+o]*n;return(n*=128)<=r&&(r-=Math.pow(2,8*t)),r},Ia.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||es(e,t,this.length);for(var r=t,n=1,o=this[e+--r];0<r&&(n*=256);)o+=this[e+--r]*n;return(n*=128)<=o&&(o-=Math.pow(2,8*t)),o},Ia.prototype.readInt8=function(e,t){return t||es(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Ia.prototype.readInt16LE=function(e,t){t||es(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},Ia.prototype.readInt16BE=function(e,t){t||es(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},Ia.prototype.readInt32LE=function(e,t){return t||es(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Ia.prototype.readInt32BE=function(e,t){return t||es(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Ia.prototype.readFloatLE=function(e,t){return t||es(e,4,this.length),Ma(this,e,!0,23,4)},Ia.prototype.readFloatBE=function(e,t){return t||es(e,4,this.length),Ma(this,e,!1,23,4)},Ia.prototype.readDoubleLE=function(e,t){return t||es(e,8,this.length),Ma(this,e,!0,52,8)},Ia.prototype.readDoubleBE=function(e,t){return t||es(e,8,this.length),Ma(this,e,!1,52,8)},Ia.prototype.writeUIntLE=function(e,t,i,r){e=+e,t|=0,i|=0,r||ts(this,e,t,i,Math.pow(2,8*i)-1,0);var n=1,o=0;for(this[t]=255&e;++o<i&&(n*=256);)this[t+o]=e/n&255;return t+i},Ia.prototype.writeUIntBE=function(e,t,i,r){e=+e,t|=0,i|=0,r||ts(this,e,t,i,Math.pow(2,8*i)-1,0);var n=i-1,o=1;for(this[t+n]=255&e;0<=--n&&(o*=256);)this[t+n]=e/o&255;return t+i},Ia.prototype.writeUInt8=function(e,t,i){return e=+e,t|=0,i||ts(this,e,t,1,255,0),Ia.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Ia.prototype.writeUInt16LE=function(e,t,i){return e=+e,t|=0,i||ts(this,e,t,2,65535,0),Ia.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):is(this,e,t,!0),t+2},Ia.prototype.writeUInt16BE=function(e,t,i){return e=+e,t|=0,i||ts(this,e,t,2,65535,0),Ia.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):is(this,e,t,!1),t+2},Ia.prototype.writeUInt32LE=function(e,t,i){return e=+e,t|=0,i||ts(this,e,t,4,4294967295,0),Ia.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):rs(this,e,t,!0),t+4},Ia.prototype.writeUInt32BE=function(e,t,i){return e=+e,t|=0,i||ts(this,e,t,4,4294967295,0),Ia.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):rs(this,e,t,!1),t+4},Ia.prototype.writeIntLE=function(e,t,i,r){if(e=+e,t|=0,!r){var n=Math.pow(2,8*i-1);ts(this,e,t,i,n-1,-n)}var o=0,a=1,s=0;for(this[t]=255&e;++o<i&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+i},Ia.prototype.writeIntBE=function(e,t,i,r){if(e=+e,t|=0,!r){var n=Math.pow(2,8*i-1);ts(this,e,t,i,n-1,-n)}var o=i-1,a=1,s=0;for(this[t+o]=255&e;0<=--o&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+i},Ia.prototype.writeInt8=function(e,t,i){return e=+e,t|=0,i||ts(this,e,t,1,127,-128),Ia.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Ia.prototype.writeInt16LE=function(e,t,i){return e=+e,t|=0,i||ts(this,e,t,2,32767,-32768),Ia.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):is(this,e,t,!0),t+2},Ia.prototype.writeInt16BE=function(e,t,i){return e=+e,t|=0,i||ts(this,e,t,2,32767,-32768),Ia.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):is(this,e,t,!1),t+2},Ia.prototype.writeInt32LE=function(e,t,i){return e=+e,t|=0,i||ts(this,e,t,4,2147483647,-2147483648),Ia.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):rs(this,e,t,!0),t+4},Ia.prototype.writeInt32BE=function(e,t,i){return e=+e,t|=0,i||ts(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Ia.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):rs(this,e,t,!1),t+4},Ia.prototype.writeFloatLE=function(e,t,i){return os(this,e,t,!0,i)},Ia.prototype.writeFloatBE=function(e,t,i){return os(this,e,t,!1,i)},Ia.prototype.writeDoubleLE=function(e,t,i){return as(this,e,t,!0,i)},Ia.prototype.writeDoubleBE=function(e,t,i){return as(this,e,t,!1,i)},Ia.prototype.copy=function(e,t,i,r){if(i||(i=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),0<r&&r<i&&(r=i),r===i)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-i&&(r=e.length-t+i);var n,o=r-i;if(this===e&&i<t&&t<r)for(n=o-1;0<=n;--n)e[n+t]=this[n+i];else if(o<1e3||!Ia.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)e[n+t]=this[n+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+o),t);return o},Ia.prototype.fill=function(e,t,i,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Ia.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;var o;if(t>>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(o=t;o<i;++o)this[o]=e;else{var a=Ua(e)?e:us(new Ia(e,r).toString()),s=a.length;for(o=0;o<i-t;++o)this[o+t]=a[o%s]}return this};var ss=/[^+\/0-9A-Za-z-_]/g;function ls(e){return e<16?"0"+e.toString(16):e.toString(16)}function us(e,t){var i;t=t||1/0;for(var r=e.length,n=null,o=[],a=0;a<r;++a){if(55295<(i=e.charCodeAt(a))&&i<57344){if(!n){if(56319<i){-1<(t-=3)&&o.push(239,191,189);continue}if(a+1===r){-1<(t-=3)&&o.push(239,191,189);continue}n=i;continue}if(i<56320){-1<(t-=3)&&o.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&-1<(t-=3)&&o.push(239,191,189);if(n=null,i<128){if((t-=1)<0)break;o.push(i)}else if(i<2048){if((t-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function cs(e){return wa(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(ss,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function hs(e,t,i,r){for(var n=0;n<r&&!(n+i>=t.length||n>=e.length);++n)t[n+i]=e[n];return n}function fs(e){return null!=e&&(!!e._isBuffer||ds(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ds(e.slice(0,0))}(e))}function ds(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var _s=Object.freeze({INSPECT_MAX_BYTES:50,kMaxLength:za,Buffer:Ia,SlowBuffer:function(e){return+e!=e&&(e=0),Ia.alloc(+e)},isBuffer:fs});ga.setTimeout,ga.clearTimeout;var ps=ga.performance||{},vs=(ps.now||ps.mozNow||ps.msNow||ps.oNow||ps.webkitNow,"function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;function i(){}i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e});function ms(e,t){var i={seen:[],stylize:ys};return 3<=arguments.length&&(i.depth=arguments[2]),4<=arguments.length&&(i.colors=arguments[3]),Ts(t)?i.showHidden=t:t&&function(e,t){if(!t||!Rs(t))return;var i=Object.keys(t),r=i.length;for(;r--;)e[i[r]]=t[i[r]]}(i,t),Es(i.showHidden)&&(i.showHidden=!1),Es(i.depth)&&(i.depth=2),Es(i.colors)&&(i.colors=!1),Es(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=gs),xs(i,e,i.depth)}function gs(e,t){var i=ms.styles[t];return i?"\x1b["+ms.colors[i][0]+"m"+e+"\x1b["+ms.colors[i][1]+"m":e}function ys(e,t){return e}function xs(t,i,r){if(t.customInspect&&i&&zs(i.inspect)&&i.inspect!==ms&&(!i.constructor||i.constructor.prototype!==i)){var e=i.inspect(r,t);return ks(e)||(e=xs(t,e,r)),e}var n=function(e,t){if(Es(t))return e.stylize("undefined","undefined");if(ks(t)){var i="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(i,"string")}if(function(e){return"number"==typeof e}(t))return e.stylize(""+t,"number");if(Ts(t))return e.stylize(""+t,"boolean");if(ws(t))return e.stylize("null","null")}(t,i);if(n)return n;var o=Object.keys(i),a=function(e){var t={};return e.forEach(function(e){t[e]=!0}),t}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(i)),Ps(i)&&(0<=o.indexOf("message")||0<=o.indexOf("description")))return bs(i);if(0===o.length){if(zs(i)){var s=i.name?": "+i.name:"";return t.stylize("[Function"+s+"]","special")}if(Ms(i))return t.stylize(RegExp.prototype.toString.call(i),"regexp");if(Ss(i))return t.stylize(Date.prototype.toString.call(i),"date");if(Ps(i))return bs(i)}var l,u="",c=!1,h=["{","}"];!function(e){return Array.isArray(e)}(i)||(c=!0,h=["[","]"]),zs(i)&&(u=" [Function"+(i.name?": "+i.name:"")+"]");return Ms(i)&&(u=" "+RegExp.prototype.toString.call(i)),Ss(i)&&(u=" "+Date.prototype.toUTCString.call(i)),Ps(i)&&(u=" "+bs(i)),0!==o.length||c&&0!=i.length?r<0?Ms(i)?t.stylize(RegExp.prototype.toString.call(i),"regexp"):t.stylize("[Object]","special"):(t.seen.push(i),l=c?function(t,i,r,n,e){for(var o=[],a=0,s=i.length;a<s;++a)Is(i,String(a))?o.push(As(t,i,r,n,String(a),!0)):o.push("");return e.forEach(function(e){e.match(/^\d+$/)||o.push(As(t,i,r,n,e,!0))}),o}(t,i,r,a,o):o.map(function(e){return As(t,i,r,a,e,c)}),t.seen.pop(),function(e,t,i){if(60<e.reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0))return i[0]+(""===t?"":t+"\n ")+" "+e.join(",\n  ")+" "+i[1];return i[0]+t+" "+e.join(", ")+" "+i[1]}(l,u,h)):h[0]+u+h[1]}function bs(e){return"["+Error.prototype.toString.call(e)+"]"}function As(e,t,i,r,n,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),Is(r,n)||(a="["+n+"]"),s||(e.seen.indexOf(l.value)<0?-1<(s=ws(i)?xs(e,l.value,null):xs(e,l.value,i-1)).indexOf("\n")&&(s=o?s.split("\n").map(function(e){return"  "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return"   "+e}).join("\n")):s=e.stylize("[Circular]","special")),Es(a)){if(o&&n.match(/^\d+$/))return s;a=(a=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),e.stylize(a,"string"))}return a+": "+s}function Ts(e){return"boolean"==typeof e}function ws(e){return null===e}function ks(e){return"string"==typeof e}function Es(e){return void 0===e}function Ms(e){return Rs(e)&&"[object RegExp]"===Os(e)}function Rs(e){return"object"==typeof e&&null!==e}function Ss(e){return Rs(e)&&"[object Date]"===Os(e)}function Ps(e){return Rs(e)&&("[object Error]"===Os(e)||e instanceof Error)}function zs(e){return"function"==typeof e}function Ns(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Os(e){return Object.prototype.toString.call(e)}function Is(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ls(e,t){if(e===t)return 0;for(var i=e.length,r=t.length,n=0,o=Math.min(i,r);n<o;++n)if(e[n]!==t[n]){i=e[n],r=t[n];break}return i<r?-1:r<i?1:0}ms.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},ms.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Cs,Fs=Object.prototype.hasOwnProperty,Ds=Object.keys||function(e){var t=[];for(var i in e)Fs.call(e,i)&&t.push(i);return t},js=Array.prototype.slice;function Us(){return void 0!==Cs?Cs:Cs="foo"===function(){}.name}function Gs(e){return Object.prototype.toString.call(e)}function Bs(e){return!fs(e)&&("function"==typeof ga.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}function Vs(e,t){e||Zs(e,!0,t,"==",Ks)}var qs=/\s*function\s+([^\(\s]*)\s*/;function Hs(e){if(zs(e)){if(Us())return e.name;var t=e.toString().match(qs);return t&&t[1]}}function Ys(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return Ws(Xs(e.actual),128)+" "+e.operator+" "+Ws(Xs(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||Zs;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var i=new Error;if(i.stack){var r=i.stack,n=Hs(t),o=r.indexOf("\n"+n);if(0<=o){var a=r.indexOf("\n",o+1);r=r.substring(a+1)}this.stack=r}}}function Ws(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function Xs(e){if(Us()||!zs(e))return ms(e);var t=Hs(e);return"[Function"+(t?": "+t:"")+"]"}function Zs(e,t,i,r,n){throw new Ys({message:i,actual:e,expected:t,operator:r,stackStartFunction:n})}function Ks(e,t){e||Zs(e,!0,t,"==",Ks)}function Js(e,t,i,r){if(e===t)return!0;if(fs(e)&&fs(t))return 0===Ls(e,t);if(Ss(e)&&Ss(t))return e.getTime()===t.getTime();if(Ms(e)&&Ms(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(Bs(e)&&Bs(t)&&Gs(e)===Gs(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===Ls(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(fs(e)!==fs(t))return!1;var n=(r=r||{actual:[],expected:[]}).actual.indexOf(e);return-1!==n&&n===r.expected.indexOf(t)||(r.actual.push(e),r.expected.push(t),function(e,t,i,r){if(null==e||null==t)return!1;if(Ns(e)||Ns(t))return e===t;if(i&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var n=$s(e),o=$s(t);if(n&&!o||!n&&o)return!1;if(n)return e=js.call(e),t=js.call(t),Js(e,t,i);var a,s,l=Ds(e),u=Ds(t);if(l.length!==u.length)return!1;for(l.sort(),u.sort(),s=l.length-1;0<=s;s--)if(l[s]!==u[s])return!1;for(s=l.length-1;0<=s;s--)if(a=l[s],!Js(e[a],t[a],i,r))return!1;return!0}(e,t,i,r))}return i?e===t:e==t}function $s(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function Qs(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function el(e,t,i,r){var n;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof i&&(r=i,i=null),n=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(i&&i.name?" ("+i.name+").":".")+(r?" "+r:"."),e&&!n&&Zs(n,i,"Missing expected exception"+r);var o="string"==typeof r,a=!e&&n&&!i;if((!e&&Ps(n)&&o&&Qs(n,i)||a)&&Zs(n,i,"Got unwanted exception"+r),e&&n&&i&&!Qs(n,i)||!e&&n)throw n}vs(Vs.AssertionError=Ys,Error),Vs.fail=Zs,Vs.ok=Ks,Vs.equal=function e(t,i,r){t!=i&&Zs(t,i,r,"==",e)},Vs.notEqual=function e(t,i,r){t==i&&Zs(t,i,r,"!=",e)},Vs.deepEqual=function e(t,i,r){Js(t,i,!1)||Zs(t,i,r,"deepEqual",e)},Vs.deepStrictEqual=function e(t,i,r){Js(t,i,!0)||Zs(t,i,r,"deepStrictEqual",e)},Vs.notDeepEqual=function e(t,i,r){Js(t,i,!1)&&Zs(t,i,r,"notDeepEqual",e)},Vs.notDeepStrictEqual=function e(t,i,r){Js(t,i,!0)&&Zs(t,i,r,"notDeepStrictEqual",e)},Vs.strictEqual=function e(t,i,r){t!==i&&Zs(t,i,r,"===",e)},Vs.notStrictEqual=function e(t,i,r){t===i&&Zs(t,i,r,"!==",e)},Vs.throws=function(e,t,i){el(!0,e,t,i)},Vs.doesNotThrow=function(e,t,i){el(!1,e,t,i)},Vs.ifError=function(e){if(e)throw e};function tl(){}var il={sort:function(e){return e.sort(function(e,t){return e.height-t.height}),e},placeItems:function(e){var t=0;return e.forEach(function(e){e.x=0,e.y=t,t+=e.height}),e}},rl={sort:function(e){return e.sort(function(e,t){return e.width-t.width}),e},placeItems:function(e){var t=0;return e.forEach(function(e){e.x=t,e.y=0,t+=e.width}),e}},nl={sort:function(e){return e.sort(function(e,t){return Math.sqrt(Math.pow(e.height,2)+Math.pow(e.width,2))-Math.sqrt(Math.pow(t.height,2)+Math.pow(t.width,2))}),e},placeItems:function(e){var t=0,i=0;return e.forEach(function(e){e.x=t,e.y=i,t+=e.width,i+=e.height}),e}},ol={sort:function(e){return e.sort(function(e,t){return Math.sqrt(Math.pow(e.height,2)+Math.pow(e.width,2))-Math.sqrt(Math.pow(t.height,2)+Math.pow(t.width,2))}),e},placeItems:function(e){var i=0,r=0;return e.forEach(function(e){var t=e.width;e.x=i-t,e.y=r,i-=t,r+=e.height}),e}};tl.prototype={fit:function(e){var t,i,r,n,o=e.length,a=0<o?e[0].width:0,s=0<o?e[0].height:0;for(this.root={x:0,y:0,width:a,height:s},t=0;t<o;t++)r=e[t],n=(i=this.findNode(this.root,r.width,r.height))?this.splitNode(i,r.width,r.height):this.growNode(r.width,r.height),r.x=n.x,r.y=n.y},findNode:function(e,t,i){return e.used?this.findNode(e.right,t,i)||this.findNode(e.down,t,i):t<=e.width&&i<=e.height?e:null},splitNode:function(e,t,i){return e.used=!0,e.down={x:e.x,y:e.y+i,width:e.width,height:e.height-i},e.right={x:e.x+t,y:e.y,width:e.width-t,height:i},e},growNode:function(e,t){var i=e<=this.root.width,r=t<=this.root.height,n=r&&this.root.height>=this.root.width+e,o=i&&this.root.width>=this.root.height+t;return n?this.growRight(e,t):o?this.growDown(e,t):r?this.growRight(e,t):i?this.growDown(e,t):null},growRight:function(e,t){var i;return this.root={used:!0,x:0,y:0,width:this.root.width+e,height:this.root.height,down:this.root,right:{x:this.root.width,y:0,width:e,height:this.root.height}},(i=this.findNode(this.root,e,t))?this.splitNode(i,e,t):null},growDown:function(e,t){var i;return this.root={used:!0,x:0,y:0,width:this.root.width,height:this.root.height+t,down:{x:0,y:this.root.height,width:this.root.width,height:t},right:this.root},(i=this.findNode(this.root,e,t))?this.splitNode(i,e,t):null}};var al=tl,sl={sort:function(e){return e},placeItems:function(e){return function(e,t){t=t||{};var i=new al,r=t.inPlace||!1,n=e.map(function(e){return r?e:{width:e.width,height:e.height,item:e}});n=n.sort(function(e,t){return t.width*t.height-e.width*e.height}),i.fit(n);var o={width:n.reduce(function(e,t){return Math.max(e,t.x+t.width)},0),height:n.reduce(function(e,t){return Math.max(e,t.y+t.height)},0)};r||(o.items=n)}(e,{inPlace:!0}),e}},ll={};function ul(e,t){var i=e||"top-down";return"string"==typeof i&&Vs(i=ll[e],"Sorry, the '"+e+"' algorithm could not be loaded."),new ma(i,t)}function cl(e,t){ll[e]=t}ul.PackingSmith=ma,ul.addAlgorithm=cl,ul.algorithms=ll,cl("top-down",il),cl("left-right",rl),cl("diagonal",nl),cl("alt-diagonal",ol),cl("binary-tree",sl);var hl=ul;function fl(e){for(var t=0;t<(arguments.length<=1?0:arguments.length-1);t++){var i=t+1<1||arguments.length<=t+1?void 0:arguments[t+1];if(i)for(var r in i){var n=i[r];null===n||"object"!==vr(n)||Array.isArray(n)?void 0!==n&&(e[r]=n):null===e[r]||"object"!==vr(e[r])||Array.isArray(e[r])?e[r]=fl({},n):e[r]=fl(e[r],n)}}return e}function dl(e){var t;try{e.getContext("2d").getImageData(0,0,1,1)}catch(e){t=e.message}return t}function _l(e,t,i){if(e instanceof HTMLImageElement){var r=e.ownerDocument.createElement("canvas");r.width=t,r.height=i,r.getContext("2d").drawImage(e,0,0,t,i),e=r}return e}var pl,vl={};(function(){var n=this;function s(e){var t=vr(e);if("object"==t){if(!e)return"null";if(e instanceof Array)return"array";if(e instanceof Object)return t;var i=Object.prototype.toString.call(e);if("[object Window]"==i)return"object";if("[object Array]"==i||"number"==typeof e.length&&void 0!==e.splice&&void 0!==e.propertyIsEnumerable&&!e.propertyIsEnumerable("splice"))return"array";if("[object Function]"==i||void 0!==e.call&&void 0!==e.propertyIsEnumerable&&!e.propertyIsEnumerable("call"))return"function"}else if("function"==t&&void 0===e.call)return"object";return t}function l(e){var t=vr(e);return"object"==t&&null!=e||"function"==t}function e(e,t){e=e.split(".");var i,r=n;e[0]in r||!r.execScript||r.execScript("var "+e[0]);for(;e.length&&(i=e.shift());)e.length||void 0===t?r=r[i]&&r[i]!==Object.prototype[i]?r[i]:r[i]={}:r[i]=t}function t(e,o){function t(){}t.prototype=o.prototype,e.ma=o.prototype,e.prototype=new t,(e.prototype.constructor=e).ta=function(e,t,i){for(var r=Array(arguments.length-2),n=2;n<arguments.length;n++)r[n-2]=arguments[n];return o.prototype[t].apply(e,r)}}var i=Math,f=i.min,d=i.max,r=i.round,o=i.floor,a=i.ceil,c=i.abs,h=i.log,u=i.sqrt,_=i.pow,p=i.sin,v=i.asin,m=i.cos,g=i.tan,y=i.atan2,x=i.PI,b=x/2,A=x/4,T=2*x,w=3*x,k=x/180,E=180/x;function M(e,t,i){return i<e?i:e<t?t:e}function R(e,t,i,r){return r||(r=0),t<i?t-r<=e&&e<=i+r:i-r<=e&&e<=t+r}function S(e,t,i,r,n,o){return u(_((e-n)*(r-o)-(t-o)*(i-n),2)/(_(i-n,2)+_(r-o,2)))}function P(e,t,i,r,n){for(var o,a,s,l=i.length,u=l,c=i[0],h=0,f=0,d=0,_=r/2||0,p=n?1:3;1!=h&&p<u;)o=i[--u],r=i[--u],s=i[u?u-1:(l+(u-1))%l],a=i[u?u-2:(l+(u-2))%l],e-_<=r&&r<=e+_&&t-_<=o&&o<=t+_||e-_<=a&&a<=e+_&&t-_<=s&&s<=t+_?h=1:h||r!==e?!h&&R(e,r,a,_)&&((r<e&&e<a||e<r&&a<e)&&(f+=t<(c=o+(e-r)/(a-r)*(s-o)),d+=c<t),h=R(t,o,s,_)&&S(e,t,r,o,a,s)<=_?2:0):(a===e&&(o<t&&t<s||t<o&&s<t)||(c<=e&&e<a||e<=c&&a<e)&&(t<=o?++f:++d),h=R(t,o,s,_)&&S(e,t,r,o,a,s)<=_?2:0),c=r;return!h&&n&&0!==d&&0!=f%2&&(h=3),h}function z(e,t){this.x=+e,this.y=+t}function N(e,t,i,r,n,o,a,s,l,u){return e={x:e,y:t,next:i||null,m:r||null,la:n||null,O:o||null,l:a||0,L:s||0,J:l||0,alpha:u||0},r&&(e.m.next=e),i&&(e.next.m=e),e}function O(e){for(;e&&e.l;)e=e.next;return e}function I(e){if(e)for(;e.next;)e=e.next;return e}function L(e){var t=e;if(t)for(;(t=t.next)!=e&&(!t.l||t.l&&t.J););return t}function C(e){var t=I(e);(t.m.next=e).m=t.m}function F(e,t,i,r,n){var o,a=t.x-e.x,s=t.y-e.y,l=r.x-i.x,u=r.y-i.y,c=a*u-s*l;return c?(l=((i.x-e.x)*u-(i.y-e.y)*l)/c,c=(s*(i.x-e.x)-a*(i.y-e.y))/c,l<0||1<l||c<0||1<c?0:(0===l?o=e:1===l?o=t:0===c?o=i:1===c&&(o=r),o?(o.x+=2480549651603763e-20,o.y+=7321997314118067e-20,o.H&&(o.H.x=o.x,o.H.y=o.y),F(e,t,i,r,n)):(n.oa=e.x+l*a,n.pa=e.y+l*s,n.aa=l,n.ba=c,1))):0}function D(e,t){var i=[];if(Array.isArray(t))i=t.reduce(function(e,t){return e.push(t.x,t.y),e},i);else for(;t;)i.push(t.x,t.y),t=t.next;return 0===P(e.x,e.y,i,0,!0)?0:1}function j(e,t,i){for(t=t.next;t!==i&&t.alpha<=e.alpha;)t=t.next;e.next=t,e.m=t.m,(e.next.m=e).m.next=e}function U(e){for(var t,i=null,r=0,n=e.length;r<n;r++)((t=N(e[r].x,e[r].y,i)).next=i)&&(i.m=t),i=t;return i}function G(e,t,i,r){return(e-=i)*e+(t-=r)*t}e("H.math.normalize",function(e,t,i){return t-=i=i||0,(e-=i)-o(e/t)*t+i}),e("H.math.clamp",M),e("H.math.CoverType",{NONE:0,sa:1,qa:2,ra:3}),e("H.math.isCoveredBy",P),e("H.math.Point",z),z.prototype.set=z.prototype.set=z,z.prototype.clone=z.prototype.clone=function(e){return e?(e.x=this.x,e.y=this.y):e=new z(this.x,this.y),e},z.prototype.add=z.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},z.prototype.sub=z.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},z.prototype.scale=z.prototype.scale=function(e,t){return this.x*=e,this.y*=void 0===t?e:t,this},z.prototype.round=z.prototype.round=function(){return this.x=r(this.x),this.y=r(this.y),this},z.prototype.floor=z.prototype.floor=function(){return this.x=o(this.x),this.y=o(this.y),this},z.prototype.ceil=z.prototype.ceil=function(){return this.x=a(this.x),this.y=a(this.y),this},z.prototype.equals=z.prototype.w=function(e){return!(!e||this.x!==e.x||this.y!==e.y)},z.prototype.getNearest=z.prototype.ea=function(e,t){var i=t.x-e.x,r=t.y-e.y,n=e;if(i||r){var o=((this.x-e.x)*i+(this.y-e.y)*r)/(i*i+r*r);n=o<=0?e:1<=o?t:new z(e.x+o*i,e.y+o*r)}return n},z.prototype.distance=z.prototype.K=function(e){return u(_(this.x-e.x,2)+_(this.y-e.y,2))},z.fromIPoint=function(e){if(!e)throw Error("invalid argument");return e instanceof z?e:new z(e.x,e.y)},e("H.math.clipping.clipPolygon",function(e,t,i){var r,n;e=U(e),t=U(t);var o={},a=r=1;switch(~~(i||0)){case 1:a=r=0;break;case 2:r=0,a=1;break;case 3:r=1,a=0}i=r;var s=a;if(t&&e){for(t.H=N(t.x,t.y,null,I(t)),e.H=N(e.x,e.y,null,I(e)),a=t;a.next;a=a.next)if(!a.l)for(r=e;r.next;r=r.next)if(!r.l){var l=O(a.next),u=O(r.next);if(n=F(a,l,r,u,o)){n=o.aa;var c=o.ba,h=o.oa,f=o.pa;j(n=N(h,f,null,null,null,null,1,0,0,n),a,l),j(l=N(h,f,null,null,null,null,1,0,0,c),r,u),(n.O=l).O=n}}for(o=D(t,e),i&&(o=1-o),a=t;a;a=a.next)a.l&&(o=1-(a.L=o));for(o=D(e,t),s&&(o=1-o),r=e;r.next;r=r.next)r.l&&(o=1-(r.L=o));for(C(t),C(e);(e=L(t))!=t;){for(i=null;!e.J;e=e.O){for(o=e.L;i=N(e.x,e.y,i),e.J=1,e=o?e.next:e.m;)if(e.l){e.J=1;break}if(!e)break}i.la=d;var d=i}return d}}),e("H.math.simplifyDP",function(e,t,i){return function e(t,i,r,n,o){var a=0,s=n,l=t[n].x,u=t[n].y,c=t[o].x,h=t[o].y,f=n+1,d=G(l,u,c,h);if(d)for(;f<o;){var _=t[f++],p=_.x;_=_.y;var v=((p-l)*(c-l)+(_-u)*(h-u))/d;p=v<0?G(p,_,l,u):1<v?G(p,_,c,h):G(p,_,l+v*(c-l),u+v*(h-u)),a<p&&(a=p,s=f-1)}else for(;f<o;)_=t[f++],p=_.x,_=_.y,p=G(p,_,l,u),a<p&&(a=p,s=f-1);n=i<=a||0<r&&s-n?(--r,1<s-n?(n=e(t,i,r,n,s),n.splice(n.length-1,1)):n=[t[n]],1<o-s?n.concat(e(t,i,r,s,o)):n.concat(t.slice(s,o+1))):[t[n],t[o]];return n}(e,t*t,i||0,0,e.length-1)});var B=this,V=String,H=self.eval("undefined"),q=self.eval("null"),Y="prototype constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function W(e,t){if(!0==(e instanceof t&&e.constructor===t))throw new TypeError("Illegal constructor "+J(t))}e("H.lang.isObject",l),e("H.lang.isEmptyObject",function(e){for(var t in e)return!1;return!0}),e("H.lang.isArray",function(e,t,i,r){var n;if(!(n="Array"===Z(e))&&t)throw new ie(t,i,r!==H?r:e);return n}),e("H.lang.isString",function(e){return"string"==typeof e});var X=isNaN;function Z(e){var t=Object[Y[0]][Y[6]].call(e).match(/^\[object (\w+)\]$/);return t?t[1]:vr(e)}e("H.lang.isNumber",function(e){return e===+e});var K=[];function J(i,e,r,n){var o,a="",t=arguments.length<2;return t&&(e={H:B.H},r="",n=K.slice()),ee(e,!0,function(e,t){try{if(t=function(e,i){var r=[];return ee(e,!1,function(e,t){e[t]===i&&r.push(t)}),r.sort($)[0]}(e,o=e[t]),!(l(o)&&o.window===o&&o.self===o||l(o)&&0<o.nodeType&&"function"==s(o.cloneNode))&&l(o)){if(o===i)return a=r+"."+t,!0;if(n.indexOf(o)<0&&(n.push(o),a=J(i,o,r+"."+t,n)))return!0}}catch(e){}}),t&&(a=a?a.substr(1).replace("."+Y[0]+".","#"):"~"+("function"==s(i)?function(e){return(e=/^\s*function ([^\( ]+)/.exec(e))?e[1]:"anonymous"}(i)+"()":Z(i))),a}function $(e,t){return t.length-e.length}K.indexOf(K)<0&&K.push(K);var Q=Object[Y[0]][Y[2]];function ee(e,t,i){var r;if(e){for(n in e)if((!t||Q.call(e,n))&&i(e,n,!0))return;for(r=Y.length;r--;){var n=Y[r];if((!t||Q.call(e,n))&&i(e,n,!1))break}}}function te(e,t,i){i[t]="#"+t}function ie(e,t,i){var r,n=arguments.length;t=1<n?+t:t,n=2<n?V(i):"",t!==H&&((r=(r=/^.*?\(([^\)]+)/.exec((""+e).replace(/(\/\*([\s\S]*?)\*\/)|(\/\/(.*)$)/gm,"")))?(r=r[1].replace(/\s+/g,""),V(r).split(","!==H?",":" ")):[]).forEach(te),r=r[t]||"#"+t),this.message=(e?J(e):"")+(r||n?" (":"")+(r?"Argument "+r:"")+(n?(r?" ":"")+n:"")+(r||n?")":""),this.stack=Error().stack}e("H.lang.InvalidArgumentError",ie),(ie.prototype=Error()).name="InvalidArgumentError";var re={undefined:"GL",GL:"GL",OL:"OL",SL:"SL",SB:"SB",WE:"WE",WG:"WG"};function ne(e,t,i){var r=M(+e,-90,90);if(t&&X(r))throw new ie(t,i,e);return r}function oe(e,t,i){var r,n=+e;(n<-180||180<n)&&(n=(!1==(r=(n+180)%360)<0?r:360+r)-180);if(t&&X(n))throw new ie(t,i,e);return n}function ae(e,t,i){var r;if(e!==H&&X(r=+e)&&t)throw new ie(t,i,e);return r}function se(e,t,i){var r=!re[e];if(t&&r)throw new ie(t,i,e);return!r}function le(){W(this,le)}function ue(e,t,i,r){this.lat=ne(e,ue,0),this.lng=oe(t,ue,1),i!==H&&(this.alt=ae(i,ue,2)),r!==H&&se(r,ue,3)&&(this.ctx=r)}function ce(e,t,i){var r=!!e&&!(X(e.lat=ne(e.lat))||X(e.lng=oe(e.lng))||e.alt!==H&&X(e.alt=ae(e.alt))||e.ctx!==H&&!se(e.ctx));if(!r&&t)throw new ie(t,i,e);return r}function he(e,t,i,r){fe(this,ne(e,he,0),oe(t,he,1),ne(i,he,2),oe(r,he,3))}function fe(e,t,i,r,n){return e.c=i,e.g=n,t<r&&(i=t,t=r,r=i),e.i=t,e.h=r,e.f=e.a=e.b=null,e}function de(e,t){return(e=t-e)+(e<0?360:0)}function _e(e,t){return(e+=t/2)-(180<e?360:0)}function pe(e,t,i,r,n,o,a,s,l){i=f(i,a),e=d(e,n);var u=_e(t,n=de(t,r)),c=_e(o,a=de(o,s))-u;if((c+=c-1e-6<0?360:0)-1e-6<180){u=t;var h=s}else c=360-c,u=o,h=r;return 360<=(c=c+n/2+a/2)+5e-7?(u=-180,h=180):c-5e-7<n?(u=t,h=r):c-5e-7<a&&(u=o,h=s),l?fe(l,e,u,i,h):new he(e,u,i,h)}function ve(e,t,i){return i||(ce(e,ve,0),ce(t,ve,1)),new he(e.lat,e.lng,t.lat,t.lng)}function me(e,t,i,r,n,o){W(this,me),this.ka=e||10,this.f=this.b=null,this.j=r||0,this.o=n||0,this.C=t||1,this.S=i||1,this.U=!!o,((e=new Ae(null,NaN,this.j-this.C,this.o-this.S,this.j+this.C,this.o+this.S)).b=this).a=this.b=e,this.f=null}e("H.geo.AltitudeContext",re),e("H.geo.isDBC",function(e,t){return 0!=(e<0^t<0)&&180<c(t-e)}),e("H.geo.AbstractGeometry",le),le.prototype.getBoundingBox=le.prototype.D,le.prototype.equals=le.prototype.w,le.prototype.j="",le.prototype.toString=le.prototype.toString=function(){return this.o([this.j.toUpperCase()," "]).join("")},t(ue,le),e("H.geo.Point",ue),ue.prototype.equals=ue.prototype.w=function(e){return this===e||!!e&&this.lat===e.lat&&this.lng===e.lng&&re[this.ctx]===re[e.ctx]&&(this.alt||0)===(e.alt||0)},ue.prototype.distance=ue.prototype.K=function(e){if(this===e||this.lat===e.lat&&this.lng===e.lng)e=0;else{var t=this.lat*k,i=e.lat*k;e=12742001.58*v(f(1,u(_(p((t-i)/2),2)+m(t)*m(i)*_(p((this.lng*k-e.lng*k)/2),2))))}return e},ue.prototype.walk=ue.prototype.na=function(e,t,i){if(i){if(t/=6371000.79){e*=k;var r=k*this.lat,n=p(r),o=p(t),a=m(t),s=k*this.lng,l=m(r);r=v(l*m(e)*o+n*a),l=(e=(s+(e=y(p(e)*l*o,a-n*p(r)))+x)%(2*x)-x)*E}return t?new ue(r*E,(l+540)%360-180):this}if(0==((e=(e%360+360)%360)+90)%180)return r=this.lng+t/(6371000.79*T*m(this.lat*k))*(270===e?-360:360),new ue(this.lat,(r+540)%360-180);if(t/=6371000.79){e*=k,s=this.lat*k,n=this.lng*k,a=(o=s+t*m(e))-s,r=h(g(o/2+A)/g(s/2+A)),r=X(a/r)?m(s):a/r;var u=t*p(e)/r;c(o)>b&&(o=0<o?x-o:-(x+o))}return t?new ue(o*E,((n+u+w+(c(s+a)>b?x:0))%T-x)*E):this},ue.prototype.getBoundingBox=ue.prototype.D=function(){return new he(this.lat,this.lng,this.lat,this.lng)},ue.validate=ce,ue.fromIPoint=function e(t){if(!t)throw new ie(e,0,t);return new ue(t.lat,t.lng,t.alt,t.ctx)},ue.prototype.j="Point",ue.prototype.o=function(e){return e.push("(",this.lng," ",this.lat,")"),e},t(he,le),e("H.geo.Rect",he),he.prototype.j="Polygon",he.prototype.o=function(e){var t=this.i,i=this.c,r=this.h,n=this.g;return e.push("(","(",i," ",t,",",n," ",t,",",n," ",r,",",i," ",r,",",i," ",t,")",")"),e},he.prototype.equals=he.prototype.w=function(e){return this===e||!!e&&this.i===e.i&&this.c===e.c&&this.h===e.h&&this.g===e.g},he.prototype.clone=he.prototype.clone=function(){return new he(this.i,this.c,this.h,this.g)},he.prototype.getTopLeft=he.prototype.N=function(){return this.f||(this.f=new ue(this.i,this.c)),this.f},he.prototype.getBottomRight=he.prototype.M=function(){return this.a||(this.a=new ue(this.h,this.g)),this.a},he.prototype.getTop=he.prototype.ga=function(){return this.i},he.prototype.getBottom=he.prototype.ca=function(){return this.h},he.prototype.getLeft=he.prototype.da=function(){return this.c},he.prototype.getRight=he.prototype.fa=function(){return this.g},he.prototype.getCenter=he.prototype.A=function(){return this.b||(this.b=new ue(this.h+(this.i-this.h)/2,_e(this.c,this.s()))),this.b},he.prototype.getWidth=he.prototype.s=function(){return de(this.c,this.g)},he.prototype.getHeight=he.prototype.B=function(){return this.i-this.h},he.prototype.isCDB=he.prototype.I=function(){return this.c>this.g},he.prototype.isEmpty=he.prototype.ja=function(){return!this.s()&&!this.B()},he.prototype.getBoundingBox=he.prototype.D=function(){return new he(this.i,this.c,this.h,this.g)},he.prototype.containsLatLng=he.prototype.G=function(e,t,i){var r=this.A();return i||(e=ne(e,this.G,0),t=oe(t,this.G,1)),(e=(t=this.u(e,t,i)).A()).lat===r.lat&&e.lng===r.lng&&this.B()===t.B()&&this.s()===t.s()},he.prototype.containsPoint=he.prototype.P=function(e,t){return t||ce(e,this.P,0),this.G(e.lat,e.lng,t)},he.prototype.containsRect=he.prototype.R=function(e,t){var i=this.A();if(!(t||e instanceof he))throw new ie(this.R,0,e);return(e=(t=this.F(e,t)).A()).lat===i.lat&&e.lng===i.lng&&this.B()===t.B()&&this.s()===t.s()},he.prototype.mergeLatLng=he.prototype.u=function(e,t,i,r){if(!i){if(X(e=ne(e)))throw new ie(this.u,0,e);if(X(t=oe(t)))throw new ie(this.u,1,t)}return pe(this.i,this.c,this.h,this.g,e,t,e,t,r)},he.prototype.mergePoint=he.prototype.V=function(e,t,i){return t||ce(e,this.V,0),this.u(e.lat,e.lng,t,i)},he.prototype.mergeRect=he.prototype.F=function(e,t,i){if(!(t||e instanceof he))throw new ie(this.F,0,e);return pe(this.i,this.c,this.h,this.g,e.i,e.c,e.h,e.g,i)},he.prototype.mergeTopLeftBottomRight=he.prototype.v=function(e,t,i,r,n,o){return n||(e=ne(e,this.v,0),t=oe(t,this.v,1),i=ne(i,this.v,2),r=oe(r,this.v,3)),pe(this.i,this.c,this.h,this.g,e,t,i,r,o)},he.prototype.intersects=he.prototype.T=function(e,t){var i=this.c<=this.g,r=e.c<=e.g,n=this.c<e.g,o=e.c<this.g;if(!(t||e instanceof he))throw new ie(this.T,0,e);return this.h<=e.i&&e.h<=this.i&&(!i&&(!r||n||o)||!r&&(n||o)||n&&o)},he.merge=pe,he.fromPoints=ve,he.coverPoints=function e(t,i){var r=1,n=t.length,o=null,a=s(t);if("array"!=a&&("object"!=a||"number"!=typeof t.length))throw new ie(e,0,t);if(0<n)for(o=ve(a=t[0],a,i);r<n;r++)a=t[r],o.u(a.lat,a.lng,i,o);return o},he.coverLatLngAlts=function e(t,i){var r,n=3,o=t.length;if(!(i||t&&null!=t.length))throw new ie(e,0,t);if(0<o)for(r=new he(t[0],t[1],t[0],t[1]);n<o;n+=3)r.u(t[n],t[n+1],i,r);return r},he.coverRects=function e(t,i){var r,n=1,o=t.length;if(i&&(!t||null==t.length))throw new ie(e,0,t);if(0<o)for(r=new he(t[0].i,t[0].c,t[0].h,t[0].g);n<o;n++)r.F(t[n],i,r);return r},he.prototype.resizeToCenter=he.prototype.W=function(e,t){var i=this.c,r=this.i,n=this.g,o=this.h,a=this.A().lng;ce(e,this.W,0);var s=e.lat-o-(r-o)/2,l=e.lng-a;return e=(e=i+((l=180<l||l<-180?-(a+e.lng):l)<0?2*l:0))<-180?360+e:e,n=180<(n+=0<l?2*l:0)?n-360:n,90<=(r=0<s?r+2*s:r)&&(r=90),(o=s<0?o+2*s:o)<=-90&&(o=-90),t?fe(t,r,e,o,n):new he(r,e,o,n)};var ge={Z:0,$:1,X:2,Y:3};function ye(e,t,i){var r,n;if(e.U&&(r=e.f))for(n=3;0<=n;n--){var o=t[n];if(n%3?o>=r[n]:o<=r[n]){if(!i){e.f=null;break}r[n]=o}}}function xe(e,t){var i,r=e.a;if(t){var n=t;if(n!==r)for(r=n;n=n.f;)(n.entries||1<n.a)&&(r=n)}else for(;!r.entries&&(i=r.a)<2&&i;)r=n;e.a=r}me.prototype.remove=function(e){var t,i,r,n=!1;if(e&&(t=e.b)&&t.b===this&&(i=t.entries)&&0<=(r=i.indexOf(e))){var o,a;for(i.splice(r,1),i=this.a;t;)if((o=t.entries)&&o.length||(o&&delete t.entries,t.a||!(a=t.f)))t=q;else{r=a;var s=(n=t).j;r[s]===n&&(delete r[s],delete n.f,--r.a),i===t&&(i=a),t=a}this.a!==i&&(this.a=i,xe(this)),ye(this,e,!1),n=!0}return n},me.prototype.l=function(e,t,i,r){var n=[],o=this.a,a=this.b;return e<=o[5]&&t<=o[6]&&i>o[7]&&r>o[4]&&function e(t,i,r,n,o,a,s,l,u){var c,h=i.entries,f=i[7],d=i[4],_=i[5],p=i[6],v=i[8],m=i[9];if(h){var g=h.length;if(d<o||f<n||s<p||a<_)for(;g--;){f=h[g],d=f[3],_=f[0],p=f[1];var y=f[2];o<=y&&n<=p&&(_<s||l&&_==s)&&(d<a||u&&d==a)&&r.push(f)}else for(;g--;)r.push(h[g])}v<a&&(o<m&&(c=i[ge.$])&&e(t,c,r,n,o,a,s,l,u),m<s&&(c=i[ge.Y])&&e(t,c,r,n,o,a,s,l,u));n<v&&(o<m&&(c=i[ge.Z])&&e(t,c,r,n,o,a,s,l,u),m<s&&(c=i[ge.X])&&e(t,c,r,n,o,a,s,l,u))}(this,o,n,e,t,i,r,r>=a[6],i>=a[5]),n};var be=0;function Ae(e,t,i,r,n,o){this.j=t,e&&(this.f=e,this.b=e.b,n=1&t?(i=e[8],e[5]):(i=e[7],e[8]),o=2&t?(r=e[9],e[6]):(r=e[4],e[9])),this[7]=i,this[5]=n,this[8]=(i+n)/2,this[4]=r,this[6]=o,this[9]=(r+o)/2}function Te(e,t,i,r,n,o){Te.ma.constructor.apply(this,arguments)}function we(e,t,i,r,n,o,a){var s,l,u=t[8],c=t[9];return a&&(n<u||(s=u<=i))&&(o<c||(l=c<=r))?i=(u=we)(e,t=t[s|=l<<1]||(++t.a,t[s]=new Ae(t,s)),i,r,n,o,a-1):(r=i=new ke(i,r,n,o),(t.entries||(t.entries=[])).push(r),r.b=t,ye(e,i,!0),xe(e,t)),i}function ke(e,t,i,r){this.a=be++,this[0]=t,this[1]=i,this[2]=r,this[3]=e}function Ee(e){this.o=new Te(+e||10,180,90,0,0,!0),this.j=[],this.C=!1,this.a=this.b=this.f=null}function Me(e,t,i,r,n,o){if(o)o=new ke(n,-t,i+360,-r),e.j.push(o),e.C=!0,e.a&&e.a.v(t,i,r,n,!0,e.a);else{var a=-t,s=-r,l=(o=e.o).b,u=l[5],c=l[6];if(!(l[7]<=i&&l[4]<=a&&(n<u||u===n&&u===l.b.b[5])&&(s<c||c===s&&c===l.b.b[6])))throw Error("Coordinates out of bounds");o=we(o,o.b,i,a,n,s,o.ka),e.b&&e.b.v(t,i,r,n,!0,e.b)}return e.f=null,o}function Re(e,t,i,r,n){var o,a=(e=e.j).length,s=[];if(a){var l=i+360;for(o=n+360;a--;){var u=e[a];Se(u,t,i,r,n)?s.push(u):Se(u,t,l,r,o)&&s.push(u)}}return s}function Se(e,t,i,r,n){var o=e[3],a=e[1],s=e[2];return e[0]<r&&o<n&&t<=s&&i<=a}function Pe(e,t){var i,r,n;if(i=t.length){var o=e.length;for(r={};o--;)r[e[o].a]=1;for(;i--;)(n=t[i]).a in r||e.push(n)}}Ae.prototype.a=0,t(Te,me),e("H.geo.QuadTree",Ee),Ee.prototype.I=function(){return this.C},Ee.prototype.D=function(){var e;if(!this.f){var t,i,r,n,o=[];if(t=!this.b){var a=this.o,s=a.f;a.U&&!s&&((t=a.a).entries||t[0]||t[1]||t[2]||t[3])&&(s=function e(t,i){var r,n,o,a,s=0;for(r=3;0<=r;r--){var l=r+4,u=0<r%3,c=[],h=i[r],f=t[r];for(n=f.length;n--;){var d=f[n];if(o=d.entries)for(a=o.length;a--;){var _=o[a][r];(u?h<_:_<h)&&(h=_)}for(a=4;a--;)(o=d[a])&&(u?o[l]>h:o[l]<h)&&c.push(o)}s+=c.length,i[r]=h,t[r]=c}return s&&(i=e(t,i)),i}([s=[t],s,s,s],[t[6],t[7],t[4],t[5]]),a.f=s),t=a=s}if(t&&(this.b=new he(-a[0],a[3],-a[2],a[1])),(e=this.b)&&o.push(e),!this.a&&(n=(r=this.j).length)){for(t=360,s=-(a=90),i=0;n--;){var l=r[n];a=f(a,l[0]),t=f(t,l[3]),s=d(s,l[2]),i=d(i,l[1])}this.a=new he(-a,t,-s,i-360)}(e=this.a)&&o.push(e),(e=o[0])&&(o[1]&&(e=e.F(o[1],!0)),this.f=e)}return this.f},Ee.prototype.insertBoundingBox=Ee.prototype.ha=function(e){var t=e.N(),i=e.M();return(e=e.I())?Me(this,t.lat,i.lng,i.lat,t.lng,e):Me(this,t.lat,t.lng,i.lat,i.lng,e)},Ee.prototype.remove=Ee.prototype.remove=function(e){var t;if(e.b){var i=this.o.remove(e);this.b=null}else(i=0<=(e=(t=this.j).indexOf(e)))&&(t.splice(e,1),this.C=0<t.length,this.a=null);return i&&(this.f=null),i},Ee.prototype.intersectBoundingBox=Ee.prototype.ia=function(e){var t=this.o,i=e.N(),r=e.M(),n=-i.lat;i=i.lng;var o=-r.lat;return r=r.lng,n==o||i===r?e=[]:e.I()?(Pe(e=t.l(-180,n,r,o),t.l(i,n,180,o)),Pe(e,Re(this,n,r,o,i+360))):Pe(e=t.l(i,n,r,o),Re(this,n,i,o,r)),e}}).call(vl);var ml=pl={};function gl(e){return wr(vl.H.math.Point,Pr(e))}pl.clipPolygon=function(e,t){var i,r,n,o,a=[];if(i=vl.H.math.clipping.clipPolygon(e.map(gl),t.map(gl)))do{for(r=[],n=i;r.push([(o=n).x,o.y]),n=n.next;);a.push(r)}while(i=i.nextPoly);else pl.isPointInsidePolygon(t[0],e)?a.push(t):pl.isPointInsidePolygon(e[0],t)&&a.push(e);return a},pl.isPointInsidePolygon=function(e,t){for(var i,r,n=t.length,o=new Int32Array(2*n);n--;)i=t[n],o[r=n<<1]=i[0],o[1+r]=i[1];return vl.H.math.isCoveredBy(e[0],e[1],o,0,!0)!==vl.H.math.CoverType.NONE},pl.clamp=function(e,t,i){return(e-=0)>i?i:e<t?t:e},pl.splitLegs=function(e,t){var i=[];e.push(e[0]);for(var r=0;r<e.length-1;r++){var n=e[r],o=e[r+1];if(i.push(n),Math.abs(o[0]-n[0])>=t){var a=[(n[0]+o[0])/2,(n[1]+o[1])/2];i.push(a)}}return i.length!==e.length-1?pl.splitLegs(i,t):i},pl.getBBox=function(e){var t=1/0,i=1/0,r=-1/0,n=-1/0;return e.forEach(function(e){e[0]<t&&(t=e[0]),e[1]<i&&(i=e[1]),e[0]>r&&(r=e[0]),e[1]>n&&(n=e[1])}),[t,i,r,n]},pl.getBBoxCenter=function(e){var t=Sr(e,4),i=t[0],r=t[1];return[i+(t[2]-i)/2,r+(t[3]-r)/2]},pl.getLineLength=function(e,t,i,r){return Math.sqrt(Math.pow(e-i,2)+Math.pow(t-r,2))};var yl=Jr.metersToLatLng([Jr.half_circumference_meters,Jr.half_circumference_meters]),xl=Math.log(Jr.tile_size)/Math.LN2;function bl(e){var t=e.x,i=e.y,r=e.z;return{row:i===Math.pow(2,r)-1,column:t===Math.pow(2,r)-1}}var Al=function(){function g(e,t){var i;return mr(this,g),i=Mr(this,Ar(g).call(this,e,t)),Lr.is_worker&&(i._quad_tree=new vl.H.geo.QuadTree,i._marker_quad_tree=new vl.H.geo.QuadTree,i._tree_entries_by_object_id={},i._groups_by_id={}),Lr.is_main&&(i._objects_by_id={},i._commands=[],i._sendCommands=nn(i._sendCommands,100,200)),i}return br(g,uo),yr(g,[{key:"onReady",value:function(){var e=this;this._synced_at=this.provider.getInvalidations().getMark();var t,i,r=this.provider.getRootGroup(),n=r.getObjects(!0),o=[];for(n.push(r),t=n.length;t--;)i=n[t],this._isObjectSupported(i)&&this._shouldBeStored(i)&&(this._objects_by_id[i.getId()]=i,o.push(i.forWorkerMessage()));Cr.postMessage(this.worker,this.target_name+".addObjects",o).then(function(){return e.dispatchUpdate()})}},{key:"onProviderUpdate",value:function(e){var t=e.target,i=e.currentTarget.getInvalidations(t.type);if(this._isObjectSupported(t)){var r=this._synced_at,n=t.getId();i.isRemove(r)?this._hasSameVolatility(t)&&(delete this._objects_by_id[n],this._commands.push({method_name:"removeObjectsByIds",arguments:[[n]]})):i.isAdd(r)?this._shouldBeStored(t)&&(this._objects_by_id[n]=t,this._commands.push({method_name:"addObjects",arguments:[[t.forWorkerMessage()]]})):this.has_volatile_data&&(i.isSpatial(r)||i.isVisual(r))?this._shouldBeStored(t)&&(this._objects_by_id[n]=t,this._sendImmediateCommands([{method_name:"removeObjectsByIds",arguments:[[n]]},{method_name:"addObjects",arguments:[[t.forWorkerMessage()]]}])):i.isSpatial(r)||i.isVisual(r)||i.isZOrder(r)?this._shouldBeStored(t)&&(delete this._objects_by_id[n],this._commands.push({method_name:"removeObjectsByIds",arguments:[[n]]}),this._objects_by_id[n]=t,this._commands.push({method_name:"addObjects",arguments:[[t.forWorkerMessage()]]})):i.isVolatility(r)&&(delete this._objects_by_id[n],this._commands.push({method_name:"removeObjectsByIds",arguments:[[n]]}),this._shouldBeStored(t)&&(this._objects_by_id[n]=t,this._commands.push({method_name:"addObjects",arguments:[[t.forWorkerMessage()]]}))),this._commands.length&&this._sendCommands()}this._synced_at=i.getMark()}},{key:"_shouldBeStored",value:function(e){return 5===e.type||(!e.getIcon||1===e.getIcon().getState())&&this._hasSameVolatility(e)}},{key:"_hasSameVolatility",value:function(e){return e.getVolatility(!0)===this.has_volatile_data}},{key:"hasPendingCommands",value:function(){return 0<this._commands.length}},{key:"_sendCommands",value:function(){this._sendImmediateCommands(this._commands),this._commands=[]}},{key:"_sendImmediateCommands",value:function(e){var t=this;Cr.postMessage(this.worker,this.target_name+".executeCommands",e).then(function(){t.dispatchUpdate()})}},{key:"_isObjectSupported",value:function(e){return e.forWorkerMessage&&4!==e.type}},{key:"getSyncedAt",value:function(){return this._synced_at}},{key:"getMapObjectById",value:function(e){return this._objects_by_id[e]}},{key:"getIconBitmapByObjectId",value:function(e,t){var i=this.getMapObjectById(e);if(i){var r=i.getIcon();if(r.uid===t&&1===r.getState()){var n=r.getSize();return _l(r.getBitmap(),n.w,n.h)}}}},{key:"fetchFeaturesForTile",value:function(e){var t=[],i=[],r=[],n=[],o=[],a=this._marker_quad_tree.intersectBoundingBox(this.getTileBoundingBox(e.coords));e.source_data.error=null;for(var s={},l=hl("binary-tree"),u=0;u<a.length;u++){var c=fl({},a[u].$feature$);c.geometry.coordinates=pa.deepClone(a[u].$geoCoordinates$),c.properties.zInfo=this._getZInfo([],c),t.push(c);var h=c.properties.icon;s[h.id]||(l.addItem({width:h.size.w,height:h.size.h,meta:{objectId:c.id,id:h.id}}),s[h.id]=!0)}a=this._quad_tree.intersectBoundingBox(this.getTileBoundingBox(e.coords,100));for(var f=0;f<a.length;f++){var d=fl({},a[f].$feature$);if(d.geometry.coordinates=pa.deepClone(a[f].$geoCoordinates$),d.properties.zInfo=this._getZInfo([],d),d.properties.overlay)i.push(d);else if(d.geometry.type.includes("LineString"))r.push(d);else if(d.geometry.type.includes("Polygon")){n.push(d);var _=fl({},d);o.push(_)}}e.rasters=l.export(),t.sort(function(e,t){return g._compareZInfo(t,e)}),n.sort(g._compareZInfo),i.sort(g._compareZInfo);var p=this.has_volatile_data?16380:0;o.sort(g._compareZInfo);for(var v=0;v<o.length;v++)o[v].properties.effectiveZIdx=p++;r.sort(g._compareZInfo);for(var m=0;m<r.length;m++)r[m].properties.effectiveZIdx=p++;e.source_data.layers.markers={type:"FeatureCollection",features:t},e.source_data.layers.polylines={type:"FeatureCollection",features:r},e.source_data.layers.polygons={type:"FeatureCollection",features:n},e.source_data.layers.outlines={type:"FeatureCollection",features:o},e.source_data.layers.overlays={type:"FeatureCollection",features:i}}},{key:"getTileBoundingBox",value:function(e,t){var i=1<arguments.length&&void 0!==t?t:0,r=Jr.wrapTile(e,{x:!0}),n=Jr.metersForTile(r),o=Jr.metersPerPixel(r.z),a=Jr.metersToLatLng([n.x-i*o,n.y+i*o]),s=Jr.metersToLatLng([n.x+(this.tile_size+i)*o,n.y-(this.tile_size+i)*o]),l=bl(r);return new vl.H.geo.Rect(0===e.y?90:ml.clamp(a[1],-90,90),ml.clamp(a[0],-180,180),l.row?-90:ml.clamp(s[1],-90,90),l.column?180:ml.clamp(s[0],-180,180))}},{key:"tileTexture",value:function(e){var t=e.source_data.layers.overlays;if(t){var i=this.name+"_"+e.coords.key,r=aa.coordinateWithMaxZoom(e.coords,this.max_zoom),n=t.features[0].properties.overlays_config;return{name:i,filtering:this.filtering,coords:r,width:Jr.tile_size,height:Jr.tile_size,overlays_config:n,source:this.name}}}},{key:"_load",value:function(e,t){this.fetchFeaturesForTile(e);var i={indexMaxZoom:0,maxZoom:this.max_zoom,tolerance:1.5,extent:Jr.tile_scale},r=Jr.wrapTile(e.coords,{x:!0}),n=e.source_data.layers.overlays;n.features.length&&delete e.source_data.layers.overlays;var o=e.source_data.layers.markers;for(var a in o.features.length&&delete e.source_data.layers.markers,e.source_data.layers){var s=e.source_data.layers[a];if(s.features.length){i.buffer=a.includes("lines")?100*Jr.units_per_pixel:0;var l=ro(s,i).getTile(r.z,r.x,r.y);e.source_data.layers[a]=zn(l)}}return e.source_data.layers.overlays=this._processOverlays(e,n),e.source_data.layers.markers=this._processMarkers(e,o),t(e),Promise.resolve(e)}},{key:"_processMarkers",value:function(e,t){var i=t.features.length;if(i){for(var n=Jr.unitsPerMeter(e.coords.z),r=Jr.wrapTile(e.coords,{x:!0}),o=Jr.metersForTile(r),a=bl(r),s=Jr.tile_scale,l=function(e){_n.coordsToMeters(e),_n.metersToTileUnits(n,o,e);var t=Sr(e,2),i=t[0],r=t[1];return 0<=i&&(a.column||i<s)&&0<=r&&(a.row||r<s)},u=[],c=0;c<i;c++){var h=t.features[c].geometry,f=!1;if("Point"===h.type){var d=h.coordinates;l(d)?h.coordinates=d:f=!0}else"MultiPoint"===h.type&&(h.coordinates=h.coordinates.filter(l),0===h.coordinates.length&&(f=!0));f||u.push(t.features[c])}t.features=u}return t}},{key:"_processOverlays",value:function(t,e){var i=this;if(!e.features.length)return e;var r={coords:t.coords,min:Jr.metersForTile(Jr.wrapTile(t.coords,{x:!0}))},n={coords:t.coords,source_data:{layers:{_default:{type:"FeatureCollection",features:e.features}}}},h=Math.pow(2,t.coords.z+xl);uo.projectData(n.source_data),uo.scaleData(n.source_data,r);var o=e.features.map(function(e){var t=e.geometry.coordinates[0],i=t[0],r=t[5===t.length?2:3],n=Math.floor(i[0]/Jr.tile_scale*Jr.tile_size),o=Math.floor(i[1]/Jr.tile_scale*Jr.tile_size),a=Math.floor(r[0]/Jr.tile_scale*Jr.tile_size),s=Math.floor(r[1]/Jr.tile_scale*Jr.tile_size)-o,l=a<=n,u=l?h-(n-a):a-n,c=[];return n<=Jr.tile_size&&c.push([n,o,u,s]),l&&0<a&&c.push([n-h,o,u,s]),{id:e.id,properties:e.properties,texcoords:c}}).filter(function(e){return i.isVisible(e.properties,t.style_zoom)}),a=Jr.tile_scale;return t.pad_scale=this.pad_scale,t.default_winding="CW",e.features=o.length?[{geometry:{type:"Polygon",coordinates:[[[0,0],[a,0],[a,a],[0,a],[0,0]]]},properties:{overlays_config:o}}]:o,e}},{key:"executeCommands",value:function(e){for(var t=0;t<e.length;t++){var i=e[t];this[i.method_name].apply(this,i.arguments)}}},{key:"addObjects",value:function(e){for(var t=0;t<e.length;t++){var i=e[t];if("Group"===i.type)i.$children_ids$={},this._groups_by_id[i.id]=i;else{var r=i.geometry.boundingBox;g._preprocessGeometry(i.geometry);var n=new vl.H.geo.Rect(ml.clamp(r[0],-yl[1],yl[1]),r[1],ml.clamp(r[2],-yl[1],yl[1]),r[3]),o=-1!==i.geometry.type.indexOf("Point")?this._marker_quad_tree:this._quad_tree,a=o.insertBoundingBox(n);a.$tree=o,a.$geoCoordinates$=pa.deepClone(i.geometry.coordinates),a.$feature$=i,this._tree_entries_by_object_id[i.id]=a}}for(var s=0;s<e.length;s++){var l=e[s];if(l.properties.parent)this._groups_by_id[l.properties.parent].$children_ids$[l.id]=l.id}}},{key:"removeObjectsByIds",value:function(e,t){for(var i=!(1<arguments.length&&void 0!==t)||t,r=0;r<e.length;r++){var n=e[r],o=void 0,a=void 0;(o=this._tree_entries_by_object_id[n])?(delete this._groups_by_id[o.$feature$.properties.parent].$children_ids$[n],o.$tree.remove(o),delete this._tree_entries_by_object_id[n]):(a=this._groups_by_id[n])&&(a.properties.parent&&delete this._groups_by_id[a.properties.parent].$children_ids$[n],i&&this.removeObjectsByIds(Object.keys(a.$children_ids$)),delete this._groups_by_id[n])}}},{key:"updateObjects",value:function(e){this.removeObjectsByIds(e.map(g._getObjectId),!1),this.addObjects(e)}},{key:"_getZInfo",value:function(e,t){var i=t.properties.zIdx,r=t.properties.sIdx;return e[0]|=void 0!==i,e.splice(1,0,i||0,r<0?t.id:r),0===t.properties.parent?e:this._getZInfo(e,this._groups_by_id[t.properties.parent])}},{key:"isVisible",value:function(e,t){if(e.overlays_config)return!0;var i=e.visible,r=e.min<=t&&e.max>=t,n=!e.parent||this.isVisible(this._groups_by_id[e.parent].properties,t);return i&&r&&n}}],[{key:"_getObjectId",value:function(e){return e.id}},{key:"_compareZInfo",value:function(e,t){for(var i,r=e.properties.zInfo,n=t.properties.zInfo,o=r.length,a=n.length,s=Math.min(o,a),l=1;l<s;l++)if(i=r[l]-n[l])return i;return o-a}},{key:"_preprocessGeometry",value:function(e){var t=e.type;e.coordinates="Point"===t?g._processPointCoordinates(e.coordinates):"MultiPoint"===t?e.coordinates.map(g._processPointCoordinates):"LineString"===t?g._processLineStringCoordinates(e.coordinates):"MultiLineString"===t?e.coordinates.map(g._processLineStringCoordinates):"Polygon"===t?e.coordinates.map(g._processPolygonCoordinates):"MultiPolygon"===t?e.coordinates.map(g._processMultiPolygonCoordinates):[],delete e.boundingBox}},{key:"_processPointCoordinates",value:function(e){return[e[1],e[0],e[2]]}},{key:"_processLineStringCoordinates",value:function(e){return g._latLngAltArrayToLineString(e,!1)}},{key:"_processPolygonCoordinates",value:function(e){return g._latLngAltArrayToLineString(e,!0)}},{key:"_processMultiPolygonCoordinates",value:function(e){return e.map(g._processPolygonCoordinates)}},{key:"_latLngAltArrayToLineString",value:function(e,t){for(var i=[],r=e.length,n=0;n<r;n+=3)i.push([e[n+1],e[n]]);return t&&i.push([e[1],e[0]]),i}}]),g}();uo.register(Al,"ObjectSource");var Tl=1,wl=2,kl=3,El=function(){function e(){mr(this,e),this._map={}}return yr(e,[{key:"set",value:function(e,t,i){if(this._map[e])this._map[e].accumulator.add(i);else{var r=new Set;r.add(i),this._map[e]={value:t,accumulator:r}}}},{key:"get",value:function(e){return this._map[e]&&this._map[e].value}},{key:"delete",value:function(e,t){var i=this._map[e];i&&i.accumulator&&(i.accumulator.delete(t),0===i.accumulator.size&&delete this._map[e])}}]),e}(),Ml=function(){function r(e,t){var i;return mr(this,r),i=Mr(this,Ar(r).call(this,e,t)),Lr.is_worker?i._loading={}:i._icons=new El,i}return br(r,uo),yr(r,[{key:"onProviderUpdate",value:function(e){e.target instanceof H.map.provider.Tile?this.dispatchUpdate(e.target):this.dispatchUpdate()}},{key:"onReady",value:function(){var e=this.provider;e.setTileCanvasRendering&&e.setTileCanvasRendering(!1),e.providesMarkers()&&(this._onCacheDrop=this._onCacheDrop.bind(this),e.getCache().registerOnDrop(this._onCacheDrop)),this.dispatchUpdate()}},{key:"dispose",value:function(){Rr(Ar(r.prototype),"dispose",this).call(this);var e=this.provider;e.providesMarkers()&&e.getCache().deRegisterOnDrop(this._onCacheDrop)}},{key:"_onCacheDrop",value:function(e,t,i){this.provider.cacheFilter(e)&&this._deleteIcons(e,t.data)}},{key:"_deleteIcons",value:function(e,t){for(var i=0,r=t.length;i<r;i++){var n=t[i].getIcon();this._icons.delete(n.uid,e)}}},{key:"getIconBitmapByObjectId",value:function(e,t){var i=this._icons.get(t);return i&&i.getBitmap()}},{key:"requestMarkerTile",value:function(t){var s=this;return new Promise(function(a,e){s.provider?s.provider.requestTileAsPromise(t.x,t.y,t.z,!1).then(function(e){var t,i,r=[];if(e.data)for(i=(t=e.data).length;i--;){var n=t[i],o=n.getIcon();s._icons.set(o.uid,o,e.key),r.push(n.forWorkerMessage())}a(r)}):a([])})}},{key:"requestSpatialTile",value:function(t){var i=this;return new Promise(function(o,e){i.provider?i.provider.requestTileAsPromise(t.x,t.y,t.z,!1).then(function(e){var t,i=[];if(e.getObjects){t=e.getObjects();for(var r=0;r<t.length;r++){var n=t[r];i.push({id:n.getId(),geometries:n.getGeometriesForTile(e),isClosed:n.isClosed(),style:n.getStyle().forWorkerMessage()})}}o(i)}):o([])})}},{key:"_pointToArray",value:function(e){var t=Jr.tile_scale/this.tile_size;return[e.x*t,e.y*t]}},{key:"_getGeoJsonMultiPolygon",value:function(e){for(var t=e.geometries,i=t.length,r=[],n={coordinates:r,type:"MultiPolygon"},o=0;o<i;o++){var a=t[o],s=a.paths,l=s.length,u=a.interiorsIndex,c=a.outlinesIndex,h=Math.min(u,c,l),f=void 0,d=void 0;for(d=0;d<h;d++)f=[s[d].map(this._pointToArray,this)],r.push(f);if(1===h)for(h=Math.min(c,l),d=u;d<h;d++)f.push(s[d].map(this._pointToArray,this))}return n}},{key:"_getGeoJsonMultiLineString",value:function(e,t){for(var i=1<arguments.length&&void 0!==t&&t,r={coordinates:[],type:"MultiLineString"},n=e.geometries,o=0;o<n.length;o++)for(var a=n[o],s=i?a.outlinesIndex:0,l=i?a.paths.length:Math.min(a.interiorsIndex,a.outlinesIndex,a.paths.length),u=s;u<l;u++){var c=a.paths[u].map(this._pointToArray,this);r.coordinates.push(c)}return r}},{key:"_getGeoJsonGeometry",value:function(e,t){var i;return(i=t===Tl?this._getGeoJsonMultiPolygon(e):this._getGeoJsonMultiLineString(e,t===kl)).coordinates.length?i:null}},{key:"_load",value:function(f,n){var d=this,o=f.coords;return new Promise(function(e,t){var i=d._loading[o.x+"_"+o.y+"_"+o.z];i||(i=Cr.postMessage(d.target_name+".requestMarkerTile",f.coords).then(d._prepareTileData.bind(d,f)),d._loading[o.x+"_"+o.y+"_"+o.z]=i);var r=new Promise(function(h,e){Cr.postMessage(d.target_name+".requestSpatialTile",f.coords).then(function(e){for(var t=[],i=[],r=[],n=0;n<e.length;n++){var o=e[n],a=void 0,s=void 0;s=o.isClosed?(a=i,Tl):(a=t,wl);var l=d._getGeoJsonGeometry(o,s);if(l){var u={id:o.id,type:"Feature",properties:{style:o.style},geometry:l};s===wl&&(u.properties.effectiveZIdx=t.length),a.push(u)}var c=d._getGeoJsonGeometry(o,kl);c&&r.push({id:o.id,type:"Feature",properties:{style:o.style,effectiveZIdx:r.length},geometry:c})}f.source_data.layers.polylines={type:"FeatureCollection",features:t},f.source_data.layers.polygons={type:"FeatureCollection",features:i},f.source_data.layers.outlines={type:"FeatureCollection",features:r},h(f)})});Promise.all([i,r]).then(function(){n(f),e(f)})})}},{key:"_prepareTileData",value:function(e,t){var i=e.coords;delete this._loading[i.x+"_"+i.y+"_"+i.z];var r=Jr.wrapTile(e.coords,{x:!0,y:!0}),n=Jr.metersForTile(r);e.source_data.layers={markers:{features:t,type:"FeatureCollection"}};var o={coords:r,min:n},a=e.source_data,s=hl("binary-tree"),l={};for(var u in a.layers)for(var c=a.layers[u].features.length,h=0;h<c;h++){var f=a.layers[u].features[h],d=f.properties.icon;l[d.id]||(s.addItem({width:d.size.w,height:d.size.h,meta:{objectId:f.id,id:d.id}}),l[d.id]=!0),Jr.transformGeometry(f.geometry,function(e){var t=e[0];e[0]=e[1],e[1]=t})}return e.rasters=s.export(),uo.projectData(e.source_data),uo.scaleData(e.source_data,o),e}}]),r}();uo.register(Ml,"ObjectTileSource");var Rl=function(){function r(e,t){var i;return mr(this,r),(i=Mr(this,Ar(r).call(this,e,t))).uid_=e.uid,i}return br(r,sa),yr(r,[{key:"initialize",value:function(e,t,i,r){this.provider=e,this._on_update=t,this._onProviderUpdate=this._onProviderUpdate.bind(this),e.addEventListener("update",this._onProviderUpdate)}},{key:"_onProviderUpdate",value:function(e){this._on_update(this.name)}},{key:"tileTexture",value:function(e){return Object.assign(Rr(Ar(r.prototype),"tileTexture",this).call(this,e),{uid:this.uid_,url:this.uid_+"_"+e.coords.key,coords:e.coords})}},{key:"dispose",value:function(){this.provider.removeEventListener("update",this._onProviderUpdate)}}]),r}();_n.register(Rl,"RemoteRasterTileSource");var Sl={type:"FeatureCollection",features:[]},Pl=function(){function i(e,t){return mr(this,i),e.tiled=!0,e.url="",Mr(this,Ar(i).call(this,e,t))}return br(i,uo),yr(i,[{key:"fetchTile",value:function(e,t,i){return this.provider?this.provider.requestTileAsPromise(e,t,i).then(function(e){return e.data}):Promise.resolve(Sl)}},{key:"_load",value:function(r,n){var o=Jr.wrapTile(r.coords,{x:!0,y:!0}),a={indexMaxZoom:0,maxZoom:this.max_zoom,tolerance:1.5,extent:Jr.tile_scale};return Cr.postMessage(this.target_name+".fetchTile",o.x,o.y,o.z).then(function(e){for(var t in r.source_data.layers="FeatureCollection"===e.type?{_default:e}:e,r.source_data.layers){var i=ro(r.source_data.layers[t],a).getTile(o.z,o.x,o.y);r.source_data.layers[t]=zn(i)}return n(r),r})}},{key:"onReady",value:function(){this.dispatchUpdate()}}]),i}();_n.register(Pl,"GeoJSONTileSource");var zl,Nl={layers:{_default:{type:"FeatureCollection",features:[{type:"Point",geometry:{}}]}}},Ol=function(){function i(e,t){return mr(this,i),e.max_zoom=0,Mr(this,Ar(i).call(this,e,t))}return br(i,_n),yr(i,[{key:"load",value:function(e){return e.source_data="0/0/0"===e.coords.key?Nl:void 0,Promise.resolve(e)}}]),i}();_n.register(Ol,"SkyBox");var Il=zl={draw_label_collision_boxes:!1,draw_label_texture_boxes:!1,suppress_label_fade_in:!1,suppress_label_snap_animation:!1,show_hidden_labels:!1,layer_stats:!1};var Ll,Cl=0,Fl=1;function Dl(t,e){var i={};return e.forEach(function(e){return i[e]=t[e]}),i}var jl=Ll={},Ul=0;Ll.getContext=function(e,t){var i=!1;null==e&&((e=document.createElement("canvas")).style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex=-1,document.body.appendChild(e),i=!0);var r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);if(!r)throw new Error("Couldn't create WebGL context.");return r._tangram_id=Ul++,i?(Ll.resize(r,window.innerWidth,window.innerHeight,t.device_pixel_ratio),window.addEventListener("resize",function(){Ll.resize(r,window.innerWidth,window.innerHeight,t.device_pixel_ratio)})):Ll.resize(r,parseFloat(e.style.width),parseFloat(e.style.height),t.device_pixel_ratio),r},Ll.resize=function(e,t,i,r){e.canvas.style.width=t+"px",e.canvas.style.height=i+"px",e.canvas.width=Math.round(t*r),e.canvas.height=Math.round(i*r),e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,e.canvas.width,e.canvas.height)};var Gl={parseUniforms:function(e){var t=[];for(var i in e){var r,n=i,o=e[i];if("number"==typeof o)t.push({type:"float",method:"1f",name:i,value:o,key:n,uniforms:e});else if(Array.isArray(o)){if("number"==typeof o[0])2<=o.length&&o.length<=4?t.push({type:"vec"+o.length,method:o.length+"fv",name:i,value:o,key:n,uniforms:e}):4<o.length&&t.push({type:"float[]",method:"1fv",name:i+"[0]",value:o,key:n,uniforms:e});else if("string"==typeof o[0])for(r=0;r<o.length;r++)t.push({type:"sampler2D",method:"1i",name:i+"["+r+"]",value:o[r],key:r,uniforms:o});else if(Array.isArray(o[0])&&"number"==typeof o[0][0]&&2<=o[0].length&&o[0].length<=4)for(r=0;r<o.length;r++)t.push({type:"vec"+o[0].length,method:o[r].length+"fv",name:i+"["+r+"]",value:o[r],key:r,uniforms:o})}else"boolean"==typeof o?t.push({type:"bool",method:"1i",name:i,value:o,key:n,uniforms:e}):"string"==typeof o&&t.push({type:"sampler2D",method:"1i",name:i,value:o,key:n,uniforms:e})}return t},defineVariable:function(e,t){var i,r;if("number"==typeof t)i="float";else if(Array.isArray(t))"number"==typeof t[0]?2<=t.length&&t.length<=4?i="vec"+t.length:(i="float",r=t.length):"string"==typeof t[0]&&(i="sampler2D",r=t.length);else if("boolean"==typeof t)i="bool";else{if("string"!=typeof t)return;i="sampler2D"}var n="";return n+="".concat(i," ").concat(e),r&&(n+="[".concat(r,"]")),n+=";\n"},defineUniform:function(e,t){var i=Gl.defineVariable(e,t);if(i)return"uniform "+i},isUniformDefined:function(e,t){var i=new RegExp("uniform[^;]+(?:{[\\s\\S]*})?[^;]*\\b"+e+"\\b","g");return!!t.match(i)},isSymbolReferenced:function(e,t){var i=new RegExp("\\b"+e+"\\b","g");return 0<=t.search(i)},expandVec3:function(e){var t,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;if(Array.isArray(e)){if(2!==e.length)return e;t=[].concat(Pr(e),[i]).map(parseFloat)}else t=[e,e,e].map(parseFloat);if(t&&t.every(function(e){return"number"==typeof e&&!isNaN(e)}))return t},expandVec4:function(e){var t,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;if(Array.isArray(e)){if(3!==e.length)return e;t=[].concat(Pr(e),[i]).map(parseFloat)}else t=[e,e,e,i].map(parseFloat);if(t&&t.every(function(e){return"number"==typeof e&&!isNaN(e)}))return t}},Bl=[];function Vl(t,e){var i=Bl.filter(function(e){return e[0]===t})[0];return(i=i&&i[1])||(Bl.push([t,{}]),i=Bl[Bl.length-1][1]),i[e]||(i[e]=t.getExtension(e)),i[e]}function ql(e){var t,i,r=0;if(0===e.length)return r;for(t=0,i=e.length;t<i;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r}var Hl=i(function(e){var r="(.|[\\r\\n]|\\n)*?\\*\\/\\n?\\n?",n=/(^|[^\S\n])(?:\/\/)([\s\S]+?)$/gm,o=/(^|[^\S\n])(?:\/\/[^!])([\s\S]+?)$/gm,i=e.exports=function(e,t){return e?i.block(i.line(e,t),t):""};i.block=function(e,t){t=t||{};var i=new RegExp("\\/\\*"+r,"gm");return t.safe&&(i=new RegExp("\\/\\*(?!\\*?\\!)"+r,"gm")),e?e.replace(i,""):""},i.line=function(e,t){var i=n;return(t=t||{}).safe&&(i=o),e?e.replace(i,""):""}}),Yl=function(e){e=String(e);var t,i=[];for(;t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var r=(a=t[1].trim()).split(":"),n=r.slice(2).join(":").trim(),o=parseInt(r[0],10),a=parseInt(r[1],10);i.push({message:n,file:o,line:a})}return i};var Wl=/^\s*#pragma.*$/gm,Xl=/\\\s*\n/gm,Zl=function(){function f(e,t,i,r){mr(this,f),r=r||{},this.gl=e,this.program=null,this.compiled=!1,this.compiling=!1,this.error=null,this.defines=Object.assign({},r.defines||{}),this.blocks=Object.assign({},r.blocks||{}),this.block_scopes=Object.assign({},r.block_scopes||{}),this.extensions=r.extensions||[],this.dependent_uniforms=r.uniforms,this.uniforms={},this.attribs={},this.vertex_source=t,this.fragment_source=i,this.id=f.id++,this.name=r.name}return yr(f,[{key:"destroy",value:function(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},this.compiled=!1}},{key:"use",value:function(){this.compiled&&(f.current!==this&&this.gl.useProgram(this.program),f.current=this)}},{key:"compile",value:function(){var i=this;if(this.compiling)throw new Error("ShaderProgram.compile(): skipping for ".concat(this.id," (").concat(this.name,") because already compiling"));this.compiling=!0,this.compiled=!1,this.error=null,this.computed_vertex_source=this.vertex_source,this.computed_fragment_source=this.fragment_source;var e,t=this.checkExtensions(),r=this.buildDefineList(),n=this.buildShaderBlockList();for(var o in n){var a=n[o];if(a&&(!Array.isArray(a)||0!==a.length)){e=new RegExp("^\\s*#pragma\\s+tangram:\\s+"+o+"\\s*$","m");var s=this.computed_vertex_source.match(e),l=this.computed_fragment_source.match(e);if(null!=s||null!=l){var u="";a.forEach(function(e){var t="".concat(e.scope,", ").concat(e.key,", ").concat(e.num);u+="\n// tangram-block-start: ".concat(t,"\n"),u+=e.source,u+="\n// tangram-block-end: ".concat(t,"\n")}),null!=s&&(this.computed_vertex_source=this.computed_vertex_source.replace(e,u)),null!=l&&(this.computed_fragment_source=this.computed_fragment_source.replace(e,u)),r["TANGRAM_BLOCK_"+o.replace(/[\s-]+/g,"_").toUpperCase()]=!0}}}this.computed_vertex_source=this.computed_vertex_source.replace(Wl,""),this.computed_fragment_source=this.computed_fragment_source.replace(Wl,""),this.ensureUniforms(this.dependent_uniforms);var c="",h=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);c=h&&0<h.precision?"precision highp float;\n":"precision mediump float;\n",r.TANGRAM_VERTEX_SHADER=!0,r.TANGRAM_FRAGMENT_SHADER=!1,this.computed_vertex_source=c+f.buildDefineString(r)+this.computed_vertex_source,r.TANGRAM_VERTEX_SHADER=!1,r.TANGRAM_FRAGMENT_SHADER=!0,this.computed_fragment_source=f.buildExtensionString(t)+c+f.buildDefineString(r)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(Xl,""),this.computed_fragment_source=this.computed_fragment_source.replace(Xl,"");try{this.program=f.updateProgram(this.gl,this.program,this.computed_vertex_source,this.computed_fragment_source),this.compiled=!0,this.compiling=!1}catch(t){throw this.program=null,this.compiled=!1,this.compiling=!1,"vertex"!==(this.error=t).type&&"fragment"!==t.type||(this.shader_errors=t.errors,this.shader_errors.forEach(function(e){e.type=t.type,e.block=i.block(t.type,e.line)})),t}this.computed_vertex_source=null,this.computed_fragment_source=null,this.use(),this.refreshUniforms(),this.refreshAttributes()}},{key:"buildDefineList",value:function(){var e,t={};for(e in f.defines)t[e]=f.defines[e];for(e in this.defines)t[e]=this.defines[e];return t}},{key:"buildShaderBlockList",value:function(){var i,e={};for(i in f.blocks){var t;if(e[i]=[],Array.isArray(f.blocks[i]))(t=e[i]).push.apply(t,Pr(f.blocks[i].map(function(e,t){return{key:i,source:e,num:t,scope:"ShaderProgram"}})));else e[i]=[{key:i,source:f.blocks[i],num:0,scope:"ShaderProgram"}]}for(i in this.blocks)if(e[i]=e[i]||[],Array.isArray(this.blocks[i]))for(var r=this.block_scopes&&this.block_scopes[i]||[],n=null,o=0,a=0;a<this.blocks[i].length;a++)r[a]!==n&&(n=r[a],o=0),e[i].push({key:i,source:this.blocks[i][a],num:o,scope:n||this.name}),o++;else e[i].push({key:i,source:this.blocks[i],num:0,scope:this.name});return e}},{key:"ensureUniforms",value:function(e){if(e){var t,i=Hl(this.computed_vertex_source),r=Hl(this.computed_fragment_source),n=[],o=[];for(var a in e){var s=Gl.isUniformDefined(a,i),l=Gl.isUniformDefined(a,r);if(!s||!l){if(!(t=Gl.defineUniform(a,e[a])))continue;s||(Kr("trace","Program ".concat(this.name,": ").concat(a," not defined in vertex shader, injecting: '").concat(t,"'")),n.push(t)),l||(Kr("trace","Program ".concat(this.name,": ").concat(a," not defined in fragment shader, injecting: '").concat(t,"'")),o.push(t))}}0<n.length&&(this.computed_vertex_source=n.join("\n")+this.computed_vertex_source),0<o.length&&(this.computed_fragment_source=o.join("\n")+this.computed_fragment_source)}}},{key:"setUniforms",value:function(e,t){var i=!(1<arguments.length&&void 0!==t)||t;if(this.compiled){i&&(this.texture_unit=0);for(var r=Gl.parseUniforms(e),n=0;n<r.length;n++){var o=r[n];"sampler2D"===o.type?this.setTextureUniform(o.name,o.value):this.uniform(o.method,o.name,o.value)}}}},{key:"saveUniforms",value:function(e){var t=e||this.uniforms;for(var i in t){var r=this.uniforms[i];r&&(r.saved_value=r.value)}this.saved_texture_unit=this.texture_unit||0}},{key:"restoreUniforms",value:function(e){var t=e||this.uniforms;for(var i in t){var r=this.uniforms[i];r&&r.saved_value&&(r.value=r.saved_value,this.updateUniform(r))}this.texture_unit=this.saved_texture_unit||0}},{key:"setTextureUniform",value:function(e,t){var i=$o.textures[t];null!=i?(i.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),this.texture_unit++):Kr("warn","Cannot find texture '".concat(t,"'"))}},{key:"uniform",value:function(e,t,i){if(this.compiled){this.uniforms[t]=this.uniforms[t]||{};var r=this.uniforms[t];r.name=t,void 0===r.location&&(r.location=this.gl.getUniformLocation(this.program,t)),r.method=e,r.value=i,this.updateUniform(r)}}},{key:"updateUniform",value:function(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e))}},{key:"commitUniform",value:function(e){var t=e.location,i=e.value;switch(e.method){case"1i":this.gl.uniform1i(t,i);break;case"1f":this.gl.uniform1f(t,i);break;case"2f":this.gl.uniform2f(t,i[0],i[1]);break;case"3f":this.gl.uniform3f(t,i[0],i[1],i[2]);break;case"4f":this.gl.uniform4f(t,i[0],i[1],i[2],i[3]);break;case"1iv":this.gl.uniform1iv(t,i);break;case"3iv":this.gl.uniform3iv(t,i);break;case"1fv":this.gl.uniform1fv(t,i);break;case"2fv":this.gl.uniform2fv(t,i);break;case"3fv":this.gl.uniform3fv(t,i);break;case"4fv":this.gl.uniform4fv(t,i);break;case"Matrix3fv":this.gl.uniformMatrix3fv(t,!1,i);break;case"Matrix4fv":this.gl.uniformMatrix4fv(t,!1,i)}}},{key:"refreshUniforms",value:function(){if(this.compiled)for(var e in this.uniforms){var t=this.uniforms[e];t.location=this.gl.getUniformLocation(this.program,e),this.updateUniform(t)}}},{key:"refreshAttributes",value:function(){this.attribs={}}},{key:"attribute",value:function(e){if(this.compiled){var t=this.attribs[e]=this.attribs[e]||{};return null!=t.location||(t.name=e,t.location=this.gl.getAttribLocation(this.program,e)),t}}},{key:"source",value:function(e){return"vertex"===e?this.computed_vertex_source:"fragment"===e?this.computed_fragment_source:void 0}},{key:"lines",value:function(e){var t=this.source(e);return t?t.split("\n"):[]}},{key:"line",value:function(e,t){var i=this.lines(e);if(i)return i[t]}},{key:"block",value:function(e,t){for(var i,r=this.lines(e),n=0;n<t&&n<r.length;n++){var o=r[n],a=o.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);a&&1<a.length?i={scope:a[1],name:a[2],num:a[3]}:(a=o.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/))&&1<a.length&&(i=null),i&&(i.line=null==i.line?-1:i.line+1,i.source=o)}return i}},{key:"checkExtensions",value:function(){var r=this,n=[];return this.extensions.forEach(function(e){var t=Vl(r.gl,e),i="TANGRAM_EXTENSION_".concat(e);r.defines[i]=null!=t,t?n.push(e):Kr("debug","Could not enable extension '".concat(e,"'"))}),n}}]),f}();Zl.id=0,Zl.current=null,Zl.defines={},Zl.blocks={},Zl.reset=function(){Zl.programs_by_source={},Zl.shaders_by_source={}},Zl.reset(),Zl.buildDefineString=function(e){var t="";for(var i in e)null!=e[i]&&!1!==e[i]&&("boolean"==typeof e[i]&&!0===e[i]?t+="#define "+i+"\n":"number"==typeof e[i]&&Math.floor(e[i])===e[i]?t+="#define "+i+" "+e[i].toFixed(1)+"\n":t+="#define "+i+" "+e[i]+"\n");return t},Zl.buildExtensionString=function(e){var t="";return(e=e||[]).forEach(function(e){t+="#ifdef GL_".concat(e,"\n#extension GL_").concat(e," : enable\n#endif\n")}),t},Zl.addBlock=function(e){var t;Zl.blocks[e]=Zl.blocks[e]||[];for(var i=arguments.length,r=new Array(1<i?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(t=Zl.blocks[e]).push.apply(t,r)},Zl.removeBlock=function(e){Zl.blocks[e]=[]},Zl.replaceBlock=function(e){Zl.removeBlock(e);for(var t=arguments.length,i=new Array(1<t?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];Zl.addBlock.apply(Zl,[e].concat(i))},Zl.updateProgram=function(e,t,i,r){var n=ql(e._tangram_id+"::"+i+"::"+r);if(Zl.programs_by_source[n])return Kr("trace","Reusing identical source GL program object"),Zl.programs_by_source[n];var o=Zl.createShader(e,i,e.VERTEX_SHADER),a=Zl.createShader(e,r,e.FRAGMENT_SHADER);if(e.useProgram(null),null!=t)for(var s=e.getAttachedShaders(t),l=0;l<s.length;l++)e.detachShader(t,s[l]);else t=e.createProgram();if(null==o||null==a)return t;if(e.attachShader(t,o),e.attachShader(t,a),e.linkProgram(t),e.getProgramParameter(t,e.LINK_STATUS))return Zl.programs_by_source[n]=t;var u=new Error("WebGL program error:\n            VALIDATE_STATUS: ".concat(e.getProgramParameter(t,e.VALIDATE_STATUS),"\n            ERROR: ").concat(e.getError(),"\n            --- Vertex Shader ---\n            ").concat(i,"\n            --- Fragment Shader ---\n            ").concat(r));throw Object.assign(new Error(u),{type:"program"})};var Kl={disabled:!(Zl.createShader=function(e,t,i){var r=ql(e._tangram_id+"::"+t);if(Zl.shaders_by_source[r])return Kr("trace","Reusing identical source GL shader object"),Zl.shaders_by_source[r];var n=e.createShader(i);if(e.shaderSource(n,t),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS))return Zl.shaders_by_source[r]=n;var o=i===e.VERTEX_SHADER?"vertex":"fragment",a=e.getShaderInfoLog(n),s=Yl(a);throw Object.assign(new Error(a),{type:o,errors:s})}),bound_vao:[],init:function(e){var t;!0!==this.disabled&&(t=Vl(e,"OES_vertex_array_object")),null!=t?Kr("info","Vertex Array Object extension available"):!0!==this.disabled?Kr("warn","Vertex Array Object extension NOT available"):Kr("warn","Vertex Array Object extension force disabled")},create:function(e,t,i){var r={};r.setup=t,r.teardown=i;var n=Vl(e,"OES_vertex_array_object");return null!=n&&(r._vao=n.createVertexArrayOES(),n.bindVertexArrayOES(r._vao)),r.setup(!0),r},getCurrentBinding:function(t){var e=this.bound_vao.filter(function(e){return e[0]===t})[0];return e&&e[1]},setCurrentBinding:function(t,e){var i=this.bound_vao,r=i.filter(function(e){return e[0]===t})[0];null==r?i.push([t,e]):r[1]=e},bind:function(e,t){var i=Vl(e,"OES_vertex_array_object");if(null!=t)null!=i&&null!=t._vao?(i.bindVertexArrayOES(t._vao),this.setCurrentBinding(e,t)):t.setup(!1);else{var r=this.getCurrentBinding(e);null!=i?i.bindVertexArrayOES(null):null!=r&&"function"==typeof r.teardown&&r.teardown(),this.setCurrentBinding(e,null)}},destroy:function(e,t){var i=Vl(e,"OES_vertex_array_object");null!=i&&null!=t&&null!=t._vao&&(i.deleteVertexArrayOES(t._vao),t._vao=null)}},Jl=function(){function y(e){mr(this,y),this._gl=e,this._requests={},this._pixels=null,this._has_dirty_buffer=!1,this._fbo=this._gl.createFramebuffer(),this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,this._fbo),this._fbo_size={width:256,height:256};var t=$o.create(this._gl,"selection_fbo",{filtering:"nearest"});t.setData(this._fbo_size.width,this._fbo_size.height,null,{filtering:"nearest"}),this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER,this._gl.COLOR_ATTACHMENT0,this._gl.TEXTURE_2D,t.texture,0);var i=this._gl.createRenderbuffer();this._gl.bindRenderbuffer(this._gl.RENDERBUFFER,i),this._gl.renderbufferStorage(this._gl.RENDERBUFFER,this._gl.DEPTH_COMPONENT16,this._fbo_size.width,this._fbo_size.height),this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER,this._gl.DEPTH_ATTACHMENT,this._gl.RENDERBUFFER,i),this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,null)}return yr(y,[{key:"destroy",value:function(){this._gl&&this._fbo&&(this._gl.deleteFramebuffer(this._fbo),this._fbo=null,this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,null))}},{key:"bind",value:function(){var e;this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,this._fbo),this._gl.viewport(0,0,this._fbo_size.width,this._fbo_size.height),(e=this._gl).clearColor.apply(e,Pr(y.defaultColor))}},{key:"getFeatureAt",value:function(i,e){var r=this,n=e.radius,t=e.top_most_only,o=void 0===t||t;return!i||i.x<0||i.y<0||1<i.x||1<i.y?Promise.resolve({features:null}):new Promise(function(e,t){r.selection_request_id=r.selection_request_id+1||0,r._requests[r.selection_request_id]={id:r.selection_request_id,point:i,radius:n,top_most_only:o,ttl:o?1:y.MAX_PICKING_TRIES,resolve:e,reject:t}})}},{key:"hasPendingRequests",value:function(){return 0<Object.keys(this._requests).length}},{key:"clearPendingRequests",value:function(){for(var e in this._requests){var t=this._requests[e];t.reject({request:t}),delete this._requests[e]}this._pending_deep_request=null}},{key:"read",value:function(e){if(this.hasPendingRequests()){var t=this._gl;for(var i in t.bindFramebuffer(t.FRAMEBUFFER,this._fbo),this._pending_deep_request&&this.processRequest(this._pending_deep_request,e),this._requests)if(this.processRequest(this._requests[i],e))break;t.bindFramebuffer(t.FRAMEBUFFER,null)}}},{key:"processRequest",value:function(e,t){var i,r,n=this._gl,o=255,a=e.point,s=e.radius;if(s){var l=Math.min(this._fbo_size.width,this._fbo_size.height);r={x:Math.min(Math.ceil(2*s.x*this._fbo_size.width),l),y:Math.min(Math.ceil(2*s.y*this._fbo_size.height),l)}}else s={x:0,y:0},r={x:1,y:1};var u=r.x*r.y*4;if(null==this._pixels||this._pixels.byteLength<u)this._pixels=new Uint8Array(u);else if(this._pixels.fill instanceof Function)this._pixels.fill(0,0,u);else for(var c=0;c<u;c++)this._pixels[c]=0;n.readPixels(Math.round((a.x-s.x)*this._fbo_size.width),Math.round((1-a.y-s.y)*this._fbo_size.height),r.x,r.y,n.RGBA,n.UNSIGNED_BYTE,this._pixels),e.ttl--;var h=4*(Math.round(r.y/2)*r.x+Math.round(r.x/2)),f=this._pixels.slice(0,4),d=this._pixels[h]+(this._pixels[h+1]<<8)+(this._pixels[h+2]<<16);if(0<d)i=d+(this._pixels[h+3]<<24)>>>0,o=this._pixels[h+3];else for(var _=-1>>>0,p=h=0;p<r.y;p++)for(var v=0;v<r.x;v++,h+=4)if(0<(d=this._pixels[h]+(this._pixels[h+1]<<8)+(this._pixels[h+2]<<16))){var m=(v-r.x/2)*(v-r.x/2)+(p-r.y/2)*(p-r.y/2);m<=_&&(f=this._pixels.slice(h,h+4),i=d+(this._pixels[h+3]<<24)>>>0,o=this._pixels[h+3],_=m)}if(255!==o){var g=this._getFeatureWithKey(i,t);if(e.features||(e.features=[]),!g)return void this._finishRead(e);if(e.features.every(function(e){return e.id!==g.id})&&e.features.push(g),e.ttl)return this._pending_deep_request=e,y._discardColor([f[0]/255,f[1]/255,f[2]/255,f[3]/255]),this._has_dirty_buffer=!0;this._finishRead(e)}else this._finishRead(e)}},{key:"_finishRead",value:function(e){var t=e.features||y.EMPTY_ARRAY;e.top_most_only||(this._pending_deep_request=null,y._resetDiscardedColors()),delete this._requests[e.id],e.resolve({features:t})}},{key:"_getFeatureWithKey",value:function(e,t){for(var i=null,r=0;r<t.length;r++){var n=t[r];if(n.selection_data&&(i=n.selection_data[e])){i.tile={coords:n.coords};break}}return i}},{key:"setupDiscards",value:function(e){for(var t=y.MAX_PICKING_TRIES;t--;)e.uniform("4fv","u_selection_discard".concat(t),y._discarded_colors[t]||y.defaultColor)}},{key:"has_dirty_buffer",get:function(){return this._has_dirty_buffer},set:function(e){this._has_dirty_buffer=!!this._pending_deep_request}}],[{key:"makeEntry",value:function(){this.map_entry++;var e=255&this.map_entry,t=this.map_entry>>8&255,i=this.map_entry>>16&255,r=this.map_prefix;return{key:e+(t<<8)+(i<<16)+(r<<24)>>>0,color:[e/255,t/255,i/255,r/255]}}},{key:"reset",value:function(){this.map_entry=0}},{key:"setPrefix",value:function(e){this.map_prefix=e}},{key:"_discardColor",value:function(e){this._discarded_colors.push(e)}},{key:"_resetDiscardedColors",value:function(){this._discarded_colors.length=0}}]),y}();Jl._discarded_colors=[],Jl.map_entry=0,Jl.map_prefix=0,Jl.defaultColor=[0,0,0,1],Jl.MAX_PICKING_TRIES=10,Jl.EMPTY_ARRAY=Object.freeze([]);var $l,Ql=function(){function o(e,t,i,r,n){mr(this,o),n=n||{},this.gl=e,this.vertex_data=t,this.element_data=i,this.vertex_layout=r,this.vertex_buffer=this.gl.createBuffer(),this.buffer_size=this.vertex_data.byteLength,this.draw_mode=n.draw_mode||this.gl.TRIANGLES,this.data_usage=n.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=n.uniforms,this.textures=n.textures,this.retain=n.retain||!1,this.created_at=+new Date,this.fade_in_time=n.fade_in_time||0,this.vertex_count=this.vertex_data.byteLength/this.vertex_layout.stride,this.element_count=0,this.vaos={},this.toggle_element_array=!1,this.element_data?(this.toggle_element_array=!0,this.element_count=this.element_data.length,this.geometry_count=this.element_count/this.vertices_per_geometry,this.element_type=this.element_data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT,this.element_buffer=this.gl.createBuffer(),this.buffer_size+=this.element_data.byteLength,this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.element_data,this.data_usage)):this.geometry_count=this.vertex_count/this.vertices_per_geometry,this.upload(),this.retain||(delete this.vertex_data,delete this.element_data),this.valid=!0}return yr(o,[{key:"render",value:function(e){var t=0<arguments.length&&void 0!==e?e:{};if(!this.valid)return!1;var i=t.program||Zl.current;i.use(),this.uniforms&&(i.saveUniforms(this.uniforms),i.setUniforms(this.uniforms,!1));var r=(+new Date-this.created_at)/1e3;return i.uniform("1f","u_visible_time",r),this.bind(i),this.toggle_element_array?this.gl.drawElements(this.draw_mode,this.element_count,this.element_type,0):this.gl.drawArrays(this.draw_mode,0,this.vertex_count),Kl.bind(this.gl,null),this.uniforms&&i.restoreUniforms(this.uniforms),r<this.fade_in_time}},{key:"bind",value:function(t){var i=this,e=this.vaos[t.id];e?Kl.bind(this.gl,e):this.vaos[t.id]=Kl.create(this.gl,function(e){i.gl.bindBuffer(i.gl.ARRAY_BUFFER,i.vertex_buffer),i.toggle_element_array&&i.gl.bindBuffer(i.gl.ELEMENT_ARRAY_BUFFER,i.element_buffer),i.vertex_layout.enable(i.gl,t,e)})}},{key:"upload",value:function(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertex_data,this.data_usage)}},{key:"destroy",value:function(){if(!this.valid)return!1;for(var e in this.valid=!1,this.vaos)Kl.destroy(this.gl,this.vaos[e]);return this.gl.deleteBuffer(this.vertex_buffer),this.vertex_buffer=null,this.element_buffer&&(this.gl.deleteBuffer(this.element_buffer),this.element_buffer=null),delete this.vertex_data,delete this.element_data,this.textures&&this.textures.forEach(function(e){return $o.release(e)}),!0}}]),o}(),eu=["emission","ambient","diffuse","specular"],tu=function(){function e(i){var r=this;mr(this,e),i=i||{},eu.forEach(function(e){var t=i[e];null!=t&&(t.texture?r[e]={texture:t.texture,mapping:t.mapping||"spheremap",scale:Gl.expandVec3(null!=t.scale?t.scale:1),amount:Gl.expandVec4(null!=t.amount?t.amount:1)}:"number"==typeof t||Array.isArray(t)?r[e]={amount:Gl.expandVec4(t)}:r[e]="string"==typeof t?{amount:jo.parseColor(t)}:t)}),this.specular&&(this.specular.shininess=i.shininess?parseFloat(i.shininess):.2),null!=i.normal&&(this.normal={texture:i.normal.texture,mapping:i.normal.mapping||"triplanar",scale:Gl.expandVec3(null!=i.normal.scale?i.normal.scale:1),amount:null!=i.normal.amount?i.normal.amount:1})}return yr(e,[{key:"inject",value:function(r){var n=this;eu.forEach(function(e){var t="TANGRAM_MATERIAL_".concat(e.toUpperCase()),i=t+"_TEXTURE";r.defines[t]=null!=n[e],n[e]&&n[e].texture&&(r.defines[i]=!0,r.defines[i+"_"+n[e].mapping.toUpperCase()]=!0,r.defines["TANGRAM_MATERIAL_TEXTURE_".concat(n[e].mapping.toUpperCase())]=!0,r.texcoords=r.texcoords||"uv"===n[e].mapping)}),this.normal&&this.normal.texture&&(r.defines.TANGRAM_MATERIAL_NORMAL_TEXTURE=!0,r.defines["TANGRAM_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,r.defines["TANGRAM_MATERIAL_TEXTURE_".concat(this.normal.mapping.toUpperCase())]=!0,r.texcoords=r.texcoords||"uv"===this.normal.mapping),r.replaceShaderBlock(e.block,"/*Defines globals:materiallight_accumulator_**/struct Material{\n#ifdef TANGRAM_MATERIAL_EMISSION\nvec4 emission;\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\nvec3 emissionScale;\n#endif\n#endif\n#ifdef TANGRAM_MATERIAL_AMBIENT\nvec4 ambient;\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\nvec3 ambientScale;\n#endif\n#endif\n#ifdef TANGRAM_MATERIAL_DIFFUSE\nvec4 diffuse;\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\nvec3 diffuseScale;\n#endif\n#endif\n#ifdef TANGRAM_MATERIAL_SPECULAR\nvec4 specular;float shininess;\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\nvec3 specularScale;\n#endif\n#endif\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nvec3 normalScale;float normalAmount;\n#endif\n};uniform Material u_material;Material material;\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\nuniform sampler2D u_material_emission_texture;\n#endif\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\nuniform sampler2D u_material_ambient_texture;\n#endif\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\nuniform sampler2D u_material_diffuse_texture;\n#endif\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\nuniform sampler2D u_material_specular_texture;\n#endif\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nuniform sampler2D u_material_normal_texture;\n#endif\nvec4 light_accumulator_ambient=vec4(vec3(0.0),1.);vec4 light_accumulator_diffuse=vec4(vec3(0.0),1.);\n#ifdef TANGRAM_MATERIAL_SPECULAR\nvec4 light_accumulator_specular=vec4(vec3(0.0),1.);\n#endif\n#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP\nvec4 getSphereMap(in sampler2D _tex,in vec3 _eyeToPoint,in vec3 _normal,in vec2 _skew){vec3 eye=normalize(_eyeToPoint);eye.xy-=_skew;eye=normalize(eye);vec3 r=reflect(eye,_normal);r.z+=1.0;float m=2.*length(r);vec2 uv=r.xy/m+.5;return texture2D(_tex,uv);}\n#endif\n#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR\nvec3 getTriPlanarBlend(in vec3 _normal){vec3 blending=abs(_normal);blending=normalize(max(blending,0.00001));float b=(blending.x+blending.y+blending.z);return blending/b;}vec4 getTriPlanar(in sampler2D _tex,in vec3 _pos,in vec3 _normal,in vec3 _scale){vec3 blending=getTriPlanarBlend(_normal);vec4 xaxis=texture2D(_tex,fract(_pos.yz*_scale.x));vec4 yaxis=texture2D(_tex,fract(_pos.xz*_scale.y));vec4 zaxis=texture2D(_tex,fract(_pos.xy*_scale.z));return xaxis*blending.x+yaxis*blending.y+zaxis*blending.z;}\n#endif\n#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR\nvec4 getPlanar(in sampler2D _tex,in vec3 _pos,in vec2 _scale){return texture2D(_tex,fract(_pos.xy*_scale.x));}\n#endif\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nvoid calculateNormal(inout vec3 _normal){\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV\n_normal+=texture2D(u_material_normal_texture,fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;\n#endif\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR\nvec3 normalTex=getPlanar(u_material_normal_texture,v_world_position.xyz,material.normalScale.xy).rgb*2.0-1.0;_normal+=normalTex;\n#endif\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR\nvec3 normalTex=getTriPlanar(u_material_normal_texture,v_world_position.xyz,_normal,material.normalScale).rgb*2.0-1.0;_normal+=normalTex;\n#endif\n_normal=normalize(_normal);}\n#endif\nvoid calculateMaterial(in vec3 _eyeToPoint,inout vec3 _normal){\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV\nmaterial.emission*=texture2D(u_material_emission_texture,v_texcoord);\n#endif\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR\nmaterial.emission*=getPlanar(u_material_emission_texture,v_world_position.xyz,material.emissionScale.xy);\n#endif\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR\nmaterial.emission*=getTriPlanar(u_material_emission_texture,v_world_position.xyz,_normal,material.emissionScale);\n#endif\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP\nmaterial.emission*=getSphereMap(u_material_emission_texture,_eyeToPoint,_normal,u_center_offset);\n#endif\n#endif\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV\nmaterial.ambient*=texture2D(u_material_ambient_texture,v_texcoord);\n#endif\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR\nmaterial.ambient*=getPlanar(u_material_ambient_texture,v_world_position.xyz,material.ambientScale.xy);\n#endif\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR\nmaterial.ambient*=getTriPlanar(u_material_ambient_texture,v_world_position.xyz,_normal,material.ambientScale);\n#endif\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP\nmaterial.ambient*=getSphereMap(u_material_ambient_texture,_eyeToPoint,_normal,u_center_offset);\n#endif\n#endif\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV\nmaterial.diffuse*=texture2D(u_material_diffuse_texture,v_texcoord);\n#endif\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR\nmaterial.diffuse*=getPlanar(u_material_diffuse_texture,v_world_position.xyz,material.diffuseScale.xy);\n#endif\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR\nmaterial.diffuse*=getTriPlanar(u_material_diffuse_texture,v_world_position.xyz,_normal,material.diffuseScale);\n#endif\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP\nmaterial.diffuse*=getSphereMap(u_material_diffuse_texture,_eyeToPoint,_normal,u_center_offset);\n#endif\n#endif\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV\nmaterial.specular*=texture2D(u_material_specular_texture,v_texcoord);\n#endif\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR\nmaterial.specular*=getPlanar(u_material_specular_texture,v_world_position.xyz,material.specularScale.xy);\n#endif\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR\nmaterial.specular*=getTriPlanar(u_material_specular_texture,v_world_position.xyz,_normal,material.specularScale);\n#endif\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP\nmaterial.specular*=getSphereMap(u_material_specular_texture,_eyeToPoint,_normal,u_center_offset);\n#endif\n#endif\n}","Material"),r.addShaderBlock("setup","\nmaterial = u_material;\n","Material")}},{key:"setupProgram",value:function(t){var i=this;eu.forEach(function(e){i[e]&&(i[e].texture?(t.setTextureUniform("u_material_".concat(e,"_texture"),i[e].texture),t.uniform("3fv","u_material.".concat(e,"Scale"),i[e].scale),t.uniform("4fv","u_material.".concat(e),i[e].amount)):i[e].amount&&t.uniform("4fv","u_material.".concat(e),i[e].amount))}),this.specular&&t.uniform("1f","u_material.shininess",this.specular.shininess),this.normal&&this.normal.texture&&(t.setTextureUniform("u_material_normal_texture",this.normal.texture),t.uniform("3fv","u_material.normalScale",this.normal.scale),t.uniform("1f","u_material.normalAmount",this.normal.amount))}}],[{key:"isValid",value:function(e){return null!=e&&(null!=e.emission||null!=e.ambient||null!=e.diffuse||null!=e.specular)}}]),e}();tu.block="material";var iu=$l={};$l.copy=function(e){for(var t=[],i=e.length,r=0;r<i;r++)t[r]=e[r];return t},$l.neg=function(e){for(var t=[],i=e.length,r=0;r<i;r++)t[r]=-e[r];return t},$l.add=function(e,t){for(var i=[],r=Math.min(e.length,t.length),n=0;n<r;n++)i[n]=e[n]+t[n];return i},$l.sub=function(e,t){for(var i=[],r=Math.min(e.length,t.length),n=0;n<r;n++)i[n]=e[n]-t[n];return i},$l.signed_area=function(e,t,i){return(t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1])},$l.mult=function(e,t){var i,r=[],n=e.length;if("number"==typeof t)for(i=0;i<n;i++)r[i]=e[i]*t;else for(n=Math.min(e.length,t.length),i=0;i<n;i++)r[i]=e[i]*t[i];return r},$l.multMatrix=function(e,t){return[e[0][0]*t[0]+e[0][1]*t[1],e[1][0]*t[0]+e[1][1]*t[1]]},$l.div=function(e,t){var i,r=[];if("number"==typeof t)for(i=0;i<e.length;i++)r[i]=e[i]/t;else{var n=Math.min(e.length,t.length);for(i=0;i<n;i++)r[i]=e[i]/t[i]}return r},$l.perp=function(e,t){return[t[1]-e[1],e[0]-t[0]]},$l.rot=function(e,t){var i=Math.cos(t),r=Math.sin(t);return[e[0]*i-e[1]*r,e[0]*r+e[1]*i]},$l.angle=function(e){var t=Sr(e,2),i=t[0],r=t[1];return Math.atan2(r,i)},$l.angleBetween=function(e,t){var i=$l.dot($l.normalize($l.copy(e)),$l.normalize($l.copy(t)));return 1<i&&(i=1),Math.acos(i)},$l.signedAngleBetween=function(e,t){return Math.atan2(e[0]*t[1]-e[1]*t[0],e[0]*t[0]+e[1]*t[1])},$l.isEqual=function(e,t){for(var i=e.length,r=0;r<i;r++)if(e[r]!==t[r])return!1;return!0},$l.lengthSq=function(e){return 2===e.length?e[0]*e[0]+e[1]*e[1]:3<=e.length?e[0]*e[0]+e[1]*e[1]+e[2]*e[2]:0},$l.length=function(e){return Math.sqrt($l.lengthSq(e))},$l.normalize=function(e){var t;if(2===e.length){if(1===(t=e[0]*e[0]+e[1]*e[1]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t):(e[0]=0,e[1]=0)}else if(3<=e.length){if(1===(t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t,e[2]/=t):(e[0]=0,e[1]=0,e[2]=0)}return e},$l.cross=function(e,t){return 2===e.length?e[0]*t[1]-e[1]*t[0]:3===e.length?[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]:void 0},$l.dot=function(e,t){for(var i=0,r=Math.min(e.length,t.length),n=0;n<r;n++)i+=e[n]*t[n];return i};var ru=function(){function s(e,t){mr(this,s),this.name=t.name,this.view=e,null==t.ambient||"number"==typeof t.ambient?this.ambient=Gl.expandVec3(t.ambient||0):this.ambient=jo.parseColor(t.ambient).slice(0,3),null==t.diffuse||"number"==typeof t.diffuse?this.diffuse=Gl.expandVec3(null!=t.diffuse?t.diffuse:1):this.diffuse=jo.parseColor(t.diffuse).slice(0,3),null==t.specular||"number"==typeof t.specular?this.specular=Gl.expandVec3(t.specular||0):this.specular=jo.parseColor(t.specular).slice(0,3)}return yr(s,[{key:"inject",value:function(){var e="\n            uniform ".concat(this.struct_name," u_").concat(this.name,";\n            ").concat(this.struct_name," ").concat(this.name,";\n            "),t="\n            ".concat(this.name," = u_").concat(this.name,";\n\n        ");Zl.addBlock(s.block,e),Zl.addBlock("setup",t)}},{key:"update",value:function(){}},{key:"setupProgram",value:function(e){e.uniform("3fv","u_".concat(this.name,".ambient"),this.ambient),e.uniform("3fv","u_".concat(this.name,".diffuse"),this.diffuse),e.uniform("3fv","u_".concat(this.name,".specular"),this.specular)}}],[{key:"create",value:function(e,t){if(s.types[t.type])return new s.types[t.type](e,t)}},{key:"setMode",value:function(e,t){!0===e&&(e="fragment"),e=s.enabled&&(null!=e?e:"fragment"),t.defines.TANGRAM_LIGHTING_FRAGMENT="fragment"===e,t.defines.TANGRAM_LIGHTING_VERTEX="vertex"===e}},{key:"inject",value:function(e){if(Zl.removeBlock(s.block),s.enabled){var t="";if(e&&0<Object.keys(e).length){var i={};for(var r in e)i[e[r].type]=!0;for(var n in i)s.types[n].inject();for(var o in e)e[o].inject(),t+="calculateLight(".concat(o,", _eyeToPoint, _normal);\n")}var a="\n            vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {\n\n                // Do initial material calculations over normal, emission, ambient, diffuse and specular values\n                calculateMaterial(_eyeToPoint,_normal);\n\n                // Un roll the loop of individual ligths to calculate\n                ".concat(t,"\n\n                //  Final light intensity calculation\n                vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha\n\n                #ifdef TANGRAM_MATERIAL_EMISSION\n                    color.rgb = material.emission.rgb;\n                    color.a *= material.emission.a;\n                #endif\n\n                #ifdef TANGRAM_MATERIAL_AMBIENT\n                    color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;\n                    color.a *= material.ambient.a;\n                #else\n                    #ifdef TANGRAM_MATERIAL_DIFFUSE\n                        color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;\n                    #endif\n                #endif\n\n                #ifdef TANGRAM_MATERIAL_DIFFUSE\n                    color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb;\n                    color.a *= material.diffuse.a;\n                #endif\n\n                #ifdef TANGRAM_MATERIAL_SPECULAR\n                    color.rgb += light_accumulator_specular.rgb * material.specular.rgb;\n                    color.a *= material.specular.a;\n                #endif\n\n                // Clamp final color\n                color = clamp(color, 0.0, 1.0);\n\n                return color;\n            }");Zl.addBlock(s.block,a)}}}]),s}();ru.types={},ru.block="lighting",ru.enabled=!0;var nu=function(){function r(e,t){var i;return mr(this,r),(i=Mr(this,Ar(r).call(this,e,t))).type="ambient",i.struct_name="AmbientLight",i}return br(r,ru),yr(r,[{key:"setupProgram",value:function(e){e.uniform("3fv","u_".concat(this.name,".ambient"),this.ambient)}}],[{key:"inject",value:function(){Zl.addBlock(ru.block,"/*Expected globals:light_accumulator_**/struct AmbientLight{vec3 ambient;};void calculateLight(in AmbientLight _light,in vec3 _eyeToPoint,in vec3 _normal){light_accumulator_ambient.rgb+=_light.ambient;}")}}]),r}();ru.types.ambient=nu;var ou=function(){function n(e,t){var i;if(mr(this,n),(i=Mr(this,Ar(n).call(this,e,t))).type="directional",i.struct_name="DirectionalLight",t.direction)i._direction=t.direction;else{var r=Math.sin(60*Math.PI/180);i._direction=[Math.cos(135*Math.PI/180)*r,Math.sin(135*Math.PI/180)*r,-.5]}return null==t.ambient&&(i.ambient=Gl.expandVec3(.5)),i.direction=i._direction.map(parseFloat),i._initial_direction=[i.direction[0],i.direction[1],i.direction[2]],i}return br(n,ru),yr(n,[{key:"update",value:function(){ea.transformMat4(this.direction,this._initial_direction,this.view.lookAtManipulator.getTransformationMatrix())}},{key:"setupProgram",value:function(e){Rr(Ar(n.prototype),"setupProgram",this).call(this,e),e.uniform("3fv","u_".concat(this.name,".direction"),this.direction)}},{key:"direction",get:function(){return this._direction},set:function(e){this._direction=iu.normalize(iu.copy(e))}}],[{key:"inject",value:function(){Zl.addBlock(ru.block,"/*Expected globals:materiallight_accumulator_**/struct DirectionalLight{vec3 ambient;vec3 diffuse;vec3 specular;vec3 direction;};void calculateLight(in DirectionalLight _light,in vec3 _eyeToPoint,in vec3 _normal){light_accumulator_ambient.rgb+=_light.ambient;float nDotVP=clamp(dot(_normal,-_light.direction),0.0,1.0);\n#ifdef TANGRAM_MATERIAL_DIFFUSE\nlight_accumulator_diffuse.rgb+=_light.diffuse*nDotVP;\n#endif\n#ifdef TANGRAM_MATERIAL_SPECULAR\nfloat pf=0.0;if(nDotVP>0.0){vec3 reflectVector=reflect(_light.direction,_normal);float eyeDotR=max(dot(normalize(_eyeToPoint),reflectVector),0.0);pf=pow(eyeDotR,material.shininess);}light_accumulator_specular.rgb+=_light.specular*pf;\n#endif\n}")}}]),n}();ru.types.directional=ou;var au=function(){function r(e,t){var i;return mr(this,r),(i=Mr(this,Ar(r).call(this,e,t))).type="point",i.struct_name="PointLight",i.position=t.position||[0,0,"100px"],i.position_eye=[],i.origin=t.origin||"ground",i.attenuation=isNaN(parseFloat(t.attenuation))?0:parseFloat(t.attenuation),t.radius?Array.isArray(t.radius)&&2===t.radius.length?i.radius=t.radius:i.radius=[null,t.radius]:i.radius=null,i}return br(r,ru),yr(r,[{key:"inject",value:function(){Rr(Ar(r.prototype),"inject",this).call(this),Zl.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,Zl.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],Zl.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius}},{key:"update",value:function(){var e=this.view.lookAtManipulator.getLookAtData().zoom;if("world"===this.origin){var t=Sr(Jr.latLngToMeters(this.position),2),i=t[0],r=t[1];this.position_eye[0]=i-this.view.lookAtManipulator.getLookAtData().position[0],this.position_eye[1]=r-this.view.lookAtManipulator.getLookAtData().position[1],this.position_eye[2]=jo.convertUnits(this.position[2],{zoom:e,meters_per_pixel:Jr.metersPerPixel(e)}),this.position_eye[2]=this.position_eye[2]-this.view.lookAtManipulator.getLookAtData().distance}else"ground"!==this.origin&&"camera"!==this.origin||(this.position_eye=jo.convertUnits(this.position,{zoom:e,meters_per_pixel:Jr.metersPerPixel(e)}),"ground"===this.origin&&(this.position_eye[2]=this.position_eye[2]-this.view.lookAtManipulator.getLookAtData().distance));this.position_eye[3]=1}},{key:"setupProgram",value:function(e){Rr(Ar(r.prototype),"setupProgram",this).call(this,e),e.uniform("4fv","u_".concat(this.name,".position"),this.position_eye),Zl.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT&&e.uniform("1f","u_".concat(this.name,".attenuationExponent"),this.attenuation);var t=this.view.lookAtManipulator.getLookAtData().zoom;Zl.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS&&e.uniform("1f","u_".concat(this.name,".innerRadius"),jo.convertUnits(this.radius[0],{zoom:t,meters_per_pixel:Jr.metersPerPixel(t)})),Zl.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&e.uniform("1f","u_".concat(this.name,".outerRadius"),jo.convertUnits(this.radius[1],{zoom:t,meters_per_pixel:Jr.metersPerPixel(t)}))}}],[{key:"inject",value:function(){Zl.addBlock(ru.block,"/*Expected globals:materiallight_accumulator_**/struct PointLight{vec3 ambient;vec3 diffuse;vec3 specular;vec4 position;\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\nfloat attenuationExponent;\n#endif\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\nfloat innerRadius;\n#endif\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\nfloat outerRadius;\n#endif\n};void calculateLight(in PointLight _light,in vec3 _eyeToPoint,in vec3 _normal){float dist=length(_light.position.xyz-_eyeToPoint);vec3 VP=(_light.position.xyz-_eyeToPoint)/dist;float nDotVP=clamp(dot(VP,_normal),0.0,1.0);float attenuation=1.0;\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\nfloat Rin=1.0;float e=_light.attenuationExponent;\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\nRin=_light.innerRadius;\n#endif\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\nfloat Rdiff=_light.outerRadius-Rin;float d=clamp(max(0.0,dist-Rin)/Rdiff,0.0,1.0);attenuation=1.0-(pow(d,e));\n#else\nfloat d=max(0.0,dist-Rin)/Rin+1.0;attenuation=clamp(1.0/(pow(d,e)),0.0,1.0);\n#endif\n#else\nfloat Rin=0.0;\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\nRin=_light.innerRadius;\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\nfloat Rdiff=_light.outerRadius-Rin;float d=clamp(max(0.0,dist-Rin)/Rdiff,0.0,1.0);attenuation=1.0-d*d;\n#else\nfloat d=max(0.0,dist-Rin)/Rin+1.0;attenuation=clamp(1.0/d,0.0,1.0);\n#endif\n#else\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\nfloat d=clamp(dist/_light.outerRadius,0.0,1.0);attenuation=1.0-d*d;\n#else\nattenuation=1.0;\n#endif\n#endif\n#endif\nlight_accumulator_ambient.rgb+=_light.ambient*attenuation;\n#ifdef TANGRAM_MATERIAL_DIFFUSE\nlight_accumulator_diffuse.rgb+=_light.diffuse*nDotVP*attenuation;\n#endif\n#ifdef TANGRAM_MATERIAL_SPECULAR\nfloat pf=0.0;if(nDotVP>0.0){vec3 reflectVector=reflect(-VP,_normal);float eyeDotR=max(0.0,dot(-normalize(_eyeToPoint),reflectVector));pf=pow(eyeDotR,material.shininess);}light_accumulator_specular.rgb+=_light.specular*pf*attenuation;\n#endif\n}")}}]),r}();ru.types.point=au;var su=function(){function r(e,t){var i;return mr(this,r),(i=Mr(this,Ar(r).call(this,e,t))).type="spotlight",i.struct_name="SpotLight",i.direction=i._direction=(t.direction||[0,0,-1]).map(parseFloat),i._initial_direction=[i.direction[0],i.direction[1],i.direction[2]],i.exponent=t.exponent?parseFloat(t.exponent):.2,i.angle=t.angle?parseFloat(t.angle):20,i}return br(r,au),yr(r,[{key:"setupProgram",value:function(e){Rr(Ar(r.prototype),"setupProgram",this).call(this,e),e.uniform("3fv","u_".concat(this.name,".direction"),this.direction),e.uniform("1f","u_".concat(this.name,".spotCosCutoff"),Math.cos(3.14159*this.angle/180)),e.uniform("1f","u_".concat(this.name,".spotExponent"),this.exponent)}},{key:"update",value:function(){Rr(Ar(r.prototype),"update",this).call(this),ea.transformMat4(this.direction,this._initial_direction,this.view.lookAtManipulator.getTransformationMatrix())}},{key:"direction",get:function(){return this._direction},set:function(e){this._direction=iu.normalize(iu.copy(e))}}],[{key:"inject",value:function(){Zl.addBlock(ru.block,"/*Expected globals:materiallight_accumulator_**/struct SpotLight{vec3 ambient;vec3 diffuse;vec3 specular;vec4 position;\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\nfloat attenuationExponent;\n#endif\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\nfloat innerRadius;\n#endif\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\nfloat outerRadius;\n#endif\nvec3 direction;float spotCosCutoff;float spotExponent;};void calculateLight(in SpotLight _light,in vec3 _eyeToPoint,in vec3 _normal){float dist=length(_light.position.xyz-_eyeToPoint);vec3 VP=(_light.position.xyz-_eyeToPoint)/dist;float nDotVP=clamp(dot(_normal,VP),0.0,1.0);float attenuation=1.0;\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\nfloat Rin=1.0;float e=_light.attenuationExponent;\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\nRin=_light.innerRadius;\n#endif\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\nfloat Rdiff=_light.outerRadius-Rin;float d=clamp(max(0.0,dist-Rin)/Rdiff,0.0,1.0);attenuation=1.0-(pow(d,e));\n#else\nfloat d=max(0.0,dist-Rin)/Rin+1.0;attenuation=clamp(1.0/(pow(d,e)),0.0,1.0);\n#endif\n#else\nfloat Rin=0.0;\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\nRin=_light.innerRadius;\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\nfloat Rdiff=_light.outerRadius-Rin;float d=clamp(max(0.0,dist-Rin)/Rdiff,0.0,1.0);attenuation=1.0-d*d;\n#else\nfloat d=max(0.0,dist-Rin)/Rin+1.0;attenuation=clamp(1.0/d,0.0,1.0);\n#endif\n#else\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\nfloat d=clamp(dist/_light.outerRadius,0.0,1.0);attenuation=1.0-d*d;\n#else\nattenuation=1.0;\n#endif\n#endif\n#endif\nfloat spotAttenuation=0.0;float spotDot=clamp(dot(-VP,_light.direction),0.0,1.0);if(spotDot>=_light.spotCosCutoff){spotAttenuation=pow(spotDot,_light.spotExponent);}light_accumulator_ambient.rgb+=_light.ambient*attenuation*spotAttenuation;\n#ifdef TANGRAM_MATERIAL_DIFFUSE\nlight_accumulator_diffuse.rgb+=_light.diffuse*nDotVP*attenuation*spotAttenuation;\n#endif\n#ifdef TANGRAM_MATERIAL_SPECULAR\nfloat pf=0.0;if(nDotVP>0.0){vec3 reflectVector=reflect(-VP,_normal);float eyeDotR=max(dot(-normalize(_eyeToPoint),reflectVector),0.0);pf=pow(eyeDotR,material.shininess);}light_accumulator_specular.rgb+=_light.specular*pf*attenuation*spotAttenuation;\n#endif\n}")}}]),r}();ru.types.spotlight=su;var lu,uu="\n#ifdef TANGRAM_FRAGMENT_SHADER\nuniform sampler2D u_rasters[TANGRAM_NUM_RASTER_SOURCES];uniform vec2 u_raster_sizes[TANGRAM_NUM_RASTER_SOURCES];uniform vec3 u_raster_offsets[TANGRAM_NUM_RASTER_SOURCES];\n#define adjustRasterUV(raster_index, uv) ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n#define currentRasterUV(raster_index) (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n#define currentRasterPixel(raster_index) (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n#define sampleRaster(raster_index) (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n#define sampleRasterAtPixel(raster_index, pixel) (texture2D(u_rasters[raster_index], adjustRasterUV(raster_index, (pixel) / rasterPixelSize(raster_index))))\n#define rasterPixelSize(raster_index) (u_raster_sizes[raster_index])\n#endif\n",cu={init:function(e){var t=0<arguments.length&&void 0!==e?e:{},i=t.generation,r=t.styles,n=t.sources,o=void 0===n?{}:n,a=t.introspection,s=t.id,l=void 0!==s?s+"/":"";this.main_thread_target="".concat(l,"Style/").concat(this.name),this.setGeneration(i),this.styles=r,this.sources=o,this.defines=this.hasOwnProperty("defines")&&this.defines||{},this.shaders=this.hasOwnProperty("shaders")&&this.shaders||{},this.introspection=a||!1,this.selection=this.selection||this.introspection||!1,this.compile_setup=!1,this.program=null,this.selection_program=null,this.feature_style={},this.vertex_template=[],this.tile_data={},this.defines.TANGRAM_WORLD_POSITION_WRAP=1e5,this.blend=this.blend||"opaque",this.defines["TANGRAM_BLEND_".concat(this.blend.toUpperCase())]=!0,null==this.blend_order&&(this.blend_order=-1),this.removeShaderBlock("setup"),this.material instanceof tu||(tu.isValid(this.material)||(this.material=jo.defaults.material),this.material=new tu(this.material)),this.material.inject(this),ru.setMode(this.lighting,this),this.setupRasters(),this.initialized=!0},destroy:function(){this.program&&(this.program.destroy(),this.program=null),this.selection_program&&(this.selection_program.destroy(),this.selection_program=null),Cr.removeTarget(this.main_thread_target),this.gl=null,this.initialized=!1},reset:function(){},baseStyle:function(){return this.base||this.name},setGeneration:function(e){this.generation=e,Lr.is_main&&Cr.addTarget(this.main_thread_target,this)},fillVertexTemplate:function(e,t,i,r){var n=r.size,o=r.offset;o=void 0===o?0:o;var a=e.index[t];if(void 0!==a)for(var s=0;s<n;++s){var l=i.length>s?i[s]:i;this.vertex_template[a+s+o]=l}else Kr("warn","Style: in style '".concat(this.name,"', no index found in vertex layout for attribute '").concat(t,"'"))},startData:function(e){this.tile_data[e.id]=this.tile_data[e.id]||{meshes:{},uniforms:{},textures:[]}},endData:function(e){var t=this.tile_data[e.id];if(this.tile_data[e.id]=null,t&&0<Object.keys(t.meshes).length){for(var i in t.meshes){var r=t.meshes[i];0!==r.vertex_data.vertex_count?(r.vertex_data.end(),r.vertex_elements=r.vertex_data.element_buffer,r.vertex_data=r.vertex_data.vertex_buffer):delete t.meshes[i]}return e.mesh_data[this.name]=t,this.buildRasterTextures(e,t).then(function(e){return e})}return Promise.resolve(null)},hasDataForTile:function(e){return null!=this.tile_data[e.id]},getTileMesh:function(e,t){var i=this.tile_data[e.id].meshes;return null==i[t.key]&&(i[t.key]={variant:t,vertex_data:this.vertexLayoutForMeshVariant(t).createVertexData()}),i[t.key]},vertexLayoutForMeshVariant:function(e){return this.vertex_layout},default_mesh_variant:{key:0},meshVariantTypeForDraw:function(e){return this.default_mesh_variant},addFeature:function(e,t,i){var r=i.tile;this.tile_data[r.id]||this.startData(r);var n=this.parseFeature(e,t,i);if(n){var o=this.getTileMesh(r,this.meshVariantTypeForDraw(n)),a=o.vertex_data.offset,s=o.vertex_data.vertex_count;0<this.buildGeometry(e.geometry,n,o,i)?e.generation=this.generation:o.vertex_data.vertex_count>s&&(o.vertex_data.vertex_buffer.fill(0,a,o.vertex_data.offset),o.vertex_data.vertex_count=s,o.vertex_data.offset=a)}},buildGeometry:function(e,t,i,r){var n;return"Polygon"===e.type?n=this.buildPolygons([e.coordinates],t,i,r):"MultiPolygon"===e.type?n=this.buildPolygons(e.coordinates,t,i,r):"LineString"===e.type?n=this.buildLines([e.coordinates],t,i,r):"MultiLineString"===e.type?n=this.buildLines(e.coordinates,t,i,r):"Point"===e.type?n=this.buildPoints([e.coordinates],t,i,r):"MultiPoint"===e.type&&(n=this.buildPoints(e.coordinates,t,i,r)),n},parseFeature:function(t,e,i){try{var r=this.feature_style;if(r.order=this.parseOrder(e.order,i),null==r.order&&"overlay"!==this.blend){var n="Layer '".concat(e.layers.join(", "),"', draw group '").concat(e.group,"': ");return n+="'order' parameter is required unless blend mode is 'overlay'",null!=e.order&&(n+="; 'order' was set to a dynamic value (e.g. string tied to feature property, ",n+="or JS function), but evaluated to null for one or more features"),void Kr({level:"warn",once:!0},n)}if(!(r=this._parseFeature(t,e,i)))return;if(this.selection?r.interactive=jo.evalProperty(this.introspection||e.interactive,i):r.interactive=!1,!0===r.interactive){var o=Jl.makeEntry(),a=o.color,s=o.key;r.selection_color=a,i.tile.selection_data||(i.tile.selection_data={}),i.tile.selection_data[s]={id:t.id||s,properties:t.properties,source_name:i.source,source_layer:i.layer,layers:i.layers}}else r.selection_color=Jl.defaultColor;return r}catch(e){Kr("error","Style.parseFeature: style parsing error",t,r,e.stack)}},_parseFeature:function(e,t,i){return this.feature_style},preprocess:function(e,t){if(!e.preprocessed){if(this.draw)for(var i in this.draw){var r=this.draw[i];"object"!==vr(r)||Array.isArray(r)?null==e[i]&&(e[i]=r):e[i]=fl({},r,e[i])}var n=t||"";if(!(e=this._preprocess(e,n)))return;e.preprocessed=!0}return e},_preprocess:function(e,t){return e},parseOrder:function(e,t){return"number"!=typeof e?jo.calculateOrder(e,t):e},scaleOrder:function(e){return 2*e},parseColor:function(e,t){return e?jo.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?jo.defaults.color:void 0},buildPolygons:function(){return 0},buildLines:function(){return 0},buildPoints:function(){return 0},setGL:function(e){this.gl=e,this.max_texture_size=$o.getMaxTextureSize(this.gl)},makeMesh:function(e,t,i){var r=2<arguments.length&&void 0!==i?i:{},n=this.vertexLayoutForMeshVariant(r.variant);return new Ql(this.gl,e,t,n,r)},render:function(e){return e.render()},getProgram:function(e){var t=0<arguments.length&&void 0!==e?e:"program";this.compileSetup();var i=this[t];if(i&&!i.error){if(!i.compiled)try{i.compile()}catch(e){Kr("error","Style: error compiling program for style '".concat(this.name,"' (program key '").concat(t,"')"),this,e.stack)}return i}},compileSetup:function(){if(!this.compile_setup){if(!this.gl)throw new Error("style.compile(): skipping for ".concat(this.name," because no GL context"));var e=this.buildDefineList();if(this.selection){var t=Object.assign({},e);t.TANGRAM_FEATURE_SELECTION=!0}var i=this.shaders&&this.shaders.blocks,r=this.shaders&&this.shaders.block_scopes,n=Object.assign({},this.shaders&&this.shaders.uniforms);for(var o in n)null==n[o]&&Kr({level:"warn",once:!0},"Style '".concat(this.name,"' has invalid uniform '").concat(o,"': uniform values must be non-null"));var a=this.shaders&&this.shaders.extensions;"string"==typeof a&&(a=[a]),this.program=new Zl(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:n,blocks:i,block_scopes:r,extensions:a}),this.selection?this.selection_program=new Zl(this.gl,this.vertex_shader_src,this.crop_by_tile?"\n#pragma tangram: utils\n#ifdef TANGRAM_FEATURE_SELECTION\nuniform float u_meters_per_pixel;varying vec4 v_selection_color;varying vec4 v_local_space_position;\n#endif\nvoid main(void){\n#ifdef TANGRAM_FEATURE_SELECTION\nif(isLocalSpacePixelOutsideTile(v_local_space_position,TANGRAM_TILE_SCALE.x)){discard;}else{gl_FragColor=v_selection_color;}\n#else\ngl_FragColor=vec4(0.,0.,0.,1.);\n#endif\n}":"\n#ifdef TANGRAM_FEATURE_SELECTION\nvarying vec4 v_selection_color;\n#endif\nvoid main(void){\n#ifdef TANGRAM_FEATURE_SELECTION\ngl_FragColor=v_selection_color;\n#else\ngl_FragColor=vec4(0.,0.,0.,1.);\n#endif\n}",{name:this.name+" (selection)",defines:t,uniforms:n,blocks:i,block_scopes:r,extensions:a}):this.selection_program=null,this.compile_setup=!0}},addShaderBlock:function(e,t,i){var r=2<arguments.length&&void 0!==i?i:null;this.shaders.blocks=this.shaders.blocks||{},this.shaders.blocks[e]=this.shaders.blocks[e]||[],this.shaders.blocks[e].push(t),this.shaders.block_scopes=this.shaders.block_scopes||{},this.shaders.block_scopes[e]=this.shaders.block_scopes[e]||[],this.shaders.block_scopes[e].push(r)},removeShaderBlock:function(e){this.shaders.blocks&&(this.shaders.blocks[e]=null)},replaceShaderBlock:function(e,t,i){var r=2<arguments.length&&void 0!==i?i:null;this.removeShaderBlock(e),this.addShaderBlock(e,t,r)},buildDefineList:function(){var e={};if(null!=this.defines)for(var t in this.defines)e[t]=this.defines[t];if(null!=this.shaders&&null!=this.shaders.defines)for(t in this.shaders.defines)e[t]=this.shaders.defines[t];return e},hasRasters:function(){return-1<["color","normal","custom"].indexOf(this.raster)},setupRasters:function(){var t=this;if(this.hasRasters()){"color"===this.raster?this.defines.TANGRAM_RASTER_TEXTURE_COLOR=!0:"normal"===this.raster&&(this.defines.TANGRAM_RASTER_TEXTURE_NORMAL=!0);var e=Object.keys(this.sources).filter(function(e){return t.sources[e]instanceof sa}).length;this.defines.TANGRAM_NUM_RASTER_SOURCES="".concat(e),0<e&&(this.defines.TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster",uu,"Raster"))}},buildRasterTextures:function(l,u){var t=this;if(!this.hasRasters())return Promise.resolve(u);var c={},h={};return l.rasters.map(function(e){return t.sources[e]}).filter(function(e){return e}).forEach(function(e,t){if(e instanceof sa){var i=e.tileTexture(l);c[i.url]=i,h[i.url]=t}}),0===Object.keys(c).length?Promise.resolve(u):Cr.postMessage(this.main_thread_target+".loadTextures",c).then(function(e){if(!e||e.length<1)return Kr("trace","Missing texture info for tile ".concat(l.key)),null;if(e.some(function(e){return!e.loaded}))return null;u.uniforms=u.uniforms||{},u.textures=u.textures||[];var o=u.uniforms.u_rasters=[],a=u.uniforms.u_raster_sizes=[],s=u.uniforms.u_raster_offsets=[];return e.forEach(function(e){var t=h[e.name],i=c[e.name].coords;if(o[t]=e.name,u.textures.push(e.name),a[t]=[e.width,e.height],l.coords.z>i.z){var r=l.coords.z-i.z,n=Math.pow(2,r);s[t]=[(l.coords.x%n+n)%n/n,(n-1-l.coords.y%n)/n,1/n]}else s[t]=[0,0,1]}),u})},loadTextures:function(e){return $o.createFromObject(this.gl,e).then(function(){return Promise.all(Object.keys(e).map(function(e){return $o.textures[e]&&$o.textures[e].load()}).filter(function(e){return e}))}).then(function(e){return e.forEach(function(e){return e.retain()}),e.map(function(e){return{name:e.name,width:e.width,height:e.height,loaded:e.loaded}})})},setup:function(){this.setUniforms(),this.material.setupProgram(Zl.current)},setUniforms:function(){var e=Zl.current;e&&e.setUniforms(this.shaders&&this.shaders.uniforms,!0)},render_states:{opaque:{depth_test:!0,depth_write:!0},translucent:{depth_test:!0,depth_write:!0},add:{depth_test:!0,depth_write:!1},multiply:{depth_test:!0,depth_write:!1},inlay:{depth_test:!0,depth_write:!1},overlay:{depth_test:!1,depth_write:!1}},default_blend_orders:{opaque:0,add:1,multiply:2,inlay:3,translucent:4,overlay:5},blendOrderSort:function(e,t){var i=parseInt(e.name)-parseInt(t.name);return i||("opaque"===e.blend||"opaque"===t.blend?"opaque"===e.blend&&"opaque"===t.blend?e.name<t.name?-1:1:"opaque"===e.blend?-1:1:e.blend_order<t.blend_order?-1:e.blend_order>t.blend_order?1:cu.default_blend_orders[e.blend]<cu.default_blend_orders[t.blend]?-1:cu.default_blend_orders[e.blend]>cu.default_blend_orders[t.blend]?1:e.name<t.name?-1:1)}},hu=lu={};lu.BYTE=5120,lu.UNSIGNED_BYTE=5121,lu.SHORT=5122,lu.UNSIGNED_SHORT=5123,lu.INT=5124,lu.UNSIGNED_INT=5125,lu.FLOAT=5126;var fu,du=Math.pow(2,16)-1,_u=!1,pu=function(){function t(e){mr(this,t),this.size_=e||1024,this.position_=0,this.ArrayType_=Uint16Array,this.buffer_=new this.ArrayType_(this.size_),this.overflows_=!1}return yr(t,[{key:"push",value:function(e){if(!this.overflows_||_u){if(du<e){if(this.overflows_=!0,!_u)return;this.ArrayType_===Uint16Array&&(this.ArrayType_=Uint32Array,this.buffer_=new this.ArrayType_(this.buffer_))}this.position_===this.size_&&this.expand_(),this.buffer_[this.position_]=e,this.position_+=1}}},{key:"end",value:function(){if(0===this.position_)return!1;var e=this.buffer_,t=this.position_;return this.buffer_=new this.ArrayType_(this.size_),this.position_=0,this.overflows_=!1,e.subarray(0,t)}},{key:"expand_",value:function(){this.size_=this.size_<<1;var e=new this.ArrayType_(this.size_);e.set(this.buffer_),this.buffer_=e}}]),t}();pu.setElementIndexUint=function(e){_u=e};var vu=(xr(fu={},hu.FLOAT,Float32Array),xr(fu,hu.BYTE,Int8Array),xr(fu,hu.UNSIGNED_BYTE,Uint8Array),xr(fu,hu.INT,Int32Array),xr(fu,hu.UNSIGNED_INT,Uint32Array),xr(fu,hu.SHORT,Int16Array),xr(fu,hu.UNSIGNED_SHORT,Uint16Array),fu),mu=function(){function r(e){var t=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).prealloc,i=void 0===t?500:t;mr(this,r),this.vertex_layout=e,this.vertex_elements=new pu,this.stride=this.vertex_layout.stride,0<r.array_pool.length?(this.vertex_buffer=r.array_pool.pop(),this.byte_length=this.vertex_buffer.byteLength,this.size=Math.floor(this.byte_length/this.stride),Kr("trace","VertexData: reused buffer of bytes ".concat(this.byte_length,", ").concat(this.size," vertices"))):(this.size=i,this.byte_length=this.stride*this.size,this.vertex_buffer=new Uint8Array(this.byte_length)),this.offset=0,this.vertex_count=0,this.realloc_count=0,this.setBufferViews(),this.setAddVertexFunction()}return yr(r,[{key:"setBufferViews",value:function(){var i=this;this.views={},this.views[hu.UNSIGNED_BYTE]=this.vertex_buffer,this.vertex_layout.dynamic_attribs.forEach(function(e){if(null==i.views[e.type]){var t=vu[e.type];i.views[e.type]=new t(i.vertex_buffer.buffer)}})}},{key:"checkBufferSize",value:function(){if(this.offset+this.stride>this.byte_length){this.size=Math.floor(1.5*this.size),this.size-=this.size%4,this.byte_length=this.stride*this.size;var e=new Uint8Array(this.byte_length);e.set(this.vertex_buffer),r.array_pool.push(this.vertex_buffer),this.vertex_buffer=e,this.setBufferViews(),this.realloc_count++}}},{key:"setAddVertexFunction",value:function(){this.vertexLayoutAddVertex=this.vertex_layout.getAddVertexFunction()}},{key:"addVertex",value:function(e){this.checkBufferSize(),this.vertexLayoutAddVertex(e,this.views,this.offset),this.offset+=this.stride,this.vertex_count++}},{key:"end",value:function(){return this.vertex_buffer=this.vertex_buffer.subarray(0,this.offset),this.element_buffer=this.vertex_elements.end(),Kr("trace","VertexData: ".concat(this.size," vertices total, realloc count ").concat(this.realloc_count)),this}}]),r}();mu.array_pool=[];var gu=function(){function l(e){mr(this,l),this.attribs=e,this.dynamic_attribs=this.attribs.filter(function(e){return!e.static}),this.components=[],this.index={},this.offset={};for(var t=this.stride=0,i=0,r=0;r<this.attribs.length;r++){var n=this.attribs[r];if(null==n.static){n.offset=this.stride,n.byte_size=n.size;var o=0;switch(n.type){case hu.FLOAT:case hu.INT:case hu.UNSIGNED_INT:n.byte_size*=4,o=2;break;case hu.SHORT:case hu.UNSIGNED_SHORT:n.byte_size*=2,o=1}3&n.byte_size&&(n.byte_size+=4-(3&n.byte_size)),this.stride+=n.byte_size;for(var a=n.offset>>o,s=0;s<n.size;s++)this.components.push({type:n.type,shift:o,offset:a++,index:i++});this.index[n.name]=t,t+=n.size,this.offset[n.name]=n.offset}else n.static=Array.isArray(n.static)?n.static:[n.static],n.method="vertexAttrib".concat(n.static.length,"fv")}}return yr(l,[{key:"enable",value:function(e,t,i){for(var r,n,o=0;o<this.attribs.length;o++)r=this.attribs[o],-1!==(n=t.attribute(r.name).location)&&(null==r.static?(l.enabled_attribs[n]&&!i||e.enableVertexAttribArray(n),e.vertexAttribPointer(n,r.size,r.type,r.normalized,this.stride,r.offset),l.enabled_attribs[n]=t):e[r.method]instanceof Function&&(e.enableVertexAttribArray(n),e[r.method](n,r.static),e.disableVertexAttribArray(n),delete l.enabled_attribs[n]));for(n in l.enabled_attribs)this.disableUnusedAttribute(e,n,t)}},{key:"disableUnusedAttribute",value:function(e,t,i){l.enabled_attribs[t]!==i&&(e.disableVertexAttribArray(t),delete l.enabled_attribs[t])}},{key:"createVertexData",value:function(){return new mu(this)}},{key:"getAddVertexFunction",value:function(){return null==this.addVertex&&this.createAddVertexFunction(),this.addVertex}},{key:"createAddVertexFunction",value:function(){var e=ql(JSON.stringify(this.attribs));if(null==l.add_vertex_funcs[e]){var t,i=["var t, o;"],r=Pr(this.components);r.sort(function(e,t){return e.type!==t.type?e.type-t.type:e.index-t.index});for(var n=0;n<r.length;n++){var o=r[n];t!==o.type&&(i.push("t = vs[".concat(o.type,"];")),i.push("o = off".concat(o.shift?" >> "+o.shift:"",";")),t=o.type),i.push("t[o + ".concat(o.offset,"] = v[").concat(o.index,"];"))}i=i.join("\n");var a=new Function("v","vs","off",i);l.add_vertex_funcs[e]=a}this.addVertex=l.add_vertex_funcs[e]}}]),l}();gu.enabled_attribs={},gu.add_vertex_funcs={};var yu=[{x:0,y:0},{x:Jr.tile_scale,y:-Jr.tile_scale}],xu=[0,0,1,1];function bu(e,t,i){var r=yu[0],n=yu[1];return e[0]<=r.x+i&&t[0]<=r.x+i||e[0]>=n.x-i&&t[0]>=n.x-i||e[1]>=r.y-i&&t[1]>=r.y-i||e[1]<=n.y+i&&t[1]<=n.y+i}function Au(e,t){t=t||0;var i=yu[0],r=yu[1];return e[0]<=i.x+t||e[0]>=r.x-t||e[1]>=i.y-t||e[1]<=r.y+t}var Tu=wu;function wu(e,t,i){i=i||2;var r,n,o,a,s,l,u,c=t&&t.length,h=c?t[0]*i:e.length,f=ku(e,0,h,i,!0),d=[];if(!f)return d;if(c&&(f=function(e,t,i,r){var n,o,a,s,l,u=[];for(n=0,o=t.length;n<o;n++)a=t[n]*r,s=n<o-1?t[n+1]*r:e.length,(l=ku(e,a,s,r,!1))===l.next&&(l.steiner=!0),u.push(Lu(l));for(u.sort(Nu),n=0;n<u.length;n++)Ou(u[n],i),i=Eu(i,i.next);return i}(e,t,f,i)),e.length>80*i){r=o=e[0],n=a=e[1];for(var _=i;_<h;_+=i)(s=e[_])<r&&(r=s),(l=e[_+1])<n&&(n=l),o<s&&(o=s),a<l&&(a=l);u=Math.max(o-r,a-n)}return Mu(f,d,i,r,n,u),d}function ku(e,t,i,r,n){var o,a;if(n===0<Hu(e,t,i,r))for(o=t;o<i;o+=r)a=Bu(o,e[o],e[o+1],a);else for(o=i-r;t<=o;o-=r)a=Bu(o,e[o],e[o+1],a);return a&&Du(a,a.next)&&(Vu(a),a=a.next),a}function Eu(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!Du(r,r.next)&&0!==Fu(r.prev,r,r.next))r=r.next;else{if(Vu(r),(r=t=r.prev)===r.next)return null;i=!0}}while(i||r!==t);return t}function Mu(e,t,i,r,n,o,a){if(e){!a&&o&&function(e,t,i,r){var n=e;for(;null===n.z&&(n.z=Iu(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next,n!==e;);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,r,n,o,a,s,l,u=1;do{for(i=e,o=e=null,a=0;i;){for(a++,r=i,t=s=0;t<u&&(s++,r=r.nextZ);t++);for(l=u;0<s||0<l&&r;)0===s?(r=(n=r).nextZ,l--):0!==l&&r?i.z<=r.z?(i=(n=i).nextZ,s--):(r=(n=r).nextZ,l--):(i=(n=i).nextZ,s--),o?o.nextZ=n:e=n,n.prevZ=o,o=n;i=r}o.nextZ=null,u*=2}while(1<a)}(n)}(e,r,n,o);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,o?Su(e,r,n,o):Ru(e))t.push(s.i/i),t.push(e.i/i),t.push(l.i/i),Vu(e),e=l.next,u=l.next;else if((e=l)===u){a?1===a?Mu(e=Pu(e,t,i),t,i,r,n,o,2):2===a&&zu(e,t,i,r,n,o):Mu(Eu(e),t,i,r,n,o,1);break}}}function Ru(e){var t=e.prev,i=e,r=e.next;if(0<=Fu(t,i,r))return!1;for(var n=e.next.next;n!==e.prev;){if(Cu(t.x,t.y,i.x,i.y,r.x,r.y,n.x,n.y)&&0<=Fu(n.prev,n,n.next))return!1;n=n.next}return!0}function Su(e,t,i,r){var n=e.prev,o=e,a=e.next;if(0<=Fu(n,o,a))return!1;for(var s=n.x<o.x?n.x<a.x?n.x:a.x:o.x<a.x?o.x:a.x,l=n.y<o.y?n.y<a.y?n.y:a.y:o.y<a.y?o.y:a.y,u=n.x>o.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,c=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,h=Iu(s,l,t,i,r),f=Iu(u,c,t,i,r),d=e.nextZ;d&&d.z<=f;){if(d!==e.prev&&d!==e.next&&Cu(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=Fu(d.prev,d,d.next))return!1;d=d.nextZ}for(d=e.prevZ;d&&d.z>=h;){if(d!==e.prev&&d!==e.next&&Cu(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=Fu(d.prev,d,d.next))return!1;d=d.prevZ}return!0}function Pu(e,t,i){var r=e;do{var n=r.prev,o=r.next.next;!Du(n,o)&&ju(n,r,r.next,o)&&Uu(n,o)&&Uu(o,n)&&(t.push(n.i/i),t.push(r.i/i),t.push(o.i/i),Vu(r),Vu(r.next),r=e=o),r=r.next}while(r!==e);return r}function zu(e,t,i,r,n,o){var a,s,l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&(s=u,(a=l).next.i!==s.i&&a.prev.i!==s.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&ju(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(a,s)&&Uu(a,s)&&Uu(s,a)&&function(e,t){var i=e,r=!1,n=(e.x+t.x)/2,o=(e.y+t.y)/2;for(;i.y>o!=i.next.y>o&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next,i!==e;);return r}(a,s))){var c=Gu(l,u);return l=Eu(l,l.next),c=Eu(c,c.next),Mu(l,t,i,r,n,o),void Mu(c,t,i,r,n,o)}u=u.next}l=l.next}while(l!==e)}function Nu(e,t){return e.x-t.x}function Ou(e,t){if(t=function(e,t){var i,r=t,n=e.x,o=e.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&a<s){if((a=s)===n){if(o===r.y)return r;if(o===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!i)return null;if(n===a)return i.prev;var l,u=i,c=i.x,h=i.y,f=1/0;r=i.next;for(;r!==u;)n>=r.x&&r.x>=c&&Cu(o<h?n:a,o,c,h,o<h?a:n,o,r.x,r.y)&&((l=Math.abs(o-r.y)/(n-r.x))<f||l===f&&r.x>i.x)&&Uu(r,e)&&(i=r,f=l),r=r.next;return i}(e,t)){var i=Gu(t,e);Eu(i,i.next)}}function Iu(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)/n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)/n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Lu(e){for(var t=e,i=e;t.x<i.x&&(i=t),(t=t.next)!==e;);return i}function Cu(e,t,i,r,n,o,a,s){return 0<=(n-a)*(t-s)-(e-a)*(o-s)&&0<=(e-a)*(r-s)-(i-a)*(t-s)&&0<=(i-a)*(o-s)-(n-a)*(r-s)}function Fu(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Du(e,t){return e.x===t.x&&e.y===t.y}function ju(e,t,i,r){return!!(Du(e,t)&&Du(i,r)||Du(e,r)&&Du(i,t))||0<Fu(e,t,i)!=0<Fu(e,t,r)&&0<Fu(i,r,e)!=0<Fu(i,r,t)}function Uu(e,t){return Fu(e.prev,e,e.next)<0?0<=Fu(e,t,e.next)&&0<=Fu(e,e.prev,t):Fu(e,t,e.prev)<0||Fu(e,e.next,t)<0}function Gu(e,t){var i=new qu(e.i,e.x,e.y),r=new qu(t.i,t.x,t.y),n=e.next,o=t.prev;return(e.next=t).prev=e,(i.next=n).prev=i,(r.next=i).prev=r,(o.next=r).prev=o,r}function Bu(e,t,i,r){var n=new qu(e,t,i);return r?(n.next=r.next,(n.prev=r).next.prev=n,r.next=n):(n.prev=n).next=n,n}function Vu(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function qu(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Hu(e,t,i,r){for(var n=0,o=t,a=i-r;o<i;o+=r)n+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return n}wu.deviation=function(e,t,i,r){var n=t&&t.length,o=n?t[0]*i:e.length,a=Math.abs(Hu(e,0,o,i));if(n)for(var s=0,l=t.length;s<l;s++){var u=t[s]*i,c=s<l-1?t[s+1]*i:e.length;a-=Math.abs(Hu(e,u,c,i))}var h=0;for(s=0;s<r.length;s+=3){var f=r[s]*i,d=r[s+1]*i,_=r[s+2]*i;h+=Math.abs((e[f]-e[_])*(e[1+d]-e[1+f])-(e[f]-e[d])*(e[1+_]-e[1+f]))}return 0===a&&0===h?0:Math.abs((h-a)/a)},wu.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,n=0;n<e.length;n++){for(var o=0;o<e[n].length;o++)for(var a=0;a<t;a++)i.vertices.push(e[n][o][a]);0<n&&(r+=e[n-1].length,i.holes.push(r))}return i};var Yu=[0,0,1];function Wu(e,t,i,r){var n=r.texcoord_index,o=r.texcoord_scale,a=r.texcoord_normalize,s=t.vertex_elements;if(n){a=a||1;var l=Sr(o||xu,4),u=l[0],c=l[1],h=l[2],f=l[3]}for(var d,_=0,p=e.length,v=0;v<p;v++){var m=t.vertex_count,g=e[v];if(n)var y=Sr(Jr.findBoundingBox(g),4),x=y[0],b=y[1],A=(h-u)/(y[2]-x),T=(f-c)/(y[3]-b);for(var w=0;w<g.length;w++)for(var k=g[w],E=0;E<k.length;E++){var M=k[E];i[0]=M[0],i[1]=M[1],n&&(i[n+0]=((M[0]-x)*A+u)*a,i[n+1]=((M[1]-b)*T+c)*a),t.addVertex(i)}for(var R=(d=Tu.flatten(g),Tu(d.vertices,d.holes,d.dimensions)),S=0;S<R.length;S++)s.push(m+R[S]);_+=R.length/3}return _}var Xu="uniform vec2 u_resolution;uniform float u_time;uniform vec3 u_map_position;uniform vec4 u_tile_origin;uniform float u_tile_proxy_depth;uniform float u_meters_per_pixel;uniform float u_device_pixel_ratio;uniform mat4 u_model;uniform mat4 u_modelView;uniform mat3 u_normalMatrix;uniform mat3 u_inverseNormalMatrix;attribute vec4 a_position;attribute vec4 a_color;\n#ifdef TANGRAM_NORMAL_ATTRIBUTE\nattribute vec3 a_normal;\n#define TANGRAM_NORMAL a_normal\n#else\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n#endif\n#ifdef TANGRAM_EXTRUDE_LINES\nattribute vec2 a_extrude;attribute vec2 a_offset;attribute vec2 a_scaling;uniform float u_v_scale_adjust;\n#endif\nvarying vec4 v_position;varying vec4 v_local_space_position;varying vec3 v_normal;varying vec4 v_color;varying vec4 v_world_position;\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\nattribute vec2 a_texcoord;varying vec2 v_texcoord;\n#endif\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\nvarying vec4 v_modelpos_base_zoom;\n#endif\n#if defined(TANGRAM_LIGHTING_VERTEX)\nvarying vec4 v_lighting;\n#endif\n#define UNPACK_SCALING(x) (x / 1024.)\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\nvoid main(){\n#pragma tangram: setup\n#ifdef TANGRAM_TEXTURE_COORDS\nv_texcoord=a_texcoord;\n#ifdef TANGRAM_EXTRUDE_LINES\nv_texcoord.y*=u_v_scale_adjust;\n#endif\n#endif\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\nv_modelpos_base_zoom=modelPositionBaseZoom();\n#endif\nvec4 position=vec4(a_position.xy,a_position.z/TANGRAM_HEIGHT_SCALE,1.);\n#ifdef TANGRAM_EXTRUDE_LINES\nvec2 extrude=a_extrude.xy;vec2 offset=a_offset.xy;float dz=clamp(u_map_position.z-u_tile_origin.z,0.,4.);dz+=step(1.,dz)*(1.-dz)+mix(0.,2.,clamp((dz-2.)/2.,0.,1.));float mdz=(dz-0.5)*2.;extrude-=extrude*UNPACK_SCALING(a_scaling.x)*mdz;float dwdz=UNPACK_SCALING(a_scaling.y);float sdwdz=sign(step(0.,dwdz)-0.5);offset-=offset*abs(dwdz)*((1.-step(0.,sdwdz))-(dz*-sdwdz));float ssz=exp2(-dz-(u_tile_origin.z-u_tile_origin.w));extrude*=ssz;offset*=ssz;\n#ifdef TANGRAM_BLOCK_WIDTH\nfloat width=1.;\n#pragma tangram: width\nextrude*=width;\n#endif\nposition.xy+=extrude+offset;\n#endif\nv_world_position=wrapWorldPosition(u_model*position);v_local_space_position=position;position=u_modelView*position;\n#pragma tangram: position\nv_position=position;v_normal=normalize(u_normalMatrix*TANGRAM_NORMAL);v_color=a_color;\n#if defined(TANGRAM_LIGHTING_VERTEX)\nvec3 normal=v_normal;\n#pragma tangram: normal\nv_lighting=calculateLighting(position.xyz-u_eye,normal,vec4(1.));\n#endif\ncameraProjection(position);applyLayerOrder(a_position.w+u_tile_proxy_depth+1.,position);\n#if defined(SNAP_TO_PIXEL_GRID)\nsnapToPixelGrid(position);\n#endif\ngl_Position=position;}",Zu="uniform vec2 u_resolution;uniform float u_time;uniform vec3 u_map_position;uniform vec4 u_tile_origin;uniform float u_meters_per_pixel;uniform float u_device_pixel_ratio;uniform mat3 u_normalMatrix;uniform mat3 u_inverseNormalMatrix;varying vec4 v_position;varying vec4 v_local_space_position;varying vec3 v_normal;varying vec4 v_color;varying vec4 v_world_position;\n#ifdef TANGRAM_EXTRUDE_LINES\nuniform bool u_has_line_texture;uniform sampler2D u_texture;uniform float u_texture_ratio;uniform vec4 u_dash_background_color;\n#endif\n#define TANGRAM_NORMAL v_normal\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\nvarying vec2 v_texcoord;\n#endif\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\nvarying vec4 v_modelpos_base_zoom;\n#endif\n#if defined(TANGRAM_LIGHTING_VERTEX)\nvarying vec4 v_lighting;\n#endif\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n#pragma tangram: utils\nvoid main(void){\n#pragma tangram: setup\nvec4 color=v_color;vec3 normal=TANGRAM_NORMAL;\n#ifdef TANGRAM_CROP_BY_TILE\nif(isLocalSpacePixelOutsideTile(v_local_space_position,TANGRAM_TILE_SCALE.x)){discard;}\n#endif\n#ifdef TANGRAM_RASTER_TEXTURE_COLOR\ncolor*=sampleRaster(0);\n#endif\n#ifdef TANGRAM_EXTRUDE_LINES\nif(u_has_line_texture){vec2 _line_st=vec2(v_texcoord.x,fract(v_texcoord.y/u_texture_ratio));vec4 _line_color=texture2D(u_texture,_line_st);if(_line_color.a<TANGRAM_ALPHA_TEST){\n#if !defined(TANGRAM_BLEND_OVERLAY) && !defined(TANGRAM_BLEND_INLAY)\nif(u_dash_background_color.a==0.){discard;}color=u_dash_background_color;\n#else\ncolor=vec4(u_dash_background_color.rgb,color.a*step(TANGRAM_EPSILON,u_dash_background_color.a));\n#endif\n}else{color*=_line_color;}}\n#endif\n#ifdef TANGRAM_RASTER_TEXTURE_NORMAL\nnormal=normalize(sampleRaster(0).rgb*2.-1.);\n#endif\n#if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\ncalculateNormal(normal);\n#endif\n#if !defined(TANGRAM_LIGHTING_VERTEX)\n#pragma tangram: normal\n#endif\n#pragma tangram: color\n#if defined(TANGRAM_LIGHTING_FRAGMENT)\ncolor=calculateLighting(v_position.xyz-u_eye,normal,color);\n#elif defined(TANGRAM_LIGHTING_VERTEX)\ncolor*=v_lighting;\n#endif\n#pragma tangram: filter\ngl_FragColor=color;}",Ku=Object.create(cu);Object.assign(Ku,{name:"polygons",built_in:!0,vertex_shader_src:Xu,fragment_shader_src:Zu,selection:!0,init:function(){cu.init.apply(this,arguments),this.defines.TANGRAM_NORMAL_ATTRIBUTE=!0,this.defines.TANGRAM_LAYER_ORDER=!0,this.texcoords&&(this.defines.TANGRAM_TEXTURE_COORDS=!0)},vertexLayoutForMeshVariant:function(e){if(!this.vertex_layout){var t=[{name:"a_position",size:4,type:hu.SHORT,normalized:!1},{name:"a_normal",size:3,type:hu.BYTE,normalized:!0},{name:"a_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0}];this.texcoords&&t.push({name:"a_texcoord",size:2,type:hu.UNSIGNED_SHORT,normalized:!0}),this.vertex_layout=new gu(t)}return this.vertex_layout},_parseFeature:function(e,t,i){var r=this.feature_style;return r.color=this.parseColor(t.color,i),r.color?(r.z=t.z&&jo.evalCachedDistanceProperty(t.z,i)||jo.defaults.z,r.z*=Jr.height_scale,r.extrude=jo.evalProperty(t.extrude,i),r.extrude&&(!0===r.extrude?(r.height=void 0!==e.properties.height?e.properties.height:jo.defaults.height,r.min_height=void 0!==e.properties.min_height?e.properties.min_height:jo.defaults.min_height):"number"==typeof r.extrude?(r.height=r.extrude,r.min_height=0):Array.isArray(r.extrude)&&(r.min_height=r.extrude[0],r.height=r.extrude[1]),r.height*=Jr.height_scale,r.min_height*=Jr.height_scale),r.tile_edges=t.tile_edges,r):null},_preprocess:function(e){return e.color=jo.createColorPropertyCache(e.color),e.z=jo.createPropertyCache(e.z,jo.parseUnits),e},makeVertexTemplate:function(e){var t=0;return this.vertex_template[t++]=0,this.vertex_template[t++]=0,this.vertex_template[t++]=e.z||0,this.vertex_template[t++]=this.scaleOrder(e.order),this.vertex_template[t++]=0,this.vertex_template[t++]=0,this.vertex_template[t++]=127,this.vertex_template[t++]=255*e.color[0],this.vertex_template[t++]=255*e.color[1],this.vertex_template[t++]=255*e.color[2],this.vertex_template[t++]=255*e.color[3],this.selection&&(this.vertex_template[t++]=255*e.selection_color[0],this.vertex_template[t++]=255*e.selection_color[1],this.vertex_template[t++]=255*e.selection_color[2],this.vertex_template[t++]=255*e.selection_color[3]),this.texcoords&&(this.vertex_template[t++]=0,this.vertex_template[t++]=0),this.vertex_template},buildPolygons:function(e,t,i,r){var n=this.makeVertexTemplate(t),o={texcoord_index:this.vertex_layout.index.a_texcoord,texcoord_normalize:65535,remove_tile_edges:!t.tile_edges,tile_edge_tolerance:Jr.tile_scale*r.tile.pad_scale*4,winding:r.winding};return t.extrude&&t.height?function(e,t,i,r,n,o,a,s,l){var u=l.remove_tile_edges,c=l.tile_edge_tolerance,h=l.texcoord_index,f=l.texcoord_scale,d=l.texcoord_normalize,_=l.winding,p=t+(r||0),v=t+i;o[2]=v;var m=Wu(e,n,o,{texcoord_index:h,texcoord_scale:f,texcoord_normalize:d}),g=n.vertex_elements,y=n.vertex_count;if(h){d=d||1;var x=Sr(f||xu,4),b=x[0],A=x[1],T=x[2],w=x[3],k=[[b,w],[b,A],[T,A],[T,w]]}for(var E=e.length,M=0;M<E;M++)for(var R=e[M],S=0;S<R.length;S++)for(var P=R[S],z=0;z<P.length-1;z++)if(!u||!bu(P[z],P[z+1],c)){var N=void 0,O=void 0,I=[[P[O="CCW"===_?(N=z)+1:(N=z+1,z)][0],P[O][1],v],[P[O][0],P[O][1],p],[P[N][0],P[N][1],p],[P[N][0],P[N][1],v]],L=iu.normalize([P[O][0]-P[N][0],P[O][1]-P[N][1],0]),C=iu.cross(Yu,L);o[a+0]=C[0]*s,o[a+1]=C[1]*s,o[a+2]=C[2]*s;for(var F=0;F<I.length;F++)o[0]=I[F][0],o[1]=I[F][1],o[2]=I[F][2],h&&(o[h+0]=k[F][0]*d,o[h+1]=k[F][1]*d),n.addVertex(o);g.push(y+0),g.push(y+1),g.push(y+2),g.push(y+2),g.push(y+3),g.push(y+0),y+=4,m+=2}return m}(e,t.z,t.height,t.min_height,i.vertex_data,n,this.vertex_layout.index.a_normal,127,o):Wu(e,i.vertex_data,n,o)}});var Ju=[0,0],$u={butt:0,square:1,round:2},Qu={miter:0,bevel:1,round:2},ec={MITER_LIMIT:3,TEXCOORD_NORMALIZE:1,TEXCOORD_RATIO:1,MIN_FAN_WIDTH:5},tc=Jr.tile_scale,ic=[0,0],rc=[1,0],nc=[.5,0];function oc(e,t){if(!(e.length<2)){var i,r,n,o,a=t.join_type,s=t.cap_type,l=t.closed_polygon,u=t.remove_tile_edges,c=t.tile_edge_tolerance,h=t.v_scale,f=t.miter_len_sq,d=t.crop_by_tile,_=null!=t.texcoord_index,p=0;if(l&&a===Qu.miter){var v=function(e){if(Au(e[0]))return 0;for(var t=0;t<e.length;t++){if(Au(e[e.length-1-t]))return e.length-1-t}return 0}(e);if(0!==v){var m=function(e,t){for(var i=[],r=0;r<e.length;r++){var n=(r+t)%e.length;0!=n&&i.push(e[n])}return i.push(i[0]),i}(e,v);return t.extra_lines=t.extra_lines||[],void t.extra_lines.push(m)}}var g=0,y=e.length-1,x=0;for(i=e[g],r=e[g+1];iu.isEqual(i,r);)if(i=r,r=e[++g+1],x++,g===e.length-1)return;for(;iu.isEqual(e[y],e[y-1]);)if(x++,0===--y)return;if(!(e.length<2+x))if(o=iu.normalize(iu.perp(i,r)),u&&bu(i,r,c)){var b=ac(e,g,c);b&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(b))}else{l?function(e,t,i,r,n){if(void 0===r||Au(e)&&!n.crop_by_tile)hc(e,i,i,1,0,n,1),hc(e,i,i,0,0,n,-1);else{r===Qu.miter?lc(0,e,t,i,n.miter_len_sq,!0,n):uc(r,0,e,t,i,!0,n)}}(i,n=iu.normalize(iu.perp(e[y-1],i)),o,a,t):(!d&&Au(i)||(_c(i,p,o,s,!0,t),_&&s!==$u.butt&&(p+=.5*h*t.texcoord_width)),hc(i,o,o,1,p,t,1),hc(i,o,o,0,p,t,-1)),_&&(p+=h*iu.length(iu.sub(r,i)));for(var A=g+1;A<y;A++){var T=A,w=A+1;if(i=e[T],r=e[w],!iu.isEqual(i,r)){if(u&&bu(i,r,c)){hc(i,o,o,1,p,t,1),hc(i,o,o,0,p,t,-1),cc(1,t);var k=ac(e,T+1,c);return void(k&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(k)))}n=o,o=iu.normalize(iu.perp(i,r)),a===Qu.miter?lc(p,i,n,o,f,!1,t):uc(a,p,i,n,o,!1,t),_&&(p+=h*iu.length(iu.sub(r,i)))}}i=r,n=o,l?function(e,t,i,r,n,o){if(Au(e)&&!o.crop_by_tile)hc(e,t,t,1,n,o,1),hc(e,t,t,0,n,o,-1),cc(1,o);else{var a=sc(t,i);r===Qu.miter&&iu.lengthSq(a)>o.miter_len_sq&&(r=Qu.bevel),r===Qu.miter?(hc(e,a,t,1,n,o,1),hc(e,a,t,0,n,o,-1)):(hc(e,t,t,1,n,o,1),hc(e,t,t,0,n,o,-1)),cc(1,o)}}(i,n,o=iu.normalize(iu.perp(i,e[1])),a,p,t):(hc(i,n,o,1,p,t,1),hc(i,n,o,0,p,t,-1),cc(1,t),!d&&Au(i)||_c(i,p,n,s,!1,t))}}}function ac(e,t,i){for(var r=t;e[r+1]&&bu(e[r],e[r+1],i);)r++;return 2<=e.length-r&&e.slice(r)}function sc(e,t){var i=iu.normalize(iu.add(e,t)),r=2/(1+Math.abs(iu.dot(e,i)));return iu.mult(i,r*r)}function lc(e,t,i,r,n,o,a){var s=sc(i,r);iu.lengthSq(s)>n?uc(Qu.bevel,e,t,i,r,o,a):(hc(t,s,s,1,e,a,1),hc(t,s,s,0,e,a,-1),o||cc(1,a))}function uc(e,t,i,r,n,o,a){var s=sc(r,n),l=0<n[0]*r[1]-n[1]*r[0];null!=a.texcoord_index&&(ic[1]=t,rc[1]=t),l?(hc(i,s,s,1,t,a,1),hc(i,r,s,0,t,a,-1),o||cc(1,a),dc(i,iu.neg(r),s,iu.neg(n),s,ic,rc,ic,!1,e===Qu.bevel,a),hc(i,s,s,1,t,a,1),hc(i,n,s,0,t,a,-1)):(hc(i,r,s,1,t,a,1),hc(i,s,s,0,t,a,-1),o||cc(1,a),dc(i,r,iu.neg(s),n,s,rc,ic,rc,!1,e===Qu.bevel,a),hc(i,n,s,1,t,a,1),hc(i,s,s,0,t,a,-1))}function cc(e,t){for(var i=t.vertex_data.vertex_elements,r=t.vertex_data.vertex_count-2*e-2,n=0;n<e;n++)i.push(r+2*n+2),i.push(r+2*n+1),i.push(r+2*n+0),i.push(r+2*n+2),i.push(r+2*n+3),i.push(r+2*n+1),t.geom_count+=2}function hc(e,t,i,r,n,o,a){var s=o.vertex_template,l=o.vertex_data;s[0]=e[0],s[1]=e[1];var u=o.half_width*a;s[o.extrude_index+0]=t[0]*u,s[o.extrude_index+1]=t[1]*u,o.offset&&(s[o.offset_index+0]=i[0]*o.offset,s[o.offset_index+1]=i[1]*o.offset),null!=o.texcoord_index&&(s[o.texcoord_index+0]=r*o.texcoord_normalize,s[o.texcoord_index+1]=n*o.texcoord_normalize),l.addVertex(s)}var fc=[0,0];function dc(e,t,i,r,n,o,a,s,l,u,c){for(var h=t[0]*r[1]-t[1]*r[0],f=iu.dot(t,r),d=Math.atan2(h,f);d>=Math.PI;)d-=2*Math.PI;if(u)_=1;else{var _=function(e,t){e<0&&(e=-e);var i=t>2*ec.MIN_FAN_WIDTH?Math.log2(t/ec.MIN_FAN_WIDTH):1;return Math.ceil(e/Math.PI*i)}(d,c.half_width);if(_<1)return}var p=c.vertex_data.vertex_count,v=c.vertex_data.vertex_elements;hc(e,i,n,a[0],a[1],c,1),hc(e,t,n,o[0],o[1],c,1);var m=t,g=null!=c.texcoord_index;if(g)if(l)var y=iu.sub(o,a);else{fc=iu.copy(o);var x=iu.div(iu.sub(s,o),_)}var b,A,T=d/_,w=d<0?-1:1;A=0<h?(b=2,1):(b=1,2);for(var k=0;k<_;k++)0===k&&d<0&&(m=iu.neg(m)),m=iu.rot(m,T),g&&(l?(y=iu.rot(y,T),fc[0]=y[0]+a[0],fc[1]=y[1]*c.texcoord_width*c.v_scale+a[1]):fc=iu.add(fc,x)),hc(e,m,n,fc[0],fc[1],c,w),v.push(p+k+b),v.push(p),v.push(p+k+A)}function _c(e,t,i,r,n,o){var a=iu.neg(i),s=null!=o.texcoord_index;switch(r){case $u.square:var l;n?(l=[i[1],-i[0]],hc(e,iu.add(i,l),i,1,t,o,1),hc(e,iu.add(a,l),i,0,t,o,1),s&&(t+=.5*o.texcoord_width*o.v_scale),hc(e,i,i,1,t,o,1),hc(e,a,i,0,t,o,1)):(l=[-i[1],i[0]],hc(e,i,i,1,t,o,1),hc(e,a,i,0,t,o,1),s&&(t+=.5*o.texcoord_width*o.v_scale),hc(e,iu.add(i,l),i,1,t,o,1),hc(e,iu.add(a,l),i,0,t,o,1)),cc(1,o);break;case $u.round:var u,c,h=ic,f=rc,d=nc;n?(u=i,c=a,s&&(t+=.5*o.texcoord_width*o.v_scale,h=rc,f=ic,d=nc)):(u=a,c=i),s&&(ic[1]=t,rc[1]=t,nc[1]=t),dc(e,u,Ju,c,i,h,d,f,!0,!1,o);break;case $u.butt:return}}var pc=[255,255,255,255],vc=[0,0,0,0];var mc=Object.create(cu);mc.vertex_layouts=[[],[]],mc.variants={},mc.dash_textures={};function gc(e,t){if(!(e.length<2)){for(var i=[e[0]],r=0,n=[],o=[],a=1,s=e.length;a<s;a++)if(e[a][0]!==e[a-1][0]||e[a][1]!==e[a-1][1]){i.push(e[a]);var l=iu.sub(e[a],e[a-1]),u=iu.length(l);n.push(l),o.push([r,r+u]),r+=u}if(!(i.length<2)){var c=0,h=n[n.length-1],f=n[0],d=n[1],_=[0,0];2<i.length&&(t.closed&&(_[0]=iu.signedAngleBetween(h,f)),_[1]=iu.signedAngleBetween(f,d));var p=i[0],v=o[0];t.closed?(bc(p,t,c++,v,r,_,[h,f]),bc(p,t,c++,v,r,_,[h,f])):(bc(p,t,c++,v,r,_,[f,f]),bc(p,t,c++,v,r,_,[f,f]));for(var m=1,g=i.length-1;m<g;m++)p=i[m],h=n[m-1],f=n[m],d=n[m+1],bc(p,t,c++,v=o[m-1],r,_,[h,f]),bc(p,t,c++,v,r,_,[h,f]),yc(t),v=o[m],_[0]=_[1],_[1]=m!==g-1?iu.signedAngleBetween(f,d):t.closed?iu.signedAngleBetween(f,n[0]):0,bc(p,t,c++,v,r,_,[h,f]),bc(p,t,c++,v,r,_,[h,f]);p=i[i.length-1],v=o[o.length-1],f=n[n.length-1],t.closed?(bc(p,t,c++,v,r,_,[f,n[0]]),bc(p,t,c++,v,r,_,[f,n[0]])):(bc(p,t,c++,v,r,_,[f,f]),bc(p,t,c++,v,r,_,[f,f])),yc(t)}}}function yc(e){var t=e.vertex_data.vertex_elements,i=e.vertex_data.vertex_count-4;t.push(2+i),t.push(1+i),t.push(0+i),t.push(2+i),t.push(3+i),t.push(1+i),e.geom_count+=2}Object.assign(mc,{name:"lines",built_in:!0,vertex_shader_src:Xu,fragment_shader_src:Zu,selection:!0,init:function(){cu.init.apply(this,arguments),this.styles=this.styles||{},this.defines.TANGRAM_LAYER_ORDER=!0,this.defines.TANGRAM_EXTRUDE_LINES=!0,this.defines.TANGRAM_CROP_BY_TILE=this.crop_by_tile,this.defines.TANGRAM_TEXTURE_COORDS=!0,this.outline_feature_style={},this.inline_feature_style=this.feature_style},calcDistance:function(e,t){return e&&jo.evalCachedDistanceProperty(e,t)||0},calcDistanceNextZoom:function(e,t){t.zoom++;var i=this.calcDistance(e,t);return t.zoom--,i},calcWidth:function(e,t,i){var r=this.calcDistance(e.width,i);if(!(r<0)){var n;if(n=e.next_width?this.calcDistanceNextZoom(e.next_width,i):r/2,0===r&&0===n||n<0)return!1;if(t.width_unscaled=r,t.next_width_unscaled=n,e.next_width){var o=.5*(r+(n*=2));t.width=o*i.units_per_meter_overzoom,t.width_scale=1-n/o}else t.width=r*i.units_per_meter_overzoom,t.width_scale=0;return e.texcoords&&(e.inline_texcoord_width?t.texcoord_width=e.inline_texcoord_width:t.texcoord_width=(t.width_unscaled||t.next_width_unscaled)*i.units_per_meter_overzoom/i.tile.overzoom2),!0}},calcOffset:function(e,t,i){if(e.offset_precalc)t.offset=e.offset_precalc,t.offset_scale=e.offset_scale_precalc;else if(e.offset){var r=this.calcDistance(e.offset,i);if(e.next_offset){var n=2*this.calcDistanceNextZoom(e.next_offset,i);Math.abs(r)>=Math.abs(n)?(t.offset=r*i.units_per_meter_overzoom,t.offset_scale=0!==r?1-n/r:0):(t.offset=n*i.units_per_meter_overzoom,t.offset_scale=0!=n?-1*(1-r/n):0)}else t.offset=r*i.units_per_meter_overzoom,t.offset_scale=0}else t.offset=0,t.offset_scale=0;jo.evalProperty(e.offset_reverse,i)&&(t.offset*=-1)},_parseFeature:function(e,t,i){var r=this.feature_style;if(!1!==this.calcWidth(t,r,i)&&(this.calcOffset(t,r,i),r.color=this.parseColor(t.color,i),r.color)){if(r.variant=t.variant,r.z=t.z&&jo.evalCachedDistanceProperty(t.z||0,i)||jo.defaults.z,r.height=e.properties.height||jo.defaults.height,r.extrude=jo.evalProperty(t.extrude,i),r.extrude&&("number"==typeof r.extrude?r.height=r.extrude:Array.isArray(r.extrude)&&(r.height=r.extrude[1])),r.extrude&&r.height&&(r.z+=r.height),r.z*=Jr.height_scale,r.height*=Jr.height_scale,r.cap=jo.evalProperty(t.cap,i),r.join=jo.evalProperty(t.join,i),r.miter_limit=jo.evalProperty(t.miter_limit,i),r.tile_edges=t.tile_edges,r.outline=r.outline||{width:{},next_width:{},preprocessed:!0},t.outline&&!1!==t.outline.visible&&t.outline.color&&t.outline.width){var n=2*this.calcDistance(t.outline.width,i),o=2*this.calcDistanceNextZoom(t.outline.next_width,i);0==n&&0==o||n<0||o<0?(r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null,r.outline.texcoords=!1):(r.outline.width.value=n+r.width_unscaled,r.outline.next_width.value=o+r.next_width_unscaled,r.outline.inline_texcoord_width=r.texcoord_width,r.outline.offset_precalc=r.offset,r.outline.offset_scale_precalc=r.offset_scale,r.outline.color=t.outline.color,r.outline.cap=t.outline.cap,r.outline.join=t.outline.join,r.outline.miter_limit=t.outline.miter_limit,r.outline.texcoords=t.outline.texcoords,r.outline.style=t.outline.style,r.outline.variant=t.outline.variant,t.outline.order?r.outline.order=this.parseOrder(t.outline.order,i):r.outline.order=r.order,r.outline.order>r.order&&(r.outline.order=r.order),r.outline.order-=.5,r.outline.variant_order=0)}else r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null;return r}},_preprocess:function(e,t){var i=this.sources[t]?this.sources[t].config.uid:"";if(e.color=jo.createColorPropertyCache(e.color),e.width=jo.createPropertyCache(e.width,jo.parseUnits),e.width&&e.width.type!==jo.CACHE_TYPE.STATIC&&(e.next_width=jo.createPropertyCache(e.width,jo.parseUnits)),e.offset=e.offset&&jo.createPropertyCache(e.offset,jo.parseUnits),e.offset&&e.offset.type!==jo.CACHE_TYPE.STATIC&&(e.next_offset=jo.createPropertyCache(e.offset,jo.parseUnits)),e.z=jo.createPropertyCache(e.z,jo.parseUnits),e.dash=void 0!==e.dash?e.dash:this.dash,e.dash_key=e.dash&&this.dashTextureKey(e.dash,i),e.dash_background_color=void 0!==e.dash_background_color?e.dash_background_color:this.dash_background_color,e.dash_background_color=e.dash_background_color&&jo.parseColor(e.dash_background_color),e.texture_merged=e.dash_key||(void 0!==e.texture?e.texture:this.texture),e.texcoords=this.texcoords||e.texture_merged?1:0,this.computeVariant(e),e.outline){e.outline.style=e.outline.style||this.name,e.outline.color=jo.createColorPropertyCache(e.outline.color),e.outline.width=jo.createPropertyCache(e.outline.width,jo.parseUnits),e.outline.next_width=jo.createPropertyCache(e.outline.width,jo.parseUnits),e.outline.cap=e.outline.cap||e.cap,e.outline.join=e.outline.join||e.join,e.outline.miter_limit=e.outline.miter_limit||e.miter_limit,e.outline.offset=e.offset;var r=this.styles[e.outline.style];r?(e.outline.dash=void 0!==e.outline.dash?e.outline.dash:r.dash,e.outline.texture=void 0!==e.outline.texture?e.outline.texture:r.texture,null!=e.outline.dash?(e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash,i),e.outline.texture_merged=e.outline.dash_key):null===e.outline.dash?(e.outline.dash_key=null,e.outline.texture_merged=e.outline.texture):null!=e.outline.texture?(e.outline.dash_key=null,e.outline.texture_merged=e.outline.texture):(e.outline.dash=e.dash,e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash,i),e.outline.texture_merged=e.outline.dash_key),e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:r.dash_background_color,e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:e.dash_background_color,e.outline.dash_background_color=e.outline.dash_background_color&&jo.parseColor(e.outline.dash_background_color),e.outline.texcoords=r.texcoords||e.outline.texture_merged?1:0,this.computeVariant(e.outline)):(Kr({level:"warn",once:!0},"Layer '".concat(e.layers[e.layers.length-1],"': ")+"line 'outline' specifies non-existent draw style '".concat(e.outline.style,"' (or maybe the style is ")+"defined but is missing a 'base' or has another error), skipping outlines in layer"),e.outline=null)}return e},dashTextureKey:function(e,t){return"__dash_"+t+"_"+JSON.stringify(e)},getDashTexture:function(e,t){var i=this.dashTextureKey(e,this.sources[t].config.uid);if(null==mc.dash_textures[i]){mc.dash_textures[i]=!0;var r=function(e,t){var i=1<arguments.length&&void 0!==t?t:{},r=i.dash_color||pc,n=i.background_color||vc,o=e,a=i.scale||1;o.length%2==1&&Array.prototype.push.apply(o,o);for(var s=!0,l=[],u=0;u<o.length;u++){for(var c=Math.floor(o[u]*a),h=0;h<c;h++)Array.prototype.push.apply(l,s?r:n);s=!s}return{pixels:l=new Uint8Array(l),length:l.length/4}}(e,{scale:20});$o.create(this.gl,i,{data:r.pixels,height:r.length,width:1,filtering:"nearest"})}},endData:function(a){var s=this;return cu.endData.call(this,a).then(function(n){if(n){n.uniforms.u_has_line_texture=!1,n.uniforms.u_texture=$o.default,n.uniforms.u_v_scale_adjust=Jr.tile_scale;var o=[],e=function(e){var i=n.meshes[e].variant;if(i.texture){var r=n.meshes[e].uniforms=n.meshes[e].uniforms||{};if(r.u_has_line_texture=!0,r.u_texture=i.texture,r.u_texture_ratio=1,i.dash&&(r.u_v_scale_adjust=20*Jr.tile_scale,r.u_dash_background_color=i.dash_background_color||[0,0,0,0]),i.dash_key&&null==mc.dash_textures[i.dash_key]&&(mc.dash_textures[i.dash_key]=!0,Cr.postMessage(s.main_thread_target+".getDashTexture",i.dash,a.source)),null==$o.textures[i.texture])o.push($o.syncTexturesToWorker([i.texture]).then(function(e){var t=e[i.texture];t&&(r.u_texture_ratio=t.height/t.width)}));else{var t=$o.textures[i.texture];r.u_texture_ratio=t.height/t.width}}};for(var t in n.meshes)e(t);return a.mesh_data[s.name]=n,Promise.all(o).then(function(){return n})}return n})},computeVariant:function(e){var t=e.offset?1:0;e.dash_key&&(t+=e.dash_key,e.dash_background_color&&(t+=e.dash_background_color)),e.texture_merged&&(t+=e.texture_merged),t=ql(t+="/"+e.texcoords),e.variant=t,null==mc.variants[t]&&(mc.variants[t]={key:t,order:e.variant_order,offset:e.offset?1:0,texcoords:e.texcoords,texture:e.texture_merged,dash:e.dash,dash_key:e.dash_key,dash_background_color:e.dash_background_color})},vertexLayoutForMeshVariant:function(e){if(null==mc.vertex_layouts[e.key]){var t=[{name:"a_position",size:4,type:hu.SHORT,normalized:!1},{name:"a_extrude",size:2,type:hu.SHORT,normalized:!1},{name:"a_offset",size:2,type:hu.SHORT,normalized:!1,static:e.offset?null:[0,0]},{name:"a_scaling",size:2,type:hu.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:hu.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]},{name:"a_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0}];mc.vertex_layouts[e.key]=new gu(t)}return mc.vertex_layouts[e.key]},meshVariantTypeForDraw:function(e){return mc.variants[e.variant]},makeVertexTemplate:function(e,t){var i=0;return this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=e.z||0,this.vertex_template[i++]=this.scaleOrder(e.order),this.vertex_template[i++]=0,this.vertex_template[i++]=0,t.variant.offset&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),this.vertex_template[i++]=1024*e.width_scale,this.vertex_template[i++]=1024*e.offset_scale,t.variant.texcoords&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0),this.vertex_template[i++]=255*e.color[0],this.vertex_template[i++]=255*e.color[1],this.vertex_template[i++]=255*e.color[2],this.vertex_template[i++]=255*e.color[3],this.selection&&(this.vertex_template[i++]=255*e.selection_color[0],this.vertex_template[i++]=255*e.selection_color[1],this.vertex_template[i++]=255*e.selection_color[2],this.vertex_template[i++]=255*e.selection_color[3]),this.vertex_template},buildLines:function(e,t,i,r,n){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var o=this.styles[t.outline.style];o&&o.addFeature(r.feature,t.outline,r)}this.feature_style=this.inline_feature_style;var a=i.vertex_data,s=a.vertex_layout,l=this.makeVertexTemplate(t,i);return function(e,t,i,r,n){var o,a=n.closed_polygon,s=n.remove_tile_edges,l=n.tile_edge_tolerance,u=n.texcoord_index,c=(n.texcoord_scale,n.texcoord_width),h=n.texcoord_ratio,f=n.texcoord_normalize,d=n.extrude_index,_=n.offset_index,p=n.join,v=n.cap,m=n.miter_limit,g=n.offset,y=n.crop_by_tile,x=v?$u[v]:$u.butt,b=p?Qu[p]:Qu.miter;if(b===Qu.miter)var A=(m=m||ec.MITER_LIMIT)*m;u&&(f=f||ec.TEXCOORD_NORMALIZE,o=1/(c*(h=h||ec.TEXCOORD_RATIO)*tc));for(var T={closed_polygon:a,remove_tile_edges:s,tile_edge_tolerance:l,miter_len_sq:A,join_type:b,cap_type:x,vertex_data:i,vertex_template:r,half_width:t/2,extrude_index:d,offset_index:_,v_scale:o,texcoord_index:u,texcoord_width:c,texcoord_normalize:f,offset:g,geom_count:0,crop_by_tile:y},w=0;w<e.length;w++)oc(e[w],T);if(T.extra_lines)for(var k=0;k<T.extra_lines.length;k++)oc(T.extra_lines[k],T);return T.geom_count}(e,t.width,a,l,{cap:t.cap,join:t.join,miter_limit:t.miter_limit,extrude_index:s.index.a_extrude,offset_index:s.index.a_offset,texcoord_index:s.index.a_texcoord,texcoord_width:t.texcoord_width,texcoord_normalize:65535,closed_polygon:n&&n.closed_polygon,remove_tile_edges:!t.tile_edges&&n&&n.remove_tile_edges,tile_edge_tolerance:Jr.tile_scale*r.tile.pad_scale*2,offset:t.offset,crop_by_tile:this.crop_by_tile})},buildPolygons:function(e,t,i,r){for(var n=0,o=0;o<e.length;o++)n+=this.buildLines(e[o],t,i,r,{closed_polygon:!0,remove_tile_edges:!this.crop_by_tile});return n}});var xc=[[1,1],[1,-1],[-1,1],[-1,-1]];function bc(e,t,i,r,n,o,a){var s=t.vertex_template,l=t.vertex_data;if(Ac(t,"a_position",e),Ac(t,"a_width",t.half_width),t.vertex_layout_index.a_barycentric){var u=[0,0,0];u[i%3]=1,Ac(t,"a_barycentric",u)}Ac(t,"a_tangents",a[0].concat(a[1])),Ac(t,"a_segment",r),Ac(t,"a_texcoord",xc[i%4]),Ac(t,"a_length",n),Ac(t,"a_closed",t.closed?1:0),Ac(t,"a_angles",o),l.addVertex(s)}function Ac(e,t,i){var r=i.length,n=e.vertex_template,o=e.vertex_layout_index[t],a=0;if(r)for(;a!==r;)n[o+a]=i[a],a++;else n[o+a]=i}function Tc(e,a){for(var s=e.reduce(function(e,t){return e+t}),t=0,l=[],i=0,r=e.length;i<=r;i+=2){var n=Math.max(1e-4,e[i%r]),o=Math.max(1e-4,e[(i+1)%r]);l.push(t,t+n),t+=n+o}for(var u=new Uint8Array(4*a),c=0,h=function(e){var t=s*e/(a-1),i=function(e){for(var t=e[0],i=0,r=1,n=e.length;r<n;r++)e[r]<t&&(t=e[i=r]);return i}(l.map(function(e){return Math.abs(e-t)})),r=void 0,n=void 0,o=void 0;o=i%2==0?(r=t<=l[i]?1:0,n=l[i],l[i+1]):(r=t>l[i]?2:0,n=l[i-1],l[i]),u[c++]=l[i],u[c++]=r,u[c++]=n,u[c++]=o},f=0;f<a;f++)h(f);return u}var wc=Object.create(cu),kc={round:1,"arrow-tail":2,"arrow-head":3,square:4,butt:5},Ec={miter:0,round:1,bevel:2},Mc=kc.round,Rc=Ec.miter,Sc=[0,0],Pc="antialias join linecaps miter_limit dash_index dash dash_caps dash_phase".split(" ");Object.assign(wc,{name:"pattern-lines",built_in:!0,vertex_shader_src:"uniform vec2 u_resolution;uniform float u_time;uniform vec4 u_tile_origin;uniform float u_tile_proxy_depth;uniform float u_meters_per_pixel;uniform float u_device_pixel_ratio;uniform sampler2D u_uniforms;uniform mat4 u_model;uniform mat4 u_modelView;uniform mat3 u_normalMatrix;uniform mat3 u_inverseNormalMatrix;uniform float u_antialias;uniform vec2 u_linecaps;uniform float u_linejoin;uniform float u_miter_limit;uniform float u_dash_index;uniform vec2 u_dash_caps;uniform float u_dash_phase;uniform float u_dash_period;attribute vec4 a_position;attribute vec4 a_color;attribute float a_width;\n#ifdef TANGRAM_DEBUG_TRIANGLES\nattribute vec3 a_barycentric;\n#endif\nattribute vec2 a_normal;attribute float a_length;attribute vec2 a_segment;attribute vec2 a_texcoord;attribute vec2 a_angles;attribute vec4 a_tangents;attribute float a_closed;varying vec4 v_position;varying vec4 v_local_space_position;varying vec3 v_normal;varying vec4 v_color;varying vec4 v_world_position;varying float v_closed;\n#ifdef TANGRAM_DEBUG_TRIANGLES\nvarying vec3 v_barycentric;\n#endif\nvarying vec2 v_segment;varying vec2 v_angles;varying vec2 v_texcoord;varying vec2 v_distances;varying vec2 v_miter;varying float v_length;varying float v_linewidth;varying float v_joinIndicator;\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\nvarying vec4 v_modelpos_base_zoom;\n#endif\n#if defined(TANGRAM_LIGHTING_VERTEX)\nvarying vec4 v_lighting;\n#endif\n#ifndef TANGRAM_HEIGHT_SCALE\nfloat TANGRAM_HEIGHT_SCALE=16.0;\n#endif\n#define UNPACK_SCALING(x) (x / 1024.)\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: global\nconst float PI=3.141592653589793;const float THETA=15.0*PI/180.0;float cross(in vec2 v1,in vec2 v2){return v1.x*v2.y-v1.y*v2.x;}float signed_distance(in vec2 v1,in vec2 v2,in vec2 v3){return cross(v2-v1,v1-v3)/length(v2-v1);}void rotate(in vec2 v,in float angle,out vec2 result){float cosine=cos(angle);float sine=sin(angle);result=vec2(cosine*v.x-sine*v.y,sine*v.x+cosine*v.y);}void main(){\n#pragma tangram: setup\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\nv_modelpos_base_zoom=modelPositionBaseZoom();\n#endif\nv_closed=a_closed;v_angles=a_angles;v_segment=a_segment;v_color=a_color;v_length=a_length;v_linewidth=a_width*2.0;v_texcoord=a_texcoord;\n#ifdef TANGRAM_DEBUG_TRIANGLES\nv_barycentric=a_barycentric;\n#endif\nv_color.a=min(v_linewidth,v_color.a);v_linewidth=max(v_linewidth,1.0);if(v_color.a<=0.0){gl_Position=vec4(0.0,0.0,0.0,1.0);return;}float width=ceil(1.25*u_antialias+v_linewidth)/2.0;vec2 t1=normalize(a_tangents.xy);vec2 t2=normalize(a_tangents.zw);float u=a_texcoord.x;u*=-1.0;float v=a_texcoord.y;vec2 o1=vec2(+t1.y,-t1.x);vec2 o2=vec2(+t2.y,-t2.x);vec4 position=vec4(a_position.xy,a_position.z/TANGRAM_HEIGHT_SCALE,1.0);if(t1!=t2){float angle=a_texcoord.x==1.0 ? a_angles.x : a_angles.y;vec2 t=normalize(t1+t2);vec2 o=vec2(+t.y,-t.x);float segmentLength=a_segment.y-a_segment.x;float halfMiterlength=width/cos(angle/2.0);if(u_dash_index>0.0){if((abs(angle)>THETA)){position.xy+=v*width*o/cos(angle/2.0);float s=sign(angle);if(angle<0.0){if(u==+1.0){u=v_segment.y+v*width*tan(angle/2.0);if(v==1.0){position.xy-=2.0*width*t1/sin(angle);u-=2.0*width/sin(angle);}}else{u=v_segment.x-v*width*tan(angle/2.0);if(v==1.0){position.xy+=2.0*width*t2/sin(angle);u+=2.0*width/sin(angle);}}}else{if(u==+1.0){u=v_segment.y+v*width*tan(angle/2.0);if(v==-1.0){position.xy+=2.0*width*t1/sin(angle);u+=2.0*width/sin(angle);}}else{u=v_segment.x-v*width*tan(angle/2.0);if(v==-1.0){position.xy-=2.0*width*t2/sin(angle);u-=2.0*width/sin(angle);}}}}else{position.xy+=v*width*o/cos(angle/2.0);if(u==+1.0){u=v_segment.y;}else{u=v_segment.x;}}}else{position.xy+=v*o*halfMiterlength;if(u==+1.0){u=v_segment.y+v*width*tan(angle/2.0);}else{u=v_segment.x-v*width*tan(angle/2.0);}}v_joinIndicator=(segmentLength+v*width*tan(angle/2.0))/segmentLength;}else{v_joinIndicator=-1.0;position.xy+=v*width*o1;if(u==-1.0){u=v_segment.x-width;position.xy-=width*t1;}else{u=v_segment.y+width;position.xy+=width*t2;}}vec2 t;vec2 curr=a_position.xy;if(a_texcoord.x>=0.0){vec2 next=curr+t2*(v_segment.y-v_segment.x);rotate(t1,+a_angles.x/2.0,t);v_miter.x=signed_distance(curr,curr+t,position.xy);rotate(t2,+a_angles.y/2.0,t);v_miter.y=signed_distance(next,next+t,position.xy);}else{vec2 prev=curr-t1*(v_segment.y-v_segment.x);rotate(t1,-a_angles.x/2.0,t);v_miter.x=signed_distance(prev,prev+t,position.xy);rotate(t2,-a_angles.y/2.0,t);v_miter.y=signed_distance(curr,curr+t,position.xy);}v_distances=vec2(u,v*width);v_world_position=wrapWorldPosition(u_model*position);v_local_space_position=position;position=u_modelView*position;\n#pragma tangram: position\nv_position=position;v_normal=normalize(u_normalMatrix*TANGRAM_NORMAL);\n#if defined(TANGRAM_LIGHTING_VERTEX)\nvec3 normal=v_normal;\n#pragma tangram: normal\nv_lighting=calculateLighting(position.xyz-u_eye,normal,vec4(1.));\n#endif\ncameraProjection(position);\n#ifdef TANGRAM_LAYER_ORDER\napplyLayerOrder(a_position.w+u_tile_proxy_depth+1.,position);\n#endif\ngl_Position=position;}",fragment_shader_src:"uniform vec2 u_resolution;uniform float u_time;uniform vec4 u_tile_origin;uniform float u_meters_per_pixel;uniform float u_device_pixel_ratio;uniform mat3 u_normalMatrix;uniform mat3 u_inverseNormalMatrix;uniform sampler2D u_dash_atlas;uniform float u_antialias;uniform vec2 u_linecaps;uniform float u_linejoin;uniform float u_miter_limit;uniform float u_dash_phase;uniform float u_dash_period;uniform float u_dash_index;uniform vec2 u_dash_caps;varying vec4 v_position;varying vec4 v_local_space_position;varying vec3 v_normal;varying vec4 v_color;varying vec4 v_world_position;varying float v_closed;\n#ifdef TANGRAM_DEBUG_TRIANGLES\nvarying vec3 v_barycentric;\n#endif\nvarying vec2 v_segment;varying vec2 v_angles;varying vec2 v_texcoord;varying vec2 v_distances;varying vec2 v_miter;varying float v_length;varying float v_linewidth;varying float v_joinIndicator;\n#define TANGRAM_NORMAL v_normal\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\nvarying vec4 v_modelpos_base_zoom;\n#endif\n#if defined(TANGRAM_LIGHTING_VERTEX)\nvarying vec4 v_lighting;\n#endif\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: global\n#pragma tangram: utils\nconst float PI=3.141592653589793;const float HALF_PI=PI/2.0;const float THETA=15.0*PI/180.0;/***Compute distance to cap.*@param{int}type The Type of the cap(see CAP_TYPE in pattern_lines)*@param{float}dx The distance of the pixel from the beginning of the line(not straight distance,but along the legs)*@param{float}dy The distance of the pixel from the midline(see v_distances in vertex shader,aka \xb11*half_line_width)*@param{float}aa_radius The distance from the mid-line from where antialiasing starts.*For example for a line width 10px width and 2px filter radius it is 10px/2-2px=3px.*@return{float}distance*/float cap(int type,float dx,float dy,float aa_radius){float dist=0.0;dx=abs(dx);dy=abs(dy);if(type==1)dist=sqrt(dx*dx+dy*dy);else if(type==3)dist=(dx+abs(dy));else if(type==2)dist=max(abs(dy),(aa_radius+dx-abs(dy)));else if(type==4)dist=max(dx,dy);else if(type==5)dist=max(dx+aa_radius,dy);return dist;}/***Compute distance to join.*@param{int}type The type of the join(see JOIN_TYPE in pattern_lines)*@param{vec2}segment Interpolated a_segment attribute from the vertex shader*@param{vec2}texcoord Pair of u/v coordinates to identify the 4 different extruded points of the segment.*@param{vec2}distances 2 component vector where:*x is the distance of the pixel from the beginning of the line(along the legs)*y is the  distance of the pixel from the midline(see v_distances in vertex shader,\xb11*half_line_width)*@param{vec2}miter Miter point coordiante*@param{float}miter_limit The miter limit*@param{float}line_width The line width*@return{float}computed distance*/float join(in int type,in vec2 segment,in vec2 texcoord,in vec2 distances,in vec2 miter,in float miter_limit,in float line_width){float dx=distances.x;float result=abs(distances.y);if((dx<segment.x)||(dx>segment.y)){if(type==1){float s=dx<segment.x ? segment.x : segment.y;result=max(result,length(distances-vec2(s,0.0)));}else{float m=abs(texcoord.x>=0.0 ? miter.x : miter.y);if(type==2){result=max(result,m);}else if(type==0){result=max(result,m-miter_limit*line_width/2.0);}}}return result;}void main(void){\n#pragma tangram: setup\nvec4 color=v_color;vec3 normal=TANGRAM_NORMAL;\n#ifdef TANGRAM_CROP_BY_TILE\nif(isLocalSpacePixelOutsideTile(v_local_space_position,TANGRAM_TILE_SCALE.x)){discard;}\n#endif\n#if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\ncalculateNormal(normal);\n#endif\n#if !defined(TANGRAM_LIGHTING_VERTEX)\n#pragma tangram: normal\n#endif\n#pragma tangram: color\n#if defined(TANGRAM_LIGHTING_FRAGMENT)\ncolor=calculateLighting(v_position.xyz-u_eye,normal,color);\n#elif defined(TANGRAM_LIGHTING_VERTEX)\ncolor*=v_lighting;\n#endif\n#pragma tangram: filter\nif(v_color.a<=0.0){discard;}bool solid=(u_dash_index==0.0);bool closed=v_closed>0.0;float dx=v_distances.x;float dy=v_distances.y;float aa_radius=v_linewidth/2.0-u_antialias;float width=v_linewidth;float dist=0.0;vec2 linecaps=u_linecaps;vec2 dash_caps=u_dash_caps;float line_start=0.0;float line_stop=v_length;if(solid){dist=abs(dy);bool potentialCap=!closed&&v_joinIndicator<0.0;if(potentialCap&&dx<line_start){dist=cap(int(u_linecaps.x),abs(dx),abs(dy),aa_radius);}else if(potentialCap&&dx>line_stop){dist=cap(int(u_linecaps.y),abs(dx)-line_stop,abs(dy),aa_radius);}else{dist=join(int(u_linejoin),v_segment,v_texcoord,v_distances,v_miter,u_miter_limit,v_linewidth);}}else{float segment_start=v_segment.x;float segment_stop=v_segment.y;float segment_center=(segment_start+segment_stop)/2.0;float freq=u_dash_period*width;float dash_phase=u_dash_phase-1e-5;float u=mod(dx+dash_phase*width,freq);vec4 tex=texture2D(u_dash_atlas,vec2(u/freq,u_dash_index));float dash_center=float(tex.x)*255.0*width;float dash_type=floor(float(tex.y)*255.0+0.5);float _start=float(tex.z)*255.0*width;float _stop=float(tex.a)*255.0*width;float dash_start=dx-u+_start;float dash_stop=dx-u+_stop;if((dash_stop<segment_start)&&(dash_caps.x!=5.0)){float u=mod(segment_start+dash_phase*width,freq);vec4 tex=texture2D(u_dash_atlas,vec2(u/freq,u_dash_index));dash_center=float(tex.x)*255.0*width;float _start=float(tex.z)*255.0*width;float _stop=float(tex.a)*255.0*width;dash_start=segment_start-u+_start;dash_stop=segment_start-u+_stop;}else if((dash_start>segment_stop)&&(dash_caps.y!=5.0)){float u=mod(segment_stop+dash_phase*width,freq);vec4 tex=texture2D(u_dash_atlas,vec2(u/freq,u_dash_index));dash_center=float(tex.x)*255.0*width;float _start=float(tex.z)*255.0*width;float _stop=float(tex.a)*255.0*width;dash_start=segment_stop-u+_start;dash_stop=segment_stop-u+_stop;}bool discontinuous=((dx<segment_center)&&abs(v_angles.x)>THETA)||((dx>=segment_center)&&abs(v_angles.y)>THETA);float d_join=join(int(u_linejoin),v_segment,v_texcoord,v_distances,v_miter,u_miter_limit,v_linewidth);if(closed){line_start+=v_linewidth/2.0;line_stop-=v_linewidth/2.0;}if(dash_stop<=line_start){discard;}if(dash_start>=line_stop){discard;}if(discontinuous){if((dash_start>segment_stop)){discard;}if((dash_stop<segment_start)){discard;}if(dash_caps.x==1.0){if((u>_stop)&&(dash_stop>segment_stop)&&(abs(v_angles.y)<HALF_PI)){discard;}}if(dash_caps.y==1.0){if((u<_start)&&(dash_start<segment_start)&&(abs(v_angles.x)<HALF_PI)){discard;}}if((dash_caps.x!=1.0)&&(dash_caps.x!=5.0)){if((dash_start<segment_start)&&(abs(v_angles.x)<HALF_PI)){float a=v_angles.x/2.0;float cos_a=cos(a);float sin_a=sin(a);float x=(segment_start-dx)*cos_a-dy*sin_a;float y=(segment_start-dx)*sin_a+dy*cos_a;if(x>0.0){discard;}dash_caps.x=4.0;}}if((dash_caps.y!=1.0)&&(dash_caps.y!=5.0)){if((dash_stop>segment_stop)&&(abs(v_angles.y)<HALF_PI)){float a=v_angles.y/2.0;float cos_a=cos(a);float sin_a=sin(a);float x=(dx-segment_stop)*cos_a-dy*sin_a;float y=(dx-segment_stop)*sin_a+dy*cos_a;if(x>0.0){discard;}dash_caps.y=4.0;}}}if((dx<line_start)&&(dash_start<=line_start)&&(dash_stop>line_start)){dist=cap(int(linecaps.x),dx-line_start,dy,aa_radius);}else if((dx>line_stop)&&(dash_stop>line_stop)&&(dash_start<line_stop)){dist=cap(int(linecaps.y),dx-line_stop,dy,aa_radius);}else if(dash_type==1.0){dist=cap(int(dash_caps.x),abs(dash_center-u),dy,aa_radius);if((dx>line_start)&&(dx<line_stop)){dist=max(dist,d_join);}}else if(dash_type==0.0){dist=abs(dy);}else if(dash_type==2.0){dist=cap(int(dash_caps.y),abs(u-dash_center),dy,aa_radius);if((dx>line_start)&&(dx<line_stop)){dist=max(dist,d_join);}}if((dx>line_start)&&(dx<line_stop)){if((dx<=segment_start)&&(dash_start<=segment_start)&&(dash_stop>=segment_start)){dist=d_join;float angle=HALF_PI+v_angles.x;float f=abs((segment_start-dx)*cos(angle)-dy*sin(angle));dist=max(f,dist);}else if((dx>segment_stop)&&(dash_start<=segment_stop)&&(dash_stop>=segment_stop)){dist=d_join;float angle=HALF_PI+v_angles.y;float f=abs((dx-segment_stop)*cos(angle)-dy*sin(angle));dist=max(f,dist);}else if(dx<(segment_start-v_linewidth/2.)){discard;}else if(dx>(segment_stop+v_linewidth/2.)){discard;}}else if(dx<(segment_start-v_linewidth/2.)){discard;}else if(dx>(segment_stop+v_linewidth/2.)){discard;}}dist=dist-aa_radius;if(dist>=0.0){if(u_antialias==0.0){discard;}else{color=vec4(color.rgb,exp(-dist*dist)*color.a);}}\n#ifdef TANGRAM_DEBUG_TRIANGLES\nif(any(lessThan(v_barycentric,vec3(0.0085)))){color=vec4(0.0,1.0,0.0,1.0);}\n#endif\ngl_FragColor=color;}",selection:!0,init:function(){cu.init.apply(this,arguments),this.defines.TANGRAM_LAYER_ORDER=!0,this.defines.TANGRAM_CROP_BY_TILE=this.crop_by_tile,this.defines.TANGRAM_DEBUG_TRIANGLES=!1,this.defines.TANGRAM_DEBUG_NO_TEXTURE_FLOAT_SUPPORT=!1,this.styles=this.styles||{},wc.vertex_layouts=[],wc.variants={}},calcDistance:function(e,t){return e&&jo.evalCachedDistanceProperty(e,t)||0},calcDash:function(e,t){var i=jo.evalProperty(e.dash,t),r=0;return i&&((i=Array.isArray(i)&&i.length?i:Sc).length%2==1&&(i=i.concat(i)),r=+(r=i.reduce(function(e,t){return e+t}))||0),{dash:i,dash_period:r}},calcWidth:function(e,t,i){var r=this.calcDistance(e.width,i);return!(r<0)&&(t.width=r*i.units_per_meter_overzoom,!0)},getCapType:function(e,t,i){var r=jo.evalProperty(e,t);return void 0!==kc[r]?kc[r]:i},_parseFeature:function(e,t,i){if(!1!==this.calcWidth(t,this.feature_style,i)){var r=this.parseColor(t.color,i);if(r&&0!==r[3]){var n=this.getCapType(t.cap,i,Mc),o=jo.evalProperty(t.join,i),a=+jo.evalProperty(t.miter_limit,i),s=this.calcDash(t,i),l=s.dash,u=s.dash_period,c=Object.assign({color:r,antialias:t.antialias,linecaps:[this.getCapType(t.tail_cap,i,n),this.getCapType(t.head_cap,i,n)],join:void 0!==Ec[o]?Ec[o]:Rc,miter_limit:0<=a?a:3,dash_index:0===u?0:1,dash:l,dash_caps:[this.getCapType(t.tail_cap,i,n),this.getCapType(t.head_cap,i,n)],dash_phase:+jo.evalProperty(t.dash_phase,i)||0,dash_period:u},this.feature_style);return c.z=t.z&&jo.evalCachedDistanceProperty(t.z||0,i)||jo.defaults.z,c.z*=Jr.height_scale,c.extrude=jo.evalProperty(t.extrude,i),c.extrude&&(!0===c.extrude?(c.height=void 0!==e.properties.height?e.properties.height:jo.defaults.height,c.min_height=void 0!==e.properties.min_height?e.properties.min_height:jo.defaults.min_height):"number"==typeof c.extrude?(c.height=c.extrude,c.min_height=0):Array.isArray(c.extrude)&&(c.min_height=c.extrude[0],c.height=c.extrude[1]),c.height*=Jr.height_scale,c.min_height*=Jr.height_scale),this.computeVariant(c),c}}},_preprocess:function(e,t){e.color=jo.createColorPropertyCache(e.color),e.width=jo.createPropertyCache(e.width,jo.parseUnits),e.width&&e.width.type!==jo.CACHE_TYPE.STATIC&&(e.next_width=jo.createPropertyCache(e.width,jo.parseUnits)),e.z=jo.createPropertyCache(e.z,jo.parseUnits);var i=+e.antialias;return e.antialias=isNaN(i)?0:i,e},buildRasterTextures:function(e,t){var i=[];for(var r in t.meshes){var n=wc.variants[r],o=n.uniforms,a=n.pattern;if(o.u_dash_index){var s="__dash_"+a.join("_")+"_"+e.key+"_"+e.id;i.push({name:s,data:Tc(a,1024)}),o.u_dash_atlas=s,t.meshes[r].textures=[s]}t.meshes[r].uniforms=o}return t.uniforms=t.uniforms||{},i.length?Cr.postMessage(this.main_thread_target+".loadTextures",i).then(function(){return t}):Promise.resolve(t)},loadTextures:function(e){for(var t=[],i=0;i<e.length;i++){var r=e[i],n=$o.textures[r.name];n||(n=$o.create(this.gl,r.name,{filtering:"nearest",repeat:!0,width:1024,height:1,data:r.data})),t.push(n.loading)}return Promise.all(t).then(function(e){return e.map(function(e){return e.retain(),e.name})})},computeVariant:function(e){var t=function(e){for(var t=[],i=0,r=Pc.length;i<r;i++){var n=e[Pc[i]];Array.isArray(n)?t.push(n.join("_")):"boolean"==typeof n?t.push(n?1:0):n&&t.push(n.toString())}return t.join("/")}(e);e.variant=t,null==wc.variants[t]&&(wc.variants[t]={key:t,order:e.variant_order,uniforms:{u_antialias:e.antialias,u_linecaps:e.linecaps,u_linejoin:e.join,u_miter_limit:e.miter_limit,u_dash_index:e.dash_index,u_dash_caps:e.dash_caps,u_dash_phase:e.dash_phase,u_dash_period:e.dash_period},pattern:e.dash})},vertexLayoutForMeshVariant:function(e){if(null==wc.vertex_layouts[e.key]){var t=[{name:"a_position",size:4,type:hu.SHORT,normalized:!1},{name:"a_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0},{name:"a_width",size:1,type:hu.FLOAT,normalized:!1},{name:"a_tangents",size:4,type:hu.FLOAT,normalized:!1},{name:"a_segment",size:2,type:hu.FLOAT,normalized:!1},{name:"a_angles",size:2,type:hu.FLOAT,normalized:!1},{name:"a_texcoord",size:2,type:hu.FLOAT,normalized:!0},{name:"a_length",size:1,type:hu.FLOAT,normalized:!1},{name:"a_closed",size:1,type:hu.FLOAT,normalized:!1},{name:"a_selection_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0}];this.defines.TANGRAM_DEBUG_TRIANGLES&&t.push({name:"a_barycentric",size:3,type:hu.SHORT,normalized:!1}),wc.vertex_layouts[e.key]=new gu(t)}return wc.vertex_layouts[e.key]},meshVariantTypeForDraw:function(e){return wc.variants[e.variant]},makeVertexTemplate:function(e,t){var i=0;return this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=e.z+e.height||0,this.vertex_template[i++]=this.scaleOrder(e.order),this.vertex_template[i++]=255*e.color[0],this.vertex_template[i++]=255*e.color[1],this.vertex_template[i++]=255*e.color[2],this.vertex_template[i++]=255*e.color[3],this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.selection&&(this.vertex_template[i++]=255*e.selection_color[0],this.vertex_template[i++]=255*e.selection_color[1],this.vertex_template[i++]=255*e.selection_color[2],this.vertex_template[i++]=255*e.selection_color[3]),this.defines.TANGRAM_DEBUG_TRIANGLES&&(this.vertex_template[i++]=0,this.vertex_template[i++]=0,this.vertex_template[i++]=0),this.vertex_template},buildLines:function(e,t,i,r,n){var o=4<arguments.length&&void 0!==n&&n,a=i.vertex_data,s=a.vertex_layout,l=this.makeVertexTemplate(t,i);return function(e,t,i,r,n,o){for(var a={closed:o,vertex_data:i,vertex_template:r,half_width:t/2,vertex_layout_index:n,geom_count:0},s=0,l=e.length;s<l;s++)gc(e[s],a);return a.geom_count}(e,t.width,a,l,s.index,o)},buildPolygons:function(e,t,i,r){for(var n=0,o=0,a=e.length;o<a;o++)n+=this.buildLines(e[o],t,i,r,!0);return n}});var zc=0,Nc={id_prefix:"",nextLabelId:function(){return"".concat(Nc.id_prefix,"/").concat(zc++)}};function Oc(e){return{priority:e.priority,collide:e.collide,repeat_distance:e.repeat_distance,repeat_group:e.repeat_group,buffer:e.buffer,italic:e.italic}}var Ic=["left","top-left","bottom-left"],Lc=["right","top-right","bottom-right"],Cc=["top","top-left","top-right"],Fc=["bottom","bottom-left","bottom-right"],Dc={computeOffset:function(e,t,i,r){var n=3<arguments.length&&void 0!==r?r:null;if(!i||"center"===i)return e;var o=[e[0],e[1]];return n=n||this.default_buffer,this.isLeftAnchor(i)?(o[0]-=t[0]/2,"left"===i&&(o[0]-=n[0])):this.isRightAnchor(i)&&(o[0]+=t[0]/2,"right"===i&&(o[0]+=n[1])),this.isTopAnchor(i)?(o[1]-=t[1]/2,"top"===i&&(o[1]-=n[2])):this.isBottomAnchor(i)&&(o[1]+=t[1]/2,"bottom"===i&&(o[1]+=n[3])),o},alignForAnchor:function(e){if(e&&"center"!==e){if(this.isLeftAnchor(e))return"right";if(this.isRightAnchor(e))return"left"}return"center"},isLeftAnchor:function(e){return-1<Ic.indexOf(e)},isRightAnchor:function(e){return-1<Lc.indexOf(e)},isTopAnchor:function(e){return-1<Cc.indexOf(e)},isBottomAnchor:function(e){return-1<Fc.indexOf(e)},default_buffer:[2.5,2.5,1.5,.75],zero_buffer:[0,0,0,0]};function jc(e,t,i,r,n){var o=[],a=i-e,s=r-t,l=ml.getLineLength(e,t,i,r),u=2*n,c=l/u;if(c<=1)o.push(e+a/2,t+s/2,n);else{var h=u/l,f=a*h,d=s*h;(c=l/n/2)%1&&o.push(i-f/2,r-d/2,n),c|=0;for(var _=e+f/2,p=t+d/2;c--;)o.push(_,p,n),_+=f,p+=d}return o}var Uc=function(){function n(e,t,i,r){mr(this,n),this.id=Nc.nextLabelId(),this.position=[e[0],e[1]],void 0!==e[2]&&this.position.push(e[2]),this.size=t,this.layout=r,this.anchor=Array.isArray(this.layout.anchor)?this.layout.anchor[0]:this.layout.anchor,this.placed=null,this.type="point",this.parent=this.layout.parent,this.offset=this.computeOffset(),this.align=this.layout.align||Dc.alignForAnchor(this.anchor),this._is_flat=i}return yr(n,[{key:"toJSON",value:function(){return{id:this.id,type:this.type,is_flat:this._is_flat,position:this.position,size:this.size,offset:this.offset,align:this.align,sides:this.getSides(),breach:!this.inTileBounds(),layout:Oc(this.layout)}}},{key:"inTileBounds",value:function(){var e=this.getAABB(),t=e.left,i=e.top,r=e.right,n=e.bottom;return on.pointInTile([t,i])&&on.pointInTile([r,n])}},{key:"isFlat",value:function(){return this._is_flat}},{key:"setAnchor",value:function(e){this._circles=void 0,this._aabb=void 0,this.anchor=e,this.offset=this.computeOffset()}},{key:"computeOffset",value:function(){var e=[this.layout.offset[0],this.layout.offset[1]];if(this.parent){var t=this.parent;e=Dc.computeOffset(e,t.size,t.anchor,Dc.zero_buffer),e=Dc.computeOffset(e,t.size,this.anchor,Dc.zero_buffer),t.offset!==jo.zeroPair&&(e===jo.zeroPair?e=t.offset:(e[0]+=t.offset[0],e[1]+=t.offset[1]))}return Dc.computeOffset(e,this.size,this.anchor)}},{key:"getBoundingCircles",value:function(){if(!this.angle)return[];if(!this._circles){var e=this.layout.units_per_pixel,t=this.size[0]/2*e,i=t*Math.cos(this.angle),r=t*Math.sin(this.angle),n=-i,o=-r,a=Sr(this.position,2),s=a[0],l=a[1];i+=s,r+=l*=-1,n+=s,o+=l;var u=this.size[1]/2*e;this._circles=jc(i,r,n,o,u)}return this._circles}},{key:"getAABB",value:function(){if(!this._aabb){var e=this.layout.units_per_pixel,t=(this.size[0]/2+this.layout.buffer[0])*e,i=(this.size[1]/2+this.layout.buffer[1])*e,r=this.position[0]+this.offset[0]*e,n=this.position[1]-this.offset[1]*e;this._aabb={left:r-t,top:n+i,right:r+t,bottom:n-i}}return this._aabb}},{key:"getSides",value:function(){var e=this.getAABB(),t=e.left,i=e.top,r=e.right,n=(i+e.bottom)/2;return[t,n,r,n]}}]),n}();Uc.PLACEMENT={VERTEX:0,MIDPOINT:1,SPACED:2,CENTROID:3};var Gc=Uc.PLACEMENT,Bc=80;function Vc(e,t,i,r){var n=[],o=r.placement,a=Math.max(t[0],t[1])*r.placement_min_length_ratio*r.units_per_pixel;switch(o){case Gc.SPACED:var s=function(e,t,i){var r=i.units_per_pixel,n=(i.placement_spacing||Bc)*r,o=function(e){for(var t=0,i=0;i<e.length-1;i++)t+=Hc(e[i],e[i+1]);return t}(e);if(o<=t)return!1;for(var a=Math.max(Math.floor(o/n),1),s=[],l=[],u=.5*(o-(a-1)*n),c=0;c<a;c++){var h=Yc(e,u,t,i),f=h.position,d=h.angle;null!=f&&null!=d&&(s.push(f),l.push(d)),u+=n}return{positions:s,angles:l}}(e,a,r);if(!s)return[];for(var l=s.positions,u=s.angles,c=0;c<l.length;c++){var h=l[c],f=u[c];if(!0===r.tile_edges||!Au(h)){var d=new Uc(h,t,i,r);d.angle=f,n.push(d)}}break;case Gc.VERTEX:for(var _,p,v,m=0;m<e.length-1;m++)_=e[m],p=e[m+1],!0!==r.tile_edges&&Au(_)||((v=new Uc(_,t,i,r)).angle=qc(_,p,r.angle),n.push(v));(v=new Uc(p,t,i,r)).angle=qc(_,p,r.angle),n.push(v);break;case Gc.MIDPOINT:for(var g=0;g<e.length-1;g++){var y=e[g],x=e[g+1],b=[.5*(y[0]+x[0]),.5*(y[1]+x[1])];if((!0===r.tile_edges||!Au(b))&&(!a||Hc(y,x)>a)){var A=new Uc(b,t,i,r);A.angle=qc(y,x,r.angle),n.push(A)}}}return n}function qc(e,t,i){var r=2<arguments.length&&void 0!==i?i:0;return"auto"===r?Math.atan2(t[0]-e[0],t[1]-e[1]):r}function Hc(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Yc(e,t,i,r){for(var n,o,a,s,l,u,c,h=0,f=0;f<e.length-1;f++){var d=e[f],_=e[f+1],p=Hc(d,_);if(!(p<=i)&&t<(h+=p)){l=h-t,void 0,u=Hc(a=d,s=_),n=[(c=l/u)*a[0]+(1-c)*s[0],c*a[1]+(1-c)*s[1]],o=qc(d,_,r.angle);break}}return{position:n,angle:o}}var Wc={key:function(e){return[e.style,e.weight,e.family,e.px_size,e.fill,e.stroke,e.stroke_width,e.transform,e.text_wrap,e.max_lines,e.supersample,on.device_pixel_ratio].join("/")},defaults:{style:"normal",weight:null,size:"12px",px_size:12,family:"Helvetica",fill:"white",text_wrap:15,max_lines:5,align:"center",stroke:null,stroke_width:0},compute:function(e,t,i){var r={};t.font=t.font||this.defaults,r.can_articulate=t.can_articulate,r.fill=t.font.fill&&on.toCSSColor(jo.evalCachedColorProperty(t.font.fill,i))||this.defaults.fill,r.style=t.font.style||this.defaults.style,r.weight=t.font.weight||this.defaults.weight,t.font.family?(r.family=t.font.family,r.family!==this.defaults.family&&(r.family+=", "+this.defaults.family)):r.family=this.defaults.family,r.transform=t.font.transform,r.size=t.font.size||this.defaults.size,r.supersample=t.supersample_text?1.5:1,r.px_size=jo.evalCachedProperty(t.font.px_size,i)*r.supersample,t.font.stroke&&t.font.stroke.color&&(r.stroke=on.toCSSColor(jo.evalCachedColorProperty(t.font.stroke.color,i)||this.defaults.stroke),r.stroke_width=jo.evalCachedProperty(t.font.stroke.width,i)||this.defaults.stroke_width),r.font_css=this.fontCSS(r);var n=t.text_wrap;return null==n&&"line"!==Jr.geometryType(e.geometry.type)&&(n=!0),!0===n&&(n=this.defaults.text_wrap),r.text_wrap=n,r.max_lines=t.max_lines||this.defaults.max_lines,r},fontCSS:function(e){return[e.style,e.weight,e.px_size+"px",e.family].filter(function(e){return e}).join(" ")}},Xc=i(function(e){function n(e,t){document.addEventListener?e.addEventListener("scroll",t,!1):e.attachEvent("scroll",t)}function y(e){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(e)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function x(e,t){e.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+t+";"}function o(e){var t=e.a.offsetWidth,i=t+100;return e.f.style.width=i+"px",e.c.scrollLeft=i,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t&&(e.g=t,!0)}function b(e,t){function i(){var e=r;o(e)&&e.a.parentNode&&t(e.g)}var r=e;n(e.b,i),n(e.c,i),o(e)}function t(e,t){var i=t||{};this.family=e,this.style=i.style||"normal",this.weight=i.weight||"normal",this.stretch=i.stretch||"normal"}function A(e,t){return[e.style,e.weight,function(){if(null===r){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif"}catch(e){}r=""!==e.style.font}return r}()?e.stretch:"","100px",t].join(" ")}var T,i,r,a;a=r=i=T=null,t.prototype.load=function(e,t){var _=this,p=e||"BESbswy",v=0,m=t||3e3,g=(new Date).getTime();return new Promise(function(f,d){var e;if(null===a&&(a=!!document.fonts),(e=a)&&(null===i&&(i=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),e=!i),e){e=new Promise(function(i,e){!function t(){(new Date).getTime()-g>=m?e():document.fonts.load(A(_,'"'+_.family+'"'),p).then(function(e){1<=e.length?i():setTimeout(t,25)},function(){e()})}()});var t=new Promise(function(e,t){v=setTimeout(t,m)});Promise.race([t,e]).then(function(){clearTimeout(v),f(_)},function(){d(_)})}else!function(t){document.body?t():document.addEventListener?document.addEventListener("DOMContentLoaded",function e(){document.removeEventListener("DOMContentLoaded",e),t()}):document.attachEvent("onreadystatechange",function e(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",e),t())})}(function(){function t(){var e;(e=-1!=o&&-1!=a||-1!=o&&-1!=s||-1!=a&&-1!=s)&&((e=o!=a&&o!=s&&a!=s)||(null===T&&(e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),T=!!e&&(parseInt(e[1],10)<536||536===parseInt(e[1],10)&&parseInt(e[2],10)<=11)),e=T&&(o==l&&a==l&&s==l||o==u&&a==u&&s==u||o==c&&a==c&&s==c)),e=!e),e&&(h.parentNode&&h.parentNode.removeChild(h),clearTimeout(v),f(_))}var i=new y(p),r=new y(p),n=new y(p),o=-1,a=-1,s=-1,l=-1,u=-1,c=-1,h=document.createElement("div");h.dir="ltr",x(i,A(_,"sans-serif")),x(r,A(_,"serif")),x(n,A(_,"monospace")),h.appendChild(i.a),h.appendChild(r.a),h.appendChild(n.a),document.body.appendChild(h),l=i.a.offsetWidth,u=r.a.offsetWidth,c=n.a.offsetWidth,function H(){if((new Date).getTime()-g>=m)h.parentNode&&h.parentNode.removeChild(h),d(_);else{var e=document.hidden;!0!==e&&void 0!==e||(o=i.a.offsetWidth,a=r.a.offsetWidth,s=n.a.offsetWidth,t()),v=setTimeout(H,50)}}(),b(i,function(e){o=e,t()}),x(i,A(_,'"'+_.family+'",sans-serif')),b(r,function(e){a=e,t()}),x(r,A(_,'"'+_.family+'",serif')),b(n,function(e){s=e,t()}),x(n,A(_,'"'+_.family+'",monospace'))})})},e.exports=t}),Zc={fonts_loaded:Promise.resolve(),last_loaded:null,loadFonts:function(r){var n=this,e=JSON.stringify(r)===this.last_loaded;return r&&!e&&function(){function e(t){Array.isArray(r[t])?r[t].forEach(function(e){return i.push(n.loadFontFace(t,e))}):i.push(n.loadFontFace(t,r[t]))}var i=[];for(var t in r)e(t);n.last_loaded=JSON.stringify(r),n.fonts_loaded=Promise.all(i.filter(function(e){return e}))}(),this.fonts_loaded},loadFontFace:function(e,t){if(null!=t&&("object"===vr(t)||"external"===t)){var i={family:e},r=Promise.resolve();"object"===vr(t)&&(Object.assign(i,t),"string"==typeof t.url&&(r=this.injectFontFace(i)));var n=new Xc(e,i);return r.then(function(){return n.load()}).then(function(){Kr("debug","Font face '".concat(e,"' is available"),i)},function(){Kr("debug","Font face '".concat(e,"' is NOT available"),i)})}},injectFontFace:function(e){var n=this,o=e.family,t=e.url,a=e.weight,s=e.style;void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace);var i=Promise.resolve(t);return"blob:"===t.slice(0,5)&&(i=on.io(t,6e4,"arraybuffer").then(function(e){var t=new Uint8Array(e);if(n.supports_native_font_loading)return t;for(var i="",r=0;r<t.length;r++)i+=String.fromCharCode(t[r]);return"data:font/opentype;base64,"+btoa(i)})),i.then(function(e){if(n.supports_native_font_loading){var t;"string"==typeof e?t=new FontFace(o,"url(".concat(encodeURI(e),")"),{weight:a,style:s}):e instanceof Uint8Array&&(t=new FontFace(o,e,{weight:a,style:s})),document.fonts.add(t),Kr("trace","Adding FontFace to document.fonts:",t)}else{var i="\n                    @font-face {\n                        font-family: '".concat(o,"';\n                        font-weight: ").concat(a||"normal",";\n                        font-style: ").concat(s||"normal",";\n                        src: url(").concat(encodeURI(e),");\n                    }\n                "),r=document.createElement("style");r.appendChild(document.createTextNode("")),document.head.appendChild(r),r.sheet.insertRule(i,0),Kr("trace","Injecting CSS font face:",i)}})}},Kc=function(){function T(){mr(this,T),this.createCanvas(),this.vertical_text_buffer=8,this.horizontal_text_buffer=4,this.layout=hl("binary-tree")}return yr(T,[{key:"createCanvas",value:function(){this.canvas=document.createElement("canvas"),this.canvas.style.backgroundColor="transparent",this.context=this.canvas.getContext("2d")}},{key:"resize",value:function(e,t){this.canvas.width=e,this.canvas.height=t,this.context.clearRect(0,0,e,t)}},{key:"setFont",value:function(e){var t=e.font_css,i=e.fill,r=e.stroke,n=e.stroke_width,o=e.px_size,a=e.supersample;this.px_size=o;var s=this.context,l=on.device_pixel_ratio*a;r&&0<n&&(s.strokeStyle=r,s.lineWidth=n*l),s.fillStyle=i,s.font=t,s.miterLimit=2}},{key:"textSizes",value:function(e,t){var i=this;return Zc.loadFonts().then(function(){return Ko.add({type:"textSizes",run:i.processTextSizesTask.bind(i),texts:t,tile_id:e,cursor:{styles:Object.keys(t),texts:null,style_idx:null,text_idx:null}})})}},{key:"processTextSizesTask",value:function(e){var t,i=e.cursor,r=e.texts;for(i.style_idx=i.style_idx||0;i.style_idx<i.styles.length;){var n=i.styles[i.style_idx];null==i.text_idx&&(i.text_idx=0,i.texts=Object.keys(r[n]));for(var o=r[n],a=!0;i.text_idx<i.texts.length;){var s=i.texts[i.text_idx],l=o[s],u=l.text_settings;if(a&&(this.setFont(u),a=!1),l.size=this.textSize(n,s,u).size,u.can_articulate){var c=!1,h=!1;if($c(s)&&(th(s)?c=!0:h=!0),l.isRTL=c,l.no_curving=h||(t=s,uh.test(t)),l.vertical_buffer=this.vertical_text_buffer,l.segment_sizes=[],!l.no_curving){var f=hh(s,c);l.segments=f;for(var d=0;d<f.length;d++)l.segment_sizes.push(this.textSize(n,f[d],u).size)}}if(i.text_idx++,!Ko.shouldContinue(e))return!1}i.text_idx=null,i.style_idx++}return Ko.finish(e,{texts:r}),!0}},{key:"textSize",value:function(e,t,i){var r=i.transform,n=i.text_wrap,o=i.max_lines,a=i.stroke_width,s=void 0===a?0:a,l=i.supersample;if(T.cache.text[e]=T.cache.text[e]||{},T.cache.text[e][t])return T.cache.stats.text_hits++,T.cache.text[e][t];T.cache.stats.text_misses++,T.cache.text_count++;var u=on.device_pixel_ratio*l,c=this.applyTextTransform(t,r),h=this.context,f=this.vertical_text_buffer*u,d=u*(s+this.horizontal_text_buffer),_=2*u,p=this.px_size+_,v=fh.parse(c,n,o,p,h),m=v.height,g=v.width,y=v.lines,x=[g/u,m/u],b=[g+2*d,m+2*f],A=[b[0]/u,b[1]/u];return T.cache.text[e][t]={lines:y,size:{collision_size:x,texture_size:b,logical_size:A,line_height:p}},T.cache.text[e][t]}},{key:"drawTextMultiLine",value:function(e,t,i,r,n){for(var o=Sr(t,2),a=o[0],s=o[1],l=r.stroke,u=r.stroke_width,c=void 0===u?0:u,h=r.transform,f=r.align,d=r.supersample,_=i.line_height,p=s,v=0;v<e.length;v++){var m=e[v];this.drawTextLine(m,[a,p],i,{stroke:l,stroke_width:c,transform:h,align:f,supersample:d},n),p+=_}if(Il.draw_label_collision_boxes){this.context.save();var g=on.device_pixel_ratio*d,y=g*(this.horizontal_text_buffer+c),x=g*this.vertical_text_buffer,b=i.collision_size;this.context.strokeStyle="blue",this.context.lineWidth=2,this.context.strokeRect(a+y,s+x,g*b[0],g*b[1]),"curved"===n&&this.context.strokeRect(a+i.texture_size[0]+y,s+x,g*b[0],g*b[1]),this.context.restore()}if(Il.draw_label_texture_boxes){this.context.save();var A=i.texture_size;this.context.strokeStyle="green",this.context.lineWidth=2,this.context.strokeRect(a+2,s+2,A[0]-4,A[1]-4),"curved"===n&&this.context.strokeRect(a+2+i.texture_size[0],s+2,A[0]-4,A[1]-4),this.context.restore()}}},{key:"drawTextLine",value:function(e,t,i,r,n){var o=Sr(t,2),a=o[0],s=o[1],l=r.stroke,u=r.stroke_width,c=void 0===u?0:u,h=r.transform,f=r.align,d=r.supersample,_=on.device_pixel_ratio*d;f=f||"center";var p,v=this.vertical_text_buffer*_,m=i.texture_size,g=i.line_height,y=_*(c+this.horizontal_text_buffer),x=this.applyTextTransform(e.text,h);"left"===f?p=a+y:"center"===f?p=a+m[0]/2-e.width/2:"right"===f&&(p=a+m[0]-e.width-y);var b=s+.75*v+g;if(l&&0<c){var A="curved"===n?m[0]:0;this.context.strokeText(x,p+A,b)}this.context.fillText(x,p,b)}},{key:"rasterize",value:function(e,t,i,r,n){return Ko.add({type:"rasterizeLabels",run:this.processRasterizeTask.bind(this),cancel:this.cancelRasterizeTask.bind(this),pause_factor:2,user_moving_view:!1,texts:e,textures:t,texture_prefix:r,gl:n,tile_id:i,cursor:{styles:Object.keys(e),texts:null,style_idx:0,text_idx:null,texture_idx:0,texture_resize:!0,texture_names:[]}})}},{key:"processRasterizeTask",value:function(e){for(var t,i=e.cursor,r=e.texts,n=e.textures;i.texture_idx<e.textures.length;){for(t=n[i.texture_idx],i.texture_resize&&(i.texture_resize=!1,this.resize.apply(this,Pr(t.texture_size)));i.style_idx<i.styles.length;){var o=i.styles[i.style_idx];null==i.text_idx&&(i.text_idx=0,i.texts=Object.keys(r[o]));for(var a=r[o],s=!0;i.text_idx<i.texts.length;){var l=i.texts[i.text_idx],u=a[l],c=u.text_settings;if(s&&(this.setFont(c),s=!1),c.can_articulate){u.texcoords=u.texcoords||{};for(var h=0;h<u.type.length;h++){var f=u.type[h];switch(f){case"straight":if(u.textures[h]!==i.texture_idx)continue;var d=u.isRTL?l.split().reverse().join():l,_=t.texcoord_cache[o][d],p=void 0;if(_.texcoord)p=_.texcoord;else{var v=_.texture_position,m=this.textSize(o,d,c),g=m.size,y=m.lines;this.drawTextMultiLine(y,v,g,c,f),p=$o.getTexcoordsForSprite(v,g.texture_size,t.texture_size),_.texcoord=p}u.texcoords[f]={texcoord:p,texture_id:_.texture_id};break;case"curved":var x=u.segments;u.texcoords.curved=u.texcoords.curved||[],u.texcoords_stroke=u.texcoords_stroke||[];for(var b=0;b<x.length;b++)if(u.textures[h][b]===i.texture_idx){var A=x[b],T=t.texcoord_cache[o][A],w=void 0,k=void 0;if(T.texcoord&&T.texcoord_stroke)w=T.texcoord,k=T.texcoord_stroke,u.texcoords_stroke.push(k);else{var E=T.texture_position,M=this.textSize(o,A,c),R=M.size,S=M.lines;this.drawTextMultiLine(S,E,R,c,f),w=$o.getTexcoordsForSprite(E,R.texture_size,t.texture_size);var P=[E[0]+R.texture_size[0],E[1]];k=$o.getTexcoordsForSprite(P,R.texture_size,t.texture_size),T.texcoord=w,T.texcoord_stroke=k,u.texcoords_stroke.push(k)}u.texcoords.curved.push({texcoord:w,texture_id:T.texture_id})}}}}else{var z=this.textSize(o,l,c).lines;for(var N in u.align)u.align[N].texture_id===i.texture_idx&&(this.drawTextMultiLine(z,u.align[N].texture_position,u.size,{stroke:c.stroke,stroke_width:c.stroke_width,transform:c.transform,supersample:c.supersample,align:N}),u.align[N].texcoords=$o.getTexcoordsForSprite(u.align[N].texture_position,u.size.texture_size,t.texture_size))}if(i.text_idx++,!Ko.shouldContinue(e))return!1}i.text_idx=null,i.style_idx++}var O=e.texture_prefix+i.texture_idx;$o.create(e.gl,O,{element:this.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:!0}),$o.retain(O),i.texture_names.push(O),i.texture_idx++,i.texture_resize=!0,i.style_idx=0}return Ko.finish(e,{textures:i.texture_names}),!0}},{key:"cancelRasterizeTask",value:function(e){Kr("trace","RasterizeTask: release textures [".concat(e.cursor.texture_names.join(", "),"]")),e.cursor.texture_names.forEach(function(e){return $o.release(e)})}},{key:"setTextureTextPositions",value:function(e){var t={texture_id:0,texcoord_cache:{}},i=[];for(var r in e){var n=e[r];for(var o in n){var a=n[o],s=a.text_settings.can_articulate;if(s){a.textures=[],t.texcoord_cache[r]=t.texcoord_cache[r]||{};for(var l=0;l<a.type.length;l++){switch(a.type[l]){case"straight":var u=a.isRTL?o.split().reverse().join():o;if(!t.texcoord_cache[r][u]){var c=a.size.texture_size;t.texcoord_cache[r][u]={},this.placeText(c[0],c[1],{can_articulate:s,style:r,word:u})}a.textures[l]=t.texture_id;break;case"curved":a.textures[l]=[];for(var h=0;h<a.segment_sizes.length;h++){var f=a.segments[h];if(!t.texcoord_cache[r][f]){var d=a.segment_sizes[h].texture_size,_=2*d[0];t.texcoord_cache[r][f]={},this.placeText(_,d[1],{can_articulate:s,style:r,word:f})}a.textures[l].push(t.texture_id)}}}}else{var p=a.size.texture_size;this.placeText(p[0],p[1],{can_articulate:s,text_info:a})}}}var v=this.layout.export(),m=on.getNextPowerOf2(v.width),g=on.getNextPowerOf2(v.height),y=v.items;for(var x in t.texcoord_cache={},y){var b=y[x],A=b.x,T=b.y;if(!b.meta.can_articulate){var w=b.meta.text_info;for(var k in w.align)w.align[k].texture_id=t.texture_id,w.align[k].texture_position=[A,T]}else{var E=b.meta,M=E.style,R=E.word;t.texcoord_cache[M]=t.texcoord_cache[M]||{},t.texcoord_cache[M][R]||(t.texcoord_cache[M][R]={texture_id:t.texture_id,texture_position:[A,T]})}}return 0<m&&0<g&&(i[t.texture_id]={texture_size:[m,g],texcoord_cache:t.texcoord_cache}),i}},{key:"placeText",value:function(e,t,i){this.layout.addItem({width:e,height:t,meta:i})}},{key:"applyTextTransform",value:function(e,t){return"capitalize"===t?e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1)}):"uppercase"===t?e.toUpperCase():"lowercase"===t?e.toLowerCase():e}}],[{key:"fontPixelSize",value:function(e){if(null!=e){var t=Sr((e="string"==typeof e?e:String(e)).match(T.font_size_re)||[],3),i=t[1],r=t[2];return"em"===(r=r||"px")?i*=16:"pt"===r?i/=.75:"%"===r&&(i/=6.25),i=jo.parsePositiveNumber(i),i*=on.device_pixel_ratio}}},{key:"pruneTextCache",value:function(){T.cache.text_count>T.cache.text_count_max&&(T.cache.text={},T.cache.text_count=0,Kr("debug","CanvasText: pruning text cache")),Object.keys(T.cache.segment).length>T.cache.segment_count_max&&(T.cache.segment={},Kr("debug","CanvasText: pruning segment cache"))}}]),T}();Kc.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,Kc.cache={text:{},text_count:0,text_count_max:2e3,segment:{},segment_count_max:2e3,stats:{text_hits:0,text_misses:0,segment_hits:0,segment_misses:0}};var Jc=new RegExp("[\u0591-\u07ff\u200f\u202b\u202e\ufb1d-\ufdfd\ufe70-\ufefc]");function $c(e){return Jc.test(e)}var Qc="\0-/:-@[-`{-\xbf\xd7\xf7\u02b9-\u02ff\u2000-\u2bff\u2010-\u2029\u202c\u202f-\u2bff",eh=new RegExp("["+Qc+"]+");function th(e){return eh.test(e)}var ih=new RegExp("^["+Qc+"\u0600-\u06ff]+"),rh=new RegExp("["+Qc+"\u0622-\u0625\u0627\u062f-\u0632\u0648\u0671-\u0677\u0688-\u0699\u06c4-\u06cb\u06cf\u06d2\u06d3\u06ee\u06ef]"),nh=new RegExp("^[\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed]+"),oh="[\u0300-\u036f\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u07a6-\u07b0\u0900-\u0903\u093a-\u094c\u094e\u094f\u0951-\u0957\u0962\u0963\u0981-\u0983\u09bc\u09be-\u09cc\u09d7\u09e2\u09e3\u0a01-\u0a03\u0a3c-\u0a4c\u0a51\u0a81-\u0a83\u0abc\u0abe-\u0acc\u0ae2\u0ae3\u0b01-\u0b03\u0b3c\u0b3e-\u0b4c\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe-\u0bcd\u0bd7\u0c00-\u0c03\u0c3e-\u0c4c\u0c55\u0c56\u0c62\u0c63\u0c81-\u0c83\u0cbc\u0cbe-\u0ccc\u0cd5\u0cd6\u0ce2\u0ce3\u0d01-\u0d03\u0d3e-\u0d4c\u0d4e\u0d57\u0d62\u0d63\u0d82\u0d83\u0dca-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f83\u0f86\u0f87\u0f8d-\u0fbc\u0fc6\u102b-\u1038\u103a-\u103e\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f\u109a-\u109d\u17b4-\u17d1\u17d3\u1a55-\u1a5e\u1a61-\u1a7c\u1dc0-\u1dff\u20d0-\u20ff]",ah=new RegExp("^.(?:"+oh+"+)?([\u094d\u09cd\u0a4d\u0acd\u0b4d\u0c4d\u0ccd\u0d4d\u0f84\u1039\u17d2\u1a60\u1a7f]\\W(?:"+oh+"+)?)*"),sh={Mongolian:"\u1800-\u18af"},lh=Object.keys(sh).map(function(e){return sh[e]}).join(""),uh=new RegExp("["+lh+"]");var ch=2;function hh(e,t){var i=t?1:ch;if(e.length<i)return[e];var r=e;if(Kc.cache.segment[r])return Kc.cache.stats.segment_hits++,Kc.cache.segment[r];var n=[];if(ih.exec(e)){n=e.split(rh);for(var o=-1,a=0;a<n.length-1;a++){if(0<a){var s=nh.exec(n[a]);s&&(n[a]=n[a].substring(s[0].length),n[a-1]+=s[0],o+=s[0].length)}o+=1+n[a].length,n[a]+=e.slice(o,o+1)}e=""}for(;e.length;){for(var l="",u=e,c=0;c<i&&u.length;c++){var h=(ah.exec(u)||u)[0];l+=h,u=u.substring(h.length)}n.push(l),e=e.substring(l.length)}return t&&n.reverse(),Kc.cache.stats.segment_misses++,Kc.cache.segment[r]=n}var fh=function(){function _(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1/0,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1/0;mr(this,_),this.width=0,this.height=0,this.lines=[],this.max_lines=t,this.text_wrap=i,this.context=e}return yr(_,[{key:"createLine",value:function(e){return this.lines.length<this.max_lines&&new dh(e,this.text_wrap)}},{key:"push",value:function(e){if(this.lines.length<this.max_lines){var t=this.context.measureText(e.text).width;return(e.width=t)>this.width&&(this.width=Math.ceil(t)),this.lines.push(e),this.height+=e.height,!0}return this.addEllipsis(),!1}},{key:"advance",value:function(e,t){return!!this.push(e)&&this.createLine(t)}},{key:"addEllipsis",value:function(){var e=this.lines[this.lines.length-1],t=Math.ceil(this.context.measureText(_.ellipsis).width);e.append(_.ellipsis),e.width+=t,e.width>this.width&&(this.width=e.width)}},{key:"finish",value:function(e){e?this.push(e):this.addEllipsis()}}],[{key:"parse",value:function(e,t,i,r,n){var o;o="number"==typeof t?e.split(" "):[e];for(var a=new _(n,i,t),s=a.createLine(r),l=0;l<o.length;l++){for(var u=o[l].split("\n"),c=0===l,h=0;h<u.length&&s;h++){var f=u[h];$c(f)&&th(f[f.length-1])&&(f+="\u200f");var d=c?f:" "+f;if(t&&0<l&&s.exceedsTextwrap(d)){if(!(s=a.advance(s,r)))break;s.append(f),c=!0}else s.append(d);h<u.length-1&&(s=a.advance(s,r),c=!0)}l===o.length-1&&a.finish(s)}return a}}]),_}();fh.ellipsis="...";var dh=function(){function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;mr(this,i),this.chars=0,this.text="",this.height=Math.ceil(e),this.text_wrap=t}return yr(i,[{key:"append",value:function(e){this.chars+=e.length,this.text+=e}},{key:"exceedsTextwrap",value:function(e){return e.length+this.chars>this.text_wrap}}]),i}(),_h={resetText:function(){this.texts={}},freeText:function(e){delete this.texts[e.id]},parseTextFeature:function(e,t,i,r){var n=this.parseTextSource(e,t,i);if(null!=n&&""!==n){var o=Wc.compute(e,t,i),a=Wc.key(o);this.texts[r.id]=this.texts[r.id]||{};var s=this.texts[r.id][a]=this.texts[r.id][a]||{};if(n instanceof Object){var l=[],u=n.left+"-"+n.right;for(var c in n){var h=n[c];if(h){var f=this.computeTextLayout({},e,t,i,r,h,o,u,c);s[h]||(s[h]={text_settings:o,ref:0}),l.push({draw:t,text:h,text_settings_key:a,layout:f})}}return 0<l.length&&l}var d=this.computeTextLayout({},e,t,i,r,n,o);return s[n]||(s[n]={text_settings:o,ref:0}),{draw:t,text:n,text_settings_key:a,layout:d}}},parseTextSource:function(e,t,i){var r,n=t.text_source||"name";if(null!=n&&"object"===vr(n))for(var o in r={},n)r[o]=this.parseTextSourceValue(n[o],e,i);else r=this.parseTextSourceValue(n,e,i);return r},parseTextSourceValue:function(e,t,i){var r;if(Array.isArray(e)){for(var n=0;n<e.length;n++)if("string"==typeof e[n]?r=t.properties[e[n]]:"function"==typeof e[n]&&(r=e[n](i)),r)return r}else"string"==typeof e?r=t.properties[e]:e instanceof Function&&(r=e(i));return r},prepareTextLabels:function(i,e,r){var n=this;return 0===Object.keys(this.texts[i.id]||{}).length?Promise.resolve([]):Cr.postMessage(this.main_thread_target+".calcTextSizes",i.id,this.texts[i.id]).then(function(e){var t=e.texts;return i.canceled?(Kr("trace","Style ".concat(n.name,": stop tile build because tile was canceled: ").concat(i.key,", post-calcTextSizes()")),[]):(n.texts[i.id]=t||[],t?n.buildTextLabels(i,r):(Zo.abortTile(i.id),[]))})},collideAndRenderTextLabels:function(t,i,e){var n=this;return this.prepareTextLabels(t,i,e).then(function(e){return 0===e.length?(Zo.collide([],i,t.id),Promise.resolve({})):Zo.collide(e,i,t.id).then(function(e){if(t.canceled)return Kr("trace","stop tile build because tile was canceled: ".concat(t.key,", post-collide()")),{};var r=n.texts[t.id];return null==r||0===e.length?{}:(n.cullTextStyles(r,e),e.forEach(function(e){var t=e.text_settings_key,i=r[t]&&r[t][e.text];i.text_settings.can_articulate?(i.type||(i.type=[]),-1===i.type.indexOf(e.label.type)&&i.type.push(e.label.type)):(i.align=i.align||{},i.align[e.label.align]={})}),{labels:e,texts:r,textures:[]})})})},cullTextStyles:function(e,t){for(var i=0;i<t.length;i++){var r=t[i];e[r.text_settings_key][r.text].ref++}for(var n in e)for(var o in e[n])e[n][o].ref<1&&delete e[n][o];for(var a in e)0===Object.keys(e[a]).length&&delete e[a]},calcTextSizes:function(e,t){return this.canvas||(this.canvas=new Kc),this.canvas.textSizes(e,t)},preprocessText:function(e){if(e&&e.font&&"object"===vr(e.font))return e.font.fill=jo.createPropertyCache(e.font.fill),e.font.stroke&&(e.font.stroke.color=jo.createPropertyCache(e.font.stroke.color)),e.font.px_size=jo.createPropertyCache(e.font.size||Wc.defaults.size,Kc.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=jo.createPropertyCache(e.font.stroke.width,jo.parsePositiveNumber)),e.offset=jo.createPropertyCache(e.offset,function(e){return Array.isArray(e)&&e.map(jo.parseNumber)}),e.buffer=jo.createPropertyCache(e.buffer,function(e){return(Array.isArray(e)?e:[e,e]).map(jo.parsePositiveNumber)}),e.repeat_distance=jo.createPropertyCache(e.repeat_distance||Jr.tile_size,jo.parsePositiveNumber),e},computeTextLayout:function(e,t,i,r,n,o,a,s,l){var u=e||{};return(u=this.computeLayout(u,t,i,r,n)).repeat_distance&&(s&&(u.repeat_group+="/"+s),u.repeat_group+="/"+o),u.subdiv=n.overzoom2,u.align=i.align,u.italic="normal"!==a.style,"right"===l?u.orientation=1:"left"===l&&(u.orientation=-1),u}};var ph=Math.PI/180,vh=function(){function i(e,t){mr(this,i),this._min_zoom=H.util.constants.DEFAULT_MIN_ZOOM_LEVEL,this._max_zoom=H.util.constants.DEFAULT_MAX_ZOOM_LEVEL,this._viewport=e,this._center_offset=[],this._center_offset_normalized=[],this._viewport_aspect_ratio=1,this._focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]],this._view_matrix=new Float64Array(16),this._projection_matrix=new Float64Array(16),this._heading_matrix=new Float64Array(16),this._tilt_matrix=new Float64Array(16),this._transformation_matrix=new Float64Array(16),this._camera_matrix=new Float64Array(16),this._lookAtData={position:[0,0,0],zoom:0,tile_level:0,tetragon:void 0,bounds:void 0,unpadded_bounds:void 0,distance:void 0,tilt:0,incline:0,heading:180},this._zoom_direction=0,this._horizon=0,this.handleViewportUpdate(!0),t?this.setLookAtData(t):this._updateMatrices(),Zl.replaceBlock("camera","\n            uniform mat4 u_projection;\n            uniform vec3 u_eye;\n            uniform vec2 u_center_offset;\n\n            void cameraProjection (inout vec4 position) {\n                position = u_projection * position;\n            }")}return yr(i,[{key:"_getZoomForBounds",value:function(e,t,i,r){for(var n=this.clone(),o=this._max_zoom;o>=this._min_zoom;){if(n.setLookAtData({zoom:o-=.1,position:t,tilt:i,heading:r}),e.every(function(e){return ml.isPointInsidePolygon(e,n.getLookAtData().bounds)}))break}return n.getLookAtData().zoom}},{key:"setZoomConstraints",value:function(e,t){this._min_zoom=e,this._max_zoom=t,this.setLookAtData(this.getLookAtData())}},{key:"setLookAtData",value:function(e,t){var i,r,n=e.position,o=e.zoom;if(n===i&&e.bounds!==i&&(n=ml.getBBoxCenter(ml.getBBox(e.bounds))),o===i&&e.bounds!==i&&(o=this._getZoomForBounds(e.bounds,n,e.tilt,e.heading)),t!==i&&(r=n||this.screenToWorld(t)),o!==i){o=ml.clamp(o,this._min_zoom,this._max_zoom);var a=on.zoomToTileLevel(o),s=this._lookAtData.tile_level;a!==s&&(this._zoom_direction=s<a?1:-1),this._lookAtData.zoom=o,this._lookAtData.tile_level=a}if(e.tilt!==i&&(this._lookAtData.tilt=e.tilt),e.heading!==i&&(this._lookAtData.heading=e.heading),t!==i){this._updateMatrices();var l=this.screenToWorld(t);this._lookAtData.position[0]-=l[0]-r[0],this._lookAtData.position[1]-=l[1]-r[1]}else n&&(this._lookAtData.position=n);this._lookAtData.position[2]=0,this._lookAtData.position[1]=ml.clamp(this._lookAtData.position[1],-Jr.half_circumference_meters,Jr.half_circumference_meters),this._updateMatrices(),this._updateVisibleBounds()}},{key:"getZoomDirection",value:function(){return this._zoom_direction}},{key:"resetZoomDirection",value:function(){this._zoom_direction=0}},{key:"getLookAtData",value:function(){return this._lookAtData}},{key:"handleViewportUpdate",value:function(e){var t=0<arguments.length&&void 0!==e&&e,i=this._viewport,r=i.width,n=i.height;this._viewport_aspect_ratio=r/n;var o=this._viewport.center.x-(r/2<<0),a=this._viewport.center.y-(n/2<<0);this._center_offset[0]=o,this._center_offset[1]=a,this._center_offset_normalized[0]=o/r,this._center_offset_normalized[1]=a/-n,t||(this._updateMatrices(),this._updateVisibleBounds())}},{key:"setupMatrices",value:function(e,t){ia.multiply(e.model_view32,this._view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),ta.normalFromMat4(e.normal32,e.model_view32),ta.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32)}},{key:"_updateMatrices",value:function(){var e=this._viewport.height*Jr.metersPerPixel(this._lookAtData.zoom),t=on.interpolate(this._lookAtData.zoom,this._focal_length);this._lookAtData.distance=e/2*t;var i=this._lookAtData.position[0],r=this._lookAtData.position[1];ia.lookAt(this._view_matrix,ea.fromValues(i,r,0),ea.fromValues(i,r,-1),ea.fromValues(0,1,0)),this._heading_matrix=ia.identity(this._heading_matrix);var n=180-this._lookAtData.heading;n*=ph,this._heading_matrix[0]=Math.cos(n),this._heading_matrix[1]=-Math.sin(n),this._heading_matrix[4]=Math.sin(n),this._heading_matrix[5]=Math.cos(n),this._tilt_matrix=ia.identity(this._tilt_matrix),n=0<(n=this._lookAtData.tilt?this._lookAtData.tilt*ph:0)?-n:n,this._tilt_matrix[5]=Math.cos(n),this._tilt_matrix[6]=Math.sin(n),this._tilt_matrix[9]=-Math.sin(n),this._tilt_matrix[10]=Math.cos(n),ia.multiply(this._transformation_matrix,this._tilt_matrix,this._heading_matrix),ia.multiply(this._view_matrix,this._transformation_matrix,this._view_matrix);var o=2*Math.atan(1/t),a=2*this._lookAtData.distance;this._depth_buffer_adjustment=2/Math.log(a/1),ia.perspective(this._projection_matrix,o,this._viewport_aspect_ratio,1,a),this._projection_matrix[8]=2*-this._center_offset_normalized[0],this._projection_matrix[9]=2*-this._center_offset_normalized[1],ia.translate(this._projection_matrix,this._projection_matrix,ea.fromValues(0,0,-this._lookAtData.distance)),this._camera_matrix=ia.multiply(this._camera_matrix,this._projection_matrix,this._view_matrix)}},{key:"_updateVisibleBounds",value:function(){var e=this._viewport,t=e.width,i=e.height,r=e.padding;if(this._horizon=Math.max(i/2-Math.cos(function(e){return e*Math.PI/180}(this._lookAtData.tilt))*i*.75,0),this._lookAtData.tetragon=[this.screenToWorld([0,this._horizon]),this.screenToWorld([t,this._horizon]),this.screenToWorld([t,i]),this.screenToWorld([0,i])],this._lookAtData.unpadded_bounds=this._clipAgainstGeoBounds(this._lookAtData.tetragon),0===r.left&&0===r.top&&0===r.right&&0===r.bottom)this._lookAtData.bounds=this._lookAtData.unpadded_bounds;else{var n=r.left,o=Math.max(this._horizon,r.top),a=t-r.right,s=i-r.bottom,l=[this.screenToWorld([n,o]),this.screenToWorld([a,o]),this.screenToWorld([a,s]),this.screenToWorld([n,s])];this._lookAtData.bounds=this._clipAgainstGeoBounds(l)}}},{key:"_clipAgainstGeoBounds",value:function(e){var t=Sr(ml.getBBox(e),4),i=t[0],r=t[1],n=t[2],o=t[3],a=[[i,Jr.half_circumference_meters],[n,Jr.half_circumference_meters],[n,-Jr.half_circumference_meters],[i,-Jr.half_circumference_meters]],s=ml.clipPolygon(a,e)[0],l=Sr(ml.getBBox(s),4);i=l[0],r=l[1],n=l[2],o=l[3],n-i>=Jr.circumference_meters&&(s=[[-Jr.half_circumference_meters,o],[Jr.half_circumference_meters,o],[Jr.half_circumference_meters,r],[-Jr.half_circumference_meters,r]]);var u=[];return s&&(u=ml.splitLegs(s,Jr.half_circumference_meters)),u}},{key:"applyPxOffset",value:function(e){var t=Sr(e,2),i=t[0],r=t[1],n=Math.PI-this._lookAtData.heading*ph,o=Jr.metersPerPixel(this._lookAtData.zoom);this._lookAtData.position[0]+=(i*Math.cos(n)+r*Math.sin(n))*o,this._lookAtData.position[1]-=(r*Math.cos(n)-i*Math.sin(n))*o,this._lookAtData.position[1]=ml.clamp(this._lookAtData.position[1],-Jr.half_circumference_meters,Jr.half_circumference_meters),this._updateMatrices(),this._updateVisibleBounds()}},{key:"screenToWorld",value:function(e){var t=Sr(e,2),i=t[0],r=t[1],n=this._viewport,o=n.width,a=n.height;return 0===o||0===a?[0,0]:(i-=o/2,r-=a/2,this._clipCoordsToWorldPlaneCoords([2*(i+o/2)/o-1,1-2*(r+a/2)/a,-1,1]))}},{key:"_clipToScreenCoords",value:function(e){var t=this._viewport,i=t.width,r=t.height;return[(.5*e[0]+.5)*i,r-(.5*e[1]+.5)*r]}},{key:"_isScreenPointInViewPort",value:function(e){var t=this._viewport,i=t.width,r=t.height;return 0<=e[0]&&e[0]<=i&&0<=e[1]&&e[1]<=r}},{key:"worldToScreen",value:function(e,t){var i,r=1<arguments.length&&void 0!==t&&t;if(e[2]||(e[2]=0),r){var n=this._worldToClipCoords(e);i=this._clipToScreenCoords(n)}else{var o=Math.sign(this._lookAtData.position[0]),a=Math.trunc(this._lookAtData.position[0]/Jr.circumference_meters+o/2);e[0]+=Jr.circumference_meters*a;var s=this._worldToClipCoords(e),l=i=this._clipToScreenCoords(s);this._isScreenPointInViewPort(i)||(s=this._worldToClipCoords([e[0]+Jr.circumference_meters,e[1],e[2]]),i=this._clipToScreenCoords(s),this._isScreenPointInViewPort(i)||(s=this._worldToClipCoords([e[0]-Jr.circumference_meters,e[1],e[2]]),i=this._clipToScreenCoords(s)),this._isScreenPointInViewPort(i)||(i=l))}return i}},{key:"getHorizon",value:function(){return this._horizon}},{key:"_clipCoordsToWorldPlaneCoords",value:function(e){var t=[],i=this._lookAtData.distance,r=this._lookAtData.position,n=[0,0,i,0],o=0,a=i*Math.sin(ph*this._lookAtData.tilt)*Math.cos(ph*this._lookAtData.heading),s=i*Math.sin(ph*this._lookAtData.tilt)*Math.sin(ph*this._lookAtData.heading),l=new Float64Array(16),u=new Float64Array(16);return ia.invert(l,this._projection_matrix),ra.transformMat4(t,e,l),t[2]=-1,t[3]=0,ia.invert(u,this._view_matrix),ra.transformMat4(t,t,u),ra.normalize(t,t),ra.transformMat4(n,n,this._transformation_matrix),0!==t[2]&&(o=-n[2]/t[2]),ra.scale(t,t,o),[r[0]+(t[0]+s),r[1]+(t[1]+a)]}},{key:"_worldToClipCoords",value:function(e){var t=[e[0],e[1],e[2],1];return ra.transformMat4(t,t,this._view_matrix),ra.transformMat4(t,t,this._projection_matrix),ra.scale(t,t,1/t[3]),t}},{key:"setupProgram",value:function(e){e.uniform("Matrix4fv","u_projection",this._projection_matrix),e.uniform("3f","u_eye",[0,0,this._lookAtData.distance]),e.uniform("2fv","u_center_offset",this._center_offset_normalized),e.uniform("1f","u_tilt",this._lookAtData.tilt*ph),e.uniform("1f","u_heading",this._lookAtData.heading*ph),e.uniform("1f","u_near_plane",1),e.uniform("1f","u_depth_buffer_adjustment",this._depth_buffer_adjustment)}},{key:"getTransformationMatrix",value:function(){return this._transformation_matrix}},{key:"getCameraMatrix",value:function(){return this._camera_matrix}},{key:"clone",value:function(){var e=new i(this._viewport,this._lookAtData);return e.setZoomConstraints(this._min_zoom,this._max_zoom),e}},{key:"getViewport",value:function(){return this._viewport}}]),i}();function mh(e){return void 0===e.x?e[0]:e.x}function gh(e){return void 0===e.y?e[1]:e.y}function yh(e,t){return mh(e)-mh(t)}function xh(e,t){return gh(e)-gh(t)}function bh(e){return e.sort(yh)}function Ah(e,t){for(var i,r=e[0],n=r,o=0;o<e.length;o+=1)t(i=e[o],r)<0?r=i:0<t(i,n)&&(n=i);return[r,n]}function Th(r,e){return Object.values(e.reduce(function(e,t){var i=t[+r];return e[i]||(e[i]=[]),e[i].push(t),e},{}))}function wh(e,t,i){var r=+e,n=t[r],o=i[r];if(o<n)return[];var a=[t];if(o<n)return a;for(var s=t[(1+r)%2],l=e?function(e){return a.push([s,e])}:function(e){return a.push([e,s])},u=n+1;u<o;u+=1)l(u);return a.push(i),a}function kh(e,t){return wh(!1,e,t)}function Eh(e,t){return wh(!0,e,t)}function Mh(e){var i={},r=[];return e.forEach(function(e){var t=e.key||(Array.isArray(e)?"".concat(e[0],"/").concat(e[1]):"".concat(e.x,"/").concat(e.y));i[t]||(i[t]=!0,r.push(e))}),r}function Rh(e){return e.reduce(function(e,t){return e.concat(t)})}function Sh(e,a){if(a<=0)return e;var t=function(e){var t=Sr(Ah(e,yh),2),i=t[0],r=t[1],n=[i[0]-a,i[1]],o=[r[0]+a,r[1]];return e.concat(kh(n,i),kh(r,o))},i=function(e){var t=Sr(Ah(e,xh),2),i=t[0],r=t[1],n=[i[0],i[1]-a],o=[r[0],r[1]+a];return e.concat(Eh(n,i),Eh(r,o))};return Mh(Rh(function(e){return Th(!0,e)}(Rh(function(e){return Th(!1,e)}(e).map(i))).map(t)))}function Ph(t,e,i){function r(e){return Object.values(Jr.metersToExactTileCoords(e,t.tile_level))}return Mh(function(e,n,o){return e.map(function(e){var t=Sr(e,2),i=t[0],r=t[1];return aa.coord(Jr.wrapTile({x:i,y:r,z:n},{x:!o,y:!0}))})}(Sh(function(e,t,i,r){var n=zh(t,e,i),o=zh(i,r,t);return Mh(n.concat(o))}(r(t.tetragon[0]),r(t.tetragon[1]),r(t.tetragon[3]),r(t.tetragon[2])),e),t.tile_level,i))}function zh(e,t,i){var r=Sr(function(e,t,i){var r=Sr(e,2),n=r[0],o=r[1],a=Sr(t,2),s=a[0],l=a[1],u=Sr(i,2),c=u[0],h=u[1],f=n+(l-o)/(h-o)*(c-n);return[[[n,o]].concat(Pr(bh([[s,l],[f,l]]))),[].concat(Pr(bh([[s,l],[f,l]])),[[c,h]])]}.apply(void 0,Pr(function(e){return e.sort(xh)}([e,t,i]))),2),n=r[0],o=r[1];return Mh(function(e,t,i){var r=Sr(e,2),n=r[0],o=r[1],a=Sr(t,2),s=a[0],l=a[1],u=Sr(i,1)[0];return Oh(n,s,u,o,l)}.apply(void 0,Pr(n)).concat(function(e,t,i){var r=Sr(e,2),n=r[0],o=r[1],a=Sr(t,1)[0],s=Sr(i,2),l=s[0],u=s[1];return Oh(l,n,a,u,o)}.apply(void 0,Pr(o))))}var Nh=.125;function Oh(e,t,i,r,n){var o=Math.min(e,t),a=Math.max(e,i),s=Math.min(r,n),l=Math.max(r,n);if(Math.floor(r)===Math.floor(n))return Ch(o,a,r);if(l-s<Nh)return function(e,t){var i=Sr(e,2),r=i[0],n=i[1],o=Sr(t,2),a=o[0],s=o[1],l=Lh(r,a),u=Ih(l,n),c=Ih(l,s);return u.concat(c)}([o,s],[a,l]);function u(e){_=_.concat(Ch(p,v,Math.floor(e))),p+=f,v+=d}var c=function(e,t){return Nh*(t-e)/(Math.ceil(t)-Math.floor(e))}(s,l),h=(l-s)/c,f=(t-e)/h,d=(i-e)/h,_=[],p=e,v=e;if(r<n)for(var m=s;m<=l;m+=c)u(m);else for(var g=l;s<=g;g-=c)u(g);return Mh(_)}function Ih(e,t){return e.map(function(e){return[e,t]})}function Lh(e,t){var i=Math.floor(e),r=Math.floor(t);if(r<i)return[];if(i===r)return[i];for(var n=[],o=i;o<=r;o+=1)n.push(o);return n}function Ch(e,t,i){return Ih(Lh(e,t),i)}var Fh=function(){function i(e,t){mr(this,i),Jo(this),this.scene=e,this.createMatrices(),this.bounds=null,this.center_tile=null,this.panning=!1,this.panning_stop_at=0,this.pan_snap_timer=0,this.user_input_at=0,this.user_input_timeout=50,this.user_input_active=!1,this.size={},this.buffer=0,this.wrap=!1!==t.wrapView,this.preserve_tiles_within_zoom=1,this.lookAtManipulator=new vh(t.viewport),this._viewport=t.viewport,this.handleViewportUpdate(!0)}return yr(i,[{key:"update",value:function(){this.pan_snap_timer=(+new Date-this.panning_stop_at)/1e3,this.user_input_active=+new Date-this.user_input_at<this.user_input_timeout,this.scene.tile_manager.updateTilesVisibilityCounters()}},{key:"handleViewportUpdate",value:function(e){var t=0<arguments.length&&void 0!==e&&e,i=this._viewport,r=i.width,n=i.height;this.size.css={width:r,height:n},this.size.device={width:Math.round(r*on.device_pixel_ratio),height:Math.round(n*on.device_pixel_ratio)},this.lookAtManipulator.handleViewportUpdate(),t||this.updateBounds()}},{key:"setLookAtData",value:function(e,t){var i=e.position,r=e.zoom,n=e.tilt,o=e.heading,a=e.bounds,s={zoom:r,tilt:n,heading:o};if(i&&"number"==typeof i.lng&&"number"==typeof i.lat&&(s.position=Jr.latLngToMeters([i.lng,i.lat])),a){var l=[],u=a.getBoundingBox();l.push(Jr.latLngToMeters([u.getLeft(),u.getTop()])),l.push(Jr.latLngToMeters([u.getRight(),u.getTop()])),l.push(Jr.latLngToMeters([u.getRight(),u.getBottom()])),l.push(Jr.latLngToMeters([u.getLeft(),u.getBottom()])),s.bounds=l}this.lookAtManipulator.setLookAtData(s,t),this.updateBounds()}},{key:"getLookAtData",value:function(e){var t=0<arguments.length&&void 0!==e&&e,i=this.lookAtManipulator.getLookAtData(),r=i.heading,n=i.incline,o=i.tilt,a=i.zoom,s=i.position,l=i.bounds,u=i.unpadded_bounds,c=Sr(Jr.metersToLatLng(s),2),h=c[0],f=c[1],d=new H.geo.LineString;return(t?u:l).forEach(function(e){var t=Jr.metersToLatLng(e);d.pushLatLngAlt(t[1],t[0],0)}),{heading:r,incline:n,tilt:o,zoom:a,bounds:new H.geo.Polygon(d),position:{lat:f,lng:h,alt:s[2]}}}},{key:"applyPxOffset",value:function(e){this.lookAtManipulator.applyPxOffset(e),this.updateBounds()}},{key:"setPanning",value:function(e){this.panning=e,this.panning||(this.panning_stop_at=+new Date)}},{key:"markUserInput",value:function(){this.user_input_at=+new Date}},{key:"ready",value:function(){return"number"==typeof this.size.css.width&&"number"==typeof this.size.css.height}},{key:"updateBounds",value:function(){if(this.markUserInput(),this.ready()){this.center_tile=Jr.tileForMeters(this.lookAtManipulator.getLookAtData().position,this.lookAtManipulator.getLookAtData().tile_level);var e=this.lookAtManipulator.screenToWorld([0,this.size.css.height]),t=this.lookAtManipulator.screenToWorld([this.size.css.width,0]);this.bounds={sw:{x:e[0],y:e[1]},ne:{x:t[0],y:t[1]}},this.scene.tile_manager.updateTilesForView(),this.trigger("move"),this.scene.requestRedraw()}}},{key:"getTileGridFlat",value:function(){var e=this.lookAtManipulator.getLookAtData().tile_level,t=Jr.tileForMeters([this.bounds.sw.x,this.bounds.sw.y],e),i=Jr.tileForMeters([this.bounds.ne.x,this.bounds.ne.y],e),r=[t.x-this.buffer,i.x+this.buffer,i.y-this.buffer,t.y+this.buffer];if(!1===this.wrap){var n=(1<<e)-1;r=r.map(function(e){return Math.min(Math.max(0,e),n)})}for(var o=[],a=r[0];a<=r[1];a++)for(var s=r[2];s<=r[3];s++)o.push(aa.coord(Jr.wrapTile({x:a,y:s,z:e},{x:!this.wrap,y:!0})));return Mh(o)}},{key:"getTileGridDistorted",value:function(){return Ph(this.lookAtManipulator.getLookAtData(),this.buffer,this.wrap)}},{key:"findVisibleTileCoordinates",value:function(){if(!this.bounds)return[];var e=this.lookAtManipulator.getLookAtData(),t=e.tilt,i=e.heading;return 0===t&&180===i?this.getTileGridFlat():this.getTileGridDistorted()}},{key:"pruneTilesForView",value:function(){var i=this;if(this.ready()){var r=[Math.ceil((Math.floor(this.size.css.width/Jr.tile_size)+2)/2),Math.ceil((Math.floor(this.size.css.height/Jr.tile_size)+2)/2)];this.scene.tile_manager.removeTiles(function(e){if(e.visible||e.isProxy())return!1;if(e.loading&&e.style_zoom!==i.lookAtManipulator.getLookAtData().tile_level)return!0;if(Math.abs(e.style_zoom-i.lookAtManipulator.getLookAtData().tile_level)>i.preserve_tiles_within_zoom)return!0;var t=aa.coordinateAtZoom(e.coords,i.lookAtManipulator.getLookAtData().tile_level);return Math.abs(t.x-i.center_tile.x)-r[0]>i.buffer||Math.abs(t.y-i.center_tile.y)-r[1]>i.buffer})}}},{key:"createMatrices",value:function(){this.matrices={},this.matrices.model=new Float64Array(16),this.matrices.model32=new Float32Array(16),this.matrices.model_view=new Float64Array(16),this.matrices.model_view32=new Float32Array(16),this.matrices.normal=new Float64Array(9),this.matrices.normal32=new Float32Array(9),this.matrices.inverse_normal32=new Float32Array(9)}},{key:"setupTile",value:function(e,t){e.setupProgram(this.matrices,t),this.lookAtManipulator.setupMatrices(this.matrices,t)}},{key:"setupProgram",value:function(e){var t=this.lookAtManipulator.getLookAtData();e.uniform("2fv","u_resolution",[this.size.device.width,this.size.device.height]),e.uniform("3fv","u_map_position",[t.position[0],t.position[1],Math.trunc(1e5*t.zoom)/1e5]),e.uniform("1f","u_meters_per_pixel",Jr.metersPerPixel(t.zoom)),e.uniform("1f","u_device_pixel_ratio",on.device_pixel_ratio),e.uniform("1f","u_view_pan_snap_timer",this.pan_snap_timer),e.uniform("1i","u_view_panning",this.panning),e.uniform("1f","u_horizon",this.lookAtManipulator.getHorizon()/(this.size.css.height/2)),this.lookAtManipulator.setupProgram(e)}},{key:"isAnimating",value:function(){return this.pan_snap_timer<=.5}},{key:"xyToGeo",value:function(e,t){var i=this.lookAtManipulator.screenToWorld([e,t]),r=Sr(Jr.metersToLatLng(i),2),n=r[0];return{lat:r[1],lng:n}}},{key:"geoToPixel",value:function(e){var t=Jr.latLngToMeters([e.lng,e.lat]);t.push(e.alt||0);var i=this.lookAtManipulator.worldToScreen(t);return{x:Math.floor(i[0]),y:Math.floor(i[1])}}},{key:"geoToMeters",value:function(e){var t=Sr(Jr.latLngToMeters([e.lng,e.lat]),2);return{x:t[0],y:t[1],z:e.alt||0}}},{key:"metersToGeo",value:function(e){var t=Sr(Jr.metersToLatLng([e.x,e.y]),2),i=t[0];return{lat:t[1],lng:i,alt:e.z||0}}},{key:"setZoomConstraints",value:function(e,t){this.lookAtManipulator.setZoomConstraints(e,t)}}]),i}(),Dh=Uc.PLACEMENT,jh=128/Math.PI,Uh=16384/Math.PI,Gh=Object.create(cu);Gh.variants={};Object.assign(Gh,_h),Object.assign(Gh,{name:"points",built_in:!0,vertex_shader_src:"uniform vec2 u_resolution;uniform float u_time;uniform vec3 u_map_position;uniform vec4 u_tile_origin;uniform float u_tile_proxy_depth;uniform bool u_tile_fade_in;uniform float u_meters_per_pixel;uniform float u_device_pixel_ratio;uniform float u_visible_time;uniform bool u_view_panning;uniform float u_tilt;uniform mat4 u_model;uniform mat4 u_modelView;uniform mat3 u_normalMatrix;uniform mat3 u_inverseNormalMatrix;uniform float u_heading;uniform float u_near_plane;uniform float u_depth_buffer_adjustment;attribute vec4 a_position;attribute vec4 a_shape;attribute vec4 a_color;attribute vec2 a_texcoord;attribute vec2 a_offset;uniform float u_point_type;attribute float a_is_flat;\n#ifdef TANGRAM_IS_TEXT_STYLE\nattribute vec4 a_offsets_alt;attribute vec4 a_pre_angles_alt;attribute vec4 a_angles_alt;attribute vec4 a_offsets;attribute vec4 a_pre_angles;attribute vec4 a_angles;\n#endif\n#ifdef TANGRAM_POINT_DRAW_STICK\nattribute float a_is_stick;attribute float a_stick_height;varying float v_is_stick;\n#endif\nvarying vec4 v_color;varying vec2 v_texcoord;varying vec4 v_world_position;varying float v_alpha_factor;\n#ifdef TANGRAM_HAS_SHADER_POINTS\nattribute float a_outline_edge;attribute vec4 a_outline_color;varying float v_outline_edge;varying vec4 v_outline_color;varying float v_aa_offset;\n#endif\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\nvarying float v_label_hidden;\n#endif\n#define PI 3.14159265359\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\nvec2 rotate2D(vec2 _st,float _angle){return mat2(cos(_angle),-sin(_angle),sin(_angle),cos(_angle))*_st;}vec3 rotateX3D(vec3 _st,float _angle){return mat3(1.,0.,0.,0.,cos(_angle),sin(_angle),0.,-sin(_angle),cos(_angle))*_st;}vec3 rotateZ3D(vec3 _st,float _angle){return mat3(cos(_angle),sin(_angle),0.,-sin(_angle),cos(_angle),0.,0.,0.,1.)*_st;}\n#ifdef TANGRAM_IS_TEXT_STYLE\nfloat mix4linear(float a,float b,float c,float d,float x){return mix(mix(a,b,3.*x),mix(b,mix(c,d,3.*(max(x,.66)-.66)),3.*(clamp(x,.33,.66)-.33)),step(0.33,x));}\n#endif\nvoid main(){\n#pragma tangram: setup\n#ifndef TANGRAM_SHOW_HIDDEN_LABELS\nif(a_shape.w==0.){gl_Position=vec4(0.,0.,0.,1.);return;}\n#else\nif(a_shape.w==0.){v_label_hidden=1.;}else{v_label_hidden=0.;}\n#endif\nv_alpha_factor=1.0;v_color=a_color;v_texcoord=a_texcoord;\n#ifdef TANGRAM_HAS_SHADER_POINTS\nv_outline_color=a_outline_color;v_outline_edge=a_outline_edge;if(u_point_type==TANGRAM_POINT_TYPE_SHADER){v_outline_color=a_outline_color;v_outline_edge=a_outline_edge;float size=abs(a_shape.x/128.);v_texcoord=sign(a_shape.xy)*(size+1.)/(size);size+=2.;v_aa_offset=2./size;}\n#endif\nvec4 position=u_modelView*vec4(a_position.xyz,1.);vec4 shape=vec4(a_shape.xy,0.,0.);vec2 offset=vec2(a_offset.x,-a_offset.y);\n#ifdef TANGRAM_POINT_DRAW_STICK\nv_is_stick=a_is_stick;float scaled_stick_height=(sin(u_tilt+(1.5*PI))+1.0)*a_stick_height;offset.y+=(1.0-a_is_stick)*scaled_stick_height;\n#endif\nfloat zoom=clamp(u_map_position.z-u_tile_origin.z,0.,1.);float theta=a_shape.z/4096.;float heading=u_heading;float delta=(heading-PI);float new_theta=theta-delta;float reversed=abs(new_theta)>PI/2. ? 1. : 0.;if(a_is_flat==1.0){\n#ifdef TANGRAM_IS_TEXT_STYLE\nif(a_offsets[0]!=0.){vec4 angles_scaled;vec4 pre_angles_scaled;vec4 offsets_scaled;if(reversed==1.){offsets_scaled=a_offsets_alt*4.;angles_scaled=(PI/16384.)*a_angles_alt;pre_angles_scaled=(PI/128.)*a_pre_angles_alt;}else{offsets_scaled=a_offsets*4.;angles_scaled=(PI/16384.)*a_angles;pre_angles_scaled=(PI/128.)*a_pre_angles;}float pre_angle=mix4linear(pre_angles_scaled[0],pre_angles_scaled[1],pre_angles_scaled[2],pre_angles_scaled[3],zoom);float angle=mix4linear(angles_scaled[0],angles_scaled[1],angles_scaled[2],angles_scaled[3],zoom);float offset_curve=mix4linear(offsets_scaled[0],offsets_scaled[1],offsets_scaled[2],offsets_scaled[3],zoom);shape.xy=rotate2D(shape.xy,pre_angle+PI*reversed);shape.x+=offset_curve;shape.xy=rotate2D(shape.xy,angle);shape.xy+=rotate2D(offset,theta);}else{shape.xy=rotate2D(shape.xy+offset*256.,theta+(PI*reversed));}\n#else\nshape.xy=rotate2D(shape.xy+offset*256.,theta);\n#endif\nshape.xy/=pow(2.,4.+(u_map_position.z-u_tile_origin.w));shape=u_modelView*shape;position+=shape;}else{shape.xy/=256.;\n#ifdef TANGRAM_POINT_DRAW_STICK\nshape.y*=1.0+(scaled_stick_height-1.0)*a_is_stick;\n#endif\nshape.xy=rotate2D(shape.xy+offset,theta);}\n#ifdef TANGRAM_FADE_IN_RATE\nif(u_tile_fade_in){v_alpha_factor*=clamp(u_visible_time*TANGRAM_FADE_IN_RATE,0.,1.);}\n#endif\n#ifdef TANGRAM_FADE_ON_ZOOM_OUT\nv_alpha_factor*=clamp(1.+TANGRAM_FADE_ON_ZOOM_OUT_RATE*(u_map_position.z-u_tile_origin.z),0.,1.);\n#endif\nv_world_position=u_model*position;v_world_position.xy+=shape.xy*u_meters_per_pixel;v_world_position=wrapWorldPosition(v_world_position);\n#pragma tangram: position\ncameraProjection(position);\n#ifdef TANGRAM_LAYER_ORDER\napplyLayerOrder(a_position.w+u_tile_proxy_depth+1.,position);/***Due to the precision loss on depth buffer,we had a z-fighting of translucent points when the distance to the camera was big.*For more information about the problem see: https:*For more information about the fix see: https:*position.z=(2.0*log(position.w/u_near_plane)/log(u_far_plane/u_near_plane)-1.0)*position.w;*/position.z=(log(position.w/u_near_plane)*u_depth_buffer_adjustment-1.0)*position.w;\n#endif\nif(a_is_flat!=1.){position.xy+=shape.xy*position.w*2.*u_device_pixel_ratio/u_resolution;}\n#ifdef TANGRAM_HAS_SHADER_POINTS\nif(u_point_type==TANGRAM_POINT_TYPE_SHADER){position.xy+=sign(shape.xy)*position.w*u_device_pixel_ratio/u_resolution;}\n#endif\n#ifdef TANGRAM_HAS_SHADER_POINTS\nif(!u_view_panning&&(abs(theta)<TANGRAM_EPSILON)&&u_point_type!=TANGRAM_POINT_TYPE_SHADER){\n#else\nif(!u_view_panning&&(abs(theta)<TANGRAM_EPSILON)){\n#endif\nsnapToPixelGrid(position);}gl_Position=position;}",fragment_shader_src:"uniform vec2 u_resolution;uniform float u_time;uniform vec3 u_map_position;uniform vec4 u_tile_origin;uniform float u_meters_per_pixel;uniform float u_device_pixel_ratio;uniform float u_visible_time;uniform mat3 u_normalMatrix;uniform mat3 u_inverseNormalMatrix;uniform sampler2D u_texture;uniform float u_point_type;uniform bool u_apply_color_blocks;varying vec4 v_color;varying vec2 v_texcoord;varying vec4 v_world_position;varying float v_alpha_factor;\n#ifdef TANGRAM_HAS_SHADER_POINTS\nvarying vec4 v_outline_color;varying float v_outline_edge;varying float v_aa_offset;\n#endif\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\nvarying float v_label_hidden;\n#endif\n#ifdef TANGRAM_POINT_DRAW_STICK\nvarying float v_is_stick;\n#endif\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n#ifdef TANGRAM_HAS_SHADER_POINTS\nfloat _tangram_antialias(float l,float R){float low=R-v_aa_offset;float high=R+v_aa_offset;return 1.-smoothstep(low,high,l);}\n#endif\nvoid mixTextureColor(inout vec4 color){\n#ifdef TANGRAM_HAS_SHADER_POINTS\nif(u_point_type==TANGRAM_POINT_TYPE_TEXTURE){color*=texture2D(u_texture,v_texcoord);}else if(u_point_type==TANGRAM_POINT_TYPE_LABEL){color=texture2D(u_texture,v_texcoord);color.rgb/=max(color.a,0.001);}else if(u_point_type==TANGRAM_POINT_TYPE_SHADER){float outline_edge=v_outline_edge;vec4 outlineColor=v_outline_color;float l=length(v_texcoord);float outer_alpha=_tangram_antialias(l,1.);float fill_alpha=_tangram_antialias(l,1.-v_outline_edge*0.5)*color.a;float stroke_alpha=(outer_alpha-_tangram_antialias(l,1.-v_outline_edge))*outlineColor.a;\n#ifdef TANGRAM_BLEND_ADD\ncolor.a=stroke_alpha+fill_alpha;color.rgb=color.rgb*fill_alpha+outlineColor.rgb*stroke_alpha;\n#else\ncolor.a=stroke_alpha+fill_alpha*(1.-stroke_alpha);color.rgb=mix(color.rgb*fill_alpha,outlineColor.rgb,stroke_alpha)/max(color.a,0.001);\n#endif\n}\n#else\ncolor=texture2D(u_texture,v_texcoord);color.rgb/=max(color.a,0.001);\n#endif\nif(u_apply_color_blocks){\n#pragma tangram: color\n#pragma tangram: filter\n}color.a*=v_alpha_factor;\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\nif(v_label_hidden>0.){color.a*=0.5;color.rgb=vec3(1.,0.,0.);}\n#endif\n#if !defined(TANGRAM_BLEND_OVERLAY) && !defined(TANGRAM_BLEND_INLAY) && !defined(TANGRAM_BLEND_ADD)\nif(color.a<TANGRAM_ALPHA_TEST){discard;}\n#endif\n}void main(void){\n#pragma tangram: setup\nvec4 color=v_color;\n#ifdef TANGRAM_POINT_DRAW_STICK\nif(v_is_stick==0.0){mixTextureColor(color);}\n#else\nmixTextureColor(color);\n#endif\ngl_FragColor=color;}",selection:!0,collision:!0,blend:"overlay",init:function(e){var t=0<arguments.length&&void 0!==e?e:{};cu.init.call(this,t),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!0,this.defines.TANGRAM_POINT_TYPE_TEXTURE=1,this.defines.TANGRAM_POINT_TYPE_LABEL=2,this.defines.TANGRAM_POINT_TYPE_SHADER=3,this.defines.TANGRAM_POINT_DRAW_STICK=!!this.stick,this.collision_group_points=this.name+"-points",this.collision_group_text=this.name+"-text",this.reset()},setupDefines:function(){"overlay"!==this.blend&&(this.defines.TANGRAM_LAYER_ORDER=!0),this.defines.TANGRAM_FADE_ON_ZOOM_OUT=!0,this.defines.TANGRAM_FADE_ON_ZOOM_OUT_RATE=2,Il.suppress_label_fade_in||this.suppress_fade?(this.fade_in_time=0,this.defines.TANGRAM_FADE_IN_RATE=null):(this.fade_in_time=.15,this.defines.TANGRAM_FADE_IN_RATE=1/this.fade_in_time),!0!==Il.suppress_label_snap_animation&&(this.defines.TANGRAM_VIEW_PAN_SNAP_RATE=2),!0===Il.show_hidden_labels&&(this.defines.TANGRAM_SHOW_HIDDEN_LABELS=!0)},reset:function(){this.queues={},this.resetText(),this.texture_missing_sprites={}},addFeature:function(e,t,i){var r=i.tile,n={};if(n.color=this.parseColor(t.color,i),n.texture=t.texture,n.label_texture=null,n.color||n.texture){var o;if(this.hasSprites(n)){if(!(o=this.parseSprite(n,t,i)))return;n.texcoords=o.texcoords}if(n.size=t.size,n.size){if(n.size=jo.evalCachedPointSizeProperty(t.size,o,i),null==n.size)return void Kr({level:"warn",once:!0},"Layer '".concat(t.layers[t.layers.length-1],"': ")+"'size' includes % and/or ratio-based scaling (".concat(JSON.stringify(t.size.value),"); ")+"these can only applied to sprites, but no sprite was specified, skipping features in layer");"number"==typeof n.size&&(n.size=[n.size,n.size])}else n.size=o&&o.css_size||[16,16];if(t.outline&&(n.outline_width=jo.evalCachedProperty(t.outline.width,i)||jo.defaults.outline.width,n.outline_color=this.parseColor(t.outline.color,i)),n.outline_edge_pct=0,n.outline_width&&n.outline_color){var a=n.outline_width;n.size[0]+=a,n.size[1]+=a,n.outline_edge_pct=a/Math.min(n.size[0],n.size[1])*2}if(n.size[0]=Math.min(n.size[0],256),n.size[1]=Math.min(n.size[1],256),n.placement=t.placement,n.placement_min_length_ratio=jo.evalCachedProperty(t.placement_min_length_ratio,i),n.placement===Dh.SPACED&&t.placement_spacing&&(n.placement_spacing=jo.evalCachedProperty(t.placement_spacing,i)),n.angle=jo.evalProperty(t.angle,i)||0,n.elevate_by_altitude=!!t.elevate_by_altitude,n.z=t.z?ml.clamp(jo.evalCachedDistanceProperty(t.z,i),0,32767):jo.defaults.z,n.flat=t.flat,n.tile_edges=t.tile_edges,this.computeLayout(n,e,t,i,r),t.stick&&!n.flat){var s=jo.parseNumber(jo.evalProperty(t.stick.height,i));n.stick={color:this.parseColor(t.stick.color,i)||jo.defaults.color,height:s?Math.max(s,0):0}}var l=t.text&&!1!==jo.evalProperty(t.text.visible,i)&&this.parseTextFeature(e,t.text,i,r);Array.isArray(l)&&Kr({level:"warn",once:!(l=null)},"Layer '".concat(t.layers[t.layers.length-1],"': ")+"cannot use boundary labels (e.g. 'text_source: { left: ..., right: ... }') for 'text' labels attached to 'points'; "+"provided 'text_source' value was ".concat(JSON.stringify(t.text.text_source))),l&&(l.layout.parent=n,l.layout.priority=t.text.priority?Math.max(l.layout.priority,n.priority+.5):n.priority+.5,l.layout.move_into_tile=!1,Zo.addStyle(this.collision_group_text,r.id)),this.queueFeature({feature:e,draw:t,context:i,style:n,text_feature:l},r),Zo.addStyle(this.collision_group_points,r.id)}},hasSprites:function(e){return e.texture&&$o.textures[e.texture]&&$o.textures[e.texture].sprites},getSpriteInfo:function(e,t){var i=$o.textures[e.texture].sprites[t]&&$o.getSpriteInfo(e.texture,t);return t&&!i?(this.texture_missing_sprites[e.texture]=this.texture_missing_sprites[e.texture]||{},this.texture_missing_sprites[e.texture][t]||(Kr("debug","Style: in style '".concat(this.name,"', could not find sprite '").concat(t,"' for texture '").concat(e.texture,"'")),this.texture_missing_sprites[e.texture][t]=!0)):i&&(i.sprite=t),i},parseSprite:function(e,t,i){var r=jo.evalProperty(t.sprite,i);return this.getSpriteInfo(e,r)||this.getSpriteInfo(e,t.sprite_default)},queueFeature:function(e,t){this.tile_data[t.id]&&this.queues[t.id]||this.startData(t),this.queues[t.id]=this.queues[t.id]||[],this.queues[t.id].push(e)},endData:function(r){var u=this;if(r.canceled)return Kr("trace","Style ".concat(this.name,": stop tile build because tile was canceled: ").concat(r.key)),Promise.resolve();var e=this.queues[r.id];delete this.queues[r.id];var c=[],h=[];return e.forEach(function(e){for(var t=e.style,i=e.feature,r=i.geometry,n=u.buildLabels(t.size,r,t),o=0;o<n.length;o++){var a=n[o],s={feature:i,draw:e.draw,context:e.context,style:t,label:a};if(h.push(s),e.text_feature){var l={feature:i,draw:e.text_feature.draw,context:e.context,text:e.text_feature.text,text_settings_key:e.text_feature.text_settings_key,layout:e.text_feature.layout,point_label:a,linked:s};c.push(l),e.draw.text.optional||(s.linked=l)}}}),Promise.all([Zo.collide(h,this.collision_group_points,r.id).then(function(e){e.forEach(function(e){u.feature_style=e.style,u.feature_style.label=e.label,u.feature_style.linked=e.linked,cu.addFeature.call(u,e.feature,e.draw,e.context)})}),this.collideAndRenderTextLabels(r,this.collision_group_text,c)]).then(function(e){var t=Sr(e,2)[1],i=t.labels,n=t.texts;return i&&n&&i.forEach(function(e){var t=e.text_settings_key,i=n[t]&&n[t][e.text],r=u.feature_style;r.label=e.label,r.linked=e.linked,r.size=i.size.logical_size,r.angle=0,e.label.text_data={text_info:i,text_settings_key:t,text:e.text},r.label_texture=$o.default,cu.addFeature.call(u,e.feature,e.draw,e.context)}),u.freeText(r),cu.endData.call(u,r)})},_preprocess:function(t){t.color=jo.createColorPropertyCache(t.color),t.texture=void 0!==t.texture?t.texture:this.texture,t.outline&&(t.outline.color=jo.createColorPropertyCache(t.outline.color),t.outline.width=jo.createPropertyCache(t.outline.width,jo.parsePositiveNumber)),t.z=jo.createPropertyCache(t.z,jo.parseUnits);try{t.size=jo.createPointSizePropertyCache(t.size)}catch(e){return Kr({level:"warn",once:!0},"Layer '".concat(t.layers[t.layers.length-1],"': ")+"".concat(e," (").concat(JSON.stringify(t.size),"), skipping features in layer")),null}return t.offset=jo.createPropertyCache(t.offset,function(e){return Array.isArray(e)&&e.map(jo.parseNumber)}),t.buffer=jo.createPropertyCache(t.buffer,function(e){return(Array.isArray(e)?e:[e,e]).map(jo.parsePositiveNumber)}),t.repeat_distance=jo.createPropertyCache(t.repeat_distance,jo.parseNumber),null==t.repeat_group&&(t.repeat_group=t.layers.join("-")),t.placement=Dh[t.placement&&t.placement.toUpperCase()],null==t.placement&&(t.placement=Dh.VERTEX),t.placement_spacing=null!=t.placement_spacing?t.placement_spacing:80,t.placement_spacing=jo.createPropertyCache(t.placement_spacing,jo.parsePositiveNumber),t.placement_min_length_ratio=null!=t.placement_min_length_ratio?t.placement_min_length_ratio:1,t.placement_min_length_ratio=jo.createPropertyCache(t.placement_min_length_ratio,jo.parsePositiveNumber),"number"==typeof t.angle?t.angle=t.angle*Math.PI/180:t.angle=t.angle||0,t.text=this.preprocessText(t.text),t.text&&(t.text.key=t.key,t.text.group=t.group,t.text.layers=t.layers,t.text.order=t.order,t.text.repeat_group=t.text.repeat_group||t.repeat_group,t.text.anchor=t.text.anchor||this.default_anchor,t.text.optional="boolean"==typeof t.text.optional&&t.text.optional,t.text.interactive=t.text.interactive||t.interactive),t.stick&&(t.stick.color=jo.createColorPropertyCache(t.stick.color)),t},default_anchor:["bottom","top","right","left"],computeLayout:function(e,t,i,r,n){var o=e||{};o.id=t,o.units_per_pixel=n.units_per_pixel||1,o.collide=!1!==i.collide,o.anchor=i.anchor,o.offset=jo.evalCachedProperty(i.offset,r)||jo.zeroPair,o.buffer=jo.evalCachedProperty(i.buffer,r)||jo.zeroPair,o.repeat_distance=jo.evalCachedProperty(i.repeat_distance,r),o.repeat_distance&&(o.repeat_distance*=o.units_per_pixel,o.repeat_scale=1,"function"==typeof i.repeat_group?o.repeat_group=i.repeat_group(r):o.repeat_group=i.repeat_group);var a=i.priority;return null!=a?"function"==typeof a&&(a=a(r)):a=-1>>>0,o.priority=a,o},buildTextLabels:function(e,t){for(var i=[],r=0;r<t.length;r++){var n=t[r],o=this.texts[e.id][n.text_settings_key][n.text].size.collision_size;n.label=new Uc(n.point_label.position,o,n.point_label.isFlat(),n.layout),i.push(n)}return i},buildLabels:function(e,t,i){var r=!!i.flat,n=[];if("Point"===t.type)n.push(new Uc(t.coordinates,e,r,i));else if("MultiPoint"===t.type)for(var o=t.coordinates,a=0;a<o.length;++a){var s=o[a];n.push(new Uc(s,e,r,i))}else if("LineString"===t.type)for(var l=Vc(t.coordinates,e,r,i),u=0;u<l.length;++u)n.push(l[u]);else if("MultiLineString"===t.type)for(var c=t.coordinates,h=0;h<c.length;h++)for(var f=Vc(c[h],e,r,i),d=0;d<f.length;++d)n.push(f[d]);else if("Polygon"===t.type)if(i.placement===Dh.CENTROID){var _=Jr.centroid(t.coordinates);n.push(new Uc(_,e,r,i))}else for(var p=t.coordinates,v=0;v<p.length;v++)for(var m=Vc(p[v],e,r,i),g=0;g<m.length;++g)n.push(m[g]);else if("MultiPolygon"===t.type)if(i.placement===Dh.CENTROID){var y=Jr.multiCentroid(t.coordinates);n.push(new Uc(y,e,r,i))}else for(var x=t.coordinates,b=0;b<x.length;b++)for(var A=x[b],T=0;T<A.length;T++)for(var w=Vc(A[T],e,r,i),k=0;k<w.length;++k)n.push(w[k]);return n},makeVertexTemplate:function(e,t){var i=e.color||jo.defaults.color,r=t.vertex_data.vertex_layout;if(this.fillVertexTemplate(r,"a_position",0,{size:2}),this.fillVertexTemplate(r,"a_position",e.z||0,{size:1,offset:2}),this.fillVertexTemplate(r,"a_position",this.scaleOrder(e.order),{size:1,offset:3}),this.fillVertexTemplate(r,"a_shape",0,{size:4}),this.fillVertexTemplate(r,"a_shape",e.label.layout.collide?0:1,{size:1,offset:3}),this.fillVertexTemplate(r,"a_texcoord",0,{size:2}),this.fillVertexTemplate(r,"a_offset",0,{size:2}),this.fillVertexTemplate(r,"a_color",iu.mult(i,255),{size:4}),this.defines.TANGRAM_HAS_SHADER_POINTS&&t.variant.shader_point){var n=e.outline_color||jo.defaults.outline.color;this.fillVertexTemplate(r,"a_outline_color",iu.mult(n,255),{size:4}),this.fillVertexTemplate(r,"a_outline_edge",e.outline_edge_pct||jo.defaults.outline.width,{size:1})}return this.selection&&this.fillVertexTemplate(r,"a_selection_color",iu.mult(e.selection_color,255),{size:4}),this.fillVertexTemplate(r,"a_is_flat",0,{size:1}),this.defines.TANGRAM_POINT_DRAW_STICK&&e.stick&&(this.fillVertexTemplate(r,"a_is_stick",0,{size:1}),this.fillVertexTemplate(r,"a_stick_height",e.stick.height,{size:1})),this.vertex_template},buildQuad:function(e,t,i,r,n,o,a,s,l,u,c,h,f,d,_,p,v,m,g){return t[0]<=0||t[1]<=0?0:function(e,t,i,r){var n=r.quad,o=r.quad_normalize,a=r.offset,s=r.offsets,l=r.offsets_alt,u=r.pre_angles,c=r.pre_angles_alt,h=r.angle,f=r.angles,d=r.angles_alt,_=r.is_flat,p=r.elevate_by_altitude,v=r.build_stick_points,m=r.color,g=r.stick_color,y=r.curve,x=r.texcoord_scale,b=r.texcoord_normalize,A=r.pre_angles_normalize,T=r.angles_normalize,w=r.offsets_normalize;o=o||1;var k,E=n[0]/2*o,M=n[1]/2*o,R=[[-E,-M],[E,-M],[E,M],[-E,M]],S=t.vertex_elements,P=t.vertex_count,z=t.vertex_layout.index,N=z.a_texcoord,O=z.a_position,I=z.a_shape,L=z.a_offset,C=z.a_offsets,F=z.a_offsets_alt,D=z.a_pre_angles,j=z.a_pre_angles_alt,U=z.a_angles,G=z.a_angles_alt,B=z.a_is_flat,V=z.a_is_stick,q=z.a_color;if(N){b=b||1;var Y=Sr(x||xu,4),W=Y[0],X=Y[1],Z=Y[2],K=Y[3];k=[[W,X],[Z,X],[Z,K],[W,K]]}for(var J=0,$=e.length,Q=0;Q<$;Q++){var ee=e[Q];if(v){for(var te=.5*o,ie=1*o,re=[[-te,0],[+te,0],[+te,ie],[-te,ie]],ne=0;ne<4;ne++)N&&(i[N+0]=k[ne][0]*b,i[N+1]=k[ne][1]*b),i[O+0]=ee[0],i[O+1]=ee[1],p&&(i[O+2]=ml.clamp(ee[2],0,32767)),i[I+0]=re[ne][0],i[I+1]=re[ne][1],i[I+2]=0,i[q+0]=g[0],i[q+1]=g[1],i[q+2]=g[2],i[q+3]=g[3],i[V+0]=255,t.addVertex(i);S.push(P+0),S.push(P+1),S.push(P+2),S.push(P+2),S.push(P+3),S.push(P+0),P+=4,J+=2}for(var oe=0;oe<4;oe++)N&&(i[N+0]=k[oe][0]*b,i[N+1]=k[oe][1]*b),i[O+0]=ee[0],i[O+1]=ee[1],p&&(i[O+2]=ml.clamp(ee[2],0,32767)),i[I+0]=R[oe][0],i[I+1]=R[oe][1],i[I+2]=h,i[q+0]=m[0],i[q+1]=m[1],i[q+2]=m[2],i[q+3]=m[3],i[L+0]=a[0],i[L+1]=a[1],i[B+0]=_?255:0,v&&(i[V+0]=0),y&&(i[D+0]=A*u[0],i[D+1]=A*u[1],i[D+2]=A*u[2],i[D+3]=A*u[3],i[U+0]=T*f[0],i[U+1]=T*f[1],i[U+2]=T*f[2],i[U+3]=T*f[3],i[C+0]=w*s[0],i[C+1]=w*s[1],i[C+2]=w*s[2],i[C+3]=w*s[3],l&&(i[F+0]=w*l[0],i[F+1]=w*l[1],i[F+2]=w*l[2],i[F+3]=w*l[3],i[j+0]=A*c[0],i[j+1]=A*c[1],i[j+2]=A*c[2],i[j+3]=A*c[3],i[G+0]=T*d[0],i[G+1]=T*d[1],i[G+2]=T*d[2],i[G+3]=T*d[3])),t.addVertex(i);S.push(P+0),S.push(P+1),S.push(P+2),S.push(P+2),S.push(P+3),S.push(P+0),P+=4,J+=2}return J}(e,_,p,{quad:t,quad_normalize:256,offset:s,offsets:l,offsets_alt:u,pre_angles:o,pre_angles_alt:a,angle:4096*i,angles:r,angles_alt:n,is_flat:f,elevate_by_altitude:d,build_stick_points:v,stick_color:v&&iu.mult(m,255),color:iu.mult(g||jo.defaults.color,255),curve:h,texcoord_scale:c,texcoord_normalize:65535,pre_angles_normalize:jh,angles_normalize:Uh,offsets_normalize:64})},build:function(e,t,i){var r=e.label;return"curved"===r.type?this.buildCurvedLabel(r,e,t,i):this.buildStraightLabel(r,e,t,i)},buildStraightLabel:function(e,t,i,r){var n,o,a=this.makeVertexTemplate(t,i),s=e.angle||t.angle;o="point"!==e.type?(n=t.size[e.type],xu):(n=t.size,t.texcoords||xu),i.uniforms=i.uniforms||{},t.label_texture?(i.uniforms.u_texture=t.label_texture,i.uniforms.u_point_type=2,i.uniforms.u_apply_color_blocks=!1):(t.texture?(i.uniforms.u_texture=t.texture,i.uniforms.u_point_type=1):(i.uniforms.u_texture=$o.default,i.uniforms.u_point_type=3),i.uniforms.u_apply_color_blocks=!0);var l=e.offset,u=this.defines.TANGRAM_POINT_DRAW_STICK&&!t.label_texture&&t.stick&&0<t.stick.height,c=this.buildQuad([e.position],n,s,null,null,null,null,l,null,null,o,!1,e.isFlat(),t.elevate_by_altitude,i.vertex_data,a,u,u&&t.stick.color,t.color),h=t.linked&&t.linked.label.id;return this.trackLabel(e,h,i,c,r,u),c},buildCurvedLabel:function(e,t,i,r){for(var n=this.makeVertexTemplate(t,i),o=e.angle,a=0,s=0;s<2;s++)for(var l=0;l<e.num_segments;l++){var u=t.size[e.type][l],c=xu,h=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t));h.uniforms=h.uniforms||{},h.uniforms.u_texture=t.label_texture,h.uniforms.u_point_type=2,h.uniforms.u_apply_color_blocks=!1;var f=e.offset||[0,0],d=e.position,_=e.angles[l],p=e.offsets[l],v=e.pre_angles[l],m=e.num_segments-l-1,g=e.alt_angles[m],y=e.alt_pre_angles[m],x=e.alt_offsets[m],b=this.buildQuad([d],u,o,_,g,v,y,f,p,x,c,!0,e.isFlat(),t.elevate_by_altitude,h.vertex_data,n,!1,!1,t.color);a+=b;var A=t.linked&&t.linked.label.id;this.trackLabel(e,A,i,b,r,!1)}return a},trackLabel:function(e,t,i,r,n,o){var a=5<arguments.length&&void 0!==o&&o;i.labels=i.labels||{},i.labels.collision=i.labels.collision||{},i.labels["non-collision"]=i.labels["non-collision"]||{};var s=e.layout.collide?i.labels.collision:i.labels["non-collision"];s[e.id]=s[e.id]||{container:{label:e.text_data?Object.assign(e.toJSON(),{text_data:e.text_data}):e.toJSON(),linked:t},ranges:[]};var l=2*r,u=i.vertex_data.offset-i.vertex_data.stride*l;s[e.id].ranges.push([u,l,a])},buildLines:function(e,t,i,r){return this.build(t,i,r)},buildPoints:function(e,t,i,r){return this.build(t,i,r)},buildPolygons:function(e,t,i,r){return this.build(t,i,r)},vertexLayoutForMeshVariant:function(e){if(!this.vertex_layout){var t=[{name:"a_position",size:4,type:hu.SHORT,normalized:!1},{name:"a_shape",size:4,type:hu.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:hu.UNSIGNED_SHORT,normalized:!0},{name:"a_offset",size:2,type:hu.SHORT,normalized:!1},{name:"a_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0},{name:"a_outline_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0,static:[0,0,0,0]},{name:"a_outline_edge",size:1,type:hu.FLOAT,normalized:!1,static:0},{name:"a_selection_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0},{name:"a_is_flat",size:1,type:hu.UNSIGNED_BYTE,normalized:!0}];this.defines&&this.defines.TANGRAM_POINT_DRAW_STICK&&t.push({name:"a_is_stick",size:1,type:hu.UNSIGNED_BYTE,normalized:!0},{name:"a_stick_height",size:1,type:hu.FLOAT,normalized:!1}),this.vertex_layout=new gu(t),(t=t.map(function(e){return Object.assign({},e)})).forEach(function(e){"a_outline_color"!==e.name&&"a_outline_edge"!==e.name||(e.static=null)}),this.vertex_layout_shader_point=new gu(t)}return e.shader_point?this.vertex_layout_shader_point:this.vertex_layout},meshVariantTypeForDraw:function(e){var t=e.label_texture||e.texture||this.default_mesh_variant.key;return null==Gh.variants[t]&&(Gh.variants[t]={key:t,shader_point:t===this.default_mesh_variant.key,order:e.label_texture?1:0}),Gh.variants[t]},makeMesh:function(e,t,i){var r=2<arguments.length&&void 0!==i?i:{};return r=Object.assign({},r,{fade_in_time:this.fade_in_time}),cu.makeMesh.call(this,e,t,r)}});var Bh=[0,.33,.66,.99],Vh=function(e,t,i,r,n){for(var o=[{type:"straight",tolerance:n.no_curving?1.8:1.5},{type:"curved"},{type:"straight",tolerance:2.3}],a=0;a<o.length;a++){var s=o[a],l=void 0;if("straight"===s.type?l=new Hh(t,i,r,n,s.tolerance):"curved"===s.type&&!n.no_curving&&2<i.length&&(l=new Yh(e,i,r,n)),l&&!l.throw_away)return l}return!1},qh=function(){function i(e,t){mr(this,i),this.id=Nc.nextLabelId(),this.layout=t,this.position=[],this.angle=0,this.offset=t.offset.slice(),this.unit_scale=this.layout.units_per_pixel,this.type="",this.throw_away=!1,this._is_flat=e,this._circles=void 0,this.placed=null}return yr(i,[{key:"toJSON",value:function(){return{id:this.id,type:this.type,is_flat:this._is_flat,position:this.position,size:this.size,offset:this.offset,angle:this.angle,breach:this.breach,layout:Oc(this.layout),circles:this.getBoundingCircles()}}},{key:"inTileBounds",value:function(){var e=this.getAABB(),t=e.left,i=e.top,r=e.right,n=e.bottom;return on.pointInTile([t,i])&&on.pointInTile([r,n])}},{key:"getAABBForSegment",value:function(e,t,i,r){var n=this.unit_scale,o=t/2,a=i/2,s=Sr(e,2),l=s[0],u=s[1];if(0!==this.offset[0]||0!==this.offset[1]){var c=iu.rot(this.offset,this.angle);l+=c[0]*n,u-=c[1]*n}var h=[[Math.cos(r),-Math.sin(r)],[Math.sin(r),Math.cos(r)]],f=iu.multMatrix(h,[-o,-a]),d=iu.multMatrix(h,[o,-a]),_=iu.multMatrix(h,[o,a]),p=iu.multMatrix(h,[-o,a]);return{left:l+Math.min(f[0],d[0],_[0],p[0]),top:u+Math.max(f[1],d[1],_[1],p[1]),right:l+Math.max(f[0],d[0],_[0],p[0]),bottom:u+Math.min(f[1],d[1],_[1],p[1])}}},{key:"isFlat",value:function(){return this._is_flat}},{key:"getBoundingCircles",value:function(){}},{key:"getAABB",value:function(){}}],[{key:"splitLineByOrientation",value:function(e){for(var t=[e[0]],i=0,r=0,n=0,o=t,a=!1,s=1;s<e.length;s++){var l=e[s],u=e[s-1],c=iu.length(iu.sub(l,u));l[0]>u[0]?1===n?(t.push(l),r<(i+=c)&&(o=t,r=i,a=!1)):(t=[u,l],r<(i=c)&&(o=t,r=i,a=!1),n=1):l[0]<u[0]?-1===n?(t.unshift(l),r<(i+=c)&&(o=t,r=i,a=!0)):(t=[l,u],r<(i=c)&&(o=t,r=i,a=!0),n=-1):(-1===n?t.unshift(l):(t.push(l),n=1),r<(i+=c)&&(o=t,r=i,a=-1===n))}return[o,a]}}]),i}(),Hh=function(){function a(e,t,i,r,n){var o;return mr(this,a),(o=Mr(this,Ar(a).call(this,i,r))).type="straight",o.size=e,o.throw_away=!o.fit(e,t,r,n),o}return br(a,qh),yr(a,[{key:"fit",value:function(e,t,i,r){var n,o=this.unit_scale,a=Sr(qh.splitLineByOrientation(t),2);t=a[0],n=a[1],"number"==typeof i.orientation&&(this.offset[1]+=1.2*(e[1]-i.vertical_buffer),n&&(this.offset[1]*=-1),-1===i.orientation&&(this.offset[1]*=-1));for(var s=Xh(t),l=e[0]*o,u=0;u<t.length-1;u++)for(var c=t[u],h=0,f=0,d=u+1,_=void 0;d<t.length;){var p=t[d-1],v=t[d],m=Wh(p,v);if(d!==u+1&&(h+=Zh(m,_)),.1<Math.abs(h))break;if(f+=s[d-1],l/f<r){var g=iu.mult(iu.add(c,v),.5);return this.angle=-m,Math.abs(this.angle-Math.PI/2)<.01&&(this.angle=-Math.PI/2,"number"==typeof i.orientation&&(this.offset[1]*=-1)),this.position=g,this.breach=!this.inTileBounds(),!0}_=m,d++}return!1}},{key:"getBoundingCircles",value:function(){if(!this._circles){var e=this.unit_scale,t=this.size[0]/2*e,i=t*Math.cos(this.angle),r=t*Math.sin(this.angle),n=-i,o=-r,a=this.offset[0]*e,s=this.offset[1]*e,l=Sr(this.position,2),u=l[0],c=l[1];if(c*=-1,a){var h=[i,r];iu.normalize(h),h[0]*=a,h[1]*=a,u+=h[0],c+=h[1]}if(s){var f=[r,-i];iu.normalize(f),f[0]*=s,f[1]*=s,u-=f[0],c-=f[1]}i+=u,r+=c,n+=u,o+=c;var d=this.size[1]/2*e;this._circles=jc(i,r,n,o,d)}return this._circles}},{key:"getAABB",value:function(){if(!this._aabb){var e=this.unit_scale,t=this.size,i=this.layout.buffer,r=(t[0]+2*i[0])*e,n=(t[1]+2*i[1])*e;this._aabb=this.getAABBForSegment(this.position,r,n,this.angle)}return this._aabb}}]),a}(),Yh=function(){function j(e,t,i,r){var n;return mr(this,j),(n=Mr(this,Ar(j).call(this,i,r))).type="curved",n.positions=[],n.angles=[],n._aabbs=[],n.pre_angles=[],n.offsets=[],n.num_segments=e.length,n.sizes=e,n.alt_angles=[],n.alt_pre_angles=[],n.alt_offsets=[],n.throw_away=!n.fit(n.sizes,t,r),n}return br(j,qh),yr(j,[{key:"toJSON",value:function(){return{id:this.id,type:this.type,is_flat:this._is_flat,position:this.position,breach:this.breach,layout:Oc(this.layout),circles:this.getBoundingCircles()}}},{key:"fit",value:function(e,t,i){var r,n=this.unit_scale,o=Math.max.apply(Math,Pr(e.map(function(e){return e[1]}))),a=o*n,s=Sr(qh.splitLineByOrientation(t),2);t=s[0],r=s[1],"number"==typeof i.orientation&&(this.offset[1]+=1.2*(o-i.vertical_buffer),r&&(this.offset[1]*=-1),-1===i.orientation&&(this.offset[1]*=-1));var l=Xh(t),u=e.map(function(e){return e[0]*n}),c=l.reduce(function(e,t){return e+t},0),h=u.reduce(function(e,t){return e+t},0);if(c<h)return!1;var f=t.length-1;if(f-0<2)return!1;var d=j.curvaturePlacement(t,c,l,h,0,f),_=t[d];if(-1===d||f-d<2)return!1;this.position=_;for(var p=0;p<u.length;p++){this.positions[p]=[],this.offsets[p]=[],this.angles[p]=[],this.pre_angles[p]=[];for(var v=0;v<Bh.length;v++){var m=Bh[v],g=Sr(j.scaleLine(m,t),2),y=g[0],x=g[1];_=y[d];var b=j.placeAtIndex(d,y,x,u),A=b.positions,T=b.offsets,w=b.angles,k=b.pre_angles,E=T.map(function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])/n});if(0===m){this.angle=1/w.length*w.reduce(function(e,t){return e+t});for(var M=0;M<A.length;M++){var R=A[M],S=k[M],P=u[M],z=S+w[M];this._aabbs.push(this.getAABBForSegment(R,P,a,z))}}this.positions[p].push(A[p]),this.offsets[p].push(E[p]),this.angles[p].push(w[p]),this.pre_angles[p].push(k[p])}}u=e.slice().reverse().map(function(e){return e[0]*n});for(var N=0;N<u.length;N++){this.alt_offsets[N]=[],this.alt_angles[N]=[],this.alt_pre_angles[N]=[];for(var O=0;O<Bh.length;O++){var I=Bh[O],L=Sr(j.scaleLine(I,t),2),C=(y=L[0],L[1]);_=y[d];var F=j.placeAtIndex(d,y,C,u),D=(T=F.offsets,w=F.angles,k=F.pre_angles,T.map(function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])/n}));0===I&&(this.alt_angle=1/w.length*w.reduce(function(e,t){return e+t})),this.alt_offsets[N].push(D[N]),this.alt_angles[N].push(w[N]),this.alt_pre_angles[N].push(k[N])}}return!0}},{key:"getBoundingCircles",value:function(){if(!this._circles){for(var e=[],t=this.unit_scale,i=0;i<this.positions.length;i++){var r=this.sizes[i],n=this.angles[i][0],o=this.positions[i][0],a=r[0]/2*t,s=a*Math.cos(n),l=a*Math.sin(n),u=-s,c=-l,h=Sr(o,2),f=h[0],d=h[1],_=jc(s+=f,l+=d*=-1,u+=f,c+=d,r[1]/2*t);Array.prototype.push.apply(e,_)}this._circles=e}return this._circles}},{key:"getAABB",value:function(){if(!this._aabb){for(var e=1/0,t=-1/0,i=-1/0,r=1/0,n=0;n<this._aabbs.length;n++){var o=this._aabbs[n];e=Math.min(e,o.left),t=Math.max(t,o.top),i=Math.max(i,o.right),r=Math.min(r,o.bottom)}this._aabb={left:e,top:t,right:i,bottom:r}}return this._aabb}}],[{key:"curvaturePlacement",value:function(e,t,i,r,n,o){n=n||0,o=o||e.length-1;for(var a=[],s=n+1;s<o;s++){var l=e[s-1],u=e[s],c=e[s+1],h=iu.perp(u,l),f=iu.perp(c,u),d=iu.angleBetween(h,f);1<d&&(d=1/0),a.push(d)}a.push(1/0);for(var _=[],p=[],v=n,m=0,g=0;g<n;g++)m+=i[g];for(;m+r<t;){for(var y=m+r,x=m,b=v,A=0;b<o&&x+i[b]<y&&(A+=a[b])!==1/0;)x+=i[b],b++;if(0===A)return v;var T=A/(b-v);_.push(A),p.push(T),m+=i[v],v++}if(0===_.length)return-1;var w=Math.min.apply(null,_),k=p[_.indexOf(w)];return w<1.3&&k<.4?_.indexOf(w):-1}},{key:"scaleLine",value:function(n,o){var a=[o[0]],s=[];return o.forEach(function(e,t){if(t!==o.length-1){var i=iu.sub(o[t+1],o[t]),r=iu.mult(i,1+n);a.push(iu.add(a[t],r)),s.push(iu.length(r))}}),[a,s]}},{key:"placeAtIndex",value:function(e,t,i,r){var n=t[e],o=Sr(j.getIndicesAndOffsets(e,i,r),2),a=o[0],s=o[1],l=j.getPositionsFromIndicesAndOffsets(t,a,s),u=Sr(j.getAnglesFromIndicesAndOffsets(n,a,t,l),3);return{positions:l,offsets:u[0],angles:u[1],pre_angles:u[2]}}},{key:"getIndicesAndOffsets",value:function(e,t,i){for(var r=i.length,n=[],o=[],a=0,s=0,l=0;a<r;){for(var u=i[a];a<r&&s+.5*u<=l+t[e];){var c=s-l+.5*u;o.push(c),n.push(e),s+=u,u=i[++a]}l+=t[e],e++}return[n,o]}},{key:"getPositionsFromIndicesAndOffsets",value:function(e,t,i){for(var r=[],n=0;n<t.length;n++){var o=t[n],a=i[n],s=Wh(e[o],e[o+1]),l=iu.rot([a,0],s),u=iu.add(e[o],l);r.push(u)}return r}},{key:"getAnglesFromIndicesAndOffsets",value:function(e,t,i,r){for(var n,o,a=[],s=[],l=[],u=0;u<r.length;u++){var c=r[u],h=t[u],f=iu.sub(c,e),d=-iu.angle(f),_=(n=i[h],o=i[h+1],-Wh(n,o))-d;if(0<u){var p=a[u-1],v=s[u-1];Math.abs(d-p)>Math.PI&&(d+=p<d?-2*Math.PI:2*Math.PI),Math.abs(v-_)>Math.PI&&(_+=v<_?-2*Math.PI:2*Math.PI)}a.push(d),s.push(_),l.push(f)}return[l,a,s]}}]),j}();function Wh(e,t){var i=iu.sub(t,e);return iu.angle(i)}function Xh(e){for(var t=[],i=0;i<e.length-1;i++){var r=e[i],n=e[i+1],o=Math.hypot(r[0]-n[0],r[1]-n[1]);t.push(o)}return t}function Zh(e,t){var i,r;for(r=t<e?(i=t,e):(i=e,t);r-i>Math.PI;)i+=2*Math.PI;return Math.abs(r-i)}var Kh=Object.create(Gh);Object.assign(Kh,{name:"text",super:Gh,built_in:!0,init:function(e){var t=0<arguments.length&&void 0!==e?e:{};cu.init.call(this,t),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!1,this.defines.TANGRAM_IS_TEXT_STYLE=!0,this.reset()},makeVertexTemplate:function(e,t){this.super.makeVertexTemplate.apply(this,arguments);var i=t.vertex_data.vertex_layout;return this.fillVertexTemplate(i,"a_pre_angles",0,{size:4}),this.fillVertexTemplate(i,"a_offsets",0,{size:4}),this.fillVertexTemplate(i,"a_angles",0,{size:4}),this.fillVertexTemplate(i,"a_offsets_alt",0,{size:4}),this.fillVertexTemplate(i,"a_pre_angles_alt",0,{size:4}),this.fillVertexTemplate(i,"a_angles_alt",0,{size:4}),this.vertex_template},reset:function(){this.queues={},this.resetText()},addFeature:function(t,e,i){var r=this,n=i.tile,o=t.geometry.type;e.can_articulate="LineString"===o||"MultiLineString"===o,e.supersample_text="LineString"===o||"MultiLineString"===o;var a=this.parseTextFeature(t,e,i,n);a&&(a instanceof Array?a.forEach(function(e){e.feature=t,e.context=i,e.layout.vertex=!1,r.queueFeature(e,n)}):(a.feature=t,a.context=i,a.layout.vertex=!1,this.queueFeature(a,n)),Zo.addStyle(this.name,n.id))},endData:function(n){var o=this,e=this.queues[n.id];return delete this.queues[n.id],this.collideAndRenderTextLabels(n,this.name,e).then(function(e){var t=e.labels,i=e.texts;return t&&i&&(o.texts[n.id]=i,t.forEach(function(e){var t=e.text_settings_key,i=o.texts[n.id][t]&&o.texts[n.id][t][e.text],r=o.feature_style;r.label=e.label,e.label.text_data={text_info:i,text_settings_key:t,text:e.text},r.label_texture=$o.default,i.text_settings.can_articulate?(r.size={},"straight"===e.label.type?r.size.straight=i.size.logical_size:r.size.curved=i.segment_sizes.map(function(e){return e.logical_size})):r.size=i.size.logical_size,cu.addFeature.call(o,e.feature,e.draw,e.context)})),o.freeText(n),cu.endData.call(o,n).then(function(e){if(e){for(var t in e.meshes)e.meshes[t].uniforms.u_apply_color_blocks=!0;n.mesh_data[o.name]=e}return e})})},_preprocess:function(e){return this.preprocessText(e)},buildTextLabels:function(e,t){for(var i=[],r=0;r<t.length;r++){var n=t[r],o=this.texts[e.id][n.text_settings_key][n.text],a=void 0;if(n.layout.vertical_buffer=o.vertical_buffer,o.text_settings.can_articulate){var s=o.segment_sizes.map(function(e){return e.collision_size});n.layout.no_curving=o.no_curving,a=this.buildLabels(s,n.feature.geometry,n.layout,o.size.collision_size)}else a=this.buildLabels(o.size.collision_size,n.feature.geometry,n.layout);for(var l=0;l<a.length;l++){var u=Object.create(n);u.label=a[l],i.push(u)}}return i},buildLabels:function(e,t,i,r){var n="Point"!==t.type,o=[];if("LineString"===t.type)Array.prototype.push.apply(o,this.buildLineLabels(t.coordinates,e,n,i,r));else if("MultiLineString"===t.type)for(var a=t.coordinates,s=0;s<a.length;++s)Array.prototype.push.apply(o,this.buildLineLabels(a[s],e,n,i,r));else if("Point"===t.type)o.push(new Uc(t.coordinates,e,n,i));else if("MultiPoint"===t.type)for(var l=t.coordinates,u=0;u<l.length;++u)o.push(new Uc(l[u],e,n,i));else if("Polygon"===t.type){var c=Jr.centroid(t.coordinates);o.push(new Uc(c,e,n,i))}else if("MultiPolygon"===t.type){var h=Jr.multiCentroid(t.coordinates);o.push(new Uc(h,e,n,i))}return o},buildLineLabels:function(e,t,i,r,n){var o=[],a=Math.min(r.subdiv,e.length-1);if(1<a)for(var s=(e.length-1)/a,l=0;l<a;l++){var u=Math.floor(l*s),c=Math.floor((l+1)*s)+1,h=e.slice(u,c),f=Vh(t,n,h,i,r);f&&o.push(f)}if(o.length<a){var d=Vh(t,n,e,i,r);d&&o.push(d)}return o},vertexLayoutForMeshVariant:function(){if(!this.vertex_layout){var e=[{name:"a_position",size:4,type:hu.SHORT,normalized:!1},{name:"a_shape",size:4,type:hu.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:hu.UNSIGNED_SHORT,normalized:!0},{name:"a_offset",size:2,type:hu.SHORT,normalized:!1},{name:"a_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0},{name:"a_angles",size:4,type:hu.SHORT,normalized:!1},{name:"a_offsets",size:4,type:hu.UNSIGNED_SHORT,normalized:!1},{name:"a_pre_angles",size:4,type:hu.BYTE,normalized:!1},{name:"a_selection_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0},{name:"a_is_flat",size:1,type:hu.UNSIGNED_BYTE,normalized:!0},{name:"a_offsets_alt",size:4,type:hu.UNSIGNED_SHORT,normalized:!1},{name:"a_pre_angles_alt",size:4,type:hu.BYTE,normalized:!1},{name:"a_angles_alt",size:4,type:hu.SHORT,normalized:!1}];this.vertex_layout=new gu(e)}return this.vertex_layout},meshVariantTypeForDraw:Gh.meshVariantTypeForDraw}),Kh.texture_id=0;var Jh=Object.create(Ku);Object.assign(Jh,{name:"raster",super:Ku,built_in:!0,init:function(){this.raster=this.raster||"color",this.super.init.apply(this,arguments),this.selection=!1,this.defines.SNAP_TO_PIXEL_GRID=!0},_preprocess:function(e){return e.color=e.color||jo.defaults.color,this.super._preprocess.apply(this,arguments)}});var $h=Object.create(Gh);Object.assign($h,{name:"custom_icons",collision:!1,init:function(e){var t=0<arguments.length&&void 0!==e?e:{};Gh.init.call(this,t)},loadTexture:function(e,t,i){var r,n=e.width,o=e.height,a=e.items,s=document.createElement("canvas"),l=on.device_pixel_ratio,u=this.sources[t],c={sprites:{}};if(s.width=n*l,s.height=o*l,u){var h,f=a.length,d=s.getContext("2d");for(d.scale(l,l);h=a[--f];){var _=u.getIconBitmapByObjectId(h.meta.objectId,h.meta.id);if(_){var p=dl(_);p?Kr("error",p):(d.drawImage(_,h.x,h.y,h.width,h.height),c.sprites[h.meta.id]=[h.x,h.y,h.width,h.height])}}}return c.element=s,(r=$o.create(this.gl,i,c)).retain(),r.loading.then(function(e){return e.name})},buildRasterTextures:function(e,t){return Cr.postMessage(this.main_thread_target+".loadTexture",e.rasters,e.source,e.texture_name).then(function(e){return t.textures.push(e),t})},addFeature:function(e,t,i){var r=i.tile.rasters,n={};r.items.forEach(function(e){n[e.meta.id]=[e.x,e.y,e.width,e.height]});var o="".concat(i.tile.source,"_dyn_").concat(i.tile.coords.key,"_").concat(this.generation,"_").concat(i.tile.id);t.texture=i.tile.texture_name=o;var a=Object.assign({},Qh,{name:o,width:r.width,height:r.height,sprites:n});$o.prototype.calculateSprites.apply(a),$o.textures[o]=a,Gh.addFeature.apply(this,arguments),delete $o.textures[o]}});var Qh={filtering:"linear",density:1,valid:!0,power_of_2:!1,texcoords:{},sizes:{},css_sizes:{},aspects:{}},ef=Object.create(Ku);Object.assign(ef,{name:"overlays",super:Ku,init:function(e){var t=0<arguments.length&&void 0!==e?e:{};this.selection=t.selection||!0,this.raster=this.raster||"color",this.super.init.apply(this,arguments)},countObjectSource:function(e,t){return e+(this.sources[t]instanceof Al)},setupRasters:function(){if(this.super.setupRasters.call(this),"0"===this.defines.TANGRAM_NUM_RASTER_SOURCES){var e=Object.keys(this.sources).reduce(this.countObjectSource.bind(this),0);e&&(this.defines.TANGRAM_NUM_RASTER_SOURCES="".concat(e),this.defines.TANGRAM_RASTER_TEXTURE_COLOR=!0,this.defines.TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster",uu,"Raster"))}},loadTextures:function(a,e){var s,l,u,c=this.sources[e],t=a.name;if(a.overlays_config.forEach(function(e){var t=e.texcoords,i=e.id,r=c.getMapObjectById(i),n=r.getBitmap();if(n){var o=dl(n=_l(n,n.width,n.height));o?Kr("error",o):(s||((s=document.createElement("canvas")).width=a.width,s.height=a.height,l=s.getContext("2d")),l.save(),l.globalAlpha=r.getOpacity(),t.forEach(function(e){return l.drawImage(n,e[0],e[1],e[2],e[3])}),l.restore(),u=!0)}}),u){a.element=s;var i={};return i[t]=a,this.super.loadTextures.call(this,i)}var r=$o.textures[$o.default];return Promise.resolve([{name:r.name,width:r.width,height:r.height,loaded:r.loaded}])},buildRasterTextures:function(e,i){var t=this.sources[e.source].tileTexture(e);if(!t)return Promise.resolve(i);return{}[({}[t.name]=t).name]=0,Cr.postMessage(this.main_thread_target+".loadTextures",t,e.source).then(function(e){if(!e||e.length<1)return i;if(e.some(function(e){return!e.loaded}))return null;var t=e[0];return i.uniforms=i.uniforms||{},i.textures=i.textures||[],i.uniforms.u_rasters=[t.name],i.uniforms.u_raster_sizes=[t.width,t.height],i.uniforms.u_raster_offsets=[0,0,1],i.textures.push(t.name),i})}});var tf=Object.create(cu),rf=[-1,0,1,0,-1,1,-1,1,1,0,1,1,-1,0,1,0,-1,1,-1,1,1,0,1,1];Object.assign(tf,{name:"skybox",built_in:!0,vertex_shader_src:"uniform float u_horizon;uniform float u_tilt;uniform float u_zoom;attribute vec2 a_position;attribute float a_is_sky;attribute vec4 a_color;varying vec4 v_color;const float SIN_THRESHOLD_ANGLE=0.96126069082;void main(){v_color=a_color;float sin_tilt=sin(u_tilt);float sky_bottom_alpha=1.-max(sin_tilt-SIN_THRESHOLD_ANGLE,0.)*3.;if((a_position.y==1.&&a_is_sky==0.)||(a_position.y==0.&&a_is_sky==1.)){v_color.w=sky_bottom_alpha;}float fog_height=max((22.-u_zoom)*0.04,0.)*(sin_tilt-.7);float position_z=u_zoom<17. ? .942 : .9418;gl_Position=vec4(a_position.x,a_position.y*a_is_sky+1.0-u_horizon-(1.0-a_is_sky)*(1.0-a_position.y)*fog_height,position_z,1.0);}",fragment_shader_src:"varying vec4 v_color;void main(void){gl_FragColor=v_color;}",selection:!1,blend:"inlay",blend_order:1,init:function(){cu.init.apply(this,arguments),this.selection=!1},_preprocess:function(e){return e.color={top:jo.createColorPropertyCache(e.color.zenith),bottom:jo.createColorPropertyCache(e.color.horizon),fog:jo.createColorPropertyCache(e.color.fog)},e},vertexLayoutForMeshVariant:function(e){if(!this.vertex_layout){var t=[{name:"a_position",size:2,type:hu.FLOAT,normalized:!1},{name:"a_is_sky",size:1,type:hu.FLOAT,normalized:!0},{name:"a_color",size:4,type:hu.UNSIGNED_BYTE,normalized:!0}];this.vertex_layout=new gu(t)}return this.vertex_layout},makeVertexTemplate:function(e){var t=0;return this.vertex_template[t++]=0,this.vertex_template[t++]=0,this.vertex_template},parseFeature:function(e,t,i){var r=this.feature_style;return t.color&&t.color.top&&t.color.bottom&&(r.color_top=this.parseColor(t.color.top,i),r.color_bottom=this.parseColor(t.color.bottom,i),r.color_fog=this.parseColor(t.color.fog||"white",i),r.color_fog[3]=0),r},buildGeometry:function(e,t,i,r){for(var n=this.makeVertexTemplate(t),o=i.vertex_data,a=i.vertex_data.vertex_layout,s=o.vertex_layout.index.a_position,l={top:t.color_top,bottom:t.color_bottom},u={top:t.color_bottom,bottom:t.color_fog},c=0,h=rf.length-1;c<h;c+=2){n[s+0]=rf[c],n[s+1]=rf[c+1];var f=c<12,d=0<rf[c+1],_=f?l:u;this.fillVertexTemplate(a,"a_is_sky",f?1:0,{size:1}),this.fillVertexTemplate(a,"a_color",iu.mult(d?_.top:_.bottom,255),{size:4}),o.addVertex(n)}return 4}});var nf=function(){function e(){mr(this,e),this.styles={},this.base_styles={},this.register(Object.create(Ku)),this.register(Object.create(mc)),this.register(Object.create(wc)),this.register(Object.create(Gh)),this.register(Object.create(Kh)),this.register(Object.create(Jh)),this.register(Object.create($h)),this.register(Object.create(ef)),this.register(Object.create(tf))}return yr(e,[{key:"init",value:function(){Zl.removeBlock("global"),Zl.removeBlock("setup"),Zl.addBlock("global","#ifdef TANGRAM_VERTEX_SHADER\nvec4 modelPosition(){return vec4(a_position.xyz/TANGRAM_TILE_SCALE*exp2(u_tile_origin.z-u_tile_origin.w),1.)+vec4(0.,1.,0.,0.);}vec4 modelPositionBaseZoom(){return vec4(a_position.xyz/TANGRAM_TILE_SCALE,1.)+vec4(0.,1.,0.,0.);}\n#endif\nvec4 worldPosition(){return v_world_position;}\n#ifdef TANGRAM_VERTEX_SHADER\nvec4 wrapWorldPosition(vec4 world_position){\n#if defined(TANGRAM_WORLD_POSITION_WRAP)\nvec2 anchor=u_tile_origin.xy-mod(u_tile_origin.xy,TANGRAM_WORLD_POSITION_WRAP);world_position.xy-=anchor;\n#endif\nreturn world_position;}\n#endif\n#if defined(TANGRAM_VERTEX_SHADER)\nvec3 worldNormal(){return TANGRAM_NORMAL;}\n#elif defined(TANGRAM_FRAGMENT_SHADER)\nvec3 worldNormal(){return u_inverseNormalMatrix*TANGRAM_NORMAL;}\n#endif\n"),Zl.addBlock("global","void applyLayerOrder(float layer,inout vec4 position){position.z-=layer*TANGRAM_LAYER_DELTA*position.w;}"),Zl.addBlock("global","\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\nattribute vec4 a_selection_color;varying vec4 v_selection_color;uniform vec4 u_selection_discard0;uniform vec4 u_selection_discard1;uniform vec4 u_selection_discard2;uniform vec4 u_selection_discard3;uniform vec4 u_selection_discard4;uniform vec4 u_selection_discard5;uniform vec4 u_selection_discard6;uniform vec4 u_selection_discard7;uniform vec4 u_selection_discard8;uniform vec4 u_selection_discard9;\n#endif\n"),Zl.addBlock("global","uniform float u_view_pan_snap_timer;void snapToPixelGrid(inout vec4 position){vec2 position_fract=fract((((position.xy/position.w)+1.)*.5)*u_resolution);vec2 position_snap=position.xy+((step(0.5,position_fract)-position_fract)*position.w*2./u_resolution);\n#ifdef TANGRAM_VIEW_PAN_SNAP_RATE\nposition.xy=mix(position.xy,position_snap,clamp(u_view_pan_snap_timer*TANGRAM_VIEW_PAN_SNAP_RATE,0.,1.));\n#else\nposition.xy=position_snap;\n#endif\n}"),Zl.replaceBlock("utils","#ifndef UTILS\n#define UTILS\nbool isLocalSpacePixelOutsideTile(vec4 pixel_local_space_position,float tile_scale){return pixel_local_space_position.x<0.||pixel_local_space_position.x>=tile_scale||pixel_local_space_position.y>0.||pixel_local_space_position.y<=-tile_scale;}\n#endif\n"),Zl.replaceBlock("setup","\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\nif(a_selection_color.rgb==vec3(0.)||a_selection_color==u_selection_discard0||a_selection_color==u_selection_discard1||a_selection_color==u_selection_discard2||a_selection_color==u_selection_discard3||a_selection_color==u_selection_discard4||a_selection_color==u_selection_discard5||a_selection_color==u_selection_discard6||a_selection_color==u_selection_discard7||a_selection_color==u_selection_discard8||a_selection_color==u_selection_discard9){gl_Position=vec4(0.,0.,0.,1.);return;}v_selection_color=a_selection_color;\n#endif\n"),Zl.defines.TANGRAM_EPSILON=1e-5,Zl.defines.TANGRAM_LAYER_DELTA=1/16384,Zl.defines.TANGRAM_TILE_SCALE="vec3(".concat(Jr.tile_scale,"., ").concat(Jr.tile_scale,"., u_meters_per_pixel * ").concat(Jr.tile_size,".)"),Zl.defines.TANGRAM_HEIGHT_SCALE=Jr.height_scale,Zl.defines.TANGRAM_ALPHA_TEST=.1,mc.dash_textures={}}},{key:"destroy",value:function(i){var r=this;Object.keys(this.styles).forEach(function(e){var t=r.styles[e];t.gl===i&&(Kr("trace","StyleManager.destroy: destroying render style ".concat(t.name)),t.base&&r.remove(t.name),t.destroy())})}},{key:"register",value:function(e){this.styles[e.name]=e,this.base_styles[e.name]=e}},{key:"remove",value:function(e){delete this.styles[e]}},{key:"mix",value:function(t,i){if(t.mixed)return t;t.mixed={};var e=[];if(t.mix){var r;if(Array.isArray(t.mix))(r=e).push.apply(r,Pr(t.mix));else e.push(t.mix);(e=e.map(function(e){return i[e]}).filter(function(e){return e&&e!==t})).forEach(function(e){return t.mixed[e.name]=!0})}e.push(t),t.animated=e.some(function(e){return e&&e.animated}),t.texcoords=e.some(function(e){return e&&e.texcoords}),t.base=e.map(function(e){return e.base}).filter(function(e){return e}).pop(),t.lighting=e.map(function(e){return e.lighting}).filter(function(e){return null!=e}).pop(),t.texture=e.map(function(e){return e.texture}).filter(function(e){return e}).pop(),t.raster=e.map(function(e){return e.raster}).filter(function(e){return null!=e}).pop(),t.dash=e.map(function(e){return e.dash}).filter(function(e){return null!=e}).pop(),t.dash_background_color=e.map(function(e){return e.dash_background_color}).filter(function(e){return null!=e}).pop(),e.some(function(e){return e.hasOwnProperty("blend")&&e.blend})&&(t.blend=e.map(function(e){return e.hasOwnProperty("blend")&&e.blend}).filter(function(e){return e}).pop()),t.blend_order=e.map(function(e){return e.blend_order}).filter(function(e){return null!=e}).pop(),t.defines=Object.assign.apply(Object,[{}].concat(Pr(e.map(function(e){return e.defines}).filter(function(e){return e})))),t.material=Object.assign.apply(Object,[{}].concat(Pr(e.map(function(e){return e.material}).filter(function(e){return e}))));var n=e.map(function(e){return e.draw}).filter(function(e){return e});return 0<n.length&&(t.draw=fl.apply(void 0,[{}].concat(Pr(n)))),this.mixShaders(t,i,e),t}},{key:"mixShaders",value:function(e,r,t){var a={},i=t.map(function(e){return e.shaders}).filter(function(e){return e});if(a.defines=Object.assign.apply(Object,[{}].concat(Pr(i.map(function(e){return e.defines}).filter(function(e){return e})))),a.uniforms={},a._uniforms=e.shaders&&e.shaders.uniforms||{},a._uniform_scopes={},t.filter(function(e){return e.shaders&&e.shaders.uniforms}).forEach(function(e){function t(t){a._uniform_scopes[t]=e.name,Object.defineProperty(a.uniforms,t,{enumerable:!0,configurable:!0,get:function(){return void 0!==a._uniforms[t]?a._uniforms[t]:r[a._uniform_scopes[t]].shaders.uniforms!==a.uniforms?r[a._uniform_scopes[t]].shaders.uniforms[t]:void 0},set:function(e){a._uniforms[t]=e}})}for(var i in e.shaders.uniforms)t(i)}),a.extensions=Object.keys(i.map(function(e){return e.extensions}).filter(function(e){return e}).reduce(function(t,e){return"string"==typeof e?t[e]=!0:e.forEach(function(e){return t[e]=!0}),t},{})||{}),e.shaders&&e.shaders.blocks)for(var n in e.shaders.block_scopes=e.shaders.block_scopes||{},e.shaders.blocks){var o,s=e.shaders.blocks[n];if(e.shaders.block_scopes[n]=e.shaders.block_scopes[n]||[],Array.isArray(s))(o=e.shaders.block_scopes[n]).push.apply(o,Pr(s.map(function(){return e.name})));else e.shaders.block_scopes[n].push(e.name)}var l={};return i.forEach(function(e){if(e.blocks){a.blocks=a.blocks||{},a.block_scopes=a.block_scopes||{};var t={};for(var i in e.blocks){var r=e.blocks[i],n=e.block_scopes[i];a.blocks[i]=a.blocks[i]||[],a.block_scopes[i]=a.block_scopes[i]||[],r=Array.isArray(r)?r:[r],n=Array.isArray(n)?n:[n];for(var o=0;o<r.length;o++)l[n[o]]||(t[n[o]]=!0,a.blocks[i].push(r[o]),a.block_scopes[i].push(n[o]))}Object.assign(l,t)}}),Object.assign(e.mixed,l),e.shaders=a,e}},{key:"create",value:function(e,t,i){var r=2<arguments.length&&void 0!==i?i:{},n=fl({},t);return n.name=e,(n=this.mix(n,r)).base&&this.base_styles[n.base]?this.styles[e]=n=Object.assign(Object.create(this.base_styles[n.base]),n):n.base=null,n}},{key:"build",value:function(i){var r=this,e=Object.keys(i).sort(function(e,t){return r.inheritanceDepth(e,i)-r.inheritanceDepth(t,i)});for(var t in this.styles)this.base_styles[t]?this.styles[t].reset():delete this.styles[t];var n={};return e.forEach(function(e){n[e]=r.create(e,i[e],n)}),this.styles}},{key:"initStyles",value:function(e){var t=0<arguments.length&&void 0!==e?e:{};for(var i in this.styles)this.styles[i].init(t)}},{key:"inheritanceDepth",value:function(t,i){for(var r=this,e=0;;){var n=i[t];if(!n)break;if(!n.mix)break;if(e++,Array.isArray(n.mix)){e+=Math.max.apply(Math,Pr(n.mix.map(function(e){if(t!==e)return r.inheritanceDepth(e,i)})));break}if(t===n.mix)break;t=n.mix}return e}}]),e}();function of(e){return null==e}var af={isNothing:of,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:of(e)?[]:[e]},repeat:function(e,t){var i,r="";for(i=0;i<t;i+=1)r+=e;return r},isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var i,r,n,o;if(t)for(i=0,r=(o=Object.keys(t)).length;i<r;i+=1)e[n=o[i]]=t[n];return e}};function sf(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}((sf.prototype=Object.create(Error.prototype)).constructor=sf).prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t};var lf=sf;function uf(e,t,i,r,n){this.name=e,this.buffer=t,this.position=i,this.line=r,this.column=n}uf.prototype.getSnippet=function(e,t){var i,r,n,o,a;if(!this.buffer)return null;for(e=e||4,t=t||75,i="",r=this.position;0<r&&-1==="\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(r-1));)if(r-=1,this.position-r>t/2-1){i=" ... ",r+=5;break}for(n="",o=this.position;o<this.buffer.length&&-1==="\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(o));)if((o+=1)-this.position>t/2-1){n=" ... ",o-=5;break}return a=this.buffer.slice(r,o),af.repeat(" ",e)+i+a+n+"\n"+af.repeat(" ",e+this.position-r+i.length)+"^"},uf.prototype.toString=function(e){var t,i="";return this.name&&(i+='in "'+this.name+'" '),i+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(i+=":\n"+t),i};var cf=uf,hf=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],ff=["scalar","sequence","mapping"];var df=function(t,e){if(e=e||{},Object.keys(e).forEach(function(e){if(-1===hf.indexOf(e))throw new lf('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(e){return e},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=function(e){var i={};return null!==e&&Object.keys(e).forEach(function(t){e[t].forEach(function(e){i[String(e)]=t})}),i}(e.styleAliases||null),-1===ff.indexOf(this.kind))throw new lf('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')};function _f(e,t,r){var n=[];return e.include.forEach(function(e){r=_f(e,t,r)}),e[t].forEach(function(i){r.forEach(function(e,t){e.tag===i.tag&&n.push(t)}),r.push(i)}),r.filter(function(e,t){return-1===n.indexOf(t)})}function pf(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new lf("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=_f(this,"implicit",[]),this.compiledExplicit=_f(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,i={};function r(e){i[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(r);return i}(this.compiledImplicit,this.compiledExplicit)}pf.DEFAULT=null,pf.create=function(e,t){var i,r;switch(arguments.length){case 1:i=pf.DEFAULT,r=e;break;case 2:i=e,r=t;break;default:throw new lf("Wrong number of arguments for Schema.create function")}if(i=af.toArray(i),r=af.toArray(r),!i.every(function(e){return e instanceof pf}))throw new lf("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!r.every(function(e){return e instanceof df}))throw new lf("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new pf({include:i,explicit:r})};var vf=pf,mf=new vf({explicit:[new df("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),new df("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),new df("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})]});var gf=new df("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"});var yf=new df("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});var xf=new df("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,i,r,n,o=e.length,a=0,s=!1;if(!o)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===o)return!0;if("b"===(t=e[++a])){for(a++;a<o;a++)if("_"!==(t=e[a])){if("0"!==t&&"1"!==t)return!1;s=!0}return s}if("x"===t){for(a++;a<o;a++)if("_"!==(t=e[a])){if(!(48<=(r=e.charCodeAt(a))&&r<=57||65<=r&&r<=70||97<=r&&r<=102))return!1;s=!0}return s}for(;a<o;a++)if("_"!==(t=e[a])){if(!(48<=(i=e.charCodeAt(a))&&i<=55))return!1;s=!0}return s}for(;a<o;a++)if("_"!==(t=e[a])){if(":"===t)break;if(!(48<=(n=e.charCodeAt(a))&&n<=57))return!1;s=!0}return!!s&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(a)))},construct:function(e){var t,i,r=e,n=1,o=[];return-1!==r.indexOf("_")&&(r=r.replace(/_/g,"")),"-"!==(t=r[0])&&"+"!==t||("-"===t&&(n=-1),t=(r=r.slice(1))[0]),"0"===r?0:"0"===t?"b"===r[1]?n*parseInt(r.slice(2),2):"x"===r[1]?n*parseInt(r,16):n*parseInt(r,8):-1!==r.indexOf(":")?(r.split(":").forEach(function(e){o.unshift(parseInt(e,10))}),r=0,i=1,o.forEach(function(e){r+=e*i,i*=60}),n*r):n*parseInt(r,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!af.isNegativeZero(e)},represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),bf=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var Af=/^[-+]?[0-9]+e/;var Tf=new vf({include:[mf],implicit:[gf,yf,xf,new df("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!bf.test(e)},construct:function(e){var t,i,r,n;return i="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,n=[],0<="+-".indexOf(t[0])&&(t=t.slice(1)),".inf"===t?1==i?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:0<=t.indexOf(":")?(t.split(":").forEach(function(e){n.unshift(parseFloat(e,10))}),t=0,r=1,n.forEach(function(e){t+=e*r,r*=60}),i*t):i*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||af.isNegativeZero(e))},represent:function(e,t){var i;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(af.isNegativeZero(e))return"-0.0";return i=e.toString(10),Af.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"})]}),wf=new vf({include:[Tf]}),kf=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");var Ef=new df("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&null!==kf.exec(e)},construct:function(e){var t,i,r,n,o,a,s,l,u=0,c=null;if(null===(t=kf.exec(e)))throw new Error("Date resolve error");if(i=+t[1],r=+t[2]-1,n=+t[3],!t[4])return new Date(Date.UTC(i,r,n));if(o=+t[4],a=+t[5],s=+t[6],t[7]){for(u=t[7].slice(0,3);u.length<3;)u+="0";u=+u}return t[9]&&(c=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(c=-c)),l=new Date(Date.UTC(i,r,n,o,a,s,u)),c&&l.setTime(l.getTime()-c),l},instanceOf:Date,represent:function(e){return e.toISOString()}});var Mf=new df("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),Rf=_s.Buffer,Sf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var Pf=new df("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,i,r=0,n=e.length,o=Sf;for(i=0;i<n;i++)if(!(64<(t=o.indexOf(e.charAt(i))))){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,i,r=e.replace(/[\r\n=]/g,""),n=r.length,o=Sf,a=0,s=[];for(t=0;t<n;t++)t%4==0&&t&&(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)),a=a<<6|o.indexOf(r.charAt(t));return 0==(i=n%4*6)?(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)):18==i?(s.push(a>>10&255),s.push(a>>2&255)):12==i&&s.push(a>>4&255),Rf?new Rf(s):s},predicate:function(e){return Rf&&Rf.isBuffer(e)},represent:function(e){var t,i,r="",n=0,o=e.length,a=Sf;for(t=0;t<o;t++)t%3==0&&t&&(r+=a[n>>18&63],r+=a[n>>12&63],r+=a[n>>6&63],r+=a[63&n]),n=(n<<8)+e[t];return 0==(i=o%3)?(r+=a[n>>18&63],r+=a[n>>12&63],r+=a[n>>6&63],r+=a[63&n]):2==i?(r+=a[n>>10&63],r+=a[n>>4&63],r+=a[n<<2&63],r+=a[64]):1==i&&(r+=a[n>>2&63],r+=a[n<<4&63],r+=a[64],r+=a[64]),r}}),zf=Object.prototype.hasOwnProperty,Nf=Object.prototype.toString;var Of=new df("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,i,r,n,o,a=[],s=e;for(t=0,i=s.length;t<i;t+=1){if(r=s[t],o=!1,"[object Object]"!==Nf.call(r))return!1;for(n in r)if(zf.call(r,n)){if(o)return!1;o=!0}if(!o)return!1;if(-1!==a.indexOf(n))return!1;a.push(n)}return!0},construct:function(e){return null!==e?e:[]}}),If=Object.prototype.toString;var Lf=new df("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,i,r,n,o,a=e;for(o=new Array(a.length),t=0,i=a.length;t<i;t+=1){if(r=a[t],"[object Object]"!==If.call(r))return!1;if(1!==(n=Object.keys(r)).length)return!1;o[t]=[n[0],r[n[0]]]}return!0},construct:function(e){if(null===e)return[];var t,i,r,n,o,a=e;for(o=new Array(a.length),t=0,i=a.length;t<i;t+=1)r=a[t],n=Object.keys(r),o[t]=[n[0],r[n[0]]];return o}}),Cf=Object.prototype.hasOwnProperty;var Ff=new vf({include:[wf],implicit:[Ef,Mf],explicit:[Pf,Of,Lf,new df("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,i=e;for(t in i)if(Cf.call(i,t)&&null!==i[t])return!1;return!0},construct:function(e){return null!==e?e:{}}})]});var Df=new df("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}});var jf,Uf=new df("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,i=/\/([gim]*)$/.exec(e),r="";if("/"===t[0]){if(i&&(r=i[1]),3<r.length)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,i=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(i&&(r=i[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}});try{jf=function(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}("esprima")}catch(e){"undefined"!=typeof window&&(jf=window.esprima)}var Gf=new df("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",i=jf.parse(t,{range:!0});return"Program"===i.type&&1===i.body.length&&"ExpressionStatement"===i.body[0].type&&"FunctionExpression"===i.body[0].expression.type}catch(e){return!1}},construct:function(e){var t,i="("+e+")",r=jf.parse(i,{range:!0}),n=[];if("Program"!==r.type||1!==r.body.length||"ExpressionStatement"!==r.body[0].type||"FunctionExpression"!==r.body[0].expression.type)throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach(function(e){n.push(e.name)}),t=r.body[0].expression.body.range,new Function(n,i.slice(t[0]+1,t[1]-1))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}}),Bf=vf.DEFAULT=new vf({include:[Ff],explicit:[Df,Uf,Gf]}),Vf=Object.prototype.hasOwnProperty,qf=1,Hf=2,Yf=3,Wf=4,Xf=1,Zf=2,Kf=3,Jf=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,$f=/[\x85\u2028\u2029]/,Qf=/[,\[\]\{\}]/,ed=/^(?:!|!!|![a-z\-]+!)$/i,td=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function id(e){return 10===e||13===e}function rd(e){return 9===e||32===e}function nd(e){return 9===e||32===e||10===e||13===e}function od(e){return 44===e||91===e||93===e||123===e||125===e}function ad(e){return 48===e?"\0":97===e?"\x07":98===e?"\b":116===e?"\t":9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"\x1b":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"\x85":95===e?"\xa0":76===e?"\u2028":80===e?"\u2029":""}for(var sd=new Array(256),ld=new Array(256),ud=0;ud<256;ud++)sd[ud]=ad(ud)?1:0,ld[ud]=ad(ud);function cd(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Bf,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function hd(e,t){return new lf(t,new cf(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function fd(e,t){throw hd(e,t)}function dd(e,t){e.onWarning&&e.onWarning.call(null,hd(e,t))}var _d={YAML:function(e,t,i){var r,n,o;null!==e.version&&fd(e,"duplication of %YAML directive"),1!==i.length&&fd(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(i[0]))&&fd(e,"ill-formed argument of the YAML directive"),n=parseInt(r[1],10),o=parseInt(r[2],10),1!==n&&fd(e,"unacceptable YAML version of the document"),e.version=i[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&dd(e,"unsupported YAML version of the document")},TAG:function(e,t,i){var r,n;2!==i.length&&fd(e,"TAG directive accepts exactly two arguments"),r=i[0],n=i[1],ed.test(r)||fd(e,"ill-formed tag handle (first argument) of the TAG directive"),Vf.call(e.tagMap,r)&&fd(e,'there is a previously declared suffix for "'+r+'" tag handle'),td.test(n)||fd(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=n}};function pd(e,t,i,r){var n,o,a,s;if(t<i){if(s=e.input.slice(t,i),r)for(n=0,o=s.length;n<o;n+=1)9===(a=s.charCodeAt(n))||32<=a&&a<=1114111||fd(e,"expected valid JSON character");else Jf.test(s)&&fd(e,"the stream contains non-printable characters");e.result+=s}}function vd(e,t,i,r){var n,o,a,s;for(af.isObject(i)||fd(e,"cannot merge mappings; the provided source object is unacceptable"),a=0,s=(n=Object.keys(i)).length;a<s;a+=1)o=n[a],Vf.call(t,o)||(t[o]=i[o],r[o]=!0)}function md(e,t,i,r,n,o){var a,s;if(n=String(n),null===t&&(t={}),"tag:yaml.org,2002:merge"===r)if(Array.isArray(o))for(a=0,s=o.length;a<s;a+=1)vd(e,t,o[a],i);else vd(e,t,o,i);else e.json||Vf.call(i,n)||!Vf.call(t,n)||fd(e,"duplicated mapping key"),t[n]=o,delete i[n];return t}function gd(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):fd(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function yd(e,t,i){for(var r=0,n=e.input.charCodeAt(e.position);0!==n;){for(;rd(n);)n=e.input.charCodeAt(++e.position);if(t&&35===n)for(;10!==(n=e.input.charCodeAt(++e.position))&&13!==n&&0!==n;);if(!id(n))break;for(gd(e),n=e.input.charCodeAt(e.position),r++,e.lineIndent=0;32===n;)e.lineIndent++,n=e.input.charCodeAt(++e.position)}return-1!==i&&0!==r&&e.lineIndent<i&&dd(e,"deficient indentation"),r}function xd(e){var t,i=e.position;return!(45!==(t=e.input.charCodeAt(i))&&46!==t||t!==e.input.charCodeAt(i+1)||t!==e.input.charCodeAt(i+2)||(i+=3,0!==(t=e.input.charCodeAt(i))&&!nd(t)))}function bd(e,t){1===t?e.result+=" ":1<t&&(e.result+=af.repeat("\n",t-1))}function Ad(e,t){var i,r,n=e.tag,o=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),r=e.input.charCodeAt(e.position);0!==r&&45===r&&nd(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,yd(e,!0,-1)&&e.lineIndent<=t)a.push(null),r=e.input.charCodeAt(e.position);else if(i=e.line,kd(e,t,Yf,!1,!0),a.push(e.result),yd(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===i||e.lineIndent>t)&&0!==r)fd(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!s&&(e.tag=n,e.anchor=o,e.kind="sequence",e.result=a,!0)}function Td(e){var t,i,r,n,o=!1,a=!1;if(33!==(n=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&fd(e,"duplication of a tag property"),60===(n=e.input.charCodeAt(++e.position))?(o=!0,n=e.input.charCodeAt(++e.position)):33===n?(a=!0,i="!!",n=e.input.charCodeAt(++e.position)):i="!",t=e.position,o){for(;0!==(n=e.input.charCodeAt(++e.position))&&62!==n;);e.position<e.length?(r=e.input.slice(t,e.position),n=e.input.charCodeAt(++e.position)):fd(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==n&&!nd(n);)33===n&&(a?fd(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),ed.test(i)||fd(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),n=e.input.charCodeAt(++e.position);r=e.input.slice(t,e.position),Qf.test(r)&&fd(e,"tag suffix cannot contain flow indicator characters")}return r&&!td.test(r)&&fd(e,"tag name cannot contain such characters: "+r),o?e.tag=r:Vf.call(e.tagMap,i)?e.tag=e.tagMap[i]+r:"!"===i?e.tag="!"+r:"!!"===i?e.tag="tag:yaml.org,2002:"+r:fd(e,'undeclared tag handle "'+i+'"'),!0}function wd(e){var t,i;if(38!==(i=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&fd(e,"duplication of an anchor property"),i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!nd(i)&&!od(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&fd(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function kd(e,t,i,r,n){var o,a,s,l,u,c,h,f,d=1,_=!1,p=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=s=Wf===i||Yf===i,r&&yd(e,!0,-1)&&(_=!0,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)),1===d)for(;Td(e)||wd(e);)yd(e,!0,-1)?(_=!0,s=o,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)):s=!1;if(s&&(s=_||n),1!==d&&Wf!==i||(h=qf===i||Hf===i?t:t+1,f=e.position-e.lineStart,1===d?s&&(Ad(e,f)||function(e,t,i){var r,n,o,a,s=e.tag,l=e.anchor,u={},c={},h=null,f=null,d=null,_=!1,p=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=u),a=e.input.charCodeAt(e.position);0!==a;){if(r=e.input.charCodeAt(e.position+1),o=e.line,63!==a&&58!==a||!nd(r)){if(!kd(e,i,Hf,!1,!0))break;if(e.line===o){for(a=e.input.charCodeAt(e.position);rd(a);)a=e.input.charCodeAt(++e.position);if(58===a)nd(a=e.input.charCodeAt(++e.position))||fd(e,"a whitespace character is expected after the key-value separator within a block mapping"),_&&(md(e,u,c,h,f,null),h=f=d=null),n=_=!(p=!0),h=e.tag,f=e.result;else{if(!p)return e.tag=s,e.anchor=l,!0;fd(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!p)return e.tag=s,e.anchor=l,!0;fd(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===a?(_&&(md(e,u,c,h,f,null),h=f=d=null),n=_=p=!0):_?n=!(_=!1):fd(e,"incomplete explicit mapping pair; a key node is missed"),e.position+=1,a=r;if((e.line===o||e.lineIndent>t)&&(kd(e,t,Wf,!0,n)&&(_?f=e.result:d=e.result),_||(md(e,u,c,h,f,d),h=f=d=null),yd(e,!0,-1),a=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==a)fd(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return _&&md(e,u,c,h,f,null),p&&(e.tag=s,e.anchor=l,e.kind="mapping",e.result=u),p}(e,f,h))||function(e,t){var i,r,n,o,a,s,l,u,c,h,f=!0,d=e.tag,_=e.anchor,p={};if(91===(h=e.input.charCodeAt(e.position)))s=!(n=93),r=[];else{if(123!==h)return!1;n=125,s=!0,r={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=r),h=e.input.charCodeAt(++e.position);0!==h;){if(yd(e,!0,t),(h=e.input.charCodeAt(e.position))===n)return e.position++,e.tag=d,e.anchor=_,e.kind=s?"mapping":"sequence",e.result=r,!0;f||fd(e,"missed comma between flow collection entries"),c=null,o=a=!1,63===h&&nd(e.input.charCodeAt(e.position+1))&&(o=a=!0,e.position++,yd(e,!0,t)),i=e.line,kd(e,t,qf,!1,!0),u=e.tag,l=e.result,yd(e,!0,t),h=e.input.charCodeAt(e.position),!a&&e.line!==i||58!==h||(o=!0,h=e.input.charCodeAt(++e.position),yd(e,!0,t),kd(e,t,qf,!1,!0),c=e.result),s?md(e,r,p,u,l,c):o?r.push(md(e,null,p,u,l,c)):r.push(l),yd(e,!0,t),44===(h=e.input.charCodeAt(e.position))?(f=!0,h=e.input.charCodeAt(++e.position)):f=!1}fd(e,"unexpected end of the stream within a flow collection")}(e,h)?p=!0:(a&&function(e,t){var i,r,n,o,a,s=Xf,l=!1,u=t,c=0,h=!1;if(124===(o=e.input.charCodeAt(e.position)))r=!1;else{if(62!==o)return!1;r=!0}for(e.kind="scalar",e.result="";0!==o;)if(43===(o=e.input.charCodeAt(++e.position))||45===o)Xf===s?s=43===o?Kf:Zf:fd(e,"repeat of a chomping mode identifier");else{if(!(0<=(n=48<=(a=o)&&a<=57?a-48:-1)))break;0==n?fd(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?fd(e,"repeat of an indentation width identifier"):(u=t+n-1,l=!0)}if(rd(o)){for(;rd(o=e.input.charCodeAt(++e.position)););if(35===o)for(;!id(o=e.input.charCodeAt(++e.position))&&0!==o;);}for(;0!==o;){for(gd(e),e.lineIndent=0,o=e.input.charCodeAt(e.position);(!l||e.lineIndent<u)&&32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position);if(!l&&e.lineIndent>u&&(u=e.lineIndent),id(o))c++;else{if(e.lineIndent<u){s===Kf?e.result+=af.repeat("\n",c):s===Xf&&l&&(e.result+="\n");break}for(r?rd(o)?(h=!0,e.result+=af.repeat("\n",c+1)):h?(h=!1,e.result+=af.repeat("\n",c+1)):0===c?l&&(e.result+=" "):e.result+=af.repeat("\n",c):e.result+=l?af.repeat("\n",c+1):af.repeat("\n",c),l=!0,c=0,i=e.position;!id(o)&&0!==o;)o=e.input.charCodeAt(++e.position);pd(e,i,e.position,!1)}}return!0}(e,h)||function(e,t){var i,r,n;if(39!==(i=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;0!==(i=e.input.charCodeAt(e.position));)if(39===i){if(pd(e,r,e.position,!0),39!==(i=e.input.charCodeAt(++e.position)))return!0;r=n=e.position,e.position++}else id(i)?(pd(e,r,n,!0),bd(e,yd(e,!1,t)),r=n=e.position):e.position===e.lineStart&&xd(e)?fd(e,"unexpected end of the document within a single quoted scalar"):(e.position++,n=e.position);fd(e,"unexpected end of the stream within a single quoted scalar")}(e,h)||function(e,t){var i,r,n,o,a,s,l,u,c,h;if(34!==(s=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(s=e.input.charCodeAt(e.position));){if(34===s)return pd(e,i,e.position,!0),e.position++,!0;if(92===s){if(pd(e,i,e.position,!0),id(s=e.input.charCodeAt(++e.position)))yd(e,!1,t);else if(s<256&&sd[s])e.result+=ld[s],e.position++;else if(0<(a=120===(h=s)?2:117===h?4:85===h?8:0)){for(n=a,o=0;0<n;n--)s=e.input.charCodeAt(++e.position),c=void 0,0<=(a=48<=(u=s)&&u<=57?u-48:97<=(c=32|u)&&c<=102?c-97+10:-1)?o=(o<<4)+a:fd(e,"expected hexadecimal character");e.result+=(l=o)<=65535?String.fromCharCode(l):String.fromCharCode(55296+(l-65536>>10),56320+(l-65536&1023)),e.position++}else fd(e,"unknown escape sequence");i=r=e.position}else id(s)?(pd(e,i,r,!0),bd(e,yd(e,!1,t)),i=r=e.position):e.position===e.lineStart&&xd(e)?fd(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}fd(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?p=!0:!function(e){var t,i,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!nd(r)&&!od(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&fd(e,"name of an alias node must contain at least one character"),i=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(i)||fd(e,'unidentified alias "'+i+'"'),e.result=e.anchorMap[i],yd(e,!0,-1),!0}(e)?function(e,t,i){var r,n,o,a,s,l,u,c,h=e.kind,f=e.result;if(nd(c=e.input.charCodeAt(e.position))||od(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(nd(r=e.input.charCodeAt(e.position+1))||i&&od(r)))return!1;for(e.kind="scalar",e.result="",n=o=e.position,a=!1;0!==c;){if(58===c){if(nd(r=e.input.charCodeAt(e.position+1))||i&&od(r))break}else if(35===c){if(nd(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&xd(e)||i&&od(c))break;if(id(c)){if(s=e.line,l=e.lineStart,u=e.lineIndent,yd(e,!1,-1),e.lineIndent>=t){a=!0,c=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=l,e.lineIndent=u;break}}a&&(pd(e,n,o,!1),bd(e,e.line-s),n=o=e.position,a=!1),rd(c)||(o=e.position+1),c=e.input.charCodeAt(++e.position)}return pd(e,n,o,!1),!!e.result||(e.kind=h,e.result=f,!1)}(e,h,qf===i)&&(p=!0,null===e.tag&&(e.tag="?")):(p=!0,null===e.tag&&null===e.anchor||fd(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===d&&(p=s&&Ad(e,f))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(l=0,u=e.implicitTypes.length;l<u;l+=1)if((c=e.implicitTypes[l]).resolve(e.result)){e.result=c.construct(e.result),e.tag=c.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else Vf.call(e.typeMap,e.tag)?(c=e.typeMap[e.tag],null!==e.result&&c.kind!==e.kind&&fd(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+c.kind+'", not "'+e.kind+'"'),c.resolve(e.result)?(e.result=c.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):fd(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):fd(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||p}function Ed(e){var t,i,r,n,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(n=e.input.charCodeAt(e.position))&&(yd(e,!0,-1),n=e.input.charCodeAt(e.position),!(0<e.lineIndent||37!==n));){for(a=!0,n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!nd(n);)n=e.input.charCodeAt(++e.position);for(r=[],(i=e.input.slice(t,e.position)).length<1&&fd(e,"directive name must not be less than one character in length");0!==n;){for(;rd(n);)n=e.input.charCodeAt(++e.position);if(35===n){for(;0!==(n=e.input.charCodeAt(++e.position))&&!id(n););break}if(id(n))break;for(t=e.position;0!==n&&!nd(n);)n=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==n&&gd(e),Vf.call(_d,i)?_d[i](e,i,r):dd(e,'unknown document directive "'+i+'"')}yd(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,yd(e,!0,-1)):a&&fd(e,"directives end mark is expected"),kd(e,e.lineIndent-1,Wf,!1,!0),yd(e,!0,-1),e.checkLineBreaks&&$f.test(e.input.slice(o,e.position))&&dd(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&xd(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,yd(e,!0,-1)):e.position<e.length-1&&fd(e,"end of the stream or a document separator is expected")}function Md(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var i=new cd(e,t);for(i.input+="\0";32===i.input.charCodeAt(i.position);)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)Ed(i);return i.documents}function Rd(e,t,i){var r,n,o=Md(e,i);for(r=0,n=o.length;r<n;r+=1)t(o[r])}function Sd(e,t){var i=Md(e,t);if(0!==i.length){if(1===i.length)return i[0];throw new lf("expected a single document in the stream, but found more")}}var Pd={loadAll:Rd,load:Sd,safeLoadAll:function(e,t,i){Rd(e,t,af.extend({schema:Ff},i))},safeLoad:function(e,t){return Sd(e,af.extend({schema:Ff},t))}},zd=Object.prototype.toString,Nd=Object.prototype.hasOwnProperty,Od=9,Id=10,Ld=13,Cd=32,Fd=33,Dd=34,jd=35,Ud=37,Gd=38,Bd=39,Vd=42,qd=44,Hd=45,Yd=58,Wd=62,Xd=63,Zd=64,Kd=91,Jd=93,$d=96,Qd=123,e_=124,t_=125,i_={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},r_=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function n_(e){this.schema=e.schema||Bf,this.indent=Math.max(1,e.indent||2),this.skipInvalid=e.skipInvalid||!1,this.flowLevel=af.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var i,r,n,o,a,s,l;if(null===t)return{};for(i={},n=0,o=(r=Object.keys(t)).length;n<o;n+=1)a=r[n],s=String(t[a]),"!!"===a.slice(0,2)&&(a="tag:yaml.org,2002:"+a.slice(2)),(l=e.compiledTypeMap[a])&&Nd.call(l.styleAliases,s)&&(s=l.styleAliases[s]),i[a]=s;return i}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function o_(e,t){for(var i,r=af.repeat(" ",t),n=0,o=-1,a="",s=e.length;n<s;)n=-1===(o=e.indexOf("\n",n))?(i=e.slice(n),s):(i=e.slice(n,o+1),o+1),i.length&&"\n"!==i&&(a+=r),a+=i;return a}function a_(e,t){return"\n"+af.repeat(" ",e.indent*t)}function s_(e){this.source=e,this.result="",this.checkpoint=0}function l_(e,t,i,r){var n,o,a,s,l,u,c,h,f,d,_,p,v,m,g,y,x,b,A,T;if(0!==t.length)if(-1===r_.indexOf(t)){for(n=!0,o=t.length?t.charCodeAt(0):0,a=Cd===o||Cd===t.charCodeAt(t.length-1),Hd!==o&&Xd!==o&&Zd!==o&&$d!==o||(n=!1),l=s=a||-1<e.flowLevel&&e.flowLevel<=i?(a&&(n=!1),!1):!r,u=!0,c=new s_(t),h=!1,d=f=0,_=e.indent*i,-1===(p=e.lineWidth)&&(p=9007199254740991),_<40?p-=_:p=40,m=0;m<t.length;m++){if(v=t.charCodeAt(m),n){if(Od!==(w=v)&&Id!==w&&Ld!==w&&qd!==w&&Kd!==w&&Jd!==w&&Qd!==w&&t_!==w&&jd!==w&&Gd!==w&&Vd!==w&&Fd!==w&&e_!==w&&Wd!==w&&Bd!==w&&Dd!==w&&Ud!==w&&Yd!==w&&!i_[w]&&!c_(w))continue;n=!1}u&&v===Bd&&(u=!1),g=i_[v],y=c_(v),(g||y)&&(v!==Id&&v!==Dd&&v!==Bd?l=s=!1:v===Id&&(u=!(h=!0),0<m&&t.charCodeAt(m-1)===Cd&&(s=l=!1),s&&(x=m-f,f=m,d<x&&(d=x))),v!==Dd&&(u=!1),c.takeUpTo(m),c.escapeChar())}var w;if(n&&function(e,t){var i,r;for(i=0,r=e.implicitTypes.length;i<r;i+=1)if(e.implicitTypes[i].resolve(t))return!0;return!1}(e,t)&&(n=!1),b="",(s||l)&&(A=0,t.charCodeAt(t.length-1)===Id&&(A+=1,t.charCodeAt(t.length-2)===Id&&(A+=1)),0===A?b="-":2===A&&(b="+")),(l&&d<p||null!==e.tag)&&(s=!1),h||(l=!1),n)e.dump=t;else if(u)e.dump="'"+t+"'";else if(s)T=function(e,t){var i,r="",n=0,o=e.length,a=/\n+$/.exec(e);a&&(o=a.index+1);for(;n<o;)i=e.indexOf("\n",n),n=o<i||-1===i?(r&&(r+="\n\n"),r+=u_(e.slice(n,o),t),o):(r&&(r+="\n\n"),r+=u_(e.slice(n,i),t),i+1);a&&"\n"!==a[0]&&(r+=a[0]);return r}(t,p),e.dump=">"+b+"\n"+o_(T,_);else if(l)b||(t=t.replace(/\n$/,"")),e.dump="|"+b+"\n"+o_(t,_);else{if(!c)throw new Error("Failed to dump scalar value");c.finish(),e.dump='"'+c.result+'"'}}else e.dump="'"+t+"'";else e.dump="''"}function u_(e,t){if(""===e)return e;for(var i,r,n=/[^\s] [^\s]/g,o="",a=0,s=0,l=n.exec(e);l;)t<(i=l.index)-s&&(r=a!==s?a:i,o&&(o+="\n"),o+=e.slice(s,r),s=r+1),a=i+1,l=n.exec(e);return o&&(o+="\n"),s!==a&&e.length-s>t?o+=e.slice(s,a)+"\n"+e.slice(a+1):o+=e.slice(s),o}function c_(e){return!(32<=e&&e<=126||133===e||160<=e&&e<=55295||57344<=e&&e<=65533||65536<=e&&e<=1114111)}function h_(e,t,i){var r,n,o,a,s,l;for(o=0,a=(n=i?e.explicitTypes:e.implicitTypes).length;o<a;o+=1)if(((s=n[o]).instanceOf||s.predicate)&&(!s.instanceOf||"object"==typeof t&&t instanceof s.instanceOf)&&(!s.predicate||s.predicate(t))){if(e.tag=i?s.tag:"?",s.represent){if(l=e.styleMap[s.tag]||s.defaultStyle,"[object Function]"===zd.call(s.represent))r=s.represent(t,l);else{if(!Nd.call(s.represent,l))throw new lf("!<"+s.tag+'> tag resolver accepts not "'+l+'" style');r=s.represent[l](t,l)}e.dump=r}return!0}return!1}function f_(e,t,i,r,n,o){e.tag=null,e.dump=i,h_(e,i,!1)||h_(e,i,!0);var a=zd.call(e.dump);r&&(r=e.flowLevel<0||e.flowLevel>t);var s,l,u="[object Object]"===a||"[object Array]"===a;if(u&&(l=-1!==(s=e.duplicates.indexOf(i))),(null!==e.tag&&"?"!==e.tag||l||2!==e.indent&&0<t)&&(n=!1),l&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(u&&l&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),"[object Object]"===a)r&&0!==Object.keys(e.dump).length?(function(e,t,i,r){var n,o,a,s,l,u,c="",h=e.tag,f=Object.keys(i);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new lf("sortKeys must be a boolean or a function");for(n=0,o=f.length;n<o;n+=1)u="",r&&0===n||(u+=a_(e,t)),s=i[a=f[n]],f_(e,t+1,a,!0,!0,!0)&&((l=null!==e.tag&&"?"!==e.tag||e.dump&&1024<e.dump.length)&&(e.dump&&Id===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,l&&(u+=a_(e,t)),f_(e,t+1,s,!0,l)&&(e.dump&&Id===e.dump.charCodeAt(0)?u+=":":u+=": ",c+=u+=e.dump));e.tag=h,e.dump=c||"{}"}(e,t,e.dump,n),l&&(e.dump="&ref_"+s+e.dump)):(function(e,t,i){var r,n,o,a,s,l="",u=e.tag,c=Object.keys(i);for(r=0,n=c.length;r<n;r+=1)s="",0!==r&&(s+=", "),a=i[o=c[r]],f_(e,t,o,!1,!1)&&(1024<e.dump.length&&(s+="? "),s+=e.dump+": ",f_(e,t,a,!1,!1)&&(l+=s+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),l&&(e.dump="&ref_"+s+" "+e.dump));else if("[object Array]"===a)r&&0!==e.dump.length?(function(e,t,i,r){var n,o,a="",s=e.tag;for(n=0,o=i.length;n<o;n+=1)f_(e,t+1,i[n],!0,!0)&&(r&&0===n||(a+=a_(e,t)),a+="- "+e.dump);e.tag=s,e.dump=a||"[]"}(e,t,e.dump,n),l&&(e.dump="&ref_"+s+e.dump)):(function(e,t,i){var r,n,o="",a=e.tag;for(r=0,n=i.length;r<n;r+=1)f_(e,t,i[r],!1,!1)&&(0!==r&&(o+=", "),o+=e.dump);e.tag=a,e.dump="["+o+"]"}(e,t,e.dump),l&&(e.dump="&ref_"+s+" "+e.dump));else{if("[object String]"!==a){if(e.skipInvalid)return!1;throw new lf("unacceptable kind of an object to dump "+a)}"?"!==e.tag&&l_(e,e.dump,t,o)}null!==e.tag&&"?"!==e.tag&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function d_(e,t){var i,r,n=[],o=[];for(function e(t,i,r){var n,o,a;if(null!==t&&"object"==typeof t)if(-1!==(o=i.indexOf(t)))-1===r.indexOf(o)&&r.push(o);else if(i.push(t),Array.isArray(t))for(o=0,a=t.length;o<a;o+=1)e(t[o],i,r);else for(n=Object.keys(t),o=0,a=n.length;o<a;o+=1)e(t[n[o]],i,r)}(e,n,o),i=0,r=o.length;i<r;i+=1)t.duplicates.push(n[o[i]]);t.usedDuplicates=new Array(r)}function __(e,t){var i=new n_(t=t||{});return i.noRefs||d_(e,i),f_(i,0,e,!0,!0)?i.dump+"\n":""}s_.prototype.takeUpTo=function(e){var t;if(e<this.checkpoint)throw(t=new Error("position should be > checkpoint")).position=e,t.checkpoint=this.checkpoint,t;return this.result+=this.source.slice(this.checkpoint,e),this.checkpoint=e,this},s_.prototype.escapeChar=function(){var e,t;return e=this.source.charCodeAt(this.checkpoint),t=i_[e]||function(e){var t,i,r;if(t=e.toString(16).toUpperCase(),e<=255)i="x",r=2;else if(e<=65535)i="u",r=4;else{if(!(e<=4294967295))throw new lf("code point within a string may not be greater than 0xFFFFFFFF");i="U",r=8}return"\\"+i+af.repeat("0",r-t.length)+t}(e),this.result+=t,this.checkpoint+=1,this},s_.prototype.finish=function(){this.source.length>this.checkpoint&&this.takeUpTo(this.source.length)};var p_={dump:__,safeDump:function(e,t){return __(e,af.extend({schema:Ff},t))}};function v_(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}var m_={Type:df,Schema:vf,FAILSAFE_SCHEMA:mf,JSON_SCHEMA:Tf,CORE_SCHEMA:wf,DEFAULT_SAFE_SCHEMA:Ff,DEFAULT_FULL_SCHEMA:Bf,load:Pd.load,loadAll:Pd.loadAll,safeLoad:Pd.safeLoad,safeLoadAll:Pd.safeLoadAll,dump:p_.dump,safeDump:p_.safeDump,YAMLException:lf,MINIMAL_SCHEMA:mf,SAFE_SCHEMA:Ff,DEFAULT_SCHEMA:Bf,scan:v_("scan"),parse:v_("parse"),compose:v_("compose"),addConstructor:v_("addConstructor")},g_=function(){function r(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;mr(this,r),this.url=e,!t||hn(t)&&!hn(this.url)?this.path=cn(this.url):this.path=t,this.path_for_parent=t||this.path,this.parent=i,this.container=null,this.parent&&(this.parent.container?this.container=this.parent.container:this.parent.isContainer()&&(this.container=this.parent))}return yr(r,[{key:"load",value:function(){return function(e){return new Promise(function(i,r){"string"==typeof e?on.io(e).then(function(e){try{var t=function(e){var t;try{t=m_.safeLoad(e,{json:!0})}catch(e){throw e}return t}(e);i(t)}catch(e){r(e)}},r):(e=Object.assign({},e),i(e))})}(this.url)}},{key:"resourceFor",value:function(e){return{url:this.urlFor(e),path:this.pathFor(e),type:this.typeFor(e)}}},{key:"urlFor",value:function(e){return y_(e)?e:hn(e)&&this.container?this.parent.urlFor(this.path_for_parent+e):function(e,t){if(!e||!hn(e))return e;var i,r="/"!==e[0];if(t?(i=document.createElement("a")).href=t:i=window.location,r){e=cn(i.href)+e}else{var n=i.origin;n||(n=i.protocol+"//"+i.host),e=n+e}return e}(e,this.path)}},{key:"pathFor",value:function(e){return cn(e)}},{key:"typeFor",value:function(e){return function(e){var t=(e=e.split("/").pop()).lastIndexOf(".");if(-1<t)return e.substring(t+1)}(e)}},{key:"isContainer",value:function(){return!1}}]),r}();function y_(e){return!(!e||"global."!==e.slice(0,7))}function x_(e){return null!=e}function b_(e){return"("+e+")"}function A_(e){return"$"===e[0]?"context['"+e.substring(1)+"']":"context.feature.properties['"+e+"']"}function T_(e,t){return b_(function(e){return"string"==typeof e?'"'+e+'"':e}(t)+" === "+A_(e))}function w_(t,e){return b_(e.map(function(e){return T_(t,e)}).join(" || "))}function k_(e,t){return b_(e.filter(x_).map(function(e){return b_(e.join(" && "))}).join(" "+t+" "))}function E_(e,t,i){return t&&0<t.length?k_(t.map(function(e){return S_(e,i)}),"||"):"true"}function M_(e,t,i){return t&&0<t.length?k_(t.map(function(e){return S_(e,i)}),"&&"):"true"}function R_(e,t,i){var r=[],n=i&&"function"==typeof i.rangeTransform&&i.rangeTransform;if(t.max){var o=n?n(t.max):t.max;r.push(A_(e)+" < "+o)}if(t.min){var a=n?a=n(t.min):t.min;r.push(A_(e)+" >= "+a)}return b_(r.join(" && "))}function S_(e,t){var i=[];if("function"==typeof e)return[b_(e.toString()+"(context)")];if(Array.isArray(e))return[E_(0,e,t)];if(null==e)return["true"];for(var r,n=Object.keys(e),o=0;o<n.length;o++){var a=n[o],s=e[a],l=vr(s);if("string"===l||"number"===l)i.push(T_(a,s));else if("boolean"===l)i.push((r=s,b_(A_(a)+(r?" != ":" == ")+"null")));else if("not"===a)i.push("!"+b_(S_(s,t).join(" && ")));else if("any"===a)i.push(E_(0,s,t));else if("all"===a)i.push(M_(0,s,t));else if("none"===a)i.push("!"+b_(E_(0,s,t)));else if(Array.isArray(s))i.push(w_(a,s));else if("object"===l&&null!=s)(s.max||s.min)&&i.push(R_(a,s,t));else{if(null!=s)throw new Error("Unknown Query syntax: "+s);i.push(" true ")}}return 0===n.length?["true"]:i}function P_(e,t){return null==e?function(){return!0}:new Function("context","return "+function(e){return b_(e.join(" && "))}(S_(e,t))+";")}var z_=["filter","draw","visible","enabled","data"],N_={};function O_(e,i){for(var r,t=0,n=0;n<e.length;n++)e[n].length>t&&(t=e[n].length);if(0===t)return null;for(var o={visible:!0},a=function(t){if(r=[],e.forEach(function(e){e[t]&&e[t][i]&&-1===r.indexOf(e[t][i])&&r.push(e[t][i])}),0===r.length)return"continue";r.sort(function(e,t){return(e&&e.layer_name)>(t&&t.layer_name)?1:-1}),fl.apply(void 0,[o].concat(Pr(r))),delete o.layer_name},s=0;s<t;s++)a(s);return!1===o.visible?null:o}var I_=["any","all","not","none"],L_=function(){function h(e){var t=e.layer,i=e.name,r=e.parent,n=e.draw,o=e.visible,a=e.enabled,s=e.filter,l=e.styles;if(mr(this,h),this.id=h.id++,this.config_data=t.data,this.parent=r,this.name=i,this.full_name=this.parent?this.parent.full_name+":"+this.name:this.name,this.draw=n,this.filter=s,this.styles=l,this.is_built=!1,a=void 0===a?o:a,this.parent&&!1===this.parent.visible?this.enabled=!1:this.enabled=!1!==a,this.draw)for(var u in this.draw)if(this.draw[u]=null==this.draw[u]?{}:this.draw[u],"object"!==vr(this.draw[u])){var c="Draw group '".concat(u,"' for layer ").concat(this.full_name," is invalid, must be an object, ");Kr("warn",c+="but was set to `".concat(u,": ").concat(this.draw[u],"` instead")),delete this.draw[u]}else this.draw[u].layer_name=this.full_name}return yr(h,[{key:"build",value:function(){Kr("trace","Building layer '".concat(this.full_name,"'")),this.buildFilter(),this.buildDraw(),this.is_built=!0}},{key:"buildDraw",value:function(){this.draw=on.stringsToFunctions(this.draw,jo.wrapFunction),this.calculatedDraw=function(e){var t=[];if(e.parent){var i=e.parent.calculatedDraw||[];t.push.apply(t,Pr(i))}return t.push(e.draw),t}(this)}},{key:"buildFilter",value:function(){this.filter_original=this.filter,this.filter=on.stringsToFunctions(this.filter,jo.wrapFunction);var e=vr(this.filter);if(null==this.filter||"object"===e||"function"===e)try{this.buildZooms(),this.buildPropMatches(),null!=this.filter&&("function"==typeof this.filter||0<Object.keys(this.filter).length)?this.filter=P_(this.filter,j_):this.filter=null}catch(e){var t="Filter for layer ".concat(this.full_name," is invalid, `filter: ").concat(JSON.stringify(this.filter),"` ");Kr("warn",t+="failed with error '".concat(e.message,"', stack trace: ").concat(e.stack))}else{var i="Filter for layer ".concat(this.full_name," is invalid, filter value must be an object or function, ");Kr("warn",i+="but was set to `filter: ".concat(this.filter,"` instead"))}}},{key:"buildZooms",value:function(){var e=this.filter&&this.filter.$zoom,t=vr(e);if(null!=e&&"function"!==t){if(this.zooms={},"number"===t)this.zooms[e]=!0;else if(Array.isArray(e))for(var i=0;i<e.length;i++)this.zooms[e[i]]=!0;else if("object"===t&&(null!=e.min||null!=e.max))for(var r=e.min||0,n=e.max||25,o=r;o<n;o++)this.zooms[o]=!0;delete this.filter.$zoom}}},{key:"buildPropMatches",value:function(){var n=this;this.filter&&!Array.isArray(this.filter)&&"function"!=typeof this.filter&&Object.keys(this.filter).forEach(function(e){if(-1===I_.indexOf(e)){var t=n.filter[e],i=vr(t),r=Array.isArray(t);if(!r&&"string"!==i&&"number"!==i)return;"$"===e[0]?(n.context_prop_matches=n.context_prop_matches||[],n.context_prop_matches.push([e.substring(1),r?t:[t]])):(n.feature_prop_matches=n.feature_prop_matches||[],n.feature_prop_matches.push([e,r?t:[t]])),delete n.filter[e]}})}},{key:"doPropMatches",value:function(e){if(this.feature_prop_matches)for(var t=0;t<this.feature_prop_matches.length;t++){var i=this.feature_prop_matches[t],r=e.feature.properties[i[0]];if(null==r||-1===i[1].indexOf(r))return!1}if(this.context_prop_matches)for(var n=0;n<this.context_prop_matches.length;n++){var o=this.context_prop_matches[n],a=e[o[0]];if(null==a||-1===o[1].indexOf(a))return!1}return!0}},{key:"doesMatch",value:function(t){if(!this.enabled)return!1;if(this.is_built||this.build(),null!=this.zooms&&!this.zooms[t.zoom])return!1;if(!this.doPropMatches(t))return!1;var e;if(this.filter instanceof Function)try{e=this.filter(t)}catch(e){var i="Filter for this ".concat(this.full_name,": `filter: ").concat(this.filter_original,"` ");Kr("error",i+="failed with error '".concat(e.message,"', stack trace: ").concat(e.stack),t.feature)}else e=null==this.filter;return!!e&&(this.children_to_parse&&(function(e,t,i){for(var r in t){var n=t[r];if("object"!==vr(n)||Array.isArray(n)){var o="Layer value must be an object: cannot create layer '".concat(r,": ").concat(JSON.stringify(n),"'");o+=", under parent layer '".concat(e.full_name,"'."),i[e.name]&&(o+=" The parent name '".concat(e.name,"' is also the name of a style, did you mean to create a 'draw' group"),e.parent&&(o+=" under '".concat(e.parent.name,"'")),o+=" instead?"),Kr("warn",o)}else G_(r,n,e,i)}}(this,this.children_to_parse,this.styles),delete this.children_to_parse),!0)}}]),h}();L_.id=0;var C_,F_=function(){function i(e){var t;return mr(this,i),(t=Mr(this,Ar(i).call(this,e))).is_leaf=!0,t}return br(i,L_),i}(),D_=function(){function i(e){var t;return mr(this,i),(t=Mr(this,Ar(i).call(this,e))).is_tree=!0,t.layers=e.layers||[],t}return br(i,L_),yr(i,[{key:"addLayer",value:function(e){this.layers.push(e)}},{key:"buildDrawGroups",value:function(e){var t=[],i=[];if(function e(t,i,r,n){var o=!1;if(0===i.length)return;for(var a=0;a<i.length;a++){var s=i[a];s.is_leaf?s.doesMatch(t)&&(o=!0,r.push(s),n.push(s.id)):s.is_tree&&s.doesMatch(t)&&(o=!0,e(t,s.layers,r,n)||(r.push(s),n.push(s.id)))}return o}(e,[this],t,i),0<t.length){var r=function(e){if(1<e.length){for(var t=e[0],i=1;i<e.length;i++)t+="/"+e[i];return t}return e[0]}(i);if(void 0===N_[r]){for(var n=t.map(function(e){return e&&!1!==e.visible&&e.calculatedDraw}),o={},a=0;a<n.length;a++){var s=n[a];if(s)for(var l=0;l<s.length;l++){var u=s[l];for(var c in u)o[c]=!0}}for(var h in o)N_[r]=N_[r]||{},N_[r][h]=O_(n,h),N_[r][h]?(N_[r][h].key=r+"/"+h,N_[r][h].layers=t.map(function(e){return e&&e.full_name}),N_[r][h].group=h):delete N_[r][h];N_[r]&&0===Object.keys(N_[r]).length&&(N_[r]=null)}return N_[r]}}}]),i}(),j_={rangeTransform:function(e){return"string"==typeof e&&"px2"===e.trim().slice(-3)?"".concat(parseFloat(e)," * context.meters_per_pixel_sq"):e}};function U_(e){return-1<z_.indexOf(e)}function G_(e,t,i,r){var n={name:e,layer:t=null==t?{}:t,parent:i,styles:r},o=Sr(function(e){var t={},i={};for(var r in e)U_(r)?t[r]=e[r]:i[r]=e[r];return[t,i]}(t),2),a=o[0],s=o[1],l=function(e){return 0===Object.keys(e).length}(s),u=new(l&&null!=i?F_:D_)(Object.assign(n,a));return u.enabled&&(i&&i.addLayer(u),u.children_to_parse=l?null:s),u}var B_=/^global.(.+)$/,V_=C_={loadScene:function(e,t){var r=this,i=1<arguments.length&&void 0!==t?t:{},n=i.path,o=i.type,a=[];return this.loadSceneRecursive({url:e,path:n,type:o},null,a).then(function(e){return r.finalize(e)}).then(function(e){var t=e.config,i=e.bundle;return t?(0<a.length&&a.forEach(function(e){var t="Failed to import scene: ".concat(e.url);Kr("error",t,e),r.trigger("error",{type:"scene_import",message:t,error:e,url:e.url})}),{config:t,bundle:i}):Promise.reject(a[0])})},loadSceneRecursive:function(e,t,i){var r=this,n=e.url,o=e.path,a=(e.type,2<arguments.length&&void 0!==i?i:[]);if(!n)return Promise.resolve({});var s=function(e,t,i){return new g_(e,t,i)}(n,o,t);return s.load().then(function(i){if(null==i.import)return r.normalize(i,s),{config:i,bundle:s};Array.isArray(i.import)||(i.import=[i.import]);var t=[];return i.import.forEach(function(e){"object"===vr(e)&&(e=fn(new Blob([JSON.stringify(e)]))),t.push(s.resourceFor(e))}),delete i.import,Promise.all(t.map(function(e){return r.loadSceneRecursive(e,s,a)})).then(function(e){e.forEach(function(e){return r.normalize(e.config,e.bundle)});var t=e.map(function(e){return e.config});return i=fl.apply(void 0,Pr(t).concat([i])),r.normalize(i,s),{config:i,bundle:s}})}).catch(function(e){return e.url=n,a.push(e),{}})},normalize:function(e,t){return this.normalizeDataSources(e,t),this.normalizeFonts(e,t),this.normalizeTextures(e,t),this.hoistTextures(e,t),{config:e,bundle:t}},normalizeDataSources:function(e,t){for(var i in e.sources=e.sources||{},e.sources)this.normalizeDataSource(e.sources[i],t);return e},normalizeDataSource:function(e,t){if(e.url&&(e.url=t.urlFor(e.url)),e.scripts)for(var i in Array.isArray(e.scripts)&&(e.scripts=e.scripts.reduce(function(e,t){return e[t]=t,e},{})),e.scripts)e.scripts[i]=t.urlFor(e.scripts[i]);return e},normalizeFonts:function(e,t){for(var i in e.fonts=e.fonts||{},e.fonts)if(Array.isArray(e.fonts[i]))e.fonts[i].forEach(function(e){e.url=e.url&&t.urlFor(e.url)});else{var r=e.fonts[i];r.url=r.url&&t.urlFor(r.url)}return e},normalizeTextures:function(e,t){if(e.textures=e.textures||{},e.textures)for(var i in e.textures){var r=e.textures[i];r.url&&(r.url=t.urlFor(r.url))}},hoistTextures:function(r,n){var o=this;if(r.styles){var e=function(e){var i=r.styles[e],t=i.texture;"string"!=typeof t||r.textures[t]||(i.texture=o.hoistTexture(t,r,n)),i.material&&["emission","ambient","diffuse","specular","normal"].forEach(function(e){var t=null!=i.material[e]&&i.material[e].texture;"string"!=typeof t||r.textures[t]||(i.material[e].texture=o.hoistTexture(t,r,n))})};for(var t in r.styles)e(t)}if(this.hoistStyleShaderUniformTextures(r,n,{include_globals:!1}),r.layers)for(var i=[r.layers];0<i.length;){var a=i.pop();if("object"===vr(a)&&!Array.isArray(a))for(var s in a)if("draw"===s){var l=a[s];for(var u in l){if(l[u].texture){var c=l[u].texture;"string"!=typeof c||r.textures[c]||(l[u].texture=this.hoistTexture(c,r,n))}if(l[u].outline&&l[u].outline.texture){var h=l[u].outline.texture;"string"!=typeof h||r.textures[h]||(l[u].outline.texture=this.hoistTexture(h,r,n))}}}else{if(U_(s))continue;i.push(a[s])}}},hoistStyleShaderUniformTextures:function(o,a,e){var s=this,l=e.include_globals;if(o.styles)for(var t in o.styles){var i=o.styles[t];i.shaders&&i.shaders.uniforms&&Gl.parseUniforms(i.shaders.uniforms).forEach(function(e){var t=e.type,i=e.value,r=e.key,n=e.uniforms;"sampler2D"!==t||"string"!=typeof i||o.textures[i]||!l&&y_(i)||(n[r]=s.hoistTexture(i,o,a))})}},hoistTexture:function(e,t,i){var r=y_(e),n=r?e:i.urlFor(e),o=r?"texture-".concat(n):n;return t.textures[o]={url:n},o},applyGlobalProperties:function(e){if(!e.global||0===Object.keys(e.global).length)return e;var a=function e(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:".";var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};r=r?r+i:"";for(var o in t){var a=r+o,s=t[o];"object"!==vr(n[a]=s)||Array.isArray(s)||e(s,i,a,n)}return n}(e.global);return function e(t){if("string"==typeof t){var i=function e(t,i,r){var n=2<arguments.length&&void 0!==r?r:[];if(!(-1<n.indexOf(t))){n.push(t);var o=B_.exec(t),a=o&&o[1];return a&&void 0!==i[a]?"string"==typeof i[a]&&B_.exec(i[a])?e(i[a],i,n):a:void 0}Kr({level:"warn",once:!0},"Global properties: cyclical reference detected",n)}(t,a),r=a[i];void 0!==r&&(t=r)}else if(Array.isArray(t))for(var n=0;n<t.length;n++)t[n]=e(t[n],t,n);else if("object"===vr(t))for(var o in t)t[o]=e(t[o],t,o);return t}(e)},finalize:function(e){var t=e.config,i=e.bundle;return t?(t.global=t.global||{},t.scene=t.scene||{},t.cameras=t.cameras||{},t.lights=t.lights||{},t.styles=t.styles||{},t.layers=t.layers||{},t.camera&&(t.cameras.default=t.camera),0===Object.keys(t.cameras).length&&(t.cameras.default={}),0!==Object.keys(t.lights).length&&!Object.keys(t.lights).every(function(e){return!1===t.lights[e].visible})||(t.lights.default_light={type:"directional"}),{config:t,bundle:i}):{}}};Jo(C_);var q_=function(){function e(){mr(this,e),this.coords={},this.max_proxy_descendant_depth=6,this.max_proxy_ancestor_depth=10}return yr(e,[{key:"sourceTiles",value:function(e,t){return this.coords[e.key]&&this.coords[e.key].sources&&this.coords[e.key].sources[t.name]}},{key:"addTile",value:function(e){var t=e.coords.key,i=this.coords[t];i||(i=this.coords[t]={descendants:0}),i.sources||(i.sources={}),i.sources[e.source.name]||(i.sources[e.source.name]={});for(var r=(i.sources[e.source.name][e.style_zoom]=e).coords.z-1;0<=r;r--){var n=aa.coordinateAtZoom(e.coords,r);this.coords[n.key]||(this.coords[n.key]={descendants:0}),this.coords[n.key].descendants++}}},{key:"removeTile",value:function(e){var t=this.sourceTiles(e.coords,e.source),i=e.coords.key;t&&(delete t[e.style_zoom],0===Object.keys(t).length&&(delete this.coords[i].sources[e.source.name],0===Object.keys(this.coords[i].sources).length&&(delete this.coords[i].sources,0===this.coords[i].descendants&&delete this.coords[i])));for(var r=e.coords.z-1;0<=r;r--){var n=aa.coordinateAtZoom(e.coords,r);this.coords[n.key]&&0<this.coords[n.key].descendants&&(this.coords[n.key].descendants--,0!==this.coords[n.key].descendants||this.coords[n.key].sources||delete this.coords[n.key])}}},{key:"getAncestor",value:function(e,t){var i=e.coords,r=e.style_zoom,n=e.source,o=1<arguments.length&&void 0!==t?t:1;if(!(o>this.max_proxy_ancestor_depth)){if(r>n.max_coord_zoom){var a=this.sourceTiles(i,n);if(a)for(var s=r-1;s>=n.max_coord_zoom;s--)if(a[s]&&a[s].loaded)return a[s];r=n.max_coord_zoom}r--;var l=aa.coordinateAtZoom(i,i.z-1),u=this.sourceTiles(l,n);return u&&u[r]&&u[r].loaded?u[r]:0<l.z?this.getAncestor({coords:l,style_zoom:r,source:n},o+1):void 0}}},{key:"getDescendants",value:function(e,t){var i=e.coords,r=e.style_zoom,n=e.source,o=1<arguments.length&&void 0!==t?t:1,a=[];if(r>=n.max_coord_zoom){var s=this.sourceTiles(i,n);if(s)for(var l=Math.max(Jr.default_view_max_zoom,r+this.max_proxy_descendant_depth),u=r+1;u<=l;u++)if(s[u]&&s[u].loaded)return a.push(s[u]),a;return a}if(this.coords[i.key]&&0<this.coords[i.key].descendants){r++;for(var c=aa.childrenForCoordinate(i),h=0;h<c.length;h++){var f=c[h],d=this.sourceTiles(f,n);d&&d[r]&&d[r].loaded?a.push(d[r]):o<=this.max_proxy_descendant_depth&&f.z<=n.max_coord_zoom&&a.push.apply(a,Pr(this.getDescendants({coords:f,source:n,style_zoom:r},o+1)))}}return a}}]),e}(),H_=function(){function o(e,t,i,r){mr(this,o),Object.assign(this,e),this.placed=null,this._tile=r;var n=Jr.unitsPerMeter(r.coords.z)*Math.pow(2,i-r.style_zoom);this.layout=Object.assign({},e.layout),this.layout.repeat_scale=.75,this.layout.repeat_distance=this.layout.repeat_distance||0,this.layout.repeat_distance/=n,this.position=Jr.tileSpaceToMeters(this.position,r.coords.z,r.min),this._worldToScreen=t,this._screenSpaceBoundingBox=void 0,this._boundingCircles=void 0}return yr(o,[{key:"getTile",value:function(){return this._tile}},{key:"isFlat",value:function(){return this.is_flat}},{key:"getScreenSpaceBoundingBox",value:function(){if(!this._screenSpaceBoundingBox){var e=this._worldToScreen(this.position,!0);e[0]+=this.offset[0],e[1]+=this.offset[1];var t=this.size[0]/2+this.layout.buffer[0],i=this.size[1]/2+this.layout.buffer[1],r=e[0]-t,n=e[0]+t,o=e[1]-i,a=e[1]+i;this._screenSpaceBoundingBox={left:r,bottom:a,right:n,top:o}}return this._screenSpaceBoundingBox}},{key:"getBoundingCircles",value:function(){return this._boundingCircles||(this._boundingCircles="point"===this.type?this._convertSidesToScreenSpaceCircles():this._convertCirclesToScreenSpace()),this._boundingCircles}},{key:"_convertSidesToScreenSpaceCircles",value:function(){var e=this._tile.coords.z,t=this._tile.min,i=Jr.tileSpaceToMeters([this.sides[0],this.sides[1]],e,t),r=Jr.tileSpaceToMeters([this.sides[2],this.sides[3]],e,t),n=Sr(this._worldToScreen(i,!0),2),o=n[0],a=n[1],s=Sr(this._worldToScreen(r,!0),2);return jc(o,a,s[0],s[1],this.size[1]/2+this.layout.buffer[1])}},{key:"_convertCirclesToScreenSpace",value:function(){for(var e=[],t=this.circles,i=this._tile.coords.z,r=this._tile.min,n=0;n<t.length-2;n+=3){var o=Jr.tileSpaceToMeters([t[n],-t[n+1]],i,r),a=t[n+2]/Jr.unitsPerMeter(i),s=[o[0]+a,o[1]],l=this._worldToScreen(o,!0),u=this._worldToScreen(s,!0),c=ml.getLineLength(l[0],l[1],u[0],u[1]);e.push(l[0],l[1],c)}return e}}]),o}(),Y_=0,W_={mainThreadLabelCollisionPass:function(t,a,e,u,i){Z_=X_,X_={};var s={},l={},r=[],c=e.worldToScreen.bind(e),h=new $_;for(var n in t.forEach(function(o){for(var e in o.meshes)o.meshes[e].forEach(function(e){if(e.labels){for(var t in h.trackMesh(e),e.labels["non-collision"]){var i=J_(e.labels["non-collision"][t],e,c,a,o);i.label.text_data&&h.insertLabel(i,o)}for(var r in e.labels.collision)if(!s[r]){var n=J_(e.labels.collision[r],e,c,a,o);s[r]=n.label,l[r]=n}}})}),l){var o=l[n];o.linked&&(o.linked=l[o.linked]),r.push(o)}var f=e.getViewport(),d=f.width,_=f.height;return Zo.startTile("main",{apply_repeat_groups:!0,return_hidden:!0,grid_index:new Yo(d,_,30)}),Zo.addStyle("main","main"),Zo.collide(r,"main","main").then(function(e){return e.forEach(function(e){var i=e.mesh,t=e.label.getTile();if(t.visible&&i.valid){var r=0;!0!==e.show||u&&e.label.breach&&!Z_[e.label.id]||(r=1),r&&(X_[e.label.id]=!0),e.label.text_data&&h.insertLabel(e,t);var n=i.vertex_layout.offset.a_shape,o=i.vertex_layout.stride,a=i.vertex_layout.attribs.find(function(e){return"a_shape"===e.name}),s=a.byte_size/a.size;n+=3*s;var l=!0;e.ranges.forEach(function(e){if(l){for(var t=0;t<e[1];t++){if(i.vertex_data[e[0]+t*o+n]===r)return void(l=!1);i.vertex_data[e[0]+t*o+n]=r}h.trackMesh(i)}})}}),h.createTextures(i).then(function(){return h.updateMeshes(e)})}).then(function(e){e.forEach(function(e){return e.valid&&e.upload()}),t.forEach(function(e){e.labeled=!0}),r=[],l={},s={}})}},X_={},Z_={},K_=120===new Uint8Array(new Uint32Array([305419896]).buffer)[0];function J_(e,t,i,r,n){var o=e.container,a=o.label,s=o.linked,l=e.ranges;return{label:new H_(a,i,r,n),linked:s,ranges:l,mesh:t}}var $_=function(){function e(){mr(this,e),this.tiles={},this.meshes=[],this.containers=[]}return yr(e,[{key:"insertLabel",value:function(e,t){var i=e.label.text_data,r=i.text_settings_key,n=i.text,o=i.text_info;this.containers.push(e),this._ensureTextSection(t,r)[n]=o}},{key:"trackMesh",value:function(e){-1===this.meshes.indexOf(e)&&this.meshes.push(e)}},{key:"updateMeshes",value:function(){var c=this;return this.containers.forEach(function(e){if(e.label.text_data){var t=e.label.getTile(),i=e.mesh;if(t.visible&&i.valid){var r=e.label.type,n=e.label.text_data.text_info;if(c.tiles[t.id]&&c.tiles[t.id].textures){var o=c.tiles[t.id].textures[0];if(i.uniforms.u_texture=o,-1===i.textures.indexOf(o)&&i.textures.push(o),"point"===r||"straight"===r){var a="point"===r?n.align[e.label.align].texcoords:n.texcoords[r].texcoord;c.setTexCoords(i,e,a)}else if("curved"===r){var s=n.segments.length,l=n.texcoords_stroke,u=n.texcoords.curved;c.setTexCoords(i,e,function(e){return e<s?l[e]:u[e-s].texcoord})}}}}}),this.meshes}},{key:"setTexCoords",value:function(e,t,_){var p,v=_ instanceof Function;if(!v){var i=Sr(_,4),r=i[0],n=i[1],o=i[2],a=i[3];p=[[r,n],[o,n],[o,a],[r,a]]}var m=e.vertex_layout.stride,g=new DataView(e.vertex_data.buffer),y=e.vertex_layout.offset.a_texcoord;t.ranges.forEach(function(e,t){var i=Sr(e,3),r=i[0],n=i[1],o=i[2];if(v){var a=Sr(_(t),4),s=a[0],l=a[1],u=a[2],c=a[3];p=[[s,l],[u,l],[u,c],[s,c]]}for(var h=o?n/2:0;h<n;h++){var f=p[h%4],d=r+h*m;g.setUint16(d+y,65535*f[0],K_),g.setUint16(d+y+2,65535*f[1],K_)}})}},{key:"createTextures",value:function(o){var a=this,e=Object.values(this.tiles).map(function(e){var i=e.id,t=e.key,r=e.texts,n=["labels",t,i,Y_++].join("-");return a._createTexturesForTile(o,r,n,i).then(function(e){var t=e.textures;a.tiles[i].textures=t})});return Promise.all(e)}},{key:"_createTexturesForTile",value:function(e,t,i,r){var n=new Kc,o=n.setTextureTextPositions(t);return o?n.rasterize(t,o,r,i,e):Promise.resolve({textures:o})}},{key:"_ensureTile",value:function(e){var t=e.id,i=e.key;return this.tiles[t]||(this.tiles[t]={id:t,key:i,texts:{}}),this.tiles[t]}},{key:"_ensureTextSection",value:function(e,t){var i=this._ensureTile(e).texts;return i[t]||(i[t]={}),i[t]}}]),e}(),Q_=function(){function r(e){var t=e.scene,i=e.view;mr(this,r),this._scene=t,this._view=i,this._tiles={},this._old_tiles={},this._pyramid=new q_,this._visible_coords={},this._building_tiles=null,this._renderable_tiles=[],this._active_styles=[],this._tile_visibility_counters={},this._main_thread_target=["TileManager",this._scene.id].join("_"),Cr.addTarget(this._main_thread_target,this),this._updateVisibility=this._updateVisibility.bind(this),this._keepCoordinate=this._keepCoordinate.bind(this),this._is_labeled=!1}return yr(r,[{key:"destroy",value:function(){this.forEachTile(function(e){return e.destroy()}),this._tiles={},this.forEachOldTile(function(e){return e.destroy()}),this._old_tiles={},this._pyramid=null,this._visible_coords={},this._scene=null,this._view=null}},{key:"keepTile",value:function(e){this._tiles[e.key]=e,this._pyramid.addTile(e)}},{key:"hasTile",value:function(e){return void 0!==this._tiles[e]}},{key:"_forgetTile",value:function(e){if(this.hasTile(e)){var t=this._tiles[e];this._pyramid.removeTile(t),t.workerMessage("self.removeTile",t.id),t.visible&&t.loaded?this._old_tiles[e]=t:t.destroy(),delete this._tiles[e]}this._tileBuildStop(e)}},{key:"removeTile",value:function(e){this._forgetTile(e),this._scene.requestRedraw()}},{key:"forEachOldTile",value:function(e){for(var t in this._old_tiles)e(this._old_tiles[t])}},{key:"forEachTile",value:function(e){for(var t in this._tiles)e(this._tiles[t])}},{key:"removeTiles",value:function(e){var t=[];for(var i in this._tiles){e(this._tiles[i])&&t.push(i)}for(var r=0;r<t.length;r++){var n=t[r];this.removeTile(n)}}},{key:"updateTilesForView",value:function(){this._visible_coords={};for(var e=this._view.findVisibleTileCoordinates(),t=0;t<e.length;t++){var i=e[t];this._visible_coords[i.key]=i}this.updateTileStates()}},{key:"updateTileStates",value:function(){this._keepCoordinates(),this.forEachTile(this._updateVisibility),this.forEachOldTile(this._updateVisibility),this._updateProxyTiles(),this._view.pruneTilesForView(),this._updateRenderableTiles(),this._updateActiveStyles()}},{key:"_updateLabels",value:function(){var e=this._renderable_tiles.sort(ep);return W_.mainThreadLabelCollisionPass(e,function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:2,r=Math.pow(10,i);return Math.round(Math.floor(e*t)/t*r)/r}(this._view.lookAtManipulator.getLookAtData().zoom,2),this._view.lookAtManipulator,this.isLoadingVisibleTiles(),this._scene.gl)}},{key:"_updateProxyTiles",value:function(){var n=this,o=this._view.lookAtManipulator.getZoomDirection();if(0!==o){var a=!1;this.forEachTile(function(e){if(e.setProxyFor(null),1===o){if(e.visible&&!e.built){var t=n._pyramid.getAncestor(e);t&&(t.setProxyFor(e),a=!0)}}else if(-1===o&&e.visible&&!e.built)for(var i=n._pyramid.getDescendants(e),r=0;r<i.length;r++)i[r].setProxyFor(e),a=!0}),a||this._view.lookAtManipulator.resetZoomDirection()}}},{key:"_updateVisibility",value:function(e){if(e.visible=!1,e.style_zoom===this._view.lookAtManipulator.getLookAtData().tile_level)if(this._visible_coords[e.coords.key])e.visible=!0;else for(var t in this._visible_coords)if(aa.isDescendant(e.coords,this._visible_coords[t])){e.visible=!0;break}}},{key:"getRenderableTiles",value:function(){return this._renderable_tiles}},{key:"_updateRenderableTiles",value:function(){for(var e in this._renderable_tiles=[],this._tiles){var t=this._tiles[e];t.visible&&t.loaded&&(this._renderable_tiles.push(t),(t=this._old_tiles[e])&&(t.destroy(),delete this._old_tiles[e]))}for(var i in this._old_tiles){var r=this._old_tiles[i];r.visible&&r.generation===this._scene.generation?this._renderable_tiles.push(r):(r.destroy(),delete this._old_tiles[i])}return this._renderable_tiles}},{key:"getWorkerForTile",value:function(e,t){return t.has_volatile_data?this._scene.getWorkers(Fl)[0]:t.tiled?this._scene.getWorkers(Cl)[Math.abs(e.x+e.y+e.z)%this._scene.num_workers]:this._scene.getWorkers(Cl)[t.id%this._scene.num_workers]}},{key:"getActiveStyles",value:function(){return this._active_styles}},{key:"_updateActiveStyles",value:function(){for(var e=this._renderable_tiles,t={},i=0;i<e.length;i++){var r=e[i];Object.keys(r.meshes).forEach(function(e){return t[e]=!0})}return this._active_styles=Object.keys(t),this._active_styles}},{key:"isLoadingVisibleTiles",value:function(){var t=this;return Object.keys(this._tiles).some(function(e){return t._tiles[e].visible&&!t._tiles[e].built})}},{key:"updateTilesVisibilityCounters",value:function(){var t=this;Object.keys(this._visible_coords).forEach(function(e){e in t._tile_visibility_counters||(t._tile_visibility_counters[e]=0)});var e=Object.keys(this._tile_visibility_counters),i=[];e.forEach(function(e){e in t._visible_coords?(t._tile_visibility_counters[e]++,30<=t._tile_visibility_counters[e]&&i.push(t._visible_coords[e])):(t._tile_visibility_counters[e]--,t._tile_visibility_counters[e]<=0&&delete t._tile_visibility_counters[e])}),i.length&&this.loadCoordinates(i)}},{key:"loadCoordinates",value:function(e){var l=this;e.sort(function(e,t){var i=l._view.lookAtManipulator.getLookAtData().position,r=Jr.metersPerTile(e.z)/2,n=Jr.metersForTile(e);n.x+=r,n.y-=r;var o=Jr.metersForTile(t);o.x+=r,o.y-=r;var a=Math.abs(i[0]-n.x)+Math.abs(i[1]-n.y),s=Math.abs(i[0]-o.x)+Math.abs(i[1]-o.y);return(e.center_dist=a)<(t.center_dist=s)?-1:s===a?0:1}),e.forEach(function(e){return l.loadCoordinate(e)})}},{key:"_keepCoordinates",value:function(){Object.keys(this._visible_coords).forEach(this._keepCoordinate)}},{key:"_keepCoordinate",value:function(e){var t=this._visible_coords[e];if(t.z===this._view.center_tile.z)for(var i in this._scene.sources){var r=this._scene.sources[i];if(r.builds_geometry_tiles&&r.includesTile(t,this._view.lookAtManipulator.getLookAtData().tile_level)){var n=aa.normalizedKey(t,r,this._view.lookAtManipulator.getLookAtData().tile_level);if(n&&!this.hasTile(n)){var o=new aa({source:r,coords:t,worker:this.getWorkerForTile(t,r),style_zoom:on.zoomToTileLevel(t.z),view:this._view});this.keepTile(o)}}}}},{key:"loadCoordinate",value:function(e){if(e.z===this._view.center_tile.z)for(var t in this._scene.sources){var i=this._scene.sources[t];if(i.builds_geometry_tiles&&i.includesTile(e,this._view.lookAtManipulator.getLookAtData().tile_level)){var r=aa.normalizedKey(e,i,this._view.lookAtManipulator.getLookAtData().tile_level);this.hasTile(r)&&this.buildTile(this._tiles[r])}}}},{key:"buildTile",value:function(e,t){this._building_tiles&&this._building_tiles[e.key]||e.built&&e.generation===this._scene.generation||(this._tileBuildStart(e.key),this._updateVisibility(e),e.build(this._scene.generation,t))}},{key:"buildTileStylesCompleted",value:function(e){var t=e.tile,i=e.progress;if(null==this._tiles[t.key])aa.abortBuild(t);else if(t.generation!==this._scene.generation)aa.abortBuild(t);else{if(t.id<this._tiles[t.key].id)return void aa.abortBuild(t);t=this._tiles[t.key].merge(t),i.done&&(t.built=!0),t.buildMeshes(this._scene.styles,i),this.updateTileStates(),this._scene.requestRedraw()}i.done&&this._tileBuildStop(t.key)}},{key:"buildTileError",value:function(e){this._forgetTile(e.key),aa.abortBuild(e)}},{key:"_tileBuildStart",value:function(e){this._is_labeled=!1,this._building_tiles=this._building_tiles||{},this._building_tiles[e]=!0}},{key:"_tileBuildStop",value:function(e){this._building_tiles&&(delete this._building_tiles[e],this.checkBuildQueue())}},{key:"isReady",value:function(){return this._is_labeled&&!this.isLoadingVisibleTiles()}},{key:"checkBuildQueue",value:function(){var e=this;this._building_tiles&&0!==Object.keys(this._building_tiles).length||(this._building_tiles=null,Kc.pruneTextCache(),this._updateLabels().then(function(){e._is_labeled=!Ko.queue.length,e._scene.immediateRedraw()}))}}]),r}();function ep(e,t){var i=e.coords,r=t.coords;return i.z-r.z||i.x-r.x||i.y-r.y}function tp(t){mr(this,tp),this.defaults={},this.defaults.culling=!0,this.defaults.culling_face=t.BACK,this.defaults.blending=!1,this.defaults.blending_src=t.ONE_MINUS_SRC_ALPHA,this.defaults.blending_dst=t.ONE_MINUS_SRC_ALPHA,this.defaults.blending_src_alpha=t.ONE,this.defaults.blending_dst_alpha=t.ONE_MINUS_SRC_ALPHA,this.defaults.depth_write=!0,this.defaults.depth_test=!0,t.depthFunc(t.LESS),this.culling=new ip({cull:this.defaults.culling,face:this.defaults.culling_face},function(e){e.cull?(t.enable(t.CULL_FACE),t.cullFace(e.face)):t.disable(t.CULL_FACE)}),this.blending=new ip({blend:this.defaults.blending,src:this.defaults.blending_src,dst:this.defaults.blending_dst,src_alpha:this.defaults.blending_src_alpha,dst_alpha:this.defaults.blending_dst_alpha},function(e){e.blend?(t.enable(t.BLEND),e.src_alpha&&e.dst_alpha?t.blendFuncSeparate(e.src,e.dst,e.src_alpha,e.dst_alpha):t.blendFunc(e.src,e.dst)):t.disable(t.BLEND)}),this.depth_write=new ip({depth_write:this.defaults.depth_write},function(e){t.depthMask(e.depth_write)}),this.depth_test=new ip({depth_test:this.defaults.depth_test},function(e){e.depth_test?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST)})}var ip=function(){function i(e,t){mr(this,i),t(e),this.value=e,this.setup=t}return yr(i,[{key:"get",value:function(){return this.value}},{key:"set",value:function(e){JSON.stringify(this.value)!==JSON.stringify(e)&&(this.setup(e),this.value=e)}}]),i}(),rp=function(){function e(){mr(this,e),this.canvas=null,this.gl=null,this.screenshot_canvas=null,this.screenshot_context=null,this.queue_screenshot=null,this.video_capture=null}return yr(e,[{key:"setCanvas",value:function(e,t){this.canvas=e,this.gl=t}},{key:"screenshot",value:function(e){var i=this,t=(0<arguments.length&&void 0!==e?e:{}).background;return null!=this.queue_screenshot||(this.queue_screenshot={background:t},this.queue_screenshot.promise=new Promise(function(e,t){i.queue_screenshot.resolve=e,i.queue_screenshot.reject=t})),this.queue_screenshot.promise}},{key:"completeScreenshot",value:function(){if(null!=this.queue_screenshot){var e=this.canvas.width,t=this.canvas.height,i=new Uint8Array(e*t*4);this.gl.readPixels(0,0,e,t,this.gl.RGBA,this.gl.UNSIGNED_BYTE,i);var r=this.queue_screenshot.background;r=r&&"transparent"!==r?jo.parseColor(r).slice(0,3).map(function(e){return 255*e}):null;for(var n=new Uint8ClampedArray(e*t*4),o=0;o<t;o++)for(var a=0;a<e;a++){var s=4*((t-o-1)*e+a),l=4*(o*e+a),u=i[3+s];n[0+l]=255*i[0+s]/u,n[1+l]=255*i[1+s]/u,n[2+l]=255*i[2+s]/u,n[3+l]=u,r&&(u/=255,n[0+l]=n[0+l]*u+r[0]*(1-u),n[1+l]=n[1+l]*u+r[1]*(1-u),n[2+l]=n[2+l]*u+r[2]*(1-u),n[3+l]=255)}this.screenshot_canvas=this.screenshot_canvas||document.createElement("canvas");var c=this.screenshot_canvas;c.width=e,c.height=t,this.screenshot_context=this.screenshot_context||c.getContext("2d");var h=this.screenshot_context,f=new ImageData(n,e,t);h.putImageData(f,0,0);for(var d=c.toDataURL("image/png"),_=atob(d.slice(22)),p=new Uint8Array(_.length),v=0;v<_.length;++v)p[v]=_.charCodeAt(v);var m=new Blob([p],{type:"image/png"});this.queue_screenshot.resolve({url:d,blob:m,type:"png"}),this.queue_screenshot=null}}},{key:"startVideoCapture",value:function(){var r=this;if("function"!=typeof window.MediaRecorder||!this.canvas||"function"!=typeof this.canvas.captureStream)return Kr("warn","Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser"),!1;if(this.video_capture)return Kr("warn","Video capture already in progress, call Scene.stopVideoCapture() first"),!1;try{var n=this.video_capture={};n.chunks=[],n.stream=this.canvas.captureStream(),n.options={mimeType:"video/webm"},n.media_recorder=new MediaRecorder(n.stream,n.options),n.media_recorder.ondataavailable=function(e){if(0<e.data.size&&n.chunks.push(e.data),n.resolve){var t=new Blob(n.chunks,{type:n.options.mimeType}),i=fn(t);if(n.stream)(n.stream.getTracks()||[]).forEach(function(e){e.stop(),n.stream.removeTrack(e)});n.stream=null,n.media_recorder=null,r.video_capture=null,n.resolve({url:i,blob:t,type:"webm"})}},n.media_recorder.start()}catch(e){return this.video_capture=null,Kr("error","Scene video capture failed",e),!1}return!0}},{key:"stopVideoCapture",value:function(){var i=this;return this.video_capture?(this.video_capture.promise=new Promise(function(e,t){i.video_capture.resolve=e,i.video_capture.reject=t}),this.video_capture.media_recorder.stop(),this.video_capture.promise):(Kr("warn","No scene video capture in progress, call Scene.startVideoCapture() first"),Promise.resolve({}))}}]),e}(),np=function(){function e(){mr(this,e),this.sources={},this.styles={},this.layers={},this.tiles={},this._isConfigured=!1}return yr(e,[{key:"init",value:function(e,t,i,r,n,o){return this.scene_id=e,this._worker_id=t,Kr.setLevel(i),on.device_pixel_ratio=r,pu.setElementIndexUint(n),Jl.setPrefix(this._worker_id),this._style_manager=new nf,this._importExternalScripts(o),Nc.id_prefix=t,this._isConfigured=!1,t}},{key:"dispose",value:function(){this._last_config_sources=null,this._config_sources=null,this.sources=null,this._style_manager=null,this.styles=null,this.layers=null,this.tiles=null}},{key:"_importExternalScripts",value:function(e){if(0!==e.length){Kr("debug","loading custom data source scripts in worker:",e);var t=Object.getOwnPropertyNames(window);importScripts.apply(void 0,Pr(e)),Object.getOwnPropertyNames(window).forEach(function(e){-1===t.indexOf(e)&&(self[e]=window[e])})}}},{key:"updateConfig",value:function(e,t){var i=e.config,r=e.generation,n=e.introspection;for(var o in i=JSON.parse(i),function(e){Object.assign(zl,e)}(t),this._generation=r,this._isConfigured=!1,i.layers)i.layers[o]&&(i.layers[o].data=on.stringsToFunctions(i.layers[o].data));this.global=on.stringsToFunctions(i.global),this._createDataSources(i),i.styles=on.stringsToFunctions(i.styles,jo.wrapFunction),this.styles=this._style_manager.build(i.styles),self.is_fake_worker=Lr.is_main,this._style_manager.initStyles({generation:this._generation,styles:this.styles,sources:this.sources,introspection:n,id:this.scene_id}),delete self.is_fake_worker,this.layers=function(e,t){N_={};var i={};for(var r in e){var n=e[r];n&&(i[r]=G_(r,n,null,t))}return i}(i.layers,this._style_manager.styles),this._configuring=this._syncTextures(i.textures)}},{key:"_createDataSources",value:function(t){var i=this;this._last_config_sources=this._config_sources||{},this._config_sources=t.sources;var e=this.sources,r=[];for(var n in t.sources=on.stringsToFunctions(t.sources),this.sources={},self.is_fake_worker=Lr.is_main,t.sources)if(JSON.stringify(this._last_config_sources[n])!==JSON.stringify(t.sources[n])){var o=void 0;try{o=_n.create(Object.assign({},t.sources[n],{name:n}),this.sources)}catch(e){Kr("error","Error creating source.",e.message,t.sources[n]);continue}o&&(this.sources[n]=o,r.push(n))}else this.sources[n]=e[n];delete self.is_fake_worker,r.forEach(function(e){for(var t in i.tiles)i.tiles[t].source===e&&delete i.tiles[t]})}},{key:"awaitConfiguration",value:function(){return this._configuring}},{key:"_onConfig",value:function(t){var i=this;if((this._isConfigured=!0)!==t.loaded)t.loading=!0,t.loaded=!1,t.error=null,this._loadTileSourceData(t).then(function(){if(i.getTile(t.id)){t.loading=!1,t.loaded=!0;try{aa.buildGeometry(t,i)}catch(e){t.error=e.toString(),Cr.postMessage("TileManager_".concat(i.scene_id,".buildTileError"),aa.slice(t))}}else Kr("trace","stop tile build after data source load because tile was removed. Key: ".concat(t.key,", id: ").concat(t.id))},function(e){t.loading=!1,t.loaded=!1,t.error=e.stack,Kr("error","tile load error for tile with key ".concat(t.key," and id ").concat(t.id,": ").concat(t.error)),Cr.postMessage("TileManager_".concat(i.scene_id,".buildTileError"),aa.slice(t))});else{Kr("trace","used worker cache for tile with key ".concat(t.key," and id ").concat(t.id));try{aa.buildGeometry(t,this)}catch(e){t.error=e.toString(),Cr.postMessage("TileManager_".concat(this.scene_id,".buildTileError"),aa.slice(t))}}}},{key:"buildTile",value:function(e){var t=e.tile,i=this.getTile(t.id);if(!i||!i.loading)if(t=this.tiles[t.id]=Object.assign(i||{},t),this._isConfigured)this._onConfig(t);else{var r=this;this.awaitConfiguration().then(function(){return r._onConfig(t)})}}},{key:"_loadTileSourceData",value:function(e){return this.sources[e.source]?this.sources[e.source].load(e):(e.source_data={},Promise.resolve(e))}},{key:"getTile",value:function(e){return this.tiles[e]}},{key:"removeTile",value:function(e){var t=this.tiles[e];null!=t&&(!0===t.loading&&(Kr("trace","cancel tile load for tile id ".concat(e)),t.loading=!1,aa.cancel(t)),delete this.tiles[e],Kr("trace","remove tile from cache, tile id: ".concat(e)))}},{key:"queryFeatures",value:function(e){var o=this,a=e.filter,s=e.visible,l=e.geometry,t=e.tile_ids,u=[],i=t.map(function(e){return o.tiles[e]}).filter(function(e){return e});return null!=a&&(a=-1<["{","["].indexOf(a[0])?JSON.parse(a):a,a=on.stringsToFunctions(a,jo.wrapFunction)),a=P_(a,j_),i.forEach(function(n){function e(r){n.source_data.layers[r].features.forEach(function(e){if(!(!0===s&&e.generation!==o._generation||!1===s&&e.generation===o._generation)){var t=jo.getFeatureParseContext(e,n,o.global);if(t.source=n.source,t.layer=r,a(t)){var i={type:e.type,properties:e.properties};!0===l&&(i.geometry=Jr.copyGeometry(e.geometry),Jr.tileSpaceToLatlng(i.geometry,n.coords.z,n.min)),u.push(i)}}})}for(var t in n.source_data.layers)e(t)}),u}},{key:"resetFeatureSelection",value:function(){Jl.reset()}},{key:"_syncTextures",value:function(e){var t=[];return e&&t.push.apply(t,Pr(Object.keys(e))),Kr("trace","sync textures to worker:",t),0<t.length?$o.syncTexturesToWorker(t):Promise.resolve()}},{key:"profile",value:function(e){console.profile("worker ".concat(this._worker_id,": ").concat(e))}},{key:"profileEnd",value:function(e){console.profileEnd("worker ".concat(this._worker_id,": ").concat(e))}},{key:"terminate",value:function(){this.dispose()}}]),e}();(Lr.is_worker||self.H&&self.H.DEBUG)&&Cr.addTarget("self",new np);var op=function(){function l(e,t){mr(this,l),t=t||{},Jo(this),this.id=l.id++,this.initialized=!1,this.initializing=null,this.sources={},this.view=new Fh(this,t),this.tile_manager=new Q_({scene:this,view:this.view}),this.num_workers=t.numWorkers||2,!0===t.disableVertexArrayObjects&&(Kl.disabled=!0),on.device_pixel_ratio=t.devicePixelRatio,this.config=null,this.config_source=e,this.config_bundle=null,this.last_valid_config_source=null,this.styles=null,this.style_manager=new nf,this.building=null,this.dirty=!0,t.preUpdate&&this.subscribe({pre_update:t.preUpdate}),t.postUpdate&&this.subscribe({post_update:t.postUpdate}),this.render_loop=!t.disableRenderLoop,this.render_loop_active=!1,this.render_loop_stop=!1,this.render_count=0,this.last_render_count=0,this.render_count_changed=!1,this.frame=0,this.last_main_render=-1,this.last_selection_render=-1,this.media_capture=new rp,this.selection=null,this.introspection=!0===t.introspection,this.resetTime(),this.viewport=t.viewport,this.container=t.container,this.canvas=null,this.contextOptions=t.webGLContextOptions,this.lights=null,this.background=null,this.createListeners(),this.updating=0,this.generation=l.generation,this.last_complete_generation=l.generation,this.log_level=t.logLevel||"warn",Kr.setLevel(this.log_level),Kr.reset()}return yr(l,[{key:"load",value:function(e,t){var r=this,i=0<arguments.length&&void 0!==e?e:null,n=1<arguments.length&&void 0!==t?t:{};return this.initializing||(Kr.reset(),this.updating++,this.initialized=!1,this.initial_build_time=null,(n="string"==typeof n?{base_path:n}:n).blocking=void 0===n.blocking||n.blocking,!1!==this.render_loop&&this.setupRenderLoop(),this.createCanvas(),$o.destroy(this.gl),this.initializing=this.loadScene(i,n).then(function(){return r.createWorkers()}).then(function(){r.resetFeatureSelection();var e="object"===vr(r.config_source)||r.hasSubscribersFor("load"),t=r.updateConfig({serialize_funcs:e,normalize:!1,load_event:!0,fade_in:!0});if(!0===n.blocking)return t}).then(function(){r.updating--,r.initializing=null,r.initialized=!0,r.last_valid_config_source=r.config_source,r.last_valid_options={base_path:n.base_path,file_type:n.file_type},r.requestRedraw()}).catch(function(e){var t,i;if(r.initializing=null,r.updating=0,i="YAMLException"===e.name?(t="yaml","Error parsing scene YAML"):"Error initializing scene",r.trigger("error",{type:t,message:i,error:e,url:r.config_source}),i="Scene.load() failed to load ".concat(r.config_source,": ").concat(e.message),r.last_valid_config_source)return Kr("warn",i,e),Kr("info","Scene.load() reverting to last valid configuration"),r.load(r.last_valid_config_source,r.last_valid_base_path);throw Kr("error",i,e),e})),this.initializing}},{key:"destroy",value:function(){if(this.initialized=!1,this.render_loop_stop=!0,this.destroyListeners(),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this.container=null,this.selection&&this.selection.destroy(),this.gl){$o.destroy(this.gl),this.style_manager.destroy(this.gl),this.styles={},Zl.reset();var e=this.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.gl=null}this.sources={},this.tile_manager.destroy(),this.tile_manager=null,this.destroyWorkers(),Kr.reset()}},{key:"createCanvas",value:function(){if(!this.canvas){this.container=this.container||document.body,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top=0,this.canvas.style.left=0,this.container.style.backgroundColor="transparent",this.container.appendChild(this.canvas);try{this.gl=jl.getContext(this.canvas,Object.assign({alpha:!0,premultipliedAlpha:!1,stencil:!0,device_pixel_ratio:on.device_pixel_ratio},this.contextOptions))}catch(e){throw new Error("Couldn't create WebGL context. Your browser may not support WebGL, or it's turned off? Visit http://webglreport.com/ for more info.")}this.handleViewportUpdate(),Kl.init(this.gl),this.render_states=new tp(this.gl),this.media_capture.setCanvas(this.canvas,this.gl)}}},{key:"getWorkerUrl",value:function(){var e;if(void 0!==sp){var t="("+sp+")()";if(up&&""!==lp)t+="\n//# sourceMappingURL="+up.slice(0,up.lastIndexOf("/")+1)+lp;e=fn(new Blob([t],{type:"application/javascript"}))}if(!e)throw new Error("Couldn't find internal Tangram source variable (may indicate the library did not build correctly)");return e}},{key:"updateExternalScripts",value:function(){var i=Pr(this.external_scripts||[]),e=[];if(this.config.scene.scripts)for(var t in this.config.scene.scripts)-1===e.indexOf(this.config.scene.scripts[t])&&e.push(this.config.scene.scripts[t]);for(var r in this.config.sources){var n=this.config.sources[r];if(n.scripts)for(var o in n.scripts)-1===e.indexOf(n.scripts[o])&&e.push(n.scripts[o])}return this.external_scripts=e,!(this.external_scripts.length===i.length&&this.external_scripts.every(function(e,t){return e===i[t]}))}},{key:"createWorkers",value:function(){return this.updateExternalScripts()&&this.destroyWorkers(),this._workers?Promise.resolve():this.makeWorkers(this.getWorkerUrl())}},{key:"makeWorkers",value:function(i){var r=this,n=!!this.gl.getExtension("OES_element_index_uint"),o=[];this._workers=[];for(var a=0,e=function(){var e=new Worker(i);r._workers[a]=e,Cr.addWorker(e),Kr("debug","Scene.makeWorkers: initializing worker ".concat(a));var t=a;o.push(Cr.postMessage(e,"self.init",r.id,a,r.log_level,on.device_pixel_ratio,n,r.external_scripts).then(function(e){return Kr("debug","Scene.makeWorkers: initialized worker ".concat(e)),e},function(e){return Kr("error","Scene.makeWorkers: failed to initialize worker ".concat(t,":"),e),Promise.reject(e)}))};a<this.num_workers;a++)e();var t=new np;return this._workers.push(t),o.push(t.init(this.id,a,this.log_level,on.device_pixel_ratio,n,[])),this.next_worker=0,Promise.all(o).then(function(){Kr.setWorkers(r._workers.slice(0,r.num_workers)),function(e){void 0===sn&&"function"!=typeof(sn=window.URL&&window.URL.revokeObjectURL||window.webkitURL&&window.webkitURL.revokeObjectURL)&&(sn=null,Kr("warn","window.URL.revokeObjectURL (or vendor prefix) not found, unable to create local blob URLs")),sn&&sn(e)}(i)})}},{key:"getWorkers",value:function(t){return this._workers.filter(function(e){switch(t){case Cl:return e instanceof Worker;case Fl:return e instanceof np;default:return!0}})}},{key:"destroyWorkers",value:function(){this.selection=null,Array.isArray(this._workers)&&(Kr.setWorkers(null),this._workers.forEach(function(e){e.terminate()}),this._workers=null)}},{key:"ready",value:function(){return!(!this.view.ready()||0===Object.keys(this.sources).length)}},{key:"handleViewportUpdate",value:function(){var e=this.viewport,t=e.width,i=e.height;0<t&&0<i&&(this.dirty=!0,this.view.handleViewportUpdate(),this.gl&&jl.resize(this.gl,t,i,on.device_pixel_ratio))}},{key:"requestRedraw",value:function(){this.dirty=!0}},{key:"immediateRedraw",value:function(){this.dirty=!0,this.update()}},{key:"renderLoop",value:function(){this.render_loop_active=!0,this.initialized&&this.update(),Ko.setState({user_moving_view:this.view.user_input_active}),Ko.processAll(),this.render_loop_stop?(this.render_loop_stop=!1,this.render_loop_active=!1):window.requestAnimationFrame(this.renderLoop.bind(this))}},{key:"setupRenderLoop",value:function(){var e=this;this.render_loop_active||setTimeout(function(){e.renderLoop()},0)}},{key:"update",value:function(){var e=this.dirty,t=!!this.selection&&this.selection.hasPendingRequests(),i=!(!1===e&&!1===t||!1===this.initialized||0<this.updating||!1===this.ready());return this.trigger("pre_update",i),this.view.update(),i&&(this.dirty=!1,this.render({main:e,selection:t}),this.updateViewComplete(),this.media_capture.completeScreenshot(),this.trigger("post_update",i),!0!==this.animated&&!this.view.isAnimating()||(this.dirty=!0),this.frame++,Kr("trace","Scene.render()"),!0)}},{key:"render",value:function(e){var t=this,i=e.main,r=e.selection,n=this.gl;if(Object.keys(this.lights).forEach(function(e){return t.lights[e].update()}),i&&(this.render_count=this.renderPass(),this.last_main_render=this.frame),r){if(this.view.panning||this.view.user_input_active)return void this.selection.clearPendingRequests();(this.last_selection_render<this.last_main_render||this.selection.has_dirty_buffer)&&(this.selection.bind(),this.renderPass("selection_program",{allow_blend:!1}),n.bindFramebuffer(n.FRAMEBUFFER,null),n.viewport(0,0,this.canvas.width,this.canvas.height),n.clearColor.apply(n,Pr(this.background.color)),this.last_selection_render=this.frame,this.selection.has_dirty_buffer=!1),this.selection.read(this.tile_manager.getRenderableTiles()),this.selection.has_dirty_buffer&&this.render({main:!1,selection:r})}return this.render_count_changed=!1,this.render_count!==this.last_render_count&&(this.render_count_changed=!0),this.last_render_count=this.render_count,!0}},{key:"renderPass",value:function(e,t){var i=this,r=0<arguments.length&&void 0!==e?e:"program",n=(1<arguments.length&&void 0!==t?t:{}).allow_blend,o=this.gl;n=null==n||n,this.clearFrame();for(var a,s,l=this.tile_manager.getActiveStyles().map(function(e){return i.styles[e]}).filter(function(e){return e}).sort(cu.blendOrderSort),u=0,c=0,h=0;h<l.length;h++){var f=l[h],d=c-(s=parseInt(f.name));if((f.clean_depth||d)&&(this.render_states.depth_write.value.depth_write?o.clear(o.DEPTH_BUFFER_BIT):(o.depthMask(!0),o.clear(o.DEPTH_BUFFER_BIT),o.depthMask(!1)),d&&(c=s)),f.blend!==a){var _=Object.assign({},cu.render_states[f.blend],{blend:n&&f.blend});this.setRenderState(_)}var p="translucent"===f.blend&&"program"===r;p&&(this.gl.colorMask(!1,!1,!1,!1),this.renderStyle(f.name,r),this.gl.colorMask(!0,!0,!0,!0),this.gl.depthFunc(this.gl.EQUAL),this.gl.enable(this.gl.STENCIL_TEST),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilFunc(this.gl.EQUAL,this.gl.ZERO,255),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.INCR)),u+=this.renderStyle(f.name,r),p&&(this.gl.disable(this.gl.STENCIL_TEST),this.gl.depthFunc(this.gl.LESS)),a=f.blend}return u}},{key:"renderStyle",value:function(n,o){for(var a,s=this,l=this.styles[n],u=!0,c=0,h=this.tile_manager.getRenderableTiles(),e=Math.max.apply(Math,Pr(h.map(function(e){return e.meshes[n]?Math.max.apply(Math,Pr(e.meshes[n].map(function(e){return e.variant.order}))):-1}))),t=function(t){for(var e=0;e<h.length;e++){var i=h[e];if(null!=i.meshes[n]&&i.shouldProxyForStyle(n)){var r=i.meshes[n].filter(function(e){return e.variant.order===t})[0];if(r){if(!0===u&&(u=!1,!(a=s.setupStyle(l,o))))return{v:0};s.view.setupTile(i,a),s.selection.setupDiscards(a),l.render(r)&&s.requestRedraw(),c+=r.geometry_count}}}},i=0;i<e+1;i++){var r=t(i);if("object"===vr(r))return r.v}return c}},{key:"setupStyle",value:function(t,e){var i;try{if(!(i=t.getProgram(e)))return}catch(e){return void this.trigger("warning",{type:"styles",message:"Error compiling style ".concat(t.name),style:t,shader_errors:t.program&&t.program.shader_errors})}for(var r in i.use(),t.setup(),i.uniform("1f","u_time",this.animated?(+new Date-this.start_time)/1e3:0),this.view.setupProgram(i),this.lights)this.lights[r].setupProgram(i);return i}},{key:"clearFrame",value:function(){this.initialized&&(this.render_states.depth_write.set({depth_write:!0}),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT|this.gl.STENCIL_BUFFER_BIT))}},{key:"setRenderState",value:function(e){var t=0<arguments.length&&void 0!==e?e:{},i=t.depth_test,r=t.depth_write,n=t.cull_face,o=t.blend;if(this.initialized){var a=this.render_states;i=!1!==i&&a.defaults.depth_test,r=!1!==r&&a.defaults.depth_write,n=!1!==n&&a.defaults.culling,o=null!=o?o:a.defaults.blending;var s=this.gl;a.depth_test.set({depth_test:i}),a.depth_write.set({depth_write:r}),a.culling.set({cull:n,face:a.defaults.culling_face}),o?"opaque"===o?a.blending.set({blend:!1}):"overlay"===o||"inlay"===o||"translucent"===o?a.blending.set({blend:!0,src:s.SRC_ALPHA,dst:s.ONE_MINUS_SRC_ALPHA,src_alpha:s.ONE,dst_alpha:s.ONE_MINUS_SRC_ALPHA}):"add"===o?a.blending.set({blend:!0,src:s.ONE,dst:s.ONE}):"multiply"===o&&a.blending.set({blend:!0,src:s.ZERO,dst:s.SRC_COLOR}):a.blending.set({blend:!1})}}},{key:"getFeatureAt",value:function(e,t){var i=1<arguments.length&&void 0!==t?t:{},r=i.radius,n=i.top_most_only;if(!this.initialized)return Kr("debug","Scene.getFeatureAt() called before scene was initialized"),Promise.resolve();var o={x:e.x/this.view.size.css.width,y:e.y/this.view.size.css.height};return r=0<r?{x:r/this.view.size.css.width,y:r/this.view.size.css.height}:null,this.selection.getFeatureAt(o,{radius:r,top_most_only:n}).catch(function(e){return Promise.resolve({error:e})})}},{key:"queryFeatures",value:function(e){var t=0<arguments.length&&void 0!==e?e:{},i=t.filter,r=t.unique,l=void 0===r||r,n=t.group_by,u=void 0===n?null:n,o=t.visible,a=void 0===o?null:o,s=t.geometry,c=void 0!==s&&s;i=on.serializeWithFunctions(i);var h=this.tile_manager.getRenderableTiles().map(function(e){return e.id});return Cr.postMessage(this._workers,"self.queryFeatures",{filter:i,visible:a,geometry:c,tile_ids:h}).then(function(e){var r=[],n={},o={},a=(l="string"==typeof l?[l]:l)&&function(e){return JSON.stringify(Array.isArray(l)?Dl(e,l):e)},s=(u=("string"==typeof u||Array.isArray(u))&&u)&&function(e){return Array.isArray(u)?JSON.stringify(Dl(e,u)):e[u]};return e.forEach(function(e){return e.forEach(function(e){if(a){var t=a(e);if(n[t])return;n[t]=!0}if(s){var i=s(e.properties);o[i]=o[i]||[],o[i].push(e)}else r.push(e)})}),s?o:r})}},{key:"loadScene",value:function(e,t){var r=this,i=0<arguments.length&&void 0!==e?e:null,n=1<arguments.length&&void 0!==t?t:{},o=n.base_path,a=n.file_type;return this.config_source=i||this.config_source,"string"==typeof this.config_source?this.base_path=cn(o||this.config_source):this.base_path=cn(o),this.config_path=this.base_path,V_.loadScene(this.config_source,{path:this.base_path,type:a}).then(function(e){var t=e.config,i=e.bundle;return r.config=t,r.config_bundle=i,r.config})}},{key:"createDataSources",value:function(){var t=this,i=[],e=Object.keys(this.sources),r=0;for(var n in this.config.sources){var o=this.config.sources[n],a=this.sources[n];try{var s=Object.assign({},o,{name:n,id:r++});if(this.sources[n]=_n.create(s,this.sources),!this.sources[n])throw{}}catch(e){delete this.sources[n];var l="Could not create data source: ".concat(e.message);Kr("warn","Scene: ".concat(l),o),this.trigger("warning",{type:"sources",source:o,message:l})}_n.changed(this.sources[n],a)&&i.push(n)}for(var u in e.forEach(function(e){t.config.sources[e]||(delete t.sources[e],i.push(e))}),0<i.length&&this.tile_manager.removeTiles(function(e){return-1<i.indexOf(e.source.name)}),this.config.layers){var c=this.config.layers[u];!1!==c.enabled&&c.data&&this.sources[c.data.source]&&(this.sources[c.data.source].builds_geometry_tiles=!0)}}},{key:"loadTextures",value:function(){var e=this;return $o.createFromObject(this.gl,this.config.textures).then(function(){return $o.createDefault(e.gl)})}},{key:"updateStyles",value:function(){if(!this.initialized&&!this.initializing)throw new Error("Scene.updateStyles() called before scene was initialized");for(var e in this.styles=this.style_manager.build(this.config.styles),this.style_manager.initStyles(this),this.styles)this.styles[e].setGL(this.gl);this.dirty=!0}},{key:"createLights",value:function(){for(var e in this.lights={},this.config.lights)if(this.config.lights[e]&&"object"===vr(this.config.lights[e])){var t=this.config.lights[e];t.name=e.replace("-","_"),t.visible=!1!==t.visible,t.visible&&(this.lights[t.name]=ru.create(this.view,t))}ru.inject(this.lights)}},{key:"setBackground",value:function(){var e,t=this.config.scene.background;this.background={},t&&t.color&&(this.background.color=jo.parseColor(t.color)),this.background.color||(this.background.color=[0,0,0,0]),1===this.background.color[3]?this.canvas.style.backgroundColor="rgba(".concat(this.background.color.map(function(e){return Math.floor(255*e)}).join(", "),")"):this.canvas.style.backgroundColor="transparent",(e=this.gl).clearColor.apply(e,Pr(this.background.color))}},{key:"setIntrospection",value:function(e){var t=this;return e!==this.introspection?(this.introspection=e||!1,this.updating++,this.updateConfig({normalize:!1}).then(function(){return t.updating--})):Promise.resolve()}},{key:"updateConfig",value:function(e){var t=0<arguments.length&&void 0!==e?e:{},i=t.load_event,r=void 0!==i&&i,n=t.serialize_funcs,o=t.normalize,a=void 0===o||o;t.fade_in;this.generation=++l.generation,this.updating++,this.config=V_.applyGlobalProperties(this.config),a?V_.normalize(this.config,this.config_bundle):(V_.hoistStyleShaderUniformTextures(this.config,this.config_bundle,{include_globals:!0}),V_.normalizeTextures(this.config,this.config_bundle)),this.trigger(r?"load":"update",{config:this.config}),this.style_manager.init(),this.createLights(),this.createDataSources(),this.loadTextures(),this.setBackground(),Zc.loadFonts(this.config.fonts),this.updateStyles();var s=this.syncConfigToWorker({serialize_funcs:n});return this.updating--,this.view.updateBounds(),this.requestRedraw(),s}},{key:"syncConfigToWorker",value:function(e){var t=(0<arguments.length&&void 0!==e?e:{}).serialize_funcs,i=void 0===t||t?on.serializeWithFunctions(this.config):JSON.stringify(this.config);return Cr.postMessage(this._workers,"self.updateConfig",{config:i,generation:this.generation,introspection:this.introspection},Il)}},{key:"createListeners",value:function(){var t=this;this.listeners={},this.listeners.view={move:function(){return t.trigger("move")}},this.view.subscribe(this.listeners.view),this.listeners.texture={update:function(){return t.dirty=!0},warning:function(e){return t.trigger("warning",Object.assign({type:"textures"},e))}},$o.subscribe(this.listeners.texture),this.listeners.scene_loader={error:function(e){return t.trigger("error",Object.assign({type:"scene"},e))}},V_.subscribe(this.listeners.scene_loader)}},{key:"destroyListeners",value:function(){this.unsubscribeAll(),this.view.unsubscribe(this.listeners.view),$o.unsubscribe(this.listeners.texture),V_.unsubscribe(this.listeners.scene_loader),this.listeners=null}},{key:"resetFeatureSelection",value:function(){this.selection?this._workers&&Cr.postMessage(this._workers,"self.resetFeatureSelection"):this.selection=new Jl(this.gl,this._workers)}},{key:"resetTime",value:function(){this.start_time=+new Date}},{key:"updateViewComplete",value:function(){(this.render_count_changed||this.generation!==this.last_complete_generation)&&this.tile_manager.isReady()&&(this.last_complete_generation=this.generation,this.trigger("view_complete"))}},{key:"resetViewComplete",value:function(){this.last_complete_generation=null}},{key:"screenshot",value:function(e){var t=(0<arguments.length&&void 0!==e?e:{}).background,i=void 0===t?"white":t;return this.requestRedraw(),this.media_capture.screenshot({background:i})}},{key:"pixelRatio",value:function(){return on.device_pixel_ratio}},{key:"startVideoCapture",value:function(){return this.requestRedraw(),this.media_capture.startVideoCapture()}},{key:"stopVideoCapture",value:function(){return this.media_capture.stopVideoCapture()}},{key:"_profile",value:function(e){console.profile("main thread: ".concat(e)),Cr.postMessage(this._workers,"self.profile",e)}},{key:"_profileEnd",value:function(e){console.profileEnd("main thread: ".concat(e)),Cr.postMessage(this._workers,"self.profileEnd",e)}},{key:"getCameraMatrix",value:function(){return this.view.lookAtManipulator.getCameraMatrix()}},{key:"animated",get:function(){var t=this;return void 0!==this.config.scene.animated?this.config.scene.animated:this.tile_manager.getActiveStyles().some(function(e){return t.styles[e]&&t.styles[e].animated})}}],[{key:"create",value:function(e,t){return new l(e,1<arguments.length&&void 0!==t?t:{})}}]),l}();op.id=0,op.generation=0;var ap=function(){function s(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};mr(this,s);var r,n=Math.pow(2,i.coords.z),o=Math.abs(Math.floor(i.coords.x/n));r=Math.abs(n*o-Math.abs(i.coords.x));var a=i.coords;return i.coords={x:r,y:a.y,z:a.z},Mr(this,Ar(s).call(this,e,t,i))}return br(s,$o),yr(s,[{key:"load",value:function(r){var n=this;if(!r||!r.uid)return Rr(Ar(s.prototype),"load",this).call(this,r);var o=r.coords,a=new Uint8Array([0,0,0,0]);return this.loading=new Promise(function(e,t){var i=H.map.DataModel.invoke(r.uid,"requestTileAsPromise",[o.x,o.y,o.z])||null;i?i.then(function(e){var t=e.data;n.loaded=!0,!t||t instanceof ArrayBuffer?n.setData(1,1,a,{filtering:"nearest"}):"IMG"===t.tagName.toUpperCase()||"CANVAS"===t.tagName.toUpperCase()?n.setElement(t,r):n.setData(1,1,a,{filtering:"nearest"})},function(){n.loaded=!1}).then(e,function(e){return t(e)}):t(new Error("Unable to invoke on target "+r.uid))}),this.loading}}]),s}();$o.register(ap,function(e){return e&&e.uid}),self.H=self.H||{},self.H.gl={DataSource:_n,Geo:Jr,MathUtils:ml,Scene:op,Task:Ko,Tile:aa,WorkerBroker:Cr,log:Kr,SceneLoader:V_,yaml:m_}}()};e()}();
