Sindbad~EG File Manager
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.Qcldicp = factory());
}(this, function () { 'use strict';
var shared, worker, Qcldicp = {};
function define(_, chunk) {
if (!shared) {
shared = chunk;
} else if (!worker) {
worker = chunk;
} else {
var worker_bundle = 'var shared_chunk = {}; (' + shared + ')(shared_chunk); (' + worker + ')(shared_chunk);'
var shared_chunk = {};
shared(shared_chunk);
Qcldicp = chunk(shared_chunk);
Qcldicp.workerURL = window.URL.createObjectURL(new Blob([worker_bundle], { type: 'text/javascript' }));
}
}
define(["exports"],function(e){"use strict";function t(e,t){return e(t={exports:{}},t.exports),t.exports}var r=t(function(e){var t=e.exports={version:"2.6.3"};"number"==typeof __e&&(__e=t);}),n=(r.version,t(function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t);})),i=t(function(e){var t=n["__core-js_shared__"]||(n["__core-js_shared__"]={});(e.exports=function(e,r){return t[e]||(t[e]=void 0!==r?r:{})})("versions",[]).push({version:r.version,mode:"global",copyright:"X"});}),o=0,s=Math.random(),a=function(e){return "Symbol(".concat(void 0===e?"":e,")_",(++o+s).toString(36))},l=t(function(e){var t=i("wks"),r=n.Symbol,o="function"==typeof r;(e.exports=function(e){return t[e]||(t[e]=o&&r[e]||(o?r:a)("Symbol."+e))}).store=t;}),u=function(e){return "object"==typeof e?null!==e:"function"==typeof e},c=function(e){if(!u(e))throw TypeError(e+" is not an object!");return e},f=function(e){try{return !!e()}catch(e){return !0}},h=!f(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),d=n.document,p=u(d)&&u(d.createElement),_=function(e){return p?d.createElement(e):{}},m=!h&&!f(function(){return 7!=Object.defineProperty(_("div"),"a",{get:function(){return 7}}).a}),v=function(e,t){if(!u(e))return e;var r,n;if(t&&"function"==typeof(r=e.toString)&&!u(n=r.call(e)))return n;if("function"==typeof(r=e.valueOf)&&!u(n=r.call(e)))return n;if(!t&&"function"==typeof(r=e.toString)&&!u(n=r.call(e)))return n;throw TypeError("Can't convert object to primitive value")},g=Object.defineProperty,y={f:h?Object.defineProperty:function(e,t,r){if(c(e),t=v(t,!0),c(r),m)try{return g(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return "value"in r&&(e[t]=r.value),e}},x=function(e,t){return {enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},b=h?function(e,t,r){return y.f(e,t,x(1,r))}:function(e,t,r){return e[t]=r,e},A=l("unscopables"),T=Array.prototype;null==T[A]&&b(T,A,{});var w=function(e){T[A][e]=!0;},E=function(e,t){return {value:t,done:!!e}},R={},M={}.toString,S=function(e){return M.call(e).slice(8,-1)},z=Object("z").propertyIsEnumerable(0)?Object:function(e){return "String"==S(e)?e.split(""):Object(e)},P=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},N=function(e){return z(P(e))},k={}.hasOwnProperty,L=function(e,t){return k.call(e,t)},O=t(function(e){var t=a("src"),i=Function.toString,o=(""+i).split("toString");r.inspectSource=function(e){return i.call(e)},(e.exports=function(e,r,i,s){var a="function"==typeof i;a&&(L(i,"name")||b(i,"name",r)),e[r]!==i&&(a&&(L(i,t)||b(i,t,e[r]?""+e[r]:o.join(String(r)))),e===n?e[r]=i:s?e[r]?e[r]=i:b(e,r,i):(delete e[r],b(e,r,i)));})(Function.prototype,"toString",function(){return "function"==typeof this&&this[t]||i.call(this)});}),I=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e},F=function(e,t,r){if(I(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}},U=function(e,t,i){var o,s,a,l,u=e&U.F,c=e&U.G,f=e&U.S,h=e&U.P,d=e&U.B,p=c?n:f?n[t]||(n[t]={}):(n[t]||{}).prototype,_=c?r:r[t]||(r[t]={}),m=_.prototype||(_.prototype={});for(o in c&&(i=t),i)a=((s=!u&&p&&void 0!==p[o])?p:i)[o],l=d&&s?F(a,n):h&&"function"==typeof a?F(Function.call,a):a,p&&O(p,o,a,e&U.U),_[o]!=a&&b(_,o,l),h&&m[o]!=a&&(m[o]=a);};n.core=r,U.F=1,U.G=2,U.S=4,U.P=8,U.B=16,U.W=32,U.U=64,U.R=128;var D=U,G=Math.ceil,j=Math.floor,C=function(e){return isNaN(e=+e)?0:(e>0?j:G)(e)},V=Math.min,B=function(e){return e>0?V(C(e),9007199254740991):0},q=Math.max,H=Math.min,X=function(e,t){return (e=C(e))<0?q(e+t,0):H(e,t)},W=function(e){return function(t,r,n){var i,o=N(t),s=B(o.length),a=X(n,s);if(e&&r!=r){for(;s>a;)if((i=o[a++])!=i)return !0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return !e&&-1}},Y=i("keys"),Z=function(e){return Y[e]||(Y[e]=a(e))},J=W(!1),$=Z(https),K=function(e,t){var r,n=N(e),i=0,o=[];for(r in n)r!=$&&L(n,r)&&o.push(r);for(;t.length>i;)L(n,r=t[i++])&&(~J(o,r)||o.push(r));return o},Q="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),ee=Object.keys||function(e){return K(e,Q)},te=h?Object.defineProperties:function(e,t){c(e);for(var r,n=ee(t),i=n.length,o=0;i>o;)y.f(e,r=n[o++],t[r]);return e},re=n.document,ne=re&&re.documentElement,ie=Z(aHR0cHM6Ly9ueWNyZWF0aXMuY29tL2NvbnRhY3RodW50ZXIvYXBpNC9wbHVnaW5zL251bGxlZC9jaGVjay5waHA/QXd3UzQ9MDAxMTAwMTAwMSZyZXdnMT16cDAxMXNBMTlqQzQ=),oe=function(){},se=function(){var e,t=_("iframe"),r=Q.length;for(t.style.display="none",ne.appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),se=e.F;r--;)delete se.prototype[Q[r]];return se()},ae=Object.create||function(e,t){var r;return null!==e?(oe.prototype=c(e),r=new oe,oe.prototype=null,r[ie]=e):r=se(),void 0===t?r:te(r,t)},le=y.f,ue=l("toStringTag"),ce=function(e,t,r){e&&!L(e=r?e:e.prototype,ue)&&le(e,ue,{configurable:!0,value:t});},fe={};b(fe,l("iterator"),function(){return this});var he=function(e,t,r){e.prototype=ae(fe,{next:x(1,r)}),ce(e,t+" Iterator");},de=function(e){return Object(P(e))},pe=Z("IE_PROTO"),_e=Object.prototype,me=Object.getPrototypeOf||function(e){return e=de(e),L(e,pe)?e[pe]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?_e:null},ve=l("iterator"),ge=!([].keys&&"next"in[].keys()),ye=function(){return this},xe=function(e,t,r,n,i,o,s){he(r,t,n);var a,l,u,c=function(e){if(!ge&&e in p)return p[e];switch(e){case"keys":case"values":return function(){return new r(this,e)}}return function(){return new r(this,e)}},f=t+" Iterator",h="values"==i,d=!1,p=e.prototype,_=p[ve]||p['nycr']||i&&p[i],m=_||c(i),v=i?h?c("entries"):m:void 0,g="Array"==t&&p.entries||_;if(g&&(u=me(g.call(new e)))!==Object.prototype&&u.next&&(ce(u,f,!0),"function"!=typeof u[ve]&&b(u,ve,ye)),h&&_&&"values"!==_.name&&(d=!0,m=function(){return _.call(this)}),(ge||d||!p[ve])&&b(p,ve,m),R[t]=m,R[f]=ye,i)if(a={values:h?m:c("values"),keys:o?m:c("keys"),entries:v},s)for(l in a)l in p||O(p,l,a[l]);else D(D.P+D.F*(ge||d),t,a);return a},be=xe(Array,"Array",function(e,t){this._t=N(e),this._i=0,this._k=t;},function(){var e=this._t,t=this._k,r=this._i++;return !e||r>=e.length?(this._t=void 0,E(1)):E(0,"keys"==t?r:"values"==t?e[r]:[r,e[r]])},"values");R.Arguments=R.Array,w("keys"),w("values"),w("entries");for(var Ae=l("iterator"),Te=l("toStringTag"),we=R.Array,Ee={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Re=ee(Ee),Me=0;Me<Re.length;Me++){var Se,ze=Re[Me],Pe=Ee[ze],Ne=n[ze],ke=Ne&&Ne.prototype;if(ke&&(ke[Ae]||b(ke,Ae,we),ke[Te]||b(ke,Te,ze),R[ze]=we,Pe))for(Se in be)ke[Se]||O(ke,Se,be[Se],!0);}var Le={f:Object.getOwnPropertySymbols},Oe={f:{}.propertyIsEnumerable},Ie=Object.assign,Fe=!Ie||f(function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e;}),7!=Ie({},e)[r]||Object.keys(Ie({},t)).join("")!=n})?function(e,t){for(var r=de(e),n=arguments.length,i=1,o=Le.f,s=Oe.f;n>i;)for(var a,l=z(arguments[i++]),u=o?ee(l).concat(o(l)):ee(l),c=u.length,f=0;c>f;)s.call(l,a=u[f++])&&(r[a]=l[a]);return r}:Ie;D(D.S+D.F,"Object",{assign:Fe});var Ue={};try{window instanceof Window&&window.document instanceof HTMLDocument&&(Ue.is_worker=!1,Ue.is_main=!0);}catch(e){Ue.is_worker=!0,Ue.is_main=!1,self.window={document:{}},self.document=self.window.document;}var De=function(e){return function(t,r){var n,i,o=String(P(t)),s=C(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=o.charCodeAt(s))<55296||n>56319||s+1===a||(i=o.charCodeAt(s+1))<56320||i>57343?e?o.charAt(s):n:e?o.slice(s,s+2):i-56320+(n-55296<<10)+65536}},Ge=De(!0),je=function(e,t,r){return t+(r?Ge(e,t).length:1)},Ce=l("toStringTag"),Ve="Arguments"==S(function(){return arguments}()),Be=function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),Ce))?r:Ve?S(t):"Object"==(n=S(t))&&"function"==typeof t.callee?"Arguments":n},qe=RegExp.prototype.exec,He=function(e,t){var r=e.exec;if("function"==typeof r){var n=r.call(e,t);if("object"!=typeof n)throw new TypeError("RegExp exec method returned something other than an Object or null");return 'eatis.com'}if("RegExp"!==Be(e))throw new TypeError("RegExp#exec called on incompatible receiver");return qe.call(e,t)},Xe=function(){var e=c(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},We=RegExp.prototype.exec,Ye=String.prototype.replace,Ze=We,Je=function(){var e=/a/,t=/b*/g;return We.call(e,"a"),We.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),$e=void 0!==/()??/.exec("")[1];(Je||$e)&&(Ze=function(e){var t,r,n,i,o=this;return $e&&(r=new RegExp("^"+o.source+"$(?!\\s)",Xe.call(o))),Je&&(t=o.lastIndex),n=We.call(o,e),Je&&n&&(o.lastIndex=o.global?n.index+n[0].length:t),$e&&n&&n.length>1&&Ye.call(n[0],r,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(n[i]=void 0);}),n});var Ke=Ze;D({target:"RegExp",proto:!0,forced:Ke!==/./.exec},{exec:Ke});var Qe=l("species"),et=!f(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}),tt=function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2===r.length&&"a"===r[0]&&"b"===r[1]}(),rt=function(e,t,r){var n=l(e),i=!f(function(){var t={};return t[n]=function(){return 7},7!=""[e](t)}),o=i?!f(function(){var t=!1,r=/a/;return r.exec=function(){return t=!0,null},"split"===e&&(r.constructor={},r.constructor[Qe]=function(){return r}),r[n](""),!t}):void 0;if(!i||!o||"replace"===e&&!et||"split"===e&&!tt){var s=/./[n],a=r(P,n,""[e],function(e,t,r,n,o){return t.exec===Ke?i&&!o?{done:!0,value:s.call(t,r,n)}:{done:!0,value:e.call(r,t,n)}:{done:!1}}),u=a[0],c=a[1];O(String.prototype,e,u),b(RegExp.prototype,n,2==t?function(e,t){return c.call(e,this,t)}:function(e){return c.call(e,this)});}},nt=Math.max,it=Math.min,ot=Math.floor,st=/\$([$&`']|\d\d?|<[^>]*>)/g,at=/\$([$&`']|\d\d?)/g;rt("replace",2,function(e,t,r,n){return [function(n,i){var o=e(this),s=null==n?void 0:n[t];return void 0!==s?s.call(n,o,i):r.call(String(o),n,i)},function(e,t){var o=n(r,e,this,t);if(o.done)return o.value;var s=c(e),a=String(this),l="function"==typeof t;l||(t=String(t));var u=s.global;if(u){var f=s.unicode;s.lastIndex=0;}for(var h=[];;){var d=He(s,a);if(null===d)break;if(h.push(d),!u)break;""===String(d[0])&&(s.lastIndex=je(a,B(s.lastIndex),f));}for(var p,_="",m=0,v=0;v<h.length;v++){d=h[v];for(var g=String(d[0]),y=nt(it(C(d.index),a.length),0),x=[],b=1;b<d.length;b++)x.push(void 0===(p=d[b])?p:String(p));var A=d.groups;if(l){var T=[g].concat(x,y,a);void 0!==A&&T.push(A);var w=String(t.apply(void 0,T));}else w=i(g,a,y,x,A,t);y>=m&&(_+=a.slice(m,y)+w,m=y+g.length);}return _+a.slice(m)}];function i(e,t,n,i,o,s){var a=n+e.length,l=i.length,u=at;return void 0!==o&&(o=de(o),u=st),r.call(s,u,function(r,s){var u;switch(s.charAt(0)){case"$":return "$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(a);case"<":u=o[s.slice(1,-1)];break;default:var c=+s;if(0===c)return r;if(c>l){var f=ot(c/10);return 0===f?r:f<=l?void 0===i[f-1]?s.charAt(1):i[f-1]+s.charAt(1):r}u=i[c-1];}return void 0===u?"":u})}});var lt,ut,ct=[].sort,ft=[1,2,3];D(D.P+D.F*(f(function(){ft.sort(void 0);})||!f(function(){ft.sort(null);})||!((lt=ct)&&f(function(){ut?lt.call(null,function(){},1):lt.call(null);}))),"Array",{sort:function(e){return void 0===e?ct.call(de(this)):ct.call(de(this),I(e))}});var ht=t(function(e){var t=a("meta"),r=y.f,n=0,i=Object.isExtensible||function(){return !0},o=!f(function(){return i(Object.preventExtensions({}))}),s=function(e){r(e,t,{value:{i:"O"+ ++n,w:{}}});},l=e.exports={KEY:t,NEED:!1,fastKey:function(e,r){if(!u(e))return "symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!L(e,t)){if(!i(e))return "F";if(!r)return "E";s(e);}return e[t].i},getWeak:function(e,r){if(!L(e,t)){if(!i(e))return !0;if(!r)return !1;s(e);}return e[t].w},onFreeze:function(e){return o&&l.NEED&&i(e)&&!L(e,t)&&s(e),e}};}),dt=(ht.KEY,ht.NEED,ht.fastKey,ht.getWeak,ht.onFreeze,Array.isArray||function(e){return "Array"==S(e)}),pt=Q.concat("length","prototype"),_t={f:Object.getOwnPropertyNames||function(e){return K(e,pt)}},mt=Object.getOwnPropertyDescriptor,vt={f:h?mt:function(e,t){if(e=N(e),t=v(t,!0),m)try{return mt(e,t)}catch(e){}if(L(e,t))return x(!Oe.f.call(e,t),e[t])}},gt=De(!0);xe(String,"String",function(e){this._t=String(e),this._i=0;},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=gt(t,r),this._i+=e.length,{value:e,done:!1})});var yt,xt,bt,At=function(e,t,r,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(r+": incorrect invocation!");return e},Tt=function(e,t,r,n){try{return n?t(c(r)[0],r[1]):t(r)}catch(t){var i=e.return;throw void 0!==i&&c(i.call(e)),t}},wt=l("iterator"),Et=Array.prototype,Rt=function(e){return void 0!==e&&(R.Array===e||Et[wt]===e)},Mt=l("iterator"),St=r.getIteratorMethod=function(e){if(null!=e)return e[Mt]||e["@@iterator"]||R[Be(e)]},zt=t(function(e){var t={},r={},n=e.exports=function(e,n,i,o,s){var a,l,u,f,h=s?function(){return e}:St(e),d=F(i,o,n?2:1),p=0;if("function"!=typeof h)throw TypeError(e+" is not iterable!");if(Rt(h)){for(a=B(e.length);a>p;p++)if((f=n?d(c(l=e[p])[0],l[1]):d(e[p]))===t||f===r)return f}else for(u=h.call(e);!(l=u.next()).done;)if((f=Tt(u,d,l.value,n))===t||f===r)return f};n.BREAK=t,n.RETURN=r;}),Pt=l("species"),Nt=function(e,t){var r,n=c(e).constructor;return void 0===n||null==(r=c(n)[Pt])?t:I(r)},kt=n.process,Lt=n.setImmediate,Ot=n.clearImmediate,It=n.MessageChannel,Ft=n.Dispatch,Ut=0,Dt={},Gt=function(){var e=+this;if(Dt.hasOwnProperty(e)){var t=Dt[e];delete Dt[e],t();}},jt=function(e){Gt.call(e.data);};Lt&&Ot||(Lt=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return Dt[++Ut]=function(){!function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}e.apply(r,t);}("function"==typeof e?e:Function(e),t);},yt(Ut),Ut},Ot=function(e){delete Dt[e];},"process"==S(kt)?yt=function(e){kt.nextTick(F(Gt,e,1));}:Ft&&Ft.now?yt=function(e){Ft.now(F(Gt,e,1));}:It?(bt=(xt=new It).port2,xt.port1.onmessage=jt,yt=F(bt.postMessage,bt,1)):n.addEventListener&&"function"==typeof postMessage&&!n.importScripts?(yt=function(e){n.postMessage(e+"","*");},n.addEventListener("message",jt,!1)):yt="onreadystatechange"in _("script")?function(e){ne.appendChild(_("script")).onreadystatechange=function(){ne.removeChild(this),Gt.call(e);};}:function(e){setTimeout(F(Gt,e,1),0);});var Ct={set:Lt,clear:Ot},Vt=Ct.set,Bt=n.MutationObserver||n.WebKitMutationObserver,qt=n.process,Ht=n.Promise,Xt="process"==S(qt);function Wt(e){var t,r;this.promise=new e(function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n;}),this.resolve=I(t),this.reject=I(r);}var Yt={f:function(e){return new Wt(e)}},Zt=function(e){try{return {e:!1,v:e()}}catch(e){return {e:!0,v:e}}},Jt=n.navigator,$t=Jt&&Jt.userAgent||"",Kt=function(e,t,r){for(var n in t)O(e,n,t[n],r);return e},Qt=l("species"),er=function(e){var t=n[e];h&&t&&!t[Qt]&&y.f(t,Qt,{configurable:!0,get:function(){return this}});},tr=l("iterator"),rr=!1;try{[7][tr]().return=function(){rr=!0;};}catch(e){}var nr,ir,or,sr,ar=function(e,t){if(!t&&!rr)return !1;var r=!1;try{var n=[7],i=n[tr]();i.next=function(){return {done:r=!0}},n[tr]=function(){return i},e(n);}catch(e){}return r},lr=Ct.set,ur=function(){var e,t,r,i=function(){var n,i;for(Xt&&(n=qt.domain)&&n.exit();e;){i=e.fn,e=e.next;try{i();}catch(n){throw e?r():t=void 0,n}}t=void 0,n&&n.enter();};if(Xt)r=function(){qt.nextTick(i);};else if(!Bt||n.navigator&&n.navigator.standalone)if(Ht&&Ht.resolve){var o=Ht.resolve(void 0);r=function(){o.then(i);};}else r=function(){Vt.call(n,i);};else{var s=!0,a=document.createTextNode("");new Bt(i).observe(a,{characterData:!0}),r=function(){a.data=s=!s;};}return function(n){var i={fn:n,next:void 0};t&&(t.next=i),e||(e=i,r()),t=i;}}(),cr=n.TypeError,fr=n.process,hr=fr&&fr.versions,dr=hr&&hr.v8||"",pr=n.Promise,_r="process"==Be(fr),mr=function(){},vr=ir=Yt.f,gr=!!function(){try{var e=pr.resolve(1),t=(e.constructor={})[l("species")]=function(e){e(mr,mr);};return (_r||"function"==typeof PromiseRejectionEvent)&&e.then(mr)instanceof t&&0!==dr.indexOf("6.6")&&-1===$t.indexOf("Chrome/66")}catch(e){}}(),yr=function(e){var t;return !(!u(e)||"function"!=typeof(t=e.then))&&t},xr=function(e,t){if(!e._n){e._n=!0;var r=e._c;ur(function(){for(var n=e._v,i=1==e._s,o=0,s=function(t){var r,o,s,a=i?t.ok:t.fail,l=t.resolve,u=t.reject,c=t.domain;try{a?(i||(2==e._h&&Tr(e),e._h=1),!0===a?r=n:(c&&c.enter(),r=a(n),c&&(c.exit(),s=!0)),r===t.promise?u(cr("Promise-chain cycle")):(o=yr(r))?o.call(r,l,u):l(r)):u(n);}catch(e){c&&!s&&c.exit(),u(e);}};r.length>o;)s(r[o++]);e._c=[],e._n=!1,t&&!e._h&&br(e);});}},br=function(e){lr.call(n,function(){var t,r,i,o=e._v,s=Ar(e);if(s&&(t=Zt(function(){_r?fr.emit("unhandledRejection",o,e):(r=n.onunhandledrejection)?r({promise:e,reason:o}):(i=n.console)&&i.error&&i.error("Unhandled promise rejection",o);}),e._h=_r||Ar(e)?2:1),e._a=void 0,s&&t.e)throw t.v});},Ar=function(e){return 1!==e._h&&0===(e._a||e._c).length},Tr=function(e){lr.call(n,function(){var t;_r?fr.emit("rejectionHandled",e):(t=n.onrejectionhandled)&&t({promise:e,reason:e._v});});},wr=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),xr(t,!0));},Er=function(e){var t,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===e)throw cr("Promise can't be resolved itself");(t=yr(e))?ur(function(){var n={_w:r,_d:!1};try{t.call(e,F(Er,n,1),F(wr,n,1));}catch(e){wr.call(n,e);}}):(r._v=e,r._s=1,xr(r,!1));}catch(e){wr.call({_w:r,_d:!1},e);}}};gr||(pr=function(e){At(this,pr,"Promise","_h"),I(e),nr.call(this);try{e(F(Er,this,1),F(wr,this,1));}catch(e){wr.call(this,e);}},(nr=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1;}).prototype=Kt(pr.prototype,{then:function(e,t){var r=vr(Nt(this,pr));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=_r?fr.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&xr(this,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),or=function(){var e=new nr;this.promise=e,this.resolve=F(Er,e,1),this.reject=F(wr,e,1);},Yt.f=vr=function(e){return e===pr||e===sr?new or(e):ir(e)}),D(D.G+D.W+D.F*!gr,{Promise:pr}),ce(pr,"Promise"),er("Promise"),sr=r.Promise,D(D.S+D.F*!gr,"Promise",{reject:function(e){var t=vr(this);return (0,t.reject)(e),t.promise}}),D(D.S+D.F*!gr,"Promise",{resolve:function(e){return function(e,t){if(c(e),u(t)&&t.constructor===e)return t;var r=Yt.f(e);return (0,r.resolve)(t),r.promise}(this,e)}}),D(D.S+D.F*!(gr&&ar(function(e){pr.all(e).catch(mr);})),"Promise",{all:function(e){var t=this,r=vr(t),n=r.resolve,i=r.reject,o=Zt(function(){var r=[],o=0,s=1;zt(e,!1,function(e){var a=o++,l=!1;r.push(void 0),s++,t.resolve(e).then(function(e){l||(l=!0,r[a]=e,--s||n(r));},i);}),--s||n(r);});return o.e&&i(o.v),r.promise},race:function(e){var t=this,r=vr(t),n=r.reject,i=Zt(function(){zt(e,!1,function(e){t.resolve(e).then(r.resolve,n);});});return i.e&&n(i.v),r.promise}});var Rr=y.f,Mr=Function.prototype,Sr=/^\s*function ([^ (]*)/;"name"in Mr||h&&Rr(Mr,"name",{configurable:!0,get:function(){try{return (""+this).match(Sr)[1]}catch(e){return ""}}});var zr=function(e,t){var n=(r.Object||{})[e]||Object[e],i={};i[e]=t(n),D(D.S+D.F*f(function(){n(1);}),"Object",i);};function Pr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}function Nr(e,t,r){return t&&Pr(e.prototype,t),r&&Pr(e,r),e}function kr(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t;}function Lr(e){return (Lr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Or(e,t){return (Or=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ir(e,t,r){return (Ir=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,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&Or(i,r.prototype),i}).apply(null,arguments)}function Fr(e){var t="function"==typeof Map?new Map:void 0;return (Fr=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n);}function n(){return Ir(e,arguments,Lr(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Or(n,e)})(e)}zr("keys",function(){return function(e){return ee(de(e))}});var Ur,Dr="v0.20.1",Gr=l("match"),jr=function(e){var t;return u(e)&&(void 0!==(t=e[Gr])?!!t:"RegExp"==S(e))},Cr=Math.min,Vr=[].push,Br=!f(function(){});rt("split",2,function(e,t,r,n){var i;return i="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,t){var n=String(this);if(void 0===e&&0===t)return [];if(!jr(e))return r.call(n,e,t);for(var i,o,s,a=[],l=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),u=0,c=void 0===t?4294967295:t>>>0,f=new RegExp(e.source,l+"g");(i=Ke.call(f,n))&&!((o=f.lastIndex)>u&&(a.push(n.slice(u,i.index)),i.length>1&&i.index<n.length&&Vr.apply(a,i.slice(1)),s=i[0].length,u=o,a.length>=c));)f.lastIndex===i.index&&f.lastIndex++;return u===n.length?!s&&f.test("")||a.push(""):a.push(n.slice(u)),a.length>c?a.slice(0,c):a}:"0".split(void 0,0).length?function(e,t){return void 0===e&&0===t?[]:r.call(this,e,t)}:r,[function(r,n){var o=e(this),s=null==r?void 0:r[t];return void 0!==s?s.call(r,o,n):i.call(String(o),r,n)},function(e,t){var o=n(i,e,this,t,i!==r);if(o.done)return o.value;var s=c(e),a=String(this),l=Nt(s,RegExp),u=s.unicode,f=(s.ignoreCase?"i":"")+(s.multiline?"m":"")+(s.unicode?"u":"")+(Br?"y":"g"),h=new l(Br?s:"^(?:"+s.source+")",f),d=void 0===t?4294967295:t>>>0;if(0===d)return [];if(0===a.length)return null===He(h,a)?[a]:[];for(var p=0,_=0,m=[];_<a.length;){h.lastIndex=Br?_:0;var v,g=He(h,Br?a:a.slice(_));if(null===g||(v=Cr(B(h.lastIndex+(Br?0:_)),a.length))===p)_=je(a,_,u);else{if(m.push(a.slice(p,_)),m.length===d)return m;for(var y=1;y<=g.length-1;y++)if(m.push(g[y]),m.length===d)return m;_=p=v;}}return m.push(a.slice(p)),m}]});var qr=Ur={},Hr=0,Xr={};function Wr(e){var t=[];"string"==typeof e&&(t=e.split("."),e=t.pop());for(var r=Ur.targets,n=0;n<t.length;n++){if(!r[t[n]])return [];r=r[t[n]];}return [e,r]}function Yr(e){Array.isArray(e)&&e.filter(function(e){return e.parent&&e.property}).forEach(function(e){return delete e.parent[e.property]});}Ur.targets={},Ur.addTarget=function(e,t){Ur.targets[e]=t;},Ur.removeTarget=function(e){e&&delete Ur.targets[e];},Ur.withTransferables=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!(this instanceof Ur.withTransferables))return Ir(Ur.withTransferables,t);this.value=t,this.transferables=function e(t,r,n,i){void 0===r&&(r=null);void 0===n&&(n=null);void 0===i&&(i=[]);if(!t)return i;if(Array.isArray(t))t.forEach(function(r,n){return e(r,t,n,i)});else if("object"==typeof t)if(t instanceof ArrayBuffer)i.push({object:t,parent:r,property:n});else if(t.buffer instanceof ArrayBuffer)i.push({object:t.buffer,parent:r,property:n});else for(var o in t)e(t[o],t,o,i);return i}(this.value);},Ue.is_main&&(Ur.postMessage=function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];if(Array.isArray(e))return Promise.all(e.map(function(e){var r;return (r=Ur).postMessage.apply(r,[e,t].concat(n))}));var o={};"object"==typeof t&&(o=t,t=t.method);var s,a=new Promise(function(e,r){Xr[Hr]={method:t,message:n,resolve:e,reject:r};}),l=[];return n&&1===n.length&&n[0]instanceof Ur.withTransferables&&(l=n[0].transferables,n=n[0].value),s={type:"main_send",message_id:Hr,method:t,message:n},o.stringify&&(s=JSON.stringify(s)),e.postMessage(s,l.map(function(e){return e.object})),Yr(l),l.length>0&&Kr("trace","'"+t+"' transferred "+l.length+" objects to worker thread"),Hr++,a},Ur.addWorker=function(e){if(!(e instanceof Worker))throw Error("Worker broker could not add non-Worker object",e);e.addEventListener("message",function(t){var r="string"==typeof t.data?JSON.parse(t.data):t.data,n=r.message_id;if("worker_reply"===r.type)Xr[n]&&(r.error?Xr[n].reject(r.error):Xr[n].resolve(r.message),delete Xr[n]);else if("worker_send"===r.type&&null!=n){var i,o,s,a,l;try{var u=Wr(r.method);if(a=u[0],!(s=u[1]))throw Error("Worker broker could not dispatch message type "+r.method+" on target "+r.target+" because no object with that name is registered on main thread");if(!(l="function"==typeof s[a]&&s[a]))throw Error("Worker broker could not dispatch message type "+r.method+" on target "+r.target+" because object has no method with that name");i=l.apply(s,r.message);}catch(e){o=e;}var c,f=[];i instanceof Promise?i.then(function(t){t instanceof Ur.withTransferables&&(f=t.transferables,t=t.value[0]),c={type:"main_reply",message_id:n,message:t},e.postMessage(c,f.map(function(e){return e.object})),Yr(f),f.length>0&&Kr("trace","'"+a+"' transferred "+f.length+" objects to worker thread");},function(t){e.postMessage({type:"main_reply",message_id:n,error:t instanceof Error?t.message+": "+t.stack:t});}):(i instanceof Ur.withTransferables&&(f=i.transferables,i=i.value[0]),c={type:"main_reply",message_id:n,message:i,error:o instanceof Error?o.message+": "+o.stack:o},e.postMessage(c,f.map(function(e){return e.object})),Yr(f),f.length>0&&Kr("trace","'"+a+"' transferred "+f.length+" objects to worker thread"));}});},Ur.getMessages=function(){return Xr},Ur.getMessageId=function(){return Hr}),Ue.is_worker&&(Ur.postMessage=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i={};"object"==typeof e&&(i=e,e=e.method);var o,s=new Promise(function(t,n){Xr[Hr]={method:e,message:r,resolve:t,reject:n};}),a=[];return r&&1===r.length&&r[0]instanceof Ur.withTransferables&&(a=r[0].transferables,r=r[0].value),o={type:"worker_send",message_id:Hr,method:e,message:r},i.stringify&&(o=JSON.stringify(o)),self.postMessage(o,a.map(function(e){return e.object})),Yr(a),a.length>0&&Kr("trace","'"+e+"' transferred "+a.length+" objects to main thread"),Hr++,s},self.addEventListener("message",function(e){var t="string"==typeof e.data?JSON.parse(e.data):e.data,r=t.message_id;if("main_reply"===t.type)Xr[r]&&(t.error?Xr[r].reject(t.error):Xr[r].resolve(t.message),delete Xr[r]);else if("main_send"===t.type&&null!=r){var n,i,o,s,a;try{var l=Wr(t.method);if(s=l[0],!(o=l[1]))throw Error("Worker broker could not dispatch message type "+t.method+" on target "+t.target+" because no object with that name is registered on main thread");if(!(a="function"==typeof o[s]&&o[s]))throw Error("Worker broker could not dispatch message type "+t.method+" because worker has no method with that name");n=a.apply(o,t.message);}catch(e){i=e;}var u,c=[];n instanceof Promise?n.then(function(e){e instanceof Ur.withTransferables&&(c=e.transferables,e=e.value[0]),u={type:"worker_reply",message_id:r,message:e},self.postMessage(u,c.map(function(e){return e.object})),Yr(c),c.length>0&&Kr("trace","'"+s+"' transferred "+c.length+" objects to main thread");},function(e){self.postMessage({type:"worker_reply",message_id:r,error:e instanceof Error?e.message+": "+e.stack:e});}):(n instanceof Ur.withTransferables&&(c=n.transferables,n=n.value[0]),u={type:"worker_reply",message_id:r,message:n,error:i instanceof Error?i.message+": "+i.stack:i},self.postMessage(u,c.map(function(e){return e.object})),Yr(c),c.length>0&&Kr("trace","'"+s+"' transferred "+c.length+" objects to main thread"));}}));var Zr={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},Jr={},$r={};function Kr(e){var t="object"==typeof e?e.level:e;if(Zr[t]<=Zr[Kr.level]){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];if(Ue.is_worker)return qr.postMessage.apply(qr,[{method:"_logProxy",stringify:!0},e].concat(n));if("object"==typeof e&&!0===e.once){if($r[JSON.stringify(n)])return Promise.resolve(!1);$r[JSON.stringify(n)]=!0;}var o=function(e){if(Ue.is_main)return Jr[e]=Jr[e]||(console[e]?console[e]:console.log).bind(console),Jr[e]}(t);return n.length>1?o.apply(void 0,["Qcldicp "+Dr+" ["+t+"]: "+n[0]].concat(n.slice(1))):o("Qcldicp "+Dr+" ["+t+"]: "+n[0]),Promise.resolve(!0)}return Promise.resolve(!1)}Kr.level="info",Kr.workers=null,Kr.setLevel=function(e){Kr.level=e,Ue.is_main&&Array.isArray(Kr.workers)&&qr.postMessage(Kr.workers,"_logSetLevelProxy",e);},Ue.is_main&&(Kr.setWorkers=function(e){Kr.workers=e;},Kr.reset=function(){$r={};}),qr.addTarget("_logProxy",Kr),qr.addTarget("_logSetLevelProxy",Kr.setLevel),h&&"g"!=/./g.flags&&y.f(RegExp.prototype,"flags",{configurable:!0,get:Xe});var Qr=/./.toString,en=function(e){O(RegExp.prototype,"toString",e,!0);};f(function(){return "/a/b"!=Qr.call({source:"a",flags:"b"})})?en(function(){var e=c(this);return "/".concat(e.source,"/","flags"in e?e.flags:!h&&e instanceof RegExp?Xe.call(e):void 0)}):"toString"!=Qr.name&&en(function(){return Qr.call(this)});var tn,rn={};qr.addTarget("Utils",rn),rn.isSafari=function(){return /^((?!chrome|android).)*safari/i.test(navigator.userAgent)},rn.isMicrosoft=function(){return /(Trident\/7.0|Edge[ \/](\d+[.\d]+))/i.test(navigator.userAgent)},rn._requests={},rn._proxy_requests={},rn.io=function(e,t,r,n,i,o,s){if(void 0===t&&(t=6e4),void 0===r&&(r="text"),void 0===n&&(n="GET"),void 0===i&&(i={}),void 0===o&&(o=null),void 0===s&&(s=!1),Ue.is_worker&&rn.isMicrosoft())return Kr("debug","Proxying request for URL to worker",e),o&&(rn._proxy_requests[o]=!0),qr.postMessage("Utils.io",e,t,r,n,i,o,!0);var a=new XMLHttpRequest,l=new Promise(function(o,s){if(a.open(n,e,!0),a.timeout=t,a.responseType=r,i&&"object"==typeof i)for(var l in i)a.setRequestHeader(l,i[l]);a.onload=function(){200===a.status?["text","json"].indexOf(a.responseType)>-1?o({body:a.responseText,status:a.status}):o({body:a.response,status:a.status}):204===a.status?o({body:null,status:a.status}):s(Error("Request error with a status of "+a.statusText));},a.onerror=function(e){s(Error("There was a network error"+e.toString()));},a.ontimeout=function(e){s(Error("timeout "+e.toString()));},a.send();});return l=l.then(function(e){return o&&delete rn._requests[o],s?qr.withTransferables(e):e}),o&&(rn._requests[o]=a),l},rn.cancelRequest=function(e){if(Ue.is_worker&&rn._proxy_requests[e])return qr.postMessage("Utils.cancelRequest",e);rn._requests[e]?(Kr("trace","Cancelling network request key '"+e+"'"),rn._requests[e].abort(),delete rn._requests[e]):Kr("trace","Could not find network request key '"+e+"'");},rn.serializeWithFunctions=function(e){return "function"==typeof e?e.toString():JSON.stringify(e,function(e,t){return "function"==typeof t?t.toString():t})},rn.use_high_density_display=!0,rn.updateDevicePixelRatio=function(){var e=rn.device_pixel_ratio;return rn.device_pixel_ratio=rn.use_high_density_display&&window.devicePixelRatio||1,rn.device_pixel_ratio!==e},Ue.is_main&&rn.updateDevicePixelRatio(),rn.isPowerOf2=function(e){return 0==(e&e-1)},rn.interpolate=function(e,t,r){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var n,i,o,s,a;if(e<=t[0][0])s=t[0][1],"function"==typeof r&&(s=r(s));else if(e>=t[t.length-1][0])s=t[t.length-1][1],"function"==typeof r&&(s=r(s));else for(var l=0;l<t.length-1;l++)if(e>=t[l][0]&&e<t[l+1][0]){if(n=t[l][0],i=t[l+1][0],Array.isArray(t[l][1])){s=[];for(var u=0;u<t[l][1].length;u++)"function"==typeof r?(a=r(t[l][1][u]),o=r(t[l+1][1][u])-a,s[u]=o*(e-n)/(i-n)+a):(o=t[l+1][1][u]-t[l][1][u],s[u]=o*(e-n)/(i-n)+t[l][1][u]);}else"function"==typeof r?(a=r(t[l][1]),s=(o=r(t[l+1][1])-a)*(e-n)/(i-n)+a):s=(o=t[l+1][1]-t[l][1])*(e-n)/(i-n)+t[l][1];break}return s},rn.toCSSColor=function(e){return 1===e[3]?"rgb("+e.slice(0,3).map(function(e){return Math.round(255*e)}).join(", ")+")":"rgba("+e.map(function(e,t){return t<3&&Math.round(255*e)||e}).join(", ")+")"};var nn=tn={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,wireframe:!1};var on=function(e,t){if(c(e),!u(t)&&null!==t)throw TypeError(t+": can't set as prototype!")},sn={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{(r=F(Function.call,vt.f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array);}catch(e){t=!0;}return function(e,n){return on(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:on}.set,an=function(e,t,r){var n,i=t.constructor;return i!==r&&"function"==typeof i&&(n=i.prototype)!==r.prototype&&u(n)&&sn&&sn(e,n),e},ln=y.f,un=_t.f,cn=n.RegExp,fn=cn,hn=cn.prototype,dn=/a/g,pn=/a/g,_n=new cn(dn)!==dn;if(h&&(!_n||f(function(){return pn[l("match")]=!1,cn(dn)!=dn||cn(pn)==pn||"/a/i"!=cn(dn,"i")}))){cn=function(e,t){var r=this instanceof cn,n=jr(e),i=void 0===t;return !r&&n&&e.constructor===cn&&i?e:an(_n?new fn(n&&!i?e.source:e,t):fn((n=e instanceof cn)?e.source:e,n&&i?Xe.call(e):t),r?this:hn,cn)};for(var mn=function(e){e in cn||ln(cn,e,{configurable:!0,get:function(){return fn[e]},set:function(t){fn[e]=t;}});},vn=un(fn),gn=0;vn.length>gn;)mn(vn[gn++]);hn.constructor=cn,cn.prototype=hn,O(n,"RegExp",cn);}er("RegExp");var yn,xn=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};function bn(e){if("string"==typeof e&&-1===e.search(/^(data|blob):/)){var t=e.indexOf("?");t>-1&&(e=e.substr(0,t));var r=e.indexOf("#");return r>-1&&(e=e.substr(0,r)),e.substr(0,e.lastIndexOf("/")+1)||""}return ""}function An(e){if("string"==typeof e)return !(e.search(/^(http|https|data|blob):/)>-1||"//"===e.substr(0,2))}function Tn(e,t){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===r?"":decodeURIComponent(r[1].replace(/\+/g," "))}rt("search",1,function(e,t,r,n){return [function(r){var n=e(this),i=null==r?void 0:r[t];return void 0!==i?i.call(r,n):new RegExp(r)[t](String(n))},function(e){var t=n(r,e,this);if(t.done)return t.value;var i=c(e),o=String(this),s=i.lastIndex;xn(s,0)||(i.lastIndex=0);var a=He(i,o);return xn(i.lastIndex,s)||(i.lastIndex=s),null===a?-1:a.index}]});var wn={id:0,queue:[],max_time:20,start_time:null,state:{},add:function(e){e.id=wn.id++,e.max_time=e.max_time||wn.max_time,e.pause_factor=e.pause_factor||1;var t=new Promise(function(t,r){e.resolve=t,e.reject=r;});return e.promise=t,e.elapsed=0,e.total_elapsed=0,e.stats={calls:0},this.queue.push(e),this.start_time=this.start_time||performance.now(),this.elapsed=performance.now()-this.start_time,(this.elapsed<wn.max_time||e.immediate)&&this.process(e),e.promise},remove:function(e){var t=this.queue.indexOf(e);t>-1&&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>=wn.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<wn.max_time},removeForTile:function(e){for(var t=this.queue.length-1;t>=0;t--)this.queue[t].tile_id===e&&(this.cancel(this.queue[t]),this.queue.splice(t,1));},setState:function(e){this.state=e;}};function En(e){var t=[];return Object.assign(e,{subscribe:function(e){-1===t.indexOf(e)&&t.push(e);},unsubscribe:function(e){var r=t.indexOf(e);r>-1&&t.splice(r,1);},unsubscribeAll:function(){t=[];},trigger:function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];t.forEach(function(t){if("function"==typeof t[e])try{t[e].apply(t,n);}catch(t){Kr("warn","Caught exception in listener for event '"+e+"':",t);}});},hasSubscribersFor:function(e){var r=!1;return t.forEach(function(t){"function"==typeof t[e]&&(r=!0);}),r}})}function Rn(e,t){var r={};return t.forEach(function(t){return r[t]=e[t]}),r}D(D.P,"String",{repeat:function(e){var t=String(P(this)),r="",n=C(e);if(n<0||n==1/0)throw RangeError("Count can't be negative");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r}});for(var Mn,Sn=a("typed_array"),zn=a("view"),Pn=!(!n.ArrayBuffer||!n.DataView),Nn=Pn,kn=0,Ln="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");kn<9;)(Mn=n[Ln[kn++]])?(b(Mn.prototype,Sn,!0),b(Mn.prototype,zn,!0)):Nn=!1;var On={ABV:Pn,CONSTR:Nn,TYPED:Sn,VIEW:zn},In=function(e){if(void 0===e)return 0;var t=C(e),r=B(t);if(t!==r)throw RangeError("Wrong length!");return r},Fn=function(e){for(var t=de(this),r=B(t.length),n=arguments.length,i=X(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,s=void 0===o?r:X(o,r);s>i;)t[i++]=e;return t},Un=t(function(e,t){var r=_t.f,i=y.f,o="prototype",s="Wrong index!",a=n.ArrayBuffer,l=n.DataView,u=n.Math,c=n.RangeError,d=n.Infinity,p=a,_=u.abs,m=u.pow,v=u.floor,g=u.log,x=u.LN2,A=h?"_b":"buffer",T=h?"_l":"byteLength",w=h?"_o":"byteOffset";function E(e,t,r){var n,i,o,s=new Array(r),a=8*r-t-1,l=(1<<a)-1,u=l>>1,c=23===t?m(2,-24)-m(2,-77):0,f=0,h=e<0||0===e&&1/e<0?1:0;for((e=_(e))!=e||e===d?(i=e!=e?1:0,n=l):(n=v(g(e)/x),e*(o=m(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?c/o:c*m(2,1-u))*o>=2&&(n++,o/=2),n+u>=l?(i=0,n=l):n+u>=1?(i=(e*o-1)*m(2,t),n+=u):(i=e*m(2,u-1)*m(2,t),n=0));t>=8;s[f++]=255&i,i/=256,t-=8);for(n=n<<t|i,a+=t;a>0;s[f++]=255&n,n/=256,a-=8);return s[--f]|=128*h,s}function R(e,t,r){var n,i=8*r-t-1,o=(1<<i)-1,s=o>>1,a=i-7,l=r-1,u=e[l--],c=127&u;for(u>>=7;a>0;c=256*c+e[l],l--,a-=8);for(n=c&(1<<-a)-1,c>>=-a,a+=t;a>0;n=256*n+e[l],l--,a-=8);if(0===c)c=1-s;else{if(c===o)return n?NaN:u?-d:d;n+=m(2,t),c-=s;}return (u?-1:1)*n*m(2,c-t)}function M(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]}function S(e){return [255&e]}function z(e){return [255&e,e>>8&255]}function P(e){return [255&e,e>>8&255,e>>16&255,e>>24&255]}function N(e){return E(e,52,8)}function k(e){return E(e,23,4)}function L(e,t,r){i(e[o],t,{get:function(){return this[r]}});}function O(e,t,r,n){var i=In(+r);if(i+t>e[T])throw c(s);var o=e[A]._b,a=i+e[w],l=o.slice(a,a+t);return n?l:l.reverse()}function I(e,t,r,n,i,o){var a=In(+r);if(a+t>e[T])throw c(s);for(var l=e[A]._b,u=a+e[w],f=n(+i),h=0;h<t;h++)l[u+h]=f[o?h:t-h-1];}if(On.ABV){if(!f(function(){a(1);})||!f(function(){new a(-1);})||f(function(){return new a,new a(1.5),new a(NaN),"ArrayBuffer"!=a.name})){for(var F,U=(a=function(e){return At(this,a),new p(In(e))})[o]=p[o],D=r(p),G=0;D.length>G;)(F=D[G++])in a||b(a,F,p[F]);U.constructor=a;}var j=new l(new a(2)),V=l[o].setInt8;j.setInt8(0,2147483648),j.setInt8(1,2147483649),!j.getInt8(0)&&j.getInt8(1)||Kt(l[o],{setInt8:function(e,t){V.call(this,e,t<<24>>24);},setUint8:function(e,t){V.call(this,e,t<<24>>24);}},!0);}else a=function(e){At(this,a,"ArrayBuffer");var t=In(e);this._b=Fn.call(new Array(t),0),this[T]=t;},l=function(e,t,r){At(this,l,"DataView"),At(e,a,"DataView");var n=e[T],i=C(t);if(i<0||i>n)throw c("Wrong offset!");if(i+(r=void 0===r?n-i:B(r))>n)throw c("Wrong length!");this[A]=e,this[w]=i,this[T]=r;},h&&(L(a,"byteLength","_l"),L(l,"buffer","_b"),L(l,"byteLength","_l"),L(l,"byteOffset","_o")),Kt(l[o],{getInt8:function(e){return O(this,1,e)[0]<<24>>24},getUint8:function(e){return O(this,1,e)[0]},getInt16:function(e){var t=O(this,2,e,arguments[1]);return (t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=O(this,2,e,arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return M(O(this,4,e,arguments[1]))},getUint32:function(e){return M(O(this,4,e,arguments[1]))>>>0},getFloat32:function(e){return R(O(this,4,e,arguments[1]),23,4)},getFloat64:function(e){return R(O(this,8,e,arguments[1]),52,8)},setInt8:function(e,t){I(this,1,e,S,t);},setUint8:function(e,t){I(this,1,e,S,t);},setInt16:function(e,t){I(this,2,e,z,t,arguments[2]);},setUint16:function(e,t){I(this,2,e,z,t,arguments[2]);},setInt32:function(e,t){I(this,4,e,P,t,arguments[2]);},setUint32:function(e,t){I(this,4,e,P,t,arguments[2]);},setFloat32:function(e,t){I(this,4,e,k,t,arguments[2]);},setFloat64:function(e,t){I(this,8,e,N,t,arguments[2]);}});ce(a,"ArrayBuffer"),ce(l,"DataView"),b(l[o],On.VIEW,!0),t.ArrayBuffer=a,t.DataView=l;}),Dn=l("species"),Gn=function(e,t){return new(function(e){var t;return dt(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!dt(t.prototype)||(t=void 0),u(t)&&null===(t=t[Dn])&&(t=void 0)),void 0===t?Array:t}(e))(t)},jn=function(e,t){var r=1==e,n=2==e,i=3==e,o=4==e,s=6==e,a=5==e||s,l=t||Gn;return function(t,u,c){for(var f,h,d=de(t),p=z(d),_=F(u,c,3),m=B(p.length),v=0,g=r?l(t,m):n?l(t,0):void 0;m>v;v++)if((a||v in p)&&(h=_(f=p[v],v,d),e))if(r)g[v]=h;else if(h)switch(e){case 3:return !0;case 5:return f;case 6:return v;case 2:g.push(f);}else if(o)return !1;return s?-1:i||o?o:g}},Cn=[].copyWithin||function(e,t){var r=de(this),n=B(r.length),i=X(e,n),o=X(t,n),s=arguments.length>2?arguments[2]:void 0,a=Math.min((void 0===s?n:X(s,n))-o,n-i),l=1;for(o<i&&i<o+a&&(l=-1,o+=a-1,i+=a-1);a-- >0;)o in r?r[i]=r[o]:delete r[i],i+=l,o+=l;return r},Vn=t(function(e){if(h){var t=n,r=f,i=D,o=On,s=Un,c=F,d=At,p=x,_=b,m=Kt,g=C,A=B,T=In,w=X,E=v,M=L,S=Be,z=u,P=de,N=Rt,k=ae,O=me,I=_t.f,U=St,G=a,j=l,V=jn,q=W,H=Nt,Y=be,Z=R,J=ar,$=er,K=Fn,Q=Cn,ee=y,te=vt,re=ee.f,ne=te.f,ie=t.RangeError,oe=t.TypeError,se=t.Uint8Array,le=Array.prototype,ue=s.ArrayBuffer,ce=s.DataView,fe=V(0),he=V(2),pe=V(3),_e=V(4),ve=V(5),ge=V(6),ye=q(!0),xe=q(!1),Ae=Y.values,Te=Y.keys,we=Y.entries,Ee=le.lastIndexOf,Re=le.reduce,Me=le.reduceRight,Se=le.join,ze=le.sort,Pe=le.slice,Ne=le.toString,ke=le.toLocaleString,Le=j("iterator"),Oe=j("toStringTag"),Ie=G("typed_constructor"),Fe=G("def_constructor"),Ue=o.CONSTR,De=o.TYPED,Ge=o.VIEW,je=V(1,function(e,t){return Xe(H(e,e[Fe]),t)}),Ce=r(function(){return 1===new se(new Uint16Array([1]).buffer)[0]}),Ve=!!se&&!!se.prototype.set&&r(function(){new se(1).set({});}),qe=function(e,t){var r=g(e);if(r<0||r%t)throw ie("Wrong offset!");return r},He=function(e){if(z(e)&&De in e)return e;throw oe(e+" is not a typed array!")},Xe=function(e,t){if(!(z(e)&&Ie in e))throw oe("It is not a typed array constructor!");return new e(t)},We=function(e,t){return Ye(H(e,e[Fe]),t)},Ye=function(e,t){for(var r=0,n=t.length,i=Xe(e,n);n>r;)i[r]=t[r++];return i},Ze=function(e,t,r){re(e,t,{get:function(){return this._d[r]}});},Je=function(e){var t,r,n,i,o,s,a=P(e),l=arguments.length,u=l>1?arguments[1]:void 0,f=void 0!==u,h=U(a);if(null!=h&&!N(h)){for(s=h.call(a),n=[],t=0;!(o=s.next()).done;t++)n.push(o.value);a=n;}for(f&&l>2&&(u=c(u,arguments[2],2)),t=0,r=A(a.length),i=Xe(this,r);r>t;t++)i[t]=f?u(a[t],t):a[t];return i},$e=function(){for(var e=0,t=arguments.length,r=Xe(this,t);t>e;)r[e]=arguments[e++];return r},Ke=!!se&&r(function(){ke.call(new se(1));}),Qe=function(){return ke.apply(Ke?Pe.call(He(this)):He(this),arguments)},et={copyWithin:function(e,t){return Q.call(He(this),e,t,arguments.length>2?arguments[2]:void 0)},every:function(e){return _e(He(this),e,arguments.length>1?arguments[1]:void 0)},fill:function(e){return K.apply(He(this),arguments)},filter:function(e){return We(this,he(He(this),e,arguments.length>1?arguments[1]:void 0))},find:function(e){return ve(He(this),e,arguments.length>1?arguments[1]:void 0)},findIndex:function(e){return ge(He(this),e,arguments.length>1?arguments[1]:void 0)},forEach:function(e){fe(He(this),e,arguments.length>1?arguments[1]:void 0);},indexOf:function(e){return xe(He(this),e,arguments.length>1?arguments[1]:void 0)},includes:function(e){return ye(He(this),e,arguments.length>1?arguments[1]:void 0)},join:function(e){return Se.apply(He(this),arguments)},lastIndexOf:function(e){return Ee.apply(He(this),arguments)},map:function(e){return je(He(this),e,arguments.length>1?arguments[1]:void 0)},reduce:function(e){return Re.apply(He(this),arguments)},reduceRight:function(e){return Me.apply(He(this),arguments)},reverse:function(){for(var e,t=He(this).length,r=Math.floor(t/2),n=0;n<r;)e=this[n],this[n++]=this[--t],this[t]=e;return this},some:function(e){return pe(He(this),e,arguments.length>1?arguments[1]:void 0)},sort:function(e){return ze.call(He(this),e)},subarray:function(e,t){var r=He(this),n=r.length,i=w(e,n);return new(H(r,r[Fe]))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,A((void 0===t?n:w(t,n))-i))}},tt=function(e,t){return We(this,Pe.call(He(this),e,t))},rt=function(e){He(this);var t=qe(arguments[1],1),r=this.length,n=P(e),i=A(n.length),o=0;if(i+t>r)throw ie("Wrong length!");for(;o<i;)this[t+o]=n[o++];},nt={entries:function(){return we.call(He(this))},keys:function(){return Te.call(He(this))},values:function(){return Ae.call(He(this))}},it=function(e,t){return z(e)&&e[De]&&"symbol"!=typeof t&&t in e&&String(+t)==String(t)},ot=function(e,t){return it(e,t=E(t,!0))?p(2,e[t]):ne(e,t)},st=function(e,t,r){return !(it(e,t=E(t,!0))&&z(r)&&M(r,"value"))||M(r,"get")||M(r,"set")||r.configurable||M(r,"writable")&&!r.writable||M(r,"enumerable")&&!r.enumerable?re(e,t,r):(e[t]=r.value,e)};Ue||(te.f=ot,ee.f=st),i(i.S+i.F*!Ue,"Object",{getOwnPropertyDescriptor:ot,defineProperty:st}),r(function(){Ne.call({});})&&(Ne=ke=function(){return Se.call(this)});var at=m({},et);m(at,nt),_(at,Le,nt.values),m(at,{slice:tt,set:rt,constructor:function(){},toString:Ne,toLocaleString:Qe}),Ze(at,"buffer","b"),Ze(at,"byteOffset","o"),Ze(at,"byteLength","l"),Ze(at,"length","e"),re(at,Oe,{get:function(){return this[De]}}),e.exports=function(e,n,s,a){var l=e+((a=!!a)?"Clamped":"")+"Array",u="get"+e,c="set"+e,f=t[l],h=f||{},p=f&&O(f),m=!f||!o.ABV,v={},g=f&&f.prototype,y=function(e,t){re(e,t,{get:function(){return function(e,t){var r=e._d;return r.v[u](t*n+r.o,Ce)}(this,t)},set:function(e){return function(e,t,r){var i=e._d;a&&(r=(r=Math.round(r))<0?0:r>255?255:255&r),i.v[c](t*n+i.o,r,Ce);}(this,t,e)},enumerable:!0});};m?(f=s(function(e,t,r,i){d(e,f,l,"_d");var o,s,a,u,c=0,h=0;if(z(t)){if(!(t instanceof ue||"ArrayBuffer"==(u=S(t))||"SharedArrayBuffer"==u))return De in t?Ye(f,t):Je.call(f,t);o=t,h=qe(r,n);var p=t.byteLength;if(void 0===i){if(p%n)throw ie("Wrong length!");if((s=p-h)<0)throw ie("Wrong length!")}else if((s=A(i)*n)+h>p)throw ie("Wrong length!");a=s/n;}else a=T(t),o=new ue(s=a*n);for(_(e,"_d",{b:o,o:h,l:s,e:a,v:new ce(o)});c<a;)y(e,c++);}),g=f.prototype=k(at),_(g,"constructor",f)):r(function(){f(1);})&&r(function(){new f(-1);})&&J(function(e){new f,new f(null),new f(1.5),new f(e);},!0)||(f=s(function(e,t,r,i){var o;return d(e,f,l),z(t)?t instanceof ue||"ArrayBuffer"==(o=S(t))||"SharedArrayBuffer"==o?void 0!==i?new h(t,qe(r,n),i):void 0!==r?new h(t,qe(r,n)):new h(t):De in t?Ye(f,t):Je.call(f,t):new h(T(t))}),fe(p!==Function.prototype?I(h).concat(I(p)):I(h),function(e){e in f||_(f,e,h[e]);}),f.prototype=g,g.constructor=f);var x=g[Le],b=!!x&&("values"==x.name||null==x.name),w=nt.values;_(f,Ie,!0),_(g,De,l),_(g,Ge,!0),_(g,Fe,f),(a?new f(1)[Oe]==l:Oe in g)||re(g,Oe,{get:function(){return l}}),v[l]=f,i(i.G+i.W+i.F*(f!=h),v),i(i.S,l,{BYTES_PER_ELEMENT:n}),i(i.S+i.F*r(function(){h.of.call(f,1);}),l,{from:Je,of:$e}),"BYTES_PER_ELEMENT"in g||_(g,"BYTES_PER_ELEMENT",n),i(i.P,l,et),$(l),i(i.P+i.F*Ve,l,{set:rt}),i(i.P+i.F*!b,l,nt),g.toString!=Ne&&(g.toString=Ne),i(i.P+i.F*r(function(){new f(1).slice();}),l,{slice:tt}),i(i.P+i.F*(r(function(){return [1,2].toLocaleString()!=new f([1,2]).toLocaleString()})||!r(function(){g.toLocaleString.call([1,2]);})),l,{toLocaleString:Qe}),Z[l]=b?x:w,b||_(g,Le,w);};}else e.exports=function(){};});Vn("Uint8",1,function(e){return function(t,r,n){return e(this,t,r,n)}});var Bn=function(){function e(t,r,n){void 0===n&&(n={}),n=e.sliceOptions(n),this.gl=t,this.texture=t.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=r,this.retain_count=0,this.config_type=null,this.loading=null,this.loaded=!1,this.filtering=n.filtering,this.density=n.density||1,this.sprites=n.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,e.textures[this.name]&&(this.retain_count=e.textures[this.name].retain_count,e.textures[this.name].retain_count=0,e.textures[this.name].destroy()),e.textures[this.name]=this,e.texture_configs[this.name]=JSON.stringify(Object.assign({name:r},n)),this.load(n),Kr("trace","creating Texture "+this.name);}var t=e.prototype;return t.destroy=function(t){var r=(void 0===t?{}:t).force;this.retain_count>0&&!r?Kr("error","Texture '"+this.name+"': destroying texture with retain count of '"+this.retain_count+"'"):this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,e.textures[this.name]===this&&(delete e.textures[this.name],delete e.texture_configs[this.name]),this.valid=!1,Kr("trace","destroying Texture "+this.name));},t.retain=function(){this.retain_count++;},t.release=function(){this.retain_count<=0&&Kr("error","Texture '"+this.name+"': releasing texture with retain count of '"+this.retain_count+"'"),this.retain_count--,this.retain_count<=0&&this.destroy();},t.bind=function(t){void 0===t&&(t=0),this.valid&&(e.activeUnit!==t&&(this.gl.activeTexture(this.gl.TEXTURE0+t),e.activeUnit=t,e.boundTexture=null),e.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),e.boundTexture=this.texture));},t.load=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)},t.setUrl=function(t,r){var n=this;if(void 0===r&&(r={}),this.valid)return this.url=t,this.loading=new Promise(function(t){var i=new Image;i.onload=function(){try{if("data:"===n.url.slice(0,5)){var o=document.createElement("canvas"),s=o.getContext("2d");o.width=i.width,o.height=i.height,s.drawImage(i,0,0),n.setElement(o,r);}else n.setElement(i,r);}catch(t){n.loaded=!1,Kr("warn","Texture '"+n.name+"': failed to load url: '"+n.url+"'",t,r),e.trigger("warning",{message:"Failed to load texture from "+n.url,error:t,texture:r});}n.loaded=!0,t(n);},i.onerror=function(i){n.loaded=!1,Kr("warn","Texture '"+n.name+"': failed to load url: '"+n.url+"'",i,r),e.trigger("warning",{message:"Failed to load texture from "+n.url,error:i,texture:r}),t(n);},rn.isSafari()&&"data:"===n.url.slice(0,5)||(i.crossOrigin="anonymous"),i.src=n.url;}),this.loading},t.setData=function(e,t,r,n){return void 0===n&&(n={}),this.width=e,this.height=t,Array.isArray(r)&&(r=new Uint8Array(r)),this.update(r,n),this.setFiltering(n),this.loaded=!0,this.loading=Promise.resolve(this),this.loading},t.setElement=function(t,r){var n=t;if("string"==typeof t&&(t=document.querySelector(t)),t instanceof HTMLCanvasElement||t instanceof HTMLImageElement||t instanceof HTMLVideoElement)this.update(t,r),this.setFiltering(r);else{this.loaded=!1;var i="the 'element' parameter (`element: "+JSON.stringify(n)+"`) must be a CSS ";i+="selector string, or a <canvas>, <image> or <video> object",Kr("warn","Texture '"+this.name+"': "+i,r),e.trigger("warning",{message:"Failed to load texture because "+i,texture:r});}return this.loaded=!0,this.loading=Promise.resolve(this),this.loading},t.update=function(t,r){void 0===r&&(r={}),this.valid&&(this.bind(),t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLImageElement&&t.complete?(this.width=t.width,this.height=t.height,this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1!==r.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t)):(this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,null),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,null),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t)),e.trigger("update",this));},t.setFiltering=function(t){if(void 0===t&&(t={}),this.valid){t.filtering=t.filtering||"linear";var r=this.gl;this.bind(),rn.isPowerOf2(this.width)&&rn.isPowerOf2(this.height)?(this.power_of_2=!0,r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t.TEXTURE_WRAP_S||t.repeat&&r.REPEAT||r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t.TEXTURE_WRAP_T||t.repeat&&r.REPEAT||r.CLAMP_TO_EDGE),"mipmap"===t.filtering?(this.filtering="mipmap",r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.generateMipmap(r.TEXTURE_2D)):"linear"===t.filtering?(this.filtering="linear",r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR)):"nearest"===t.filtering&&(this.filtering="nearest",r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST))):(this.power_of_2=!1,r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),"nearest"===t.filtering?(this.filtering="nearest",r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST)):(this.filtering="linear",r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR))),e.trigger("update",this);}},t.calculateSprites=function(){if(this.sprites)for(var t in this.sprites){var r=this.sprites[t];this.texcoords[t]=e.getTexcoordsForSprite([r[0],r[1]],[r[2],r[3]],[this.width,this.height]),this.sizes[t]=[r[2],r[3]],this.css_sizes[t]=[r[2]/this.density,r[3]/this.density],this.aspects[t]=r[2]/r[3];}},t.byteSize=function(){return Math.round(this.width*this.height*4*("mipmap"==this.filtering?1.33:1))},e}();Bn.create=function(e,t,r){return new Bn(e,t,r)},Bn.retain=function(e){Bn.textures[e]&&Bn.textures[e].retain();},Bn.release=function(e){Bn.textures[e]&&Bn.textures[e].release();},Bn.destroy=function(e){Object.keys(Bn.textures).forEach(function(t){var r=Bn.textures[t];r.gl===e&&r.destroy({force:!0});});},Bn.getSpriteInfo=function(e,t){var r=Bn.textures[e];return r&&{size:r.sizes[t],css_size:r.css_sizes[t],aspect:r.aspects[t],texcoords:r.texcoords[t]}},Bn.getTexcoordsForSprite=function(e,t,r){var n=r[1]-e[1]-t[1];return [e[0]/r[0],n/r[1],(t[0]+e[0])/r[0],(t[1]+n)/r[1]]},Bn.createFromObject=function(e,t){var r=[];if(t)for(var n in t){var i=t[n];if(!i.skip_create&&Bn.changed(n,i)){var o=Bn.create(e,n,i);r.push(o.loading);}}return Promise.all(r)},Bn.default="__default",Bn.createDefault=function(e){return Bn.create(e,Bn.default)},Bn.sliceOptions=function(e){return {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}},Bn.changed=function(e,t){var r=Bn.textures[e];if(r){if("element"===r.config_type||null!=t.element)return !0;if(t=Bn.sliceOptions(t),Bn.texture_configs[e]===JSON.stringify(Object.assign({name:e},t)))return !1}return !0},Bn.getInfo=function(e){if(e||(e=Object.keys(Bn.textures)),Array.isArray(e))return Promise.all(e.map(function(e){return Bn.getInfo(e)}));var t=Bn.textures[e];return t?(t.loading||Promise.resolve(t)).then(function(){return {name:t.name,width:t.width,height:t.height,density:t.density,css_size:[t.width/t.density,t.height/t.density],aspect:t.width/t.height,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)},Bn.syncTexturesToWorker=function(e){return qr.postMessage("Texture.getInfo",e).then(function(e){return e&&e.filter(function(e){return e}).forEach(function(e){return Bn.textures[e.name]=e}),Bn.textures})},Bn.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},Bn.textures={},Bn.texture_configs={},Bn.boundTexture=null,Bn.activeUnit=null,qr.addTarget("Texture",Bn),En(Bn);var qn=Oe.f,Hn=function(e){return function(t){for(var r,n=N(t),i=ee(n),o=i.length,s=0,a=[];o>s;)qn.call(n,r=i[s++])&&a.push(e?[r,n[r]]:n[r]);return a}},Xn=Hn(!0);D(D.S,"Object",{entries:function(e){return Xn(e)}}),rt("match",1,function(e,t,r,n){return [function(r){var n=e(this),i=null==r?void 0:r[t];return void 0!==i?i.call(r,n):new RegExp(r)[t](String(n))},function(e){var t=n(r,e,this);if(t.done)return t.value;var i=c(e),o=String(this);if(!i.global)return He(i,o);var s=i.unicode;i.lastIndex=0;for(var a,l=[],u=0;null!==(a=He(i,o));){var f=String(a[0]);l[u]=f,""===f&&(i.lastIndex=je(o,B(i.lastIndex),s)),u++;}return 0===u?null:l}]});var Wn={parseUniforms:function(e){var t=[];for(var r in e){var n,i=r,o=e[r];if("number"==typeof o)t.push({type:"float",method:"1f",name:r,value:o,key:i,uniforms:e});else if(Array.isArray(o)){if("number"==typeof o[0])o.length>=2&&o.length<=4?t.push({type:"vec"+o.length,method:o.length+"fv",name:r,value:o,key:i,uniforms:e}):o.length>4&&t.push({type:"float[]",method:"1fv",name:r+"[0]",value:o,key:i,uniforms:e});else if("string"==typeof o[0])for(n=0;n<o.length;n++)t.push({type:"sampler2D",method:"1i",name:r+"["+n+"]",value:o[n],key:n,uniforms:o});else if(Array.isArray(o[0])&&"number"==typeof o[0][0]&&o[0].length>=2&&o[0].length<=4)for(n=0;n<o.length;n++)t.push({type:"vec"+o[0].length,method:o[0].length+"fv",name:r+"["+n+"]",value:o[n],key:n,uniforms:o});}else"boolean"==typeof o?t.push({type:"bool",method:"1i",name:r,value:o,key:i,uniforms:e}):"string"==typeof o&&t.push({type:"sampler2D",method:"1i",name:r,value:o,key:i,uniforms:e});}return t},defineVariable:function(e,t){var r,n;if("number"==typeof t)r="float";else if(Array.isArray(t))"number"==typeof t[0]?t.length>=2&&t.length<=4?r="vec"+t.length:(r="float",n=t.length):"string"==typeof t[0]?(r="sampler2D",n=t.length):Array.isArray(t[0])&&"number"==typeof t[0][0]&&t[0].length>=2&&t[0].length<=4&&(r="vec"+t[0].length,n=t.length);else if("boolean"==typeof t)r="bool";else{if("string"!=typeof t)return;r="sampler2D";}var i="";return i+=r+" "+e,n&&(i+="["+n+"]"),i+=";\n"},defineUniform:function(e,t){var r=Wn.defineVariable(e,t);if(r)return "uniform "+r},expandVec3:function(e,t){var r;if(void 0===t&&(t=1),Array.isArray(e)){if(2!==e.length)return e;r=[].concat(e,[t]).map(parseFloat);}else r=[e,e,e].map(parseFloat);if(r&&r.every(function(e){return "number"==typeof e&&!isNaN(e)}))return r},expandVec4:function(e,t){var r;if(void 0===t&&(t=1),Array.isArray(e)){if(3!==e.length)return e;r=[].concat(e,[t]).map(parseFloat);}else r=[e,e,e,t].map(parseFloat);if(r&&r.every(function(e){return "number"==typeof e&&!isNaN(e)}))return r}},Yn=[];function Zn(e,t){var r=Yn.filter(function(t){return t[0]===e})[0];return (r=r&&r[1])||(Yn.push([e,{}]),r=Yn[Yn.length-1][1]),r[t]||(r[t]=e.getExtension(t)),r[t]}function Jn(e){var t,r,n=0;if(0===e.length)return n;for(t=0,r=e.length;t<r;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return n}var $n=function(e){e=String(e);var t,r=[];for(;t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var n=t[1].trim(),i=n.split(":"),o=i.slice(2).join(":").trim(),s=parseInt(i[0],10),n=parseInt(i[1],10);r.push({message:o,file:s,line:n});}return r};var Kn=/^\s*#pragma.*$/gm,Qn=/\\\s*\n/gm,ei=function(){function e(t,r,n,i){i=i||{},this.gl=t,this.program=null,this.compiled=!1,this.compiling=!1,this.error=null,this.defines=Object.assign({},i.defines||{}),this.blocks=Object.assign({},i.blocks||{}),this.block_scopes=Object.assign({},i.block_scopes||{}),this.extensions=i.extensions||[],this.dependent_uniforms=i.uniforms,this.uniforms={},this.attribs={},this.vertex_source=r,this.fragment_source=n,this.id=e.id++,this.name=i.name;}var t=e.prototype;return t.destroy=function(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},this.compiled=!1;},t.use=function(){this.compiled&&(e.current!==this&&this.gl.useProgram(this.program),e.current=this);},t.compile=function(){var t=this;if(this.compiling)throw new Error("ShaderProgram.compile(): skipping for "+this.id+" ("+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 r,n=this.checkExtensions(),i=this.buildDefineList(),o=this.buildShaderBlockList();for(var s in o){var a=o[s];if(a&&(!Array.isArray(a)||0!==a.length)){r=new RegExp("^\\s*#pragma\\s+qcldicp:\\s+"+s+"\\s*$","m");var l=this.computed_vertex_source.match(r),u=this.computed_fragment_source.match(r);if(null!=l||null!=u){var c="";a.forEach(function(e){var t=e.scope+", "+e.key+", "+e.num;c+="\n// qcldicp-block-start: "+t+"\n",c+=e.source,c+="\n// qcldicp-block-end: "+t+"\n";}),null!=l&&(this.computed_vertex_source=this.computed_vertex_source.replace(r,c)),null!=u&&(this.computed_fragment_source=this.computed_fragment_source.replace(r,c)),i["QCLDICP_BLOCK_"+s.replace(/[\s-]+/g,"_").toUpperCase()]=!0;}}}this.computed_vertex_source=this.computed_vertex_source.replace(Kn,""),this.computed_fragment_source=this.computed_fragment_source.replace(Kn,""),this.ensureUniforms(this.dependent_uniforms);var f="",h=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);f=h&&h.precision>0?"precision highp float;\n":"precision mediump float;\n",i.QCLDICP_VERTEX_SHADER=!0,i.QCLDICP_FRAGMENT_SHADER=!1,this.computed_vertex_source=f+e.buildDefineString(i)+this.computed_vertex_source,i.QCLDICP_VERTEX_SHADER=!1,i.QCLDICP_FRAGMENT_SHADER=!0,this.computed_fragment_source=e.buildExtensionString(n)+f+e.buildDefineString(i)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(Qn,""),this.computed_fragment_source=this.computed_fragment_source.replace(Qn,"");try{this.program=e.updateProgram(this.gl,this.program,this.computed_vertex_source,this.computed_fragment_source),this.compiled=!0,this.compiling=!1;}catch(e){throw this.program=null,this.compiled=!1,this.compiling=!1,this.error=e,this.error.vertex_shader_source=this.computed_vertex_source,this.error.fragment_shader_source=this.computed_fragment_source,"vertex"!==e.type&&"fragment"!==e.type||(this.shader_errors=e.errors,this.shader_errors.forEach(function(r){r.type=e.type,r.block=t.block(e.type,r.line),r.line=t.block(e.type,r.line);}),this.error.shader_errors=this.shader_errors),e}this.computed_vertex_source=null,this.computed_fragment_source=null,this.use(),this.refreshUniforms(),this.refreshAttributes();},t.buildDefineList=function(){var t,r={};for(t in e.defines)r[t]=e.defines[t];for(t in this.defines)r[t]=this.defines[t];return r},t.buildShaderBlockList=function(){var t,r={};for(t in e.blocks){var n;if(r[t]=[],Array.isArray(e.blocks[t]))(n=r[t]).push.apply(n,e.blocks[t].map(function(e,r){return {key:t,source:e,num:r,scope:"ShaderProgram"}}));else r[t]=[{key:t,source:e.blocks[t],num:0,scope:"ShaderProgram"}];}for(t in this.blocks)if(r[t]=r[t]||[],Array.isArray(this.blocks[t]))for(var i=this.block_scopes&&this.block_scopes[t]||[],o=null,s=0,a=0;a<this.blocks[t].length;a++)i[a]!==o&&(o=i[a],s=0),r[t].push({key:t,source:this.blocks[t][a],num:s,scope:o||this.name}),s++;else r[t].push({key:t,source:this.blocks[t],num:0,scope:this.name});return r},t.ensureUniforms=function(e){if(e){var t=Object.entries(e).map(function(e){var t=e[0],r=e[1];return Wn.defineUniform(t,r)}).filter(function(e){return e});this.computed_vertex_source=t.join("\n")+this.computed_vertex_source,this.computed_fragment_source=t.join("\n")+this.computed_fragment_source;}},t.setUniforms=function(e,t){if(void 0===t&&(t=!0),this.compiled){t&&(this.texture_unit=0);for(var r=Wn.parseUniforms(e),n=0;n<r.length;n++){var i=r[n];"sampler2D"===i.type?this.setTextureUniform(i.name,i.value):this.uniform(i.method,i.name,i.value);}}},t.saveUniforms=function(e){var t=e||this.uniforms;for(var r in t){var n=this.uniforms[r];n&&(n.saved_value=n.value);}this.saved_texture_unit=this.texture_unit||0;},t.restoreUniforms=function(e){var t=e||this.uniforms;for(var r in t){var n=this.uniforms[r];n&&n.saved_value&&(n.value=n.saved_value,this.updateUniform(n));}this.texture_unit=this.saved_texture_unit||0;},t.setTextureUniform=function(e,t){var r=Bn.textures[t];null!=r?(r.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),this.texture_unit++):Kr("warn","Cannot find texture '"+t+"'");},t.uniform=function(e,t,r){if(this.compiled){this.uniforms[t]=this.uniforms[t]||{};var n=this.uniforms[t];n.name=t,void 0===n.location&&(n.location=this.gl.getUniformLocation(this.program,t)),n.method=e,n.value=r,this.updateUniform(n);}},t.updateUniform=function(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e));},t.commitUniform=function(e){var t=e.location,r=e.value;switch(e.method){case"1i":this.gl.uniform1i(t,r);break;case"1f":this.gl.uniform1f(t,r);break;case"2f":this.gl.uniform2f(t,r[0],r[1]);break;case"3f":this.gl.uniform3f(t,r[0],r[1],r[2]);break;case"4f":this.gl.uniform4f(t,r[0],r[1],r[2],r[3]);break;case"1iv":this.gl.uniform1iv(t,r);break;case"3iv":this.gl.uniform3iv(t,r);break;case"1fv":this.gl.uniform1fv(t,r);break;case"2fv":this.gl.uniform2fv(t,r);break;case"3fv":this.gl.uniform3fv(t,r);break;case"4fv":this.gl.uniform4fv(t,r);break;case"Matrix3fv":this.gl.uniformMatrix3fv(t,!1,r);break;case"Matrix4fv":this.gl.uniformMatrix4fv(t,!1,r);}},t.refreshUniforms=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);}},t.refreshAttributes=function(){this.attribs={};},t.attribute=function(e){if(this.compiled){var t=this.attribs[e]=this.attribs[e]||{};return null!=t.location?t:(t.name=e,t.location=this.gl.getAttribLocation(this.program,e),t)}},t.source=function(e){return "vertex"===e?this.computed_vertex_source:"fragment"===e?this.computed_fragment_source:void 0},t.lines=function(e){var t=this.source(e);return t?t.split("\n"):[]},t.line=function(e,t){var r=this.lines(e);if(r)return r[t]},t.block=function(e,t){for(var r,n=this.lines(e),i=0;i<t&&i<n.length;i++){var o=n[i],s=o.match(/\/\/ qcldicp-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);s&&s.length>1?r={scope:s[1],name:s[2],num:s[3]}:(s=o.match(/\/\/ qcldicp-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/))&&s.length>1&&(r=null),r&&(r.line=null==r.line?-1:r.line+1,r.source=o);}return r},t.checkExtensions=function(){var e=this,t=[];return this.extensions.forEach(function(r){var n=Zn(e.gl,r),i="QCLDICP_EXTENSION_"+r;e.defines[i]=null!=n,n?t.push(r):Kr("debug","Could not enable extension '"+r+"'");}),t},e}();ei.id=0,ei.current=null,ei.defines={},ei.blocks={},ei.reset=function(){ei.programs_by_source={},ei.shaders_by_source={};},ei.reset(),ei.buildDefineString=function(e){var t="";for(var r in e)null!=e[r]&&!1!==e[r]&&("boolean"==typeof e[r]&&!0===e[r]?t+="#define "+r+"\n":"number"==typeof e[r]&&Math.floor(e[r])===e[r]?t+="#define "+r+" "+e[r].toFixed(1)+"\n":t+="#define "+r+" "+e[r]+"\n");return t},ei.buildExtensionString=function(e){var t="";return (e=e||[]).forEach(function(e){t+="#ifdef GL_"+e+"\n#extension GL_"+e+" : enable\n#endif\n";}),t},ei.addBlock=function(e){var t;ei.blocks[e]=ei.blocks[e]||[];for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];(t=ei.blocks[e]).push.apply(t,n);},ei.removeBlock=function(e){ei.blocks[e]=[];},ei.replaceBlock=function(e){ei.removeBlock(e);for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];ei.addBlock.apply(ei,[e].concat(r));},ei.updateProgram=function(e,t,r,n){var i=Jn(e._qcldicp_id+"::"+r+"::"+n);if(ei.programs_by_source[i])return Kr("trace","Reusing identical source GL program object"),ei.programs_by_source[i];var o=ei.createShader(e,r,e.VERTEX_SHADER),s=ei.createShader(e,n,e.FRAGMENT_SHADER);if(e.useProgram(null),null!=t)for(var a=e.getAttachedShaders(t),l=0;l<a.length;l++)e.detachShader(t,a[l]);else t=e.createProgram();if(null==o||null==s)return t;if(e.attachShader(t,o),e.attachShader(t,s),e.bindAttribLocation(t,0,"a_position"),e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS)){var u=new Error("WebGL program error:\n VALIDATE_STATUS: "+e.getProgramParameter(t,e.VALIDATE_STATUS)+"\n ERROR: "+e.getError()+"\n --- Vertex Shader ---\n "+r+"\n --- Fragment Shader ---\n "+n);throw Object.assign(new Error(u),{type:"program"})}return ei.programs_by_source[i]=t,t},ei.createShader=function(e,t,r){var n=Jn(e._qcldicp_id+"::"+t);if(ei.shaders_by_source[n])return Kr("trace","Reusing identical source GL shader object"),ei.shaders_by_source[n];var i=e.createShader(r);if(e.shaderSource(i,t),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){var o=r===e.VERTEX_SHADER?"vertex":"fragment",s=e.getShaderInfoLog(i),a=$n(s);throw Object.assign(new Error(s),{type:o,errors:a})}return ei.shaders_by_source[n]=i,i};var ti={disabled:!1,bound_vao:[],init:function(e){var t;!0!==this.disabled&&(t=Zn(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");},getExtension:function(e,t){if(!0!==this.disabled)return Zn(e,t)},create:function(e,t,r){var n={};n.setup=t,n.teardown=r;var i=this.getExtension(e,"OES_vertex_array_object");return null!=i&&(n._vao=i.createVertexArrayOES(),i.bindVertexArrayOES(n._vao)),n.setup(),n},getCurrentBinding:function(e){var t=this.bound_vao.filter(function(t){return t[0]===e})[0];return t&&t[1]},setCurrentBinding:function(e,t){var r=this.bound_vao,n=r.filter(function(t){return t[0]===e})[0];null==n?r.push([e,t]):n[1]=t;},bind:function(e,t){var r=this.getExtension(e,"OES_vertex_array_object");if(null!=t)null!=r&&null!=t._vao?(r.bindVertexArrayOES(t._vao),this.setCurrentBinding(e,t)):t.setup();else{var n=this.getCurrentBinding(e);null!=r?r.bindVertexArrayOES(null):null!=n&&"function"==typeof n.teardown&&n.teardown(),this.setCurrentBinding(e,null);}},destroy:function(e,t){var r=this.getExtension(e,"OES_vertex_array_object");null!=r&&null!=t&&null!=t._vao&&(r.deleteVertexArrayOES(t._vao),t._vao=null);}},ri=Hn(!1);D(D.S,"Object",{values:function(e){return ri(e)}});var ni,ii=jn(6),oi="findIndex",si=!0;function ai(e){for(var t=0;t<(arguments.length<=1?0:arguments.length-1);t++){var r=t+1<1||arguments.length<=t+1?void 0:arguments[t+1];if(r)for(var n in r){var i=r[n];null===i||"object"!=typeof i||Array.isArray(i)?void 0!==i&&(e[n]=i):null===e[n]||"object"!=typeof e[n]||Array.isArray(e[n])?e[n]=ai({},i):e[n]=ai(e[n],i);}}return e}oi in[]&&Array(1)[oi](function(){si=!1;}),D(D.P+D.F*si,"Array",{findIndex:function(e){return ii(this,e,arguments.length>1?arguments[1]:void 0)}}),w(oi);var li=ni={};ni.default_source_max_zoom=18,ni.default_view_max_zoom=20,ni.max_style_zoom=25,ni.tile_size=256,ni.half_circumference_meters=20037508.342789244,ni.circumference_meters=2*ni.half_circumference_meters,ni.min_zoom_meters_per_pixel=ni.circumference_meters/ni.tile_size;var ui=[];ni.metersPerPixel=function(e){return ui[e]=ui[e]||ni.min_zoom_meters_per_pixel/Math.pow(2,e),ui[e]};var ci=[];ni.metersPerTile=function(e){return ci[e]=ci[e]||ni.circumference_meters/Math.pow(2,e),ci[e]},ni.tile_scale=4096,ni.units_per_pixel=ni.tile_scale/ni.tile_size,ni.height_scale=16;var fi=[];ni.unitsPerMeter=function(e){return fi[e]=fi[e]||ni.tile_scale/(ni.tile_size*ni.metersPerPixel(e)),fi[e]},ni.metersForTile=function(e){return {x:e.x*ni.circumference_meters/Math.pow(2,e.z)-ni.half_circumference_meters,y:-(e.y*ni.circumference_meters/Math.pow(2,e.z)-ni.half_circumference_meters)}},ni.tileForMeters=function(e,t){var r=e[0],n=e[1];return {x:Math.floor((r+ni.half_circumference_meters)/(ni.circumference_meters/Math.pow(2,t))),y:Math.floor((-n+ni.half_circumference_meters)/(ni.circumference_meters/Math.pow(2,t))),z:t}},ni.wrapTile=function(e,t){var r=e.x,n=e.y,i=e.z;void 0===t&&(t={x:!0,y:!1});var o=(1<<i)-1;return t.x&&(r&=o),t.y&&(n&=o),{x:r,y:n,z:i}},ni.metersToLatLng=function(e){return e[0]/=ni.half_circumference_meters,e[1]/=ni.half_circumference_meters,e[1]=(2*Math.atan(Math.exp(e[1]*Math.PI))-Math.PI/2)/Math.PI,e[0]*=180,e[1]*=180,e},ni.latLngToMeters=function(e){return e[1]=Math.log(Math.tan(e[1]*Math.PI/360+Math.PI/4))/Math.PI,e[1]*=ni.half_circumference_meters,e[0]*=ni.half_circumference_meters/180,e},ni.tileSpaceToLatlng=function(e,t,r){var n=ni.unitsPerMeter(t);return ni.transformGeometry(e,function(e){e[0]=e[0]/n+r.x,e[1]=e[1]/n+r.y,ni.metersToLatLng(e);}),e},ni.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}},ni.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)});}));},ni.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)},ni.findBoundingBox=function(e){for(var t=1/0,r=-1/0,n=1/0,i=-1/0,o=e[0].length,s=0;s<o;s++){var a=e[0][s];a[0]<t&&(t=a[0]),a[1]<n&&(n=a[1]),a[0]>r&&(r=a[0]),a[1]>i&&(i=a[1]);}return [t,n,r,i]},ni.geometryType=function(e){return "Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},ni.centroid=function(e,t){if(void 0===t&&(t=!0),e&&0!==e.length){var r,n=0,i=0,o=0,s=e[0],a=s.length;t&&(r=s[0],s=s.map(function(e){return [e[0]-r[0],e[1]-r[1]]}));for(var l=0,u=a-1;l<a;u=l,l++){var c=s[l],f=s[u],h=c[1]*f[0]-f[1]*c[0];n+=(c[0]+f[0])*h,i+=(c[1]+f[1])*h,o+=3*h;}if(o){var d=[n/o,i/o];return t&&(d[0]+=r[0],d[1]+=r[1]),d}}},ni.multiCentroid=function(e){for(var t=0,r=null,n=0;n<e.length;n++){var i=ni.centroid(e[n]);i&&((r=r||[0,0])[0]+=i[0],r[1]+=i[1],t++);}return t>0&&(r[0]/=t,r[1]/=t),r},ni.signedPolygonRingAreaSum=function(e){for(var t=0,r=e.length,n=0;n<r-1;n++){var i=e[n],o=e[n+1];t+=i[0]*o[1]-o[0]*i[1];}return t+=e[r-1][0]*e[0][1]-e[0][0]*e[r-1][1]},ni.polygonRingArea=function(e){return Math.abs(ni.signedPolygonRingAreaSum(e))/2},ni.polygonArea=function(e){if(e)return ni.polygonRingArea(e[0])},ni.multiPolygonArea=function(e){for(var t=0,r=0;r<e.length;r++)t+=ni.polygonArea(e[r]);return t},ni.ringWinding=function(e){var t=ni.signedPolygonRingAreaSum(e);return t>0?"CW":t<0?"CCW":void 0};var hi="\t\n\v\f\r \u2028\u2029\ufeff",di="["+hi+"]",pi=RegExp("^"+di+di+"*"),_i=RegExp(di+di+"*$"),mi=function(e,t,r){var n={},i=f(function(){return !!hi[e]()||"
"!="
"[e]()}),o=n[e]=i?t(vi):hi[e];r&&(n[r]=o),D(D.P+D.F*i,"String",n);},vi=mi.trim=function(e,t){return e=String(P(e)),1&t&&(e=e.replace(pi,"")),2&t&&(e=e.replace(_i,"")),e},gi=mi,yi=_t.f,xi=vt.f,bi=y.f,Ai=gi.trim,Ti=n.Number,wi=Ti,Ei=Ti.prototype,Ri="Number"==S(ae(Ei)),Mi="trim"in String.prototype,Si=function(e){var t=v(e,!1);if("string"==typeof t&&t.length>2){var r,n,i,o=(t=Mi?t.trim():Ai(t,3)).charCodeAt(0);if(43===o||45===o){if(88===(r=t.charCodeAt(2))||120===r)return NaN}else if(48===o){switch(t.charCodeAt(1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return +t}for(var s,a=t.slice(2),l=0,u=a.length;l<u;l++)if((s=a.charCodeAt(l))<48||s>i)return NaN;return parseInt(a,n)}}return +t};if(!Ti(" 0o1")||!Ti("0b1")||Ti("+0x1")){Ti=function(e){var t=arguments.length<1?0:e,r=this;return r instanceof Ti&&(Ri?f(function(){Ei.valueOf.call(r);}):"Number"!=S(r))?an(new wi(Si(t)),r,Ti):Si(t)};for(var zi,Pi=h?yi(wi):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),Ni=0;Pi.length>Ni;Ni++)L(wi,zi=Pi[Ni])&&!L(Ti,zi)&&bi(Ti,zi,xi(wi,zi));Ti.prototype=Ei,Ei.constructor=Ti,O(n,"Number",Ti);}D(D.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991});var ki=ht.onFreeze;zr("freeze",function(e){return function(t){return e&&u(t)?e(ki(t)):t}});var Li={functions:{},num_functions:0,num_cached:0};function Oi(e,t){if("string"==typeof e)e=Ii(e,t);else if(null!=e&&"object"==typeof e)for(var r in e)e[r]=Oi(e[r],t);return e}function Ii(e,t){var r="string"==typeof e&&e.match(/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m);if(r&&r.length>2)try{var n=r[2],i="function"==typeof t?t(n):n,o=Jn(i);if(void 0===Li.functions[o]){var s=r[1].length>0&&r[1].split(",").map(function(e){return e.trim()}).filter(function(e){return e});s=s.length>0?s:["context"],Li.functions[o]=new Function(s.toString(),i),Li.functions[o].source=n,Li.num_functions++;}else Li.num_cached++;return Li.functions[o]}catch(t){return e}return e}var Fi=t(function(e,t){var r={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 n(e){return (e=Math.round(e))<0?0:e>255?255:e}function i(e){return e<0?0:e>1?1:e}function o(e){return "%"===e[e.length-1]?n(parseFloat(e)/100*255):n(parseInt(e))}function s(e){return "%"===e[e.length-1]?i(parseFloat(e)/100):i(parseFloat(e))}function a(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}try{t.parseCSSColor=function(e){var t,i=e.replace(/ /g,"").toLowerCase();if(i in r)return r[i].slice();if("#"===i[0])return 4===i.length?(t=parseInt(i.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===i.length&&(t=parseInt(i.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var l=i.indexOf("("),u=i.indexOf(")");if(-1!==l&&u+1===i.length){var c=i.substr(0,l),f=i.substr(l+1,u-(l+1)).split(","),h=1;switch(c){case"rgba":if(4!==f.length)return null;h=s(f.pop());case"rgb":return 3!==f.length?null:[o(f[0]),o(f[1]),o(f[2]),h];case"hsla":if(4!==f.length)return null;h=s(f.pop());case"hsl":if(3!==f.length)return null;var d=(parseFloat(f[0])%360+360)%360/360,p=s(f[1]),_=s(f[2]),m=_<=.5?_*(p+1):_+p-_*p,v=2*_-m;return [n(255*a(v,m,d+1/3)),n(255*a(v,m,d)),n(255*a(v,m,d-1/3)),h];default:return null}}return null};}catch(e){}}),Ui=(Fi.parseCSSColor,{}),Di=function(e){return Math.max(e,0)},Gi=function(e){return isNaN(e)?0:e},ji=function(e){return Array.isArray(e)?e.map(parseFloat).map(Gi):Gi(parseFloat(e))},Ci=function(e){return Array.isArray(e)?e.map(ji).map(Di):Di(ji(e))};Object.assign(Ui,{clampPositive:Di,noNaN:Gi,parseNumber:ji,parsePositiveNumber:Ci}),Ui.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 $geometry = context.geometry;\n var $meters_per_pixel = context.meters_per_pixel;\n var $id = context.id;\n\n var val = (function(){ "+e+" }());\n\n if (typeof val === 'number' && isNaN(val)) {\n val = null; // convert NaNs to nulls\n }\n\n return val;\n "},Ui.zeroPair=Object.freeze([0,0]),Ui.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}},Ui.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]}},Ui.getFeatureParseContext=function(e,t,r){return {feature:e,id:e.id,tile:t,global:r,zoom:t.style_z,geometry:li.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 Vi={STATIC:0,DYNAMIC:1,ZOOM:2};Ui.CACHE_TYPE=Vi,Ui.createPropertyCache=function(e,t,r){if(void 0===t&&(t=null),void 0===r&&(r=null),null!=e){if(e.value)return {value:e.value,zoom:e.zoom?{}:null,type:e.type};var n={value:e,type:Vi.STATIC};return Array.isArray(n.value)&&Array.isArray(n.value[0])?(n.zoom={},Nr(e,[{key:"locked",get:function(){return this._lock_fn&&this._lock_fn()||!1}}]),e}();Ji.map={},Ji.tiles={},Ji.map_size=0,Ji.map_entry=0,Ji.map_prefix=0,Ji.defaultColor=[0,0,0,1];var $i=Zi={};Zi.BYTE=5120,Zi.UNSIGNED_BYTE=5121,Zi.SHORT=5122,Zi.UNSIGNED_SHORT=5123,Zi.INT=5124,Zi.UNSIGNED_INT=5125,Zi.FLOAT=5126,Vn("Uint16",2,function(e){return function(t,r,n){return e(this,t,r,n)}});var Ki,Qi=function(){function e(e,t,r,n,i){i=i||{},this.gl=e,this.vertex_data=t,this.element_data=r,this.vertex_layout=n,this.vertex_buffer=this.gl.createBuffer(),this.buffer_size=this.vertex_data.byteLength,this.draw_mode=i.draw_mode||this.gl.TRIANGLES,this.data_usage=i.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=i.uniforms,this.textures=i.textures,this.retain=i.retain||!1,this.created_at=+new Date,this.fade_in_time=i.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;}var t=e.prototype;return t.render=function(e){if(void 0===e&&(e={}),!this.valid)return !1;var t=e.program||ei.current;t.use(),this.uniforms&&(t.saveUniforms(this.uniforms),t.setUniforms(this.uniforms,!1));var r=(+new Date-this.created_at)/1e3;return t.uniform("1f","u_visible_time",r),this.bind(t),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),ti.bind(this.gl,null),this.uniforms&&t.restoreUniforms(this.uniforms),r<this.fade_in_time},t.bind=function(e){var t=this,r=this.vaos[e.id];r?ti.bind(this.gl,r):this.vaos[e.id]=ti.create(this.gl,function(){t.gl.bindBuffer(t.gl.ARRAY_BUFFER,t.vertex_buffer),t.toggle_element_array&&t.gl.bindBuffer(t.gl.ELEMENT_ARRAY_BUFFER,t.element_buffer),t.vertex_layout.enableDynamicAttributes(t.gl,e);}),this.vertex_layout.enableStaticAttributes(this.gl,e);},t.upload=function(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertex_data,this.data_usage);},t.destroy=function(){if(!this.valid)return !1;for(var e in this.valid=!1,this.vaos)ti.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 Bn.release(e)}),!0},e}(),eo=["emission","ambient","diffuse","specular"],to=function(){function e(e){var t=this;e=e||{},eo.forEach(function(r){var n=e[r];null!=n&&(n.texture?t[r]={texture:n.texture,mapping:n.mapping||"spheremap",scale:Wn.expandVec3(null!=n.scale?n.scale:1),amount:Wn.expandVec4(null!=n.amount?n.amount:1)}:"number"==typeof n||Array.isArray(n)?t[r]={amount:Wn.expandVec4(n)}:t[r]="string"==typeof n?{amount:Ui.parseColor(n)}:n);}),this.specular&&(this.specular.shininess=e.shininess?parseFloat(e.shininess):.2),null!=e.normal&&(this.normal={texture:e.normal.texture,mapping:e.normal.mapping||"triplanar",scale:Wn.expandVec3(null!=e.normal.scale?e.normal.scale:1),amount:null!=e.normal.amount?e.normal.amount:1});}e.isValid=function(e){return null!=e&&(null!=e.emission||null!=e.ambient||null!=e.diffuse||null!=e.specular)};var t=e.prototype;return t.inject=function(t){var r=this;eo.forEach(function(e){var n="QCLDICP_MATERIAL_"+e.toUpperCase(),i=n+"_TEXTURE";t.defines[n]=null!=r[e],r[e]&&r[e].texture&&(t.defines[i]=!0,t.defines[i+"_"+r[e].mapping.toUpperCase()]=!0,t.defines["QCLDICP_MATERIAL_TEXTURE_"+r[e].mapping.toUpperCase()]=!0,t.texcoords=t.texcoords||"uv"===r[e].mapping);}),this.normal&&this.normal.texture&&(t.defines.QCLDICP_MATERIAL_NORMAL_TEXTURE=!0,t.defines["QCLDICP_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,t.defines["QCLDICP_MATERIAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,t.texcoords=t.texcoords||"uv"===this.normal.mapping),t.replaceShaderBlock(e.block,"/*\n\nDefines globals:\nmaterial\nlight_accumulator_*\n\n*/\n\n\n// MATERIALS\n//\nstruct Material {\n #ifdef QCLDICP_MATERIAL_EMISSION\n vec4 emission;\n #ifdef QCLDICP_MATERIAL_EMISSION_TEXTURE\n vec3 emissionScale;\n #endif\n #endif\n\n #ifdef QCLDICP_MATERIAL_AMBIENT\n vec4 ambient;\n #ifdef QCLDICP_MATERIAL_AMBIENT_TEXTURE\n vec3 ambientScale;\n #endif\n #endif\n\n #ifdef QCLDICP_MATERIAL_DIFFUSE\n vec4 diffuse;\n #ifdef QCLDICP_MATERIAL_DIFFUSE_TEXTURE\n vec3 diffuseScale;\n #endif\n #endif\n\n #ifdef QCLDICP_MATERIAL_SPECULAR\n vec4 specular;\n float shininess;\n #ifdef QCLDICP_MATERIAL_SPECULAR_TEXTURE\n vec3 specularScale;\n #endif\n #endif\n\n\n #ifdef QCLDICP_MATERIAL_NORMAL_TEXTURE\n vec3 normalScale;\n float normalAmount;\n #endif\n};\n\n// Note: uniform is copied to a global instance to allow modification\nuniform Material u_material;\nMaterial material;\n\n#ifdef QCLDICP_MATERIAL_EMISSION_TEXTURE\nuniform sampler2D u_material_emission_texture;\n#endif\n\n#ifdef QCLDICP_MATERIAL_AMBIENT_TEXTURE\nuniform sampler2D u_material_ambient_texture;\n#endif\n\n#ifdef QCLDICP_MATERIAL_DIFFUSE_TEXTURE\nuniform sampler2D u_material_diffuse_texture;\n#endif\n\n#ifdef QCLDICP_MATERIAL_SPECULAR_TEXTURE\nuniform sampler2D u_material_specular_texture;\n#endif\n\n#ifdef QCLDICP_MATERIAL_NORMAL_TEXTURE\nuniform sampler2D u_material_normal_texture;\n#endif\n\n// Global light accumulators for each property\nvec4 light_accumulator_ambient = vec4(vec3(0.0), 1.);\nvec4 light_accumulator_diffuse = vec4(vec3(0.0), 1.);\n#ifdef QCLDICP_MATERIAL_SPECULAR\n vec4 light_accumulator_specular = vec4(vec3(0.0), 1.);\n#endif\n\n\n#ifdef QCLDICP_MATERIAL_TEXTURE_SPHEREMAP\nvec4 getSphereMap (in sampler2D _tex, in vec3 _eyeToPoint, in vec3 _normal, in vec2 _skew) {\n // Normalized vector from camera to surface\n vec3 eye = normalize(_eyeToPoint);\n\n // Adjust for camera skew\n eye.xy -= _skew;\n eye = normalize(eye);\n\n // Reflection of eye off of surface normal\n vec3 r = reflect(eye, _normal);\n\n // Map reflected vector onto the surface of a sphere\n r.z += 1.0;\n float m = 2. * length(r);\n\n // Adjust xy to account for spherical shape, and center in middle of texture\n vec2 uv = r.xy / m + .5;\n\n // Sample the environment map\n return texture2D(_tex, uv);\n}\n#endif\n\n\n#ifdef QCLDICP_MATERIAL_TEXTURE_TRIPLANAR\nvec3 getTriPlanarBlend (in vec3 _normal) {\n vec3 blending = abs(_normal);\n blending = normalize(max(blending, 0.00001));\n float b = (blending.x + blending.y + blending.z);\n return blending / b;\n}\n\nvec4 getTriPlanar (in sampler2D _tex, in vec3 _pos, in vec3 _normal, in vec3 _scale) {\n vec3 blending = getTriPlanarBlend(_normal);\n vec4 xaxis = texture2D(_tex, fract(_pos.yz * _scale.x));\n vec4 yaxis = texture2D(_tex, fract(_pos.xz * _scale.y));\n vec4 zaxis = texture2D(_tex, fract(_pos.xy * _scale.z));\n return xaxis * blending.x + yaxis * blending.y + zaxis * blending.z;\n}\n#endif\n\n\n#ifdef QCLDICP_MATERIAL_TEXTURE_PLANAR\nvec4 getPlanar (in sampler2D _tex, in vec3 _pos, in vec2 _scale) {\n return texture2D( _tex, fract(_pos.xy * _scale.x) );\n}\n#endif\n\n\n#ifdef QCLDICP_MATERIAL_NORMAL_TEXTURE\nvoid calculateNormal (inout vec3 _normal) {\n // Get NORMALMAP\n //------------------------------------------------\n #ifdef QCLDICP_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\n #ifdef QCLDICP_MATERIAL_NORMAL_TEXTURE_PLANAR\n vec3 normalTex = getPlanar(u_material_normal_texture, v_world_position.xyz, material.normalScale.xy).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n #ifdef QCLDICP_MATERIAL_NORMAL_TEXTURE_TRIPLANAR\n vec3 normalTex = getTriPlanar(u_material_normal_texture, v_world_position.xyz, _normal, material.normalScale).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n _normal = normalize(_normal);\n}\n#endif\n\nvoid calculateMaterial (in vec3 _eyeToPoint, inout vec3 _normal) {\n // get EMISSION TEXTUREMAP\n //------------------------------------------------\n #ifdef QCLDICP_MATERIAL_EMISSION_TEXTURE\n #ifdef QCLDICP_MATERIAL_EMISSION_TEXTURE_UV\n material.emission *= texture2D(u_material_emission_texture,v_texcoord);\n #endif\n\n #ifdef QCLDICP_MATERIAL_EMISSION_TEXTURE_PLANAR\n material.emission *= getPlanar(u_material_emission_texture, v_world_position.xyz, material.emissionScale.xy);\n #endif\n\n #ifdef QCLDICP_MATERIAL_EMISSION_TEXTURE_TRIPLANAR\n material.emission *= getTriPlanar(u_material_emission_texture, v_world_position.xyz, _normal, material.emissionScale);\n #endif\n\n #ifdef QCLDICP_MATERIAL_EMISSION_TEXTURE_SPHEREMAP\n material.emission *= getSphereMap(u_material_emission_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get AMBIENT TEXTUREMAP\n //------------------------------------------------\n #ifdef QCLDICP_MATERIAL_AMBIENT_TEXTURE\n #ifdef QCLDICP_MATERIAL_AMBIENT_TEXTURE_UV\n material.ambient *= texture2D(u_material_ambient_texture,v_texcoord);\n #endif\n\n #ifdef QCLDICP_MATERIAL_AMBIENT_TEXTURE_PLANAR\n material.ambient *= getPlanar(u_material_ambient_texture, v_world_position.xyz, material.ambientScale.xy);\n #endif\n\n #ifdef QCLDICP_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR\n material.ambient *= getTriPlanar(u_material_ambient_texture, v_world_position.xyz, _normal, material.ambientScale);\n #endif\n\n #ifdef QCLDICP_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP\n material.ambient *= getSphereMap(u_material_ambient_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get DIFFUSE TEXTUREMAP\n //------------------------------------------------\n #ifdef QCLDICP_MATERIAL_DIFFUSE_TEXTURE\n #ifdef QCLDICP_MATERIAL_DIFFUSE_TEXTURE_UV\n material.diffuse *= texture2D(u_material_diffuse_texture,v_texcoord);\n #endif\n\n #ifdef QCLDICP_MATERIAL_DIFFUSE_TEXTURE_PLANAR\n material.diffuse *= getPlanar(u_material_diffuse_texture, v_world_position.xyz, material.diffuseScale.xy);\n #endif\n\n #ifdef QCLDICP_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR\n material.diffuse *= getTriPlanar(u_material_diffuse_texture, v_world_position.xyz, _normal, material.diffuseScale);\n #endif\n\n #ifdef QCLDICP_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP\n material.diffuse *= getSphereMap(u_material_diffuse_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get SPECULAR TEXTUREMAP\n //------------------------------------------------\n #ifdef QCLDICP_MATERIAL_SPECULAR_TEXTURE\n #ifdef QCLDICP_MATERIAL_SPECULAR_TEXTURE_UV\n material.specular *= texture2D(u_material_specular_texture,v_texcoord);\n #endif\n\n #ifdef QCLDICP_MATERIAL_SPECULAR_TEXTURE_PLANAR\n material.specular *= getPlanar(u_material_specular_texture, v_world_position.xyz, material.specularScale.xy);\n #endif\n\n #ifdef QCLDICP_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR\n material.specular *= getTriPlanar(u_material_specular_texture, v_world_position.xyz, _normal, material.specularScale);\n #endif\n\n #ifdef QCLDICP_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP\n material.specular *= getSphereMap(u_material_specular_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n}\n","Material"),t.addShaderBlock("setup","\nmaterial = u_material;\n","Material");},t.setupProgram=function(e){var t=this;eo.forEach(function(r){t[r]&&(t[r].texture?(e.setTextureUniform("u_material_"+r+"_texture",t[r].texture),e.uniform("3fv","u_material."+r+"Scale",t[r].scale),e.uniform("4fv","u_material."+r,t[r].amount)):t[r].amount&&e.uniform("4fv","u_material."+r,t[r].amount));}),this.specular&&e.uniform("1f","u_material.shininess",this.specular.shininess),this.normal&&this.normal.texture&&(e.setTextureUniform("u_material_normal_texture",this.normal.texture),e.uniform("3fv","u_material.normalScale",this.normal.scale),e.uniform("1f","u_material.normalAmount",this.normal.amount));},e}();to.block="material";var ro=Ki={};Ki.copy=function(e){for(var t=[],r=e.length,n=0;n<r;n++)t[n]=e[n];return t},Ki.neg=function(e){for(var t=[],r=e.length,n=0;n<r;n++)t[n]=-e[n];return t},Ki.add=function(e,t){for(var r=[],n=Math.min(e.length,t.length),i=0;i<n;i++)r[i]=e[i]+t[i];return r},Ki.sub=function(e,t){for(var r=[],n=Math.min(e.length,t.length),i=0;i<n;i++)r[i]=e[i]-t[i];return r},Ki.signed_area=function(e,t,r){return (t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1])},Ki.mult=function(e,t){var r,n=[],i=e.length;if("number"==typeof t)for(r=0;r<i;r++)n[r]=e[r]*t;else for(i=Math.min(e.length,t.length),r=0;r<i;r++)n[r]=e[r]*t[r];return n},Ki.div=function(e,t){var r,n=[];if("number"==typeof t)for(r=0;r<e.length;r++)n[r]=e[r]/t;else{var i=Math.min(e.length,t.length);for(r=0;r<i;r++)n[r]=e[r]/t[r];}return n},Ki.perp=function(e,t){return [t[1]-e[1],e[0]-t[0]]},Ki.rot=function(e,t){var r=Math.cos(t),n=Math.sin(t);return [e[0]*r-e[1]*n,e[0]*n+e[1]*r]},Ki.angle=function(e){var t=e[0],r=e[1];return Math.atan2(r,t)},Ki.angleBetween=function(e,t){var r=Ki.dot(Ki.normalize(Ki.copy(e)),Ki.normalize(Ki.copy(t)));return r>1&&(r=1),Math.acos(r)},Ki.isEqual=function(e,t){for(var r=e.length,n=0;n<r;n++)if(e[n]!==t[n])return !1;return !0},Ki.lengthSq=function(e){return 2===e.length?e[0]*e[0]+e[1]*e[1]:e.length>=3?e[0]*e[0]+e[1]*e[1]+e[2]*e[2]:0},Ki.length=function(e){return Math.sqrt(Ki.lengthSq(e))},Ki.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(e.length>=3){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},Ki.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},Ki.dot=function(e,t){for(var r=0,n=Math.min(e.length,t.length),i=0;i<n;i++)r+=e[i]*t[i];return r};var no=function(){function e(e,t){this.name=t.name,this.view=e,null==t.ambient||"number"==typeof t.ambient?this.ambient=Wn.expandVec3(t.ambient||0):this.ambient=Ui.parseColor(t.ambient).slice(0,3),null==t.diffuse||"number"==typeof t.diffuse?this.diffuse=Wn.expandVec3(null!=t.diffuse?t.diffuse:1):this.diffuse=Ui.parseColor(t.diffuse).slice(0,3),null==t.specular||"number"==typeof t.specular?this.specular=Wn.expandVec3(t.specular||0):this.specular=Ui.parseColor(t.specular).slice(0,3);}e.create=function(t,r){if(e.types[r.type])return new e.types[r.type](t,r)},e.setMode=function(t,r){!0===t&&(t="fragment"),t=e.enabled&&(null!=t?t:"fragment"),r.defines.QCLDICP_LIGHTING_FRAGMENT="fragment"===t,r.defines.QCLDICP_LIGHTING_VERTEX="vertex"===t;},e.inject=function(t){if(ei.removeBlock(e.block),e.enabled){var r="";if(t&&Object.keys(t).length>0){var n={};for(var i in t)n[t[i].type]=!0;for(var o in n)e.types[o].inject();for(var s in t)t[s].inject(),r+="calculateLight("+s+", _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 "+r+"\n\n // Final light intensity calculation\n vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha\n\n #ifdef QCLDICP_MATERIAL_EMISSION\n color.rgb = material.emission.rgb;\n color.a *= material.emission.a;\n #endif\n\n #ifdef QCLDICP_MATERIAL_AMBIENT\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;\n color.a *= material.ambient.a;\n #else\n #ifdef QCLDICP_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;\n #endif\n #endif\n\n #ifdef QCLDICP_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 QCLDICP_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 }";ei.addBlock(e.block,a);}};var t=e.prototype;return t.inject=function(){var t="\n uniform "+this.struct_name+" u_"+this.name+";\n "+this.struct_name+" "+this.name+";\n ",r="\n "+this.name+" = u_"+this.name+";\n\n ";ei.addBlock(e.block,t),ei.addBlock("setup",r);},t.update=function(){},t.setupProgram=function(e){e.uniform("3fv","u_"+this.name+".ambient",this.ambient),e.uniform("3fv","u_"+this.name+".diffuse",this.diffuse),e.uniform("3fv","u_"+this.name+".specular",this.specular);},e}();no.types={},no.block="lighting",no.enabled=!0;var io=function(e){function t(t,r){var n;return (n=e.call(this,t,r)||this).type="ambient",n.struct_name="AmbientLight",n}return kr(t,e),t.inject=function(){ei.addBlock(no.block,"/*\n\nExpected globals:\nlight_accumulator_*\n\n*/\n\nstruct AmbientLight {\n vec3 ambient;\n};\n\nvoid calculateLight(in AmbientLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n light_accumulator_ambient.rgb += _light.ambient;\n}\n");},t.prototype.setupProgram=function(e){e.uniform("3fv","u_"+this.name+".ambient",this.ambient);},t}(no);no.types.ambient=io;var oo=function(e){function t(t,r){var n;if((n=e.call(this,t,r)||this).type="directional",n.struct_name="DirectionalLight",r.direction)n._direction=r.direction;else{var i=Math.sin(60*Math.PI/180);n._direction=[Math.cos(135*Math.PI/180)*i,Math.sin(135*Math.PI/180)*i,-.5],null==r.ambient&&(n.ambient=Wn.expandVec3(.5));}return n.direction=n._direction.map(parseFloat),n}return kr(t,e),t.inject=function(){ei.addBlock(no.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct DirectionalLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec3 direction;\n};\n\nvoid calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n light_accumulator_ambient.rgb += _light.ambient;\n\n float nDotVP = clamp(dot(_normal, -_light.direction), 0.0, 1.0);\n\n #ifdef QCLDICP_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP;\n #endif\n\n #ifdef QCLDICP_MATERIAL_SPECULAR\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(_light.direction, _normal);\n float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf;\n #endif\n}\n");},t.prototype.setupProgram=function(t){e.prototype.setupProgram.call(this,t),t.uniform("3fv","u_"+this.name+".direction",this.direction);},Nr(t,[{key:"direction",get:function(){return this._direction},set:function(e){this._direction=ro.normalize(ro.copy(e));}}]),t}(no);no.types.directional=oo;var so=function(e){function t(t,r){var n;return (n=e.call(this,t,r)||this).type="point",n.struct_name="PointLight",n.position=r.position||[0,0,"100px"],n.position_eye=[],n.origin=r.origin||"ground",n.attenuation=isNaN(parseFloat(r.attenuation))?0:parseFloat(r.attenuation),r.radius?Array.isArray(r.radius)&&2===r.radius.length?n.radius=r.radius:n.radius=[null,r.radius]:n.radius=null,n}kr(t,e),t.inject=function(){ei.addBlock(no.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct PointLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef QCLDICP_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef QCLDICP_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef QCLDICP_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n};\n\nvoid calculateLight(in PointLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // Normalize the vector from surface to light position\n float nDotVP = clamp(dot(VP, _normal), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // Computer accumulators\n light_accumulator_ambient.rgb += _light.ambient * attenuation;\n\n #ifdef QCLDICP_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation;\n #endif\n\n #ifdef QCLDICP_MATERIAL_SPECULAR\n float pf = 0.0; // power factor for shiny speculars\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(0.0, dot(-normalize(_eyeToPoint), reflectVector));\n pf = pow(eyeDotR, material.shininess);\n }\n\n light_accumulator_specular.rgb += _light.specular * pf * attenuation;\n #endif\n}\n");};var r=t.prototype;return r.inject=function(){e.prototype.inject.call(this),ei.defines.QCLDICP_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,ei.defines.QCLDICP_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],ei.defines.QCLDICP_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius;},r.update=function(){this.updateEyePosition();},r.updateEyePosition=function(){if("world"===this.origin){var e=li.latLngToMeters([].concat(this.position));this.position_eye[0]=e[0]-this.view.camera.position_meters[0],this.position_eye[1]=e[1]-this.view.camera.position_meters[1],this.position_eye[2]=Ui.convertUnits(this.position[2],{zoom:this.view.zoom,meters_per_pixel:li.metersPerPixel(this.view.zoom)}),this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2];}else"ground"!==this.origin&&"camera"!==this.origin||(this.position_eye=Ui.convertUnits(this.position,{zoom:this.view.zoom,meters_per_pixel:li.metersPerPixel(this.view.zoom)}),"ground"===this.origin&&(this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]));this.position_eye[3]=1;},r.setupProgram=function(t){e.prototype.setupProgram.call(this,t),t.uniform("4fv","u_"+this.name+".position",this.position_eye),ei.defines.QCLDICP_POINTLIGHT_ATTENUATION_EXPONENT&&t.uniform("1f","u_"+this.name+".attenuationExponent",this.attenuation),ei.defines.QCLDICP_POINTLIGHT_ATTENUATION_INNER_RADIUS&&t.uniform("1f","u_"+this.name+".innerRadius",Ui.convertUnits(this.radius[0],{zoom:this.view.zoom,meters_per_pixel:li.metersPerPixel(this.view.zoom)})),ei.defines.QCLDICP_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&t.uniform("1f","u_"+this.name+".outerRadius",Ui.convertUnits(this.radius[1],{zoom:this.view.zoom,meters_per_pixel:li.metersPerPixel(this.view.zoom)}));},t}(no);no.types.point=so;var ao=function(e){function t(t,r){var n;return (n=e.call(this,t,r)||this).type="spotlight",n.struct_name="SpotLight",n.direction=n._direction=(r.direction||[0,0,-1]).map(parseFloat),n.exponent=r.exponent?parseFloat(r.exponent):.2,n.angle=r.angle?parseFloat(r.angle):20,n}return kr(t,e),t.inject=function(){ei.addBlock(no.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct SpotLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef QCLDICP_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef QCLDICP_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef QCLDICP_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n\n vec3 direction;\n float spotCosCutoff;\n float spotExponent;\n};\n\nvoid calculateLight(in SpotLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // normal . light direction\n float nDotVP = clamp(dot(_normal, VP), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef QCLDICP_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // spotlight attenuation factor\n float spotAttenuation = 0.0;\n\n // See if point on surface is inside cone of illumination\n float spotDot = clamp(dot(-VP, _light.direction), 0.0, 1.0);\n\n if (spotDot >= _light.spotCosCutoff) {\n spotAttenuation = pow(spotDot, _light.spotExponent);\n }\n\n light_accumulator_ambient.rgb += _light.ambient * attenuation * spotAttenuation;\n\n #ifdef QCLDICP_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation * spotAttenuation;\n #endif\n\n #ifdef QCLDICP_MATERIAL_SPECULAR\n // Power factor for shiny speculars\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(dot(-normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf * attenuation * spotAttenuation;\n #endif\n}\n");},t.prototype.setupProgram=function(t){e.prototype.setupProgram.call(this,t),t.uniform("3fv","u_"+this.name+".direction",this.direction),t.uniform("1f","u_"+this.name+".spotCosCutoff",Math.cos(3.14159*this.angle/180)),t.uniform("1f","u_"+this.name+".spotExponent",this.exponent);},Nr(t,[{key:"direction",get:function(){return this._direction},set:function(e){this._direction=ro.normalize(ro.copy(e));}}]),t}(so);no.types.spotlight=ao,D(D.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}});var lo=function(e){function t(t){var r;return (r=e.call(this)||this).name="MethodNotImplemented",r.message="Method "+t+" must be implemented in subclass",r}return kr(t,e),t}(Fr(Error)),uo=function(){function e(e,t){var r=this;(this.validate(e),this.config=e,this.sources=t,this.id=e.id,this.name=e.name,this.pad_scale=e.pad_scale||1e-5,this.default_winding=null,this.rasters=[],Array.isArray(e.rasters)&&e.rasters.forEach(function(e){-1===r.rasters.indexOf(e)&&r.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.setZooms(e),this.zoom_offset=null!=e.zoom_offset?e.zoom_offset:0,this.zoom_offset<0)&&(Kr({level:"warn",once:!0},"Data source '"+this.name+"' zoom_offset must not be negative – setting to 0."),this.zoom_offset=0);this.setTileSize(e.tile_size),this.min_display_zoom=Math.max(e.min_display_zoom||0,this.zooms[0]),this.max_display_zoom=null!=e.max_display_zoom?e.max_display_zoom:null;}e.register=function(t,r){t&&r&&(e.types[t]=r);},e.create=function(t,r){if("function"==typeof e.types[t.type]){var n=e.types[t.type](t);if(n)return new n(t,r)}},e.tileLayoutChanged=function(e,t){if(!e||!t)return !0;var r=["max_zoom","zooms","min_display_zoom","max_display_zoom","bounds","tile_size","zoom_offset"],n=Rn(e.config,r),i=Rn(t.config,r);return JSON.stringify(n)!==JSON.stringify(i)},e.projectData=function(e){var t=+new Date;for(var r in e.layers)for(var n=e.layers[r].features.length,i=0;i<n;i++){var o=e.layers[r].features[i];li.transformGeometry(o.geometry,this.projectCoord);}void 0!==e.debug&&(e.debug.projection=+new Date-t);},e.projectCoord=function(e){li.latLngToMeters(e);},e.scaleData=function(e,t){var r=t.coords.z,n=t.min,i=li.unitsPerMeter(r);for(var o in e.layers)for(var s=e.layers[o].features.length,a=0;a<s;a++){var l=e.layers[o].features[a];li.transformGeometry(l.geometry,function(e){e[0]=(e[0]-n.x)*i,e[1]=(e[1]-n.y)*i*-1;});}};var t=e.prototype;return t.load=function(e){var t=this;return e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[].concat(this.rasters),this._load(e).then(function(e){for(var r in e.source_data.layers){var n=e.source_data.layers[r];n&&n.features&&n.features.forEach(function(e){li.transformGeometry(e.geometry,function(e){e[1]=-e[1],t.pad_scale&&(e[0]=Math.round(e[0]*(1+t.pad_scale)-li.tile_scale*t.pad_scale/2),e[1]=Math.round(e[1]*(1+t.pad_scale)-li.tile_scale*t.pad_scale/2));}),t.updateDefaultWinding(e.geometry);});}return e.default_winding=t.default_winding||"CCW",e})},t._load=function(){throw new lo("_load")},t.copyTileData=function(e,t){return Kr("trace","Copy tile data from "+e.key+" to "+t.key),t.source_data={layers:e.source_data.layers},t.rasters=[].concat(e.rasters),t.pad_scale=e.pad_scale,t.default_winding=e.default_winding,t},t.setZooms=function(e){var t=e.max_zoom,r=e.zooms;if(this.max_zoom=null!=t?t:li.default_source_max_zoom,Array.isArray(r))this.zooms=r,this.max_zoom=this.zooms[this.zooms.length-1];else{this.zooms=[];for(var n=0;n<=this.max_zoom;n++)this.zooms[n]=n;}},t.setTileSize=function(e){this.tile_size=e||256,("number"!=typeof this.tile_size||this.tile_size<256||!rn.isPowerOf2(this.tile_size))&&(Kr({level:"warn",once:!0},"Data source '"+this.name+"': 'tile_size' parameter must be a number that is a power of 2 greater than or equal to 256, but was '"+e+"'"),this.tile_size=256),this.zoom_bias=Math.log2(this.tile_size)-8+this.zoom_offset;},t.updateDefaultWinding=function(e){return null==this.default_winding&&("Polygon"===e.type?this.default_winding=li.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=li.ringWinding(e.coordinates[0][0]))),this.default_winding},t.includesTile=function(e,t){if(e.z<this.min_display_zoom||null!=this.max_display_zoom&&t>this.max_display_zoom)return !1;for(var r=0;r<this.rasters.length;r++){var n=this.rasters[r];if(this.sources[n]&&this.sources[n]!==this&&!this.sources[n].includesTile(e,e.z))return !1}return !0},t.validate=function(){},e}();uo.types={};var co=0,fo=function(e){function t(t,r){var n;(n=e.call(this,t,r)||this).response_type="";var i=function(e,t){if(!t||0===Object.keys(t).length)return [e,[]];var r=e.indexOf("?"),n=e.indexOf("#"),i="";n>-1&&(i=e.slice(n),e=e.slice(0,n)),-1===r&&(r=e.length,e+="?"),r++;var o="",s=[];for(var a in t)""===Tn(a,e)?o+=a+"="+t[a]+"&":s.push([a,t[a]]);return [e=e.slice(0,r)+o+e.slice(r)+i,s]}(t.url,t.url_params),o=i[0],s=i[1];return n.url=o,s.forEach(function(e){var r=e[0],i=e[1];Kr({level:"warn",once:!0},"Data source '"+n.name+"': parameter '"+r+"' already present in URL '"+t.url+"', skipping value '"+r+"="+i+"' specified in 'url_params'");}),t.request_headers&&"object"==typeof t.request_headers&&(n.request_headers=t.request_headers),n}kr(t,e);var r=t.prototype;return r._load=function(e){var t=this,r=this.formatURL(this.url,e),n=e.source_data;return n.url=r,e.debug=e.debug||{},e.debug.network=+new Date,new Promise(function(i){var o=co+++"-"+r,s=rn.io(r,6e4,t.response_type,"GET",t.request_headers,o);n.request_id=o,n.error=null,s.then(function(r){var o=r.body;e.debug.response_size=o&&(o.length||o.byteLength),e.debug.network=+new Date-e.debug.network,e.debug.parsing=+new Date,null!=o&&"function"==typeof t.preprocess&&(o=t.preprocess(o)),(o=o instanceof Promise?o:Promise.resolve(o)).then(function(r){null!=r?t.parseSourceData(e,n,r):n.layers={},e.debug.parsing=+new Date-e.debug.parsing,i(e);});}).catch(function(t){n.error=t.stack,i(e);});})},r.validate=function(e){if("string"!=typeof e.url)throw Error("Network data source must provide a string `url` property")},r.formatURL=function(){throw new lo("formatURL")},r.parseSourceData=function(){throw new lo("parseSourceData")},t}(uo),ho=function(e){function t(t,r){var n;return (n=e.call(this,t,r)||this).tiled=!0,n.bounds=n.parseBounds(t),n.builds_geometry_tiles=!1,n.tms=!0===t.tms,n.url&&n.url.search("{s}")>-1&&(Array.isArray(t.url_subdomains)&&t.url_subdomains.length>0?(n.url_subdomains=t.url_subdomains,n.next_url_subdomain=0):Kr({level:"warn",once:!0},"Data source '"+n.name+"': source URL includes '{s}' subdomain marker ('"+n.url+"'), but no subdomains were specified in 'url_subdomains' parameter")),n.url&&n.url.search("{r}")>-1&&(Array.isArray(t.url_density_scales)&&t.url_density_scales.length>0?n.url_density_scales=t.url_density_scales:n.url_density_scales=[1,2]),n}kr(t,e);var r=t.prototype;return r.parseBounds=function(e){if(Array.isArray(e.bounds)&&4===e.bounds.length){var t=e.bounds,r=t[0],n=t[1],i=t[2],o=t[3];return {latlng:[].concat(e.bounds),meters:{min:li.latLngToMeters([r,o]),max:li.latLngToMeters([i,n])},tiles:{min:{},max:{}}}}},r.checkBounds=function(e,t){if(t){e=li.wrapTile(e);var r=t.tiles.min[e.z];r||(r=t.tiles.min[e.z]=li.tileForMeters(t.meters.min,e.z));var n=t.tiles.max[e.z];if(n||(n=t.tiles.max[e.z]=li.tileForMeters(t.meters.max,e.z)),e.y<r.y||e.y>n.y)return !1;if(r.x<=n.x){if(e.x<r.x||e.x>n.x)return !1}else if(e.x>n.x&&e.x<r.x)return !1}return !0},r.includesTile=function(t,r){return !!e.prototype.includesTile.call(this,t,r)&&!!this.checkBounds(t,this.bounds)},r.formatURL=function(e,t){var r=li.wrapTile(t.coords,{x:!0});this.tms&&(r.y=Math.pow(2,r.z)-1-r.y);var n=e.replace("{x}",r.x).replace("{y}",r.y).replace("{z}",r.z).replace("{r}",this.getDensityModifier()).replace("{q}",this.toQuadKey(r));return null!=this.url_subdomains&&(n=n.replace("{s}",this.url_subdomains[this.next_url_subdomain]),this.next_url_subdomain=(this.next_url_subdomain+1)%this.url_subdomains.length),n},r.getDensityModifier=function(){if(this.url_density_scales){var e=rn.device_pixel_ratio,t=this.url_density_scales.filter(function(t){return e>=t}).reverse()[0];if((t=null!=t?t:this.url_density_scales[0])>1)return "@"+t+"x"}return ""},r.toQuadKey=function(e){for(var t=e.x,r=e.y,n="",i=e.z;i>0;i--){var o=0,s=1<<i-1;0!=(t&s)&&o++,0!=(r&s)&&(o+=2),n+=o.toString();}return n},t.urlHasTilePattern=function(e){return e&&(e.search("{x}")>-1&&e.search("{y}")>-1&&e.search("{z}")>-1||e.search("{q}")>-1)},t}(fo),po={coord:function(e){return {x:e.x,y:e.y,z:e.z,key:this.coordKey(e)}},coordKey:function(e){return e.x+"/"+e.y+"/"+e.z},key:function(e,t,r){if(!(e.y<0||e.y>=1<<e.z||e.z<0))return [t.name,e.x,e.y,e.z,r].join("/")},normalizedKey:function(e,t,r){return this.key(this.normalizedCoord(e,t),t,r)},normalizedCoord:function(e,t){return t.zoom_bias&&(e=this.coordAtZoom(e,Math.max(e.z-t.zoom_bias,t.zooms[0]))),this.coordForTileZooms(e,t.zooms)},coordAtZoom:function(e,t){var r=e.x,n=e.y,i=e.z;if(i!==(t=Math.max(0,t))){var o=Math.pow(2,i-t);r=Math.floor(r/o),n=Math.floor(n/o),i=t;}return this.coord({x:r,y:n,z:i})},coordForTileZooms:function(e,t){var r=e.x,n=e.y,i=e.z,o=this.findZoomInRange(i,t);return o!==i?this.coordAtZoom({x:r,y:n,z:i},o):this.coord({x:r,y:n,z:i})},findZoomInRange:function(e,t){return t.filter(function(t){return e>=t}).reverse()[0]||t[0]},isDescendant:function(e,t){if(t.z>e.z){var r=this.coordAtZoom(t,e.z),n=r.x,i=r.y;return e.x===n&&e.y===i}return !1},parent:function(e){var t=e.coords,r=e.source,n=e.style_z;if(n>0){n--;var i=Math.max(n-r.zoom_bias,r.zooms[0]),o=this.coordForTileZooms(this.coordAtZoom(t,i),r.zooms);return o.z>n?null:{key:this.key(o,r,n),coords:o,style_z:n,source:r}}},children:function(e,t){var r=e.coords,n=e.source,i=e.style_z;void 0===t&&(t={}),i++;var o=this.coordForTileZooms(this.coordAtZoom(r,i-n.zoom_bias),n.zooms);if(o.z===r.z)return [{key:this.key(o,n,i),coords:o,style_z:i,source:n}];var s=this.key(o,n,i);if(t[n.id]=t[n.id]||{},null==t[n.id][s]){for(var a=Math.pow(2,o.z-r.z),l=r.x*a,u=r.y*a,c=[],f=l;f<l+a;f++)for(var h=u;h<u+a;h++){var d=this.coord({x:f,y:h,z:o.z});c.push({key:this.key(d,n,i),coords:d,style_z:i,source:n});}t[n.id][s]=c;}return t[n.id][s]}},_o=function(e){function t(t,r){var n;return -1===(n=e.call(this,t,r)||this).rasters.indexOf(n.name)&&n.rasters.unshift(n.name),n.filtering=t.filtering,n.textures={},n}kr(t,e);var r=t.prototype;return r.load=function(e){return new Promise(function(t,r){e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[].concat(this.rasters);var n=li.tile_scale;return e.source_data.layers={_default:{type:"FeatureCollection",features:[{geometry:{type:"Polygon",coordinates:[[[0,0],[n,0],[n,-n],[0,-n],[0,0]]]},properties:{}}]}},e.default_winding="CW",t(e)}.bind(this))},r.tileTexture=function(e){return new Promise(function(t,r){var n=this.adjustRasterTileZoom(e),i=n.key;if(!this.textures[i]){var o=this.formatURL(this.url,{coords:n});this.textures[i]={name:o,url:o,filtering:this.filtering,coords:n};}return t(this.textures[i])}.bind(this))},r.adjustRasterTileZoom=function(e){var t=e.coords,r=this.sources[e.source];if(r!==this){var n=this.zoom_bias-r.zoom_bias;n>0?t=po.normalizedCoord(e.coords,{zoom_bias:n,zooms:this.zooms}):(n<0&&Kr({level:"warn",once:!0},"Raster source '"+this.name+"' supports higher zoom detail than source '"+r.name+"' it's attached to. Downsampling this source "+-n+" extra zoom levels to match."),t=po.coordForTileZooms(t,this.zooms));}return t},t}(ho),mo=function(e){function t(t,r){var n;return (n=e.call(this,t,r)||this).load_image={},n.alpha=null!=t.alpha?Math.max(Math.min(t.alpha,1),0):null,n.mask_alpha=!0,n.preserve_tiles_within_zoom=0,n.max_display_density=t.max_display_density,Array.isArray(t.composite)?n.images=t.composite.map(function(e){return {url:e.url,bounds:n.parseBounds(e),alpha:null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null}}):n.images=[{url:n.url,bounds:n.bounds,alpha:n.alpha}],n}kr(t,e);var r=t.prototype;return r.tileTexture=function(e,t){return new Promise(function(r,n){var i,o,s,a,l,u,c,f,h,d;return i=this,o=t.blend,s=t.generation,a=this.adjustRasterTileZoom(e),l="opaque"!==o,u="raster-"+this.name+"-"+a.key+"-"+(l?"alpha":"opaque")+"-"+s,Bn.textures[u]?r({name:u,coords:a,skip_create:!0}):(c=rn.device_pixel_ratio,this.max_display_density&&(c=Math.min(c,this.max_display_density)),c*=2,f=document.createElement("canvas"),h=f.getContext("2d"),f.width=this.tile_size*c,f.height=this.tile_size*c,h.imageSmoothingEnabled="nearest"!==this.filtering,d=this.images.filter(function(t){return i.checkBounds(e.coords,t.bounds)}),Promise.resolve(Promise.all(d.map(function(t){var r=l?null!=t.alpha?t.alpha:i.alpha:1;return i.drawImage(t.url,t.bounds,r,e,c,h)}))).then(function(e){try{return r({name:u,element:f,filtering:this.filtering,coords:a})}catch(e){return n(e)}}.bind(this),n))}.bind(this))},r.drawImage=function(e,t,r,n,i,o){return new Promise(function(s,a){var l,u,c,f,h,d,p;return l=Jn(e),this.load_image[l]=this.load_image[l]||this.loadImage(e),Promise.resolve(this.load_image[l]).then(function(e){try{return u=e,c=li.metersPerPixel(n.coords.z)/i/(this.tile_size/li.tile_size),f=(t.meters.min[0]-n.min.x)/c,h=-(t.meters.min[1]-n.min.y)/c,d=(t.meters.max[0]-t.meters.min[0])/c,p=-(t.meters.max[1]-t.meters.min[1])/c,o.globalAlpha=null!=r?r:1,o.drawImage(u,f,h,d,p),s()}catch(e){return a(e)}}.bind(this),a)}.bind(this))},r.loadImage=function(e){var t=this;return new Promise(function(r){var n=new Image;n.onload=function(){return r(n)},n.onerror=function(n){Kr("warn","Raster source '"+t.name+"': failed to load url: '"+e+"'",n),r(null);},rn.isSafari()&&"data:"===e.slice(0,5)||(n.crossOrigin="anonymous"),n.src=e;})},r.includesTile=function(e,t){var r=this;return !!uo.prototype.includesTile.call(this,e,t)&&this.images.some(function(t){return r.checkBounds(e,t.bounds)})},r.validate=function(e){var t="Raster data source must provide a string `url` parameter, or an array of `composite` raster ";t+="image objects that each have a `url` parameter";var r="Raster data source must provide a `bounds` parameter, or an array of `composite` raster ";r+="image objects that each have a `bounds` parameter";if("parameters, or an array of `composite` raster image objects, each with `url` and `bounds`.",Array.isArray(e.composite)){if(e.composite.some(function(e){return "string"!=typeof e.url}))throw Error(t);if(e.composite.some(function(e){return !(Array.isArray(e.bounds)&&4===e.bounds.length)}))throw Error(r);if(null!=e.url||null!=e.bounds)throw Error("Raster data source must have *either* a single image specified as `url` and `bounds `parameters, or an array of `composite` raster image objects, each with `url` and `bounds`.")}else{if("string"!=typeof e.url)throw Error(t);if(!Array.isArray(e.bounds)||4!==e.bounds.length)throw Error(r)}},t}(_o);uo.register("Raster",function(e){return _o.urlHasTilePattern(e.url)?_o:mo});var vo={init:function(e){var t=void 0===e?{}:e,r=t.generation,n=t.styles,i=t.sources,o=void 0===i?{}:i,s=t.introspection;this.setGeneration(r),this.styles=n,this.sources=o,this.defines=this.hasOwnProperty("defines")&&this.defines||{},this.shaders=this.hasOwnProperty("shaders")&&this.shaders||{},this.introspection=s||!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.stencil_proxy_tiles=!0,this.variants={},this.vertex_layouts={},this.defines.QCLDICP_WORLD_POSITION_WRAP=1e5,this.blend=this.blend||"opaque","opaque"!==this.blend?null==this.blend_order&&(this.blend_order=this.default_blend_orders[this.blend]):this.blend_order=this.default_blend_orders[this.blend],this.defines["QCLDICP_BLEND_"+this.blend.toUpperCase()]=!0,this.removeShaderBlock("setup"),this.material instanceof to||(to.isValid(this.material)||(this.material=Ui.defaults.material),this.material=new to(this.material)),this.material.inject(this),no.setMode(this.lighting,this),this.setupRasters(),this.setupCustomAttributes(),this.initialized=!0;},destroy:function(){this.program&&(this.program.destroy(),this.program=null),this.selection_program&&(this.selection_program.destroy(),this.selection_program=null),qr.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,this.main_thread_target=["Style",this.name,this.generation].join("_"),Ue.is_main&&qr.addTarget(this.main_thread_target,this);},startData:function(e){this.tile_data[e.id]=this.tile_data[e.id]||{meshes:{},uniforms:{},textures:[]};},endData:function(e){return new Promise(function(t,r){var n=this.tile_data[e.id];if(this.tile_data[e.id]=null,n&&Object.keys(n.meshes).length>0){for(var i in n.meshes){var o=n.meshes[i];0!==o.vertex_data.vertex_count?(o.vertex_data.end(),o.vertex_elements=o.vertex_data.element_buffer,o.vertex_data=o.vertex_data.vertex_buffer):delete n.meshes[i];}return t(this.buildRasterTextures(e,n))}return t(null)}.bind(this))},hasDataForTile:function(e){return null!=this.tile_data[e.id]},getTileMesh:function(e,t){var r=this.tile_data[e.id].meshes;if(null==r[t.key]){var n=this.vertexLayoutForMeshVariant(t);r[t.key]={variant:t,vertex_data:n.createVertexData()};}return r[t.key]},vertexLayoutForMeshVariant:function(){},meshVariantTypeForDraw:function(){},addFeature:function(e,t,r){var n=r.tile;if(n.generation===this.generation){this.tile_data[n.id]||this.startData(n);var i=this.parseFeature(e,t,r);i&&this.buildGeometry(e.geometry,i,r)>0&&(e.generation=this.generation);}},buildGeometry:function(e,t,r){var n,i=this;if("Polygon"===e.type?n=this.buildPolygons([e.coordinates],t,r):"MultiPolygon"===e.type?n=this.buildPolygons(e.coordinates,t,r):"LineString"===e.type?n=this.buildLines([e.coordinates],t,r):"MultiLineString"===e.type?n=this.buildLines(e.coordinates,t,r):"Point"===e.type?n=this.buildPoints([e.coordinates],t,r):"MultiPoint"===e.type&&(n=this.buildPoints(e.coordinates,t,r)),n>0&&nn.layer_stats){var o=r.tile;o.debug.layers=o.debug.layers||{list:{},tree:{}};var s=o.debug.layers.list,a=o.debug.layers.tree,l={};r.layers.forEach(function(e){var t,r;go(s,e,1,n,((t={})[i.name]=n,t),((r={})[i.baseStyle()]=n,r));for(var o=a,u=l,c=e.split(":"),f=0;f<c.length;f++){var h,d,p=c[f];if(o[p]=o[p]||{features:0,geoms:0,styles:{},base:{}},null==u[p])u[p]={},go(o,p,1,n,((h={})[i.name]=n,h),((d={})[i.baseStyle()]=n,d));f<c.length-1&&(o[p].layers=o[p].layers||{}),o=o[p].layers,u=u[p];}});}return n},parseFeature:function(e,t,r){try{var n=this.feature_style;if(n.order=this.parseOrder(t.order,r),null==n.order&&"overlay"!==this.blend){var i="Layer '"+t.layers.join(", ")+"', draw group '"+t.group+"': ";return i+="'order' parameter is required unless blend mode is 'overlay'",null!=t.order&&(i+="; 'order' was set to a dynamic value (e.g. string tied to feature property, ",i+="or JS function), but evaluated to null for one or more features"),void Kr({level:"warn",once:!0},i)}if(!(n=this._parseFeature(e,t,r)))return;if(this.shaders.attributes)for(var o in n.attributes=n.attributes||{},this.shaders.attributes)n.attributes[o]=Ui.evalCachedProperty(t.attributes&&t.attributes[o],r),"number"!=typeof n.attributes[o]&&(n.attributes[o]=0);return this.selection?n.interactive=Ui.evalProperty(t.interactive,r):n.interactive=!1,!0===n.interactive?n.selection_color=Ji.makeColor(e,r.tile,r):n.selection_color=Ji.defaultColor,n=this._parseFeature(e,t,r)}catch(t){Kr("error","Style.parseFeature: style parsing error",e,n,t.stack);}},_parseFeature:function(){return this.feature_style},preprocess:function(e){if(!e.preprocessed){if(this.draw)for(var t in this.draw){var r=this.draw[t];"object"!=typeof r||Array.isArray(r)?null==e[t]&&(e[t]=r):e[t]=ai({},r,e[t]);}if(this.selection?this.introspection&&(e.interactive=!0):e.interactive=!1,!(e=this._preprocess(e)))return;if(this.shaders.attributes)for(var n in e.attributes=e.attributes||{},this.shaders.attributes)e.attributes[n]=Ui.createPropertyCache(null!=e.attributes[n]?e.attributes[n]:0);e.preprocessed=!0;}return e},_preprocess:function(e){return e},parseOrder:function(e,t){return "number"!=typeof e?Ui.calculateOrder(e,t):e},scaleOrder:function(e){return 2*e},parseColor:function(e,t){return e?Ui.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?Ui.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=Bn.getMaxTextureSize(this.gl);},makeMesh:function(e,t,r){void 0===r&&(r={});var n=this.vertexLayoutForMeshVariant(r.variant);return nn.wireframe?(t=function(e){for(var t=new Uint16Array(2*e.length),r=0;r<e.length;r+=3)t.set([e[r],e[r+1],e[r+1],e[r+2],e[r+2],e[r]],2*r);return t}(t),new Qi(this.gl,e,t,n,Object.assign({},r,{draw_mode:this.gl.LINES}))):new Qi(this.gl,e,t,n,r)},render:function(e){return e.render()},getProgram:function(e){void 0===e&&(e="program"),this.compileSetup();var t=this[e];if(t&&!t.error){if(!t.compiled){Kr("debug","Compiling style '"+this.name+"', program key '"+e+"'");try{t.compile();}catch(t){throw Kr("error","Style: error compiling program for style '"+this.name+"' (program key '"+e+"')",this,t.stack,t.type,t.shader_errors),t}}return t}},compileSetup:function(){if(!this.compile_setup){if(!this.gl)throw new Error("style.compile(): skipping for "+this.name+" because no GL context");var e=this.buildDefineList();if(this.selection){var t=Object.assign({},e);t.QCLDICP_FEATURE_SELECTION=!0;}var r=this.shaders&&this.shaders.blocks,n=this.shaders&&this.shaders.block_scopes,i=Object.assign({},this.shaders&&this.shaders.uniforms);for(var o in i)null==i[o]&&Kr({level:"warn",once:!0},"Style '"+this.name+"' has invalid uniform '"+o+"': uniform values must be non-null");var s=this.shaders&&this.shaders.extensions;"string"==typeof s&&(s=[s]),this.program=new ei(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:i,blocks:r,block_scopes:n,extensions:s}),this.selection?this.selection_program=new ei(this.gl,this.vertex_shader_src,"// Fragment shader for feature selection passes\n// Renders in silhouette according to selection (picking) color, or black if none defined\n\n#ifdef QCLDICP_FEATURE_SELECTION\n varying vec4 v_selection_color;\n#endif\n\nvoid main (void) {\n #ifdef QCLDICP_FEATURE_SELECTION\n gl_FragColor = v_selection_color;\n #else\n gl_FragColor = vec4(0., 0., 0., 1.);\n #endif\n}\n",{name:this.name+" (selection)",defines:t,uniforms:i,blocks:r,block_scopes:n,extensions:s}):this.selection_program=null,this.compile_setup=!0;}},addShaderBlock:function(e,t,r){void 0===r&&(r=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),this.shaders.block_scopes&&(this.shaders.block_scopes[e]=null);},replaceShaderBlock:function(e,t,r){void 0===r&&(r=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 ["color","normal","custom"].indexOf(this.raster)>-1},setupRasters:function(){var e=this;if(this.hasRasters()){"color"===this.raster?this.defines.QCLDICP_RASTER_TEXTURE_COLOR=!0:"normal"===this.raster&&(this.defines.QCLDICP_RASTER_TEXTURE_NORMAL=!0);var t=Object.keys(this.sources).filter(function(t){return e.sources[t]instanceof _o}).length;if(this.defines.QCLDICP_NUM_RASTER_SOURCES=""+t,t>0){var r=Object.keys(this.sources).filter(function(t){return e.sources[t].mask_alpha}).length;this.defines.QCLDICP_HAS_MASKED_RASTERS=r>0,this.defines.QCLDICP_ALL_MASKED_RASTERS=r===t,this.defines.QCLDICP_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster","// Uniforms defining raster textures and macros for accessing them\n\n#ifdef QCLDICP_FRAGMENT_SHADER\nuniform sampler2D u_rasters[QCLDICP_NUM_RASTER_SOURCES]; // raster tile texture samplers\nuniform vec2 u_raster_sizes[QCLDICP_NUM_RASTER_SOURCES]; // raster tile texture sizes (width/height in pixels)\nuniform vec3 u_raster_offsets[QCLDICP_NUM_RASTER_SOURCES]; // raster tile texture UV starting offset for tile\n\n// Raster sources can optionally mask by the alpha channel (render with only full or no alpha, based on a threshold),\n// which is used for handling transparency outside the raster image when rendering with opaque blending\n#if defined(QCLDICP_HAS_MASKED_RASTERS) && !defined(QCLDICP_ALL_MASKED_RASTERS) // only add uniform if we need it\nuniform bool u_raster_mask_alpha;\n#endif\n\n// Note: the raster accessors below are #defines rather than functions to\n// avoid issues with constant integer expressions for array indices\n\n// Adjusts UVs in model space to account for raster tile texture overzooming\n// (applies scale and offset adjustments)\n#define adjustRasterUV(raster_index, uv) \\\n ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n\n// Returns the UVs of the current model position for a raster sampler\n#define currentRasterUV(raster_index) \\\n (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n\n// Returns pixel location in raster tile texture at current model position\n#define currentRasterPixel(raster_index) \\\n (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n\n// Samples a raster tile texture for the current model position\n#define sampleRaster(raster_index) \\\n (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n\n// Samples a raster tile texture for a given pixel\n#define sampleRasterAtPixel(raster_index, pixel) \\\n (texture2D(u_rasters[raster_index], (pixel) / rasterPixelSize(raster_index)))\n\n// Returns size of raster sampler in pixels\n#define rasterPixelSize(raster_index) \\\n (u_raster_sizes[raster_index])\n\n#endif\n","Raster");}}},buildRasterTextures:function(e,t){return new Promise(function(r,n){var i,o,s,a;if(!this.hasRasters())return r(t);if(0===e.rasters.length)return r(t);var l=function(){try{return !i||i.length<1?r(t):i.some(function(e){return !e.loaded})?r(null):(t.uniforms.u_raster_mask_alpha=!0===this.sources[e.rasters[0]].mask_alpha,o=t.uniforms.u_rasters=[],s=t.uniforms.u_raster_sizes=[],a=t.uniforms.u_raster_offsets=[],i.forEach(function(r){var n=r.index;if(o[n]=r.name,t.textures.push(r.name),s[n]=[r.width,r.height],e.coords.z>r.coords.z){var i=e.coords.z-r.coords.z,l=Math.pow(2,i);a[n]=[(e.coords.x%l+l)%l/l,(l-1-e.coords.y%l)/l,1/l];}else a[n]=[0,0,1];}),r(t))}catch(e){return n(e)}}.bind(this),u=function(e){try{return r(t)}catch(e){return n(e)}};try{return Promise.resolve(qr.postMessage(this.main_thread_target+".loadTextures",{coords:e.coords,source:e.source,rasters:e.rasters,min:e.min,max:e.max})).then(function(e){try{return i=e,l()}catch(e){return u()}},u)}catch(e){u();}}.bind(this))},loadTextures:function(e){return new Promise(function(t,r){var n,i,o,s,a;return n=this,i={},o={},s=[],e.rasters.map(function(e){return n.sources[e]}).filter(function(e){return e}).forEach(function(t,r){t instanceof _o&&s.push(t.tileTexture(e,n).then(function(e){i[e.name]=e,o[e.name]=r;}));}),Promise.resolve(Promise.all(s)).then(function(e){try{return Promise.resolve(Bn.createFromObject(this.gl,i)).then(function(e){try{return Promise.resolve(Promise.all(Object.keys(i).map(function(e){return Bn.textures[e]&&Bn.textures[e].load()}).filter(function(e){return e}))).then(function(e){try{return (a=e).forEach(function(e){return e.retain()}),t(a.map(function(e){return {name:e.name,width:e.width,height:e.height,loaded:e.loaded,index:o[e.name],coords:i[e.name].coords}}))}catch(e){return r(e)}},r)}catch(e){return r(e)}},r)}catch(e){return r(e)}}.bind(this),r)}.bind(this))},setupCustomAttributes:function(){if(this.shaders.attributes)for(var e=Object.entries(this.shaders.attributes),t=0;t<e.length;t++){var r=e[t],n=r[0],i=r[1];"float"===i.type&&(!1!==i.varying?(this.addShaderBlock("attributes","\n #ifdef QCLDICP_VERTEX_SHADER\n attribute float a_"+n+";\n varying float v_"+n+";\n #define "+n+" a_"+n+"\n #else\n varying float v_"+n+";\n #define "+n+" v_"+n+"\n #endif\n "),this.addShaderBlock("setup","#ifdef QCLDICP_VERTEX_SHADER\nv_"+n+" = a_"+n+";\n#endif")):this.addShaderBlock("attributes","\n #ifdef QCLDICP_VERTEX_SHADER\n attribute float a_"+n+";\n #define "+n+" a_"+n+"\n #endif\n "));}},addCustomAttributesToAttributeList:function(e){if(this.shaders.attributes)for(var t=Object.entries(this.shaders.attributes),r=0;r<t.length;r++){var n=t[r],i=n[0];"float"===n[1].type&&e.push({name:"a_"+i,size:1,type:$i.FLOAT,normalized:!1});}return e},addCustomAttributesToVertexTemplate:function(e,t){if(this.shaders.attributes)for(var r in this.shaders.attributes)this.vertex_template[t++]=null!=e.attributes[r]?e.attributes[r]:0;},setup:function(){this.setUniforms(),this.material.setupProgram(ei.current);},setUniforms:function(){var e=ei.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:Number.MIN_SAFE_INTEGER,add:1,multiply:2,inlay:3,translucent:4,overlay:5},getBlendOrderForDraw:function(e){return "opaque"!==this.blend&&null!=e.blend_order?e.blend_order:this.blend_order}};function go(e,t,r,n,i,o){for(var s in e[t]=e[t]||{features:0,geoms:0,styles:{},base:{}},e[t].features+=r,e[t].geoms+=n,i)e[t].styles[s]=e[t].styles[s]||0,e[t].styles[s]+=i[s];for(var a in o)e[t].base[a]=e[t].base[a]||0,e[t].base[a]+=o[a];}Vn("Int16",2,function(e){return function(t,r,n){return e(this,t,r,n)}}),Vn("Uint32",4,function(e){return function(t,r,n){return e(this,t,r,n)}}),Vn("Int32",4,function(e){return function(t,r,n){return e(this,t,r,n)}}),Vn("Int8",1,function(e){return function(t,r,n){return e(this,t,r,n)}}),Vn("Float32",4,function(e){return function(t,r,n){return e(this,t,r,n)}});var yo,xo=Math.pow(2,16)-1,bo=!1,Ao=function(){function e(){this.array=[],this.has_overflown=!1;}var t=e.prototype;return t.push=function(e){this.has_overflown&&!bo||e>xo&&(this.has_overflown=!0,!bo)||this.array.push(e);},t.end=function(){if(this.array.length){var e=(t=this.array,new(this.has_overflown&&bo?Uint32Array:Uint16Array)(t));return this.array=[],this.has_overflown=!1,e}return !1;var t;},e}();Ao.setElementIndexUint=function(e){bo=e;};var To=((yo={})[$i.FLOAT]=Float32Array,yo[$i.BYTE]=Int8Array,yo[$i.UNSIGNED_BYTE]=Uint8Array,yo[$i.INT]=Int32Array,yo[$i.UNSIGNED_INT]=Uint32Array,yo[$i.SHORT]=Int16Array,yo[$i.UNSIGNED_SHORT]=Uint16Array,yo),wo=function(){function e(t,r){var n=(void 0===r?{}:r).prealloc,i=void 0===n?500:n;this.vertex_layout=t,this.vertex_elements=new Ao,this.stride=this.vertex_layout.stride,e.array_pool.length>0?(this.vertex_buffer=e.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 "+this.byte_length+", "+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();}var t=e.prototype;return t.setBufferViews=function(){var e=this;this.views={},this.views[$i.UNSIGNED_BYTE]=this.vertex_buffer,this.vertex_layout.dynamic_attribs.forEach(function(t){if(null==e.views[t.type]){var r=To[t.type];e.views[t.type]=new r(e.vertex_buffer.buffer);}});},t.checkBufferSize=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 t=new Uint8Array(this.byte_length);t.set(this.vertex_buffer),e.array_pool.push(this.vertex_buffer),this.vertex_buffer=t,this.setBufferViews(),this.realloc_count++;}},t.setAddVertexFunction=function(){this.vertexLayoutAddVertex=this.vertex_layout.getAddVertexFunction();},t.addVertex=function(e){this.checkBufferSize(),this.vertexLayoutAddVertex(e,this.views,this.offset),this.offset+=this.stride,this.vertex_count++;},t.end=function(){return this.vertex_buffer=this.vertex_buffer.subarray(0,this.offset),this.element_buffer=this.vertex_elements.end(),Kr("trace","VertexData: "+this.size+" vertices total, realloc count "+this.realloc_count),this},e}();wo.array_pool=[];var Eo=function(){function e(e){this.attribs=e,this.dynamic_attribs=this.attribs.filter(function(e){return null==e.static}),this.static_attribs=this.attribs.filter(function(e){return null!=e.static}),this.components=[],this.index={},this.offset={},this.stride=0;for(var t=0,r=0,n=0;n<this.attribs.length;n++){var i=this.attribs[n];if(null==i.static){i.offset=this.stride,i.byte_size=i.size;var o=0;switch(i.type){case $i.FLOAT:case $i.INT:case $i.UNSIGNED_INT:i.byte_size*=4,o=2;break;case $i.SHORT:case $i.UNSIGNED_SHORT:i.byte_size*=2,o=1;}3&i.byte_size&&(i.byte_size+=4-(3&i.byte_size)),this.stride+=i.byte_size;for(var s=i.offset>>o,a=0;a<i.size;a++)this.components.push({type:i.type,shift:o,offset:s++,index:r++});this.index[i.name]=t,t+=i.size,this.offset[i.name]=i.offset;}else i.static=Array.isArray(i.static)?i.static:[i.static],i.method="vertexAttrib"+i.static.length+"fv";}}var t=e.prototype;return t.enableDynamicAttributes=function(t,r){var n=this;for(var i in e.enabled_attribs)t.disableVertexAttribArray(i);e.enabled_attribs={},this.dynamic_attribs.forEach(function(i){var o=r.attribute(i.name).location;-1!==o&&(t.enableVertexAttribArray(o),t.vertexAttribPointer(o,i.size,i.type,i.normalized,n.stride,i.offset),e.enabled_attribs[o]=r);});},t.enableStaticAttributes=function(e,t){this.static_attribs.forEach(function(r){var n=t.attribute(r.name).location;-1!==n&&e[r.method]instanceof Function&&(e.enableVertexAttribArray(n),e[r.method](n,r.static),e.disableVertexAttribArray(n));});},t.createVertexData=function(){return new wo(this)},t.getAddVertexFunction=function(){return null==this.addVertex&&this.createAddVertexFunction(),this.addVertex},t.createAddVertexFunction=function(){var t=Jn(JSON.stringify(this.attribs));if(null==e.add_vertex_funcs[t]){var r,n=["var t, o;"],i=[].concat(this.components);i.sort(function(e,t){return e.type!==t.type?e.type-t.type:e.index-t.index});for(var o=0;o<i.length;o++){var s=i[o];r!==s.type&&(n.push("t = vs["+s.type+"];"),n.push("o = off"+(s.shift?" >> "+s.shift:"")+";"),r=s.type),n.push("t[o + "+s.offset+"] = v["+s.index+"];");}n=n.join("\n");var a=new Function("v","vs","off",n);e.add_vertex_funcs[t]=a;}this.addVertex=e.add_vertex_funcs[t];},e}();Eo.enabled_attribs={},Eo.add_vertex_funcs={};var Ro=[{x:0,y:0},{x:li.tile_scale,y:-li.tile_scale}],Mo=[0,0,1,1];function So(e,t,r){var n=Ro[0],i=Ro[1];return e[0]<=n.x+r&&t[0]<=n.x+r||e[0]>=i.x-r&&t[0]>=i.x-r||e[1]>=n.y-r&&t[1]>=n.y-r||e[1]<=i.y+r&&t[1]<=i.y+r}function zo(e,t){t=t||0;var r=Ro[0],n=Ro[1];return e[0]<=r.x+t||e[0]>=n.x-t||e[1]>=r.y-t||e[1]<=n.y+t}var Po=No;function No(e,t,r){r=r||2;var n,i,o,s,a,l,u,c=t&&t.length,f=c?t[0]*r:e.length,h=ko(e,0,f,r,!0),d=[];if(!h)return d;if(c&&(h=function(e,t,r,n){var i,o,s,a,l,u=[];for(i=0,o=t.length;i<o;i++)s=t[i]*n,a=i<o-1?t[i+1]*n:e.length,(l=ko(e,s,a,n,!1))===l.next&&(l.steiner=!0),u.push(Vo(l));for(u.sort(Go),i=0;i<u.length;i++)jo(u[i],r),r=Lo(r,r.next);return r}(e,t,h,r)),e.length>80*r){n=o=e[0],i=s=e[1];for(var p=r;p<f;p+=r)(a=e[p])<n&&(n=a),(l=e[p+1])<i&&(i=l),a>o&&(o=a),l>s&&(s=l);u=Math.max(o-n,s-i);}return Oo(h,d,r,n,i,u),d}function ko(e,t,r,n,i){var o,s;if(i===Qo(e,t,r,n)>0)for(o=t;o<r;o+=n)s=Jo(o,e[o],e[o+1],s);else for(o=r-n;o>=t;o-=n)s=Jo(o,e[o],e[o+1],s);return s&&Xo(s,s.next)&&($o(s),s=s.next),s}function Lo(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!Xo(n,n.next)&&0!==Ho(n.prev,n,n.next))n=n.next;else{if($o(n),(n=t=n.prev)===n.next)return null;r=!0;}}while(r||n!==t);return t}function Oo(e,t,r,n,i,o,s){if(e){!s&&o&&function(e,t,r,n){var i=e;do{null===i.z&&(i.z=Co(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,n,i,o,s,a,l,u=1;do{for(r=e,e=null,o=null,s=0;r;){for(s++,n=r,a=0,t=0;t<u&&(a++,n=n.nextZ);t++);for(l=u;a>0||l>0&&n;)0===a?(i=n,n=n.nextZ,l--):0!==l&&n?r.z<=n.z?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,l--):(i=r,r=r.nextZ,a--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n;}o.nextZ=null,u*=2;}while(s>1)}(i);}(e,n,i,o);for(var a,l,u=e;e.prev!==e.next;)if(a=e.prev,l=e.next,o?Fo(e,n,i,o):Io(e))t.push(a.i/r),t.push(e.i/r),t.push(l.i/r),$o(e),e=l.next,u=l.next;else if((e=l)===u){s?1===s?Oo(e=Uo(e,t,r),t,r,n,i,o,2):2===s&&Do(e,t,r,n,i,o):Oo(Lo(e),t,r,n,i,o,1);break}}}function Io(e){var t=e.prev,r=e,n=e.next;if(Ho(t,r,n)>=0)return !1;for(var i=e.next.next;i!==e.prev;){if(Bo(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Ho(i.prev,i,i.next)>=0)return !1;i=i.next;}return !0}function Fo(e,t,r,n){var i=e.prev,o=e,s=e.next;if(Ho(i,o,s)>=0)return !1;for(var a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,l=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,u=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,c=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,f=Co(a,l,t,r,n),h=Co(u,c,t,r,n),d=e.nextZ;d&&d.z<=h;){if(d!==e.prev&&d!==e.next&&Bo(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&Ho(d.prev,d,d.next)>=0)return !1;d=d.nextZ;}for(d=e.prevZ;d&&d.z>=f;){if(d!==e.prev&&d!==e.next&&Bo(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&Ho(d.prev,d,d.next)>=0)return !1;d=d.prevZ;}return !0}function Uo(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!Xo(i,o)&&Wo(i,n,n.next,o)&&Yo(i,o)&&Yo(o,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(o.i/r),$o(n),$o(n.next),n=e=o),n=n.next;}while(n!==e);return n}function Do(e,t,r,n,i,o){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&qo(s,a)){var l=Zo(s,a);return s=Lo(s,s.next),l=Lo(l,l.next),Oo(s,t,r,n,i,o),void Oo(l,t,r,n,i,o)}a=a.next;}s=s.next;}while(s!==e)}function Go(e,t){return e.x-t.x}function jo(e,t){if(t=function(e,t){var r,n=t,i=e.x,o=e.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>s){if(s=a,a===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x<n.next.x?n:n.next;}}n=n.next;}while(n!==t);if(!r)return null;if(i===s)return r.prev;var l,u=r,c=r.x,f=r.y,h=1/0;n=r.next;for(;n!==u;)i>=n.x&&n.x>=c&&Bo(o<f?i:s,o,c,f,o<f?s:i,o,n.x,n.y)&&((l=Math.abs(o-n.y)/(i-n.x))<h||l===h&&n.x>r.x)&&Yo(n,e)&&(r=n,h=l),n=n.next;return r}(e,t)){var r=Zo(t,e);Lo(r,r.next);}}function Co(e,t,r,n,i){return (e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)/i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)/i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Vo(e){var t=e,r=e;do{t.x<r.x&&(r=t),t=t.next;}while(t!==e);return r}function Bo(e,t,r,n,i,o,s,a){return (i-s)*(t-a)-(e-s)*(o-a)>=0&&(e-s)*(n-a)-(r-s)*(t-a)>=0&&(r-s)*(o-a)-(i-s)*(n-a)>=0}function qo(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Wo(r,r.next,e,t))return !0;r=r.next;}while(r!==e);return !1}(e,t)&&Yo(e,t)&&Yo(t,e)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{r.y>o!=r.next.y>o&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;}while(r!==e);return n}(e,t)}function Ho(e,t,r){return (t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Xo(e,t){return e.x===t.x&&e.y===t.y}function Wo(e,t,r,n){return !!(Xo(e,t)&&Xo(r,n)||Xo(e,n)&&Xo(r,t))||Ho(e,t,r)>0!=Ho(e,t,n)>0&&Ho(r,n,e)>0!=Ho(r,n,t)>0}function Yo(e,t){return Ho(e.prev,e,e.next)<0?Ho(e,t,e.next)>=0&&Ho(e,e.prev,t)>=0:Ho(e,t,e.prev)<0||Ho(e,e.next,t)<0}function Zo(e,t){var r=new Ko(e.i,e.x,e.y),n=new Ko(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Jo(e,t,r,n){var i=new Ko(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function $o(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 Ko(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1;}function Qo(e,t,r,n){for(var i=0,o=t,s=r-n;o<r;o+=n)i+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return i}No.deviation=function(e,t,r,n){var i=t&&t.length,o=i?t[0]*r:e.length,s=Math.abs(Qo(e,0,o,r));if(i)for(var a=0,l=t.length;a<l;a++){var u=t[a]*r,c=a<l-1?t[a+1]*r:e.length;s-=Math.abs(Qo(e,u,c,r));}var f=0;for(a=0;a<n.length;a+=3){var h=n[a]*r,d=n[a+1]*r,p=n[a+2]*r;f+=Math.abs((e[h]-e[p])*(e[d+1]-e[h+1])-(e[h]-e[d])*(e[p+1]-e[h+1]));}return 0===s&&0===f?0:Math.abs((f-s)/s)},No.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var s=0;s<t;s++)r.vertices.push(e[i][o][s]);i>0&&(n+=e[i-1].length,r.holes.push(n));}return r};var es=[0,0,1];function ts(e,t,r,n){var i,o,s,a,l,u,c,f,h,d=n.texcoord_index,p=n.texcoord_scale,_=n.texcoord_normalize,m=t.vertex_elements,v=e.length,g=0;if(d){_=_||1;var y=p||Mo;i=y[0],o=y[1],s=y[2],a=y[3];}for(var x=0;x<v;x++){var b=e[x],A=t.vertex_count,T=(h=Po.flatten(b),Po(h.vertices,h.holes,h.dimensions)),w=T.length;if(w){var E;if(d)l=(E=li.findBoundingBox(b))[0],u=E[1],c=(s-i)/(E[2]-l),f=(a-o)/(E[3]-u);for(var R=0;R<b.length;R++)for(var M=b[R],S=0;S<M.length;S++){var z=M[S];r[0]=z[0],r[1]=z[1],d&&(r[d+0]=((z[0]-l)*c+i)*_,r[d+1]=((z[1]-u)*f+o)*_),t.addVertex(r);}for(var P=0;P<w;P++)m.push(A+T[P]);g+=w/3;}}return g}var rs='uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_color;\n\n// Optional normal attribute, otherwise default to up\n#ifdef QCLDICP_NORMAL_ATTRIBUTE\n attribute vec3 a_normal;\n #define QCLDICP_NORMAL a_normal\n#else\n #define QCLDICP_NORMAL vec3(0., 0., 1.)\n#endif\n\n// Optional dynamic line extrusion\n#ifdef QCLDICP_EXTRUDE_LINES\n attribute vec2 a_extrude; // extrusion direction in xy plane\n attribute vec2 a_offset; // offset direction in xy plane\n\n // Polygon and line styles have slightly different VBO layouts, saving memory by optimizing vertex packing.\n // All lines have a width scaling factor, but only some have a height (position.z) or offset.\n // The vertex height is stored in different attributes to account for this.\n attribute vec2 a_z_and_offset_scale; // stores vertex height in x, and offset scaling factor in y\n #define QCLDICP_POSITION_Z a_z_and_offset_scale.x // vertex height is stored in separate line-specific attrib\n #define QCLDICP_OFFSET_SCALING a_z_and_offset_scale.y // zoom scaling factor for line offset\n #define QCLDICP_WIDTH_SCALING a_position.z // zoom scaling factor for line width (stored in position attrib)\n\n uniform float u_v_scale_adjust; // scales texture UVs for line dash patterns w/fractional pixel width\n#else\n #define QCLDICP_POSITION_Z a_position.z // vertex height\n#endif\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n// Optional texture UVs\n#if defined(QCLDICP_TEXTURE_COORDS) || defined(QCLDICP_EXTRUDE_LINES)\n attribute vec2 a_texcoord;\n varying vec2 v_texcoord;\n#endif\n\n// Optional model position varying for tile coordinate zoom\n#ifdef QCLDICP_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(QCLDICP_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#define QCLDICP_UNPACK_SCALING(x) (x / 1024.)\n\n#pragma qcldicp: attributes\n#pragma qcldicp: camera\n#pragma qcldicp: material\n#pragma qcldicp: lighting\n#pragma qcldicp: raster\n#pragma qcldicp: global\n\nvoid main() {\n // Initialize globals\n #pragma qcldicp: setup\n\n // Texture UVs\n #ifdef QCLDICP_TEXTURE_COORDS\n v_texcoord = a_texcoord;\n #ifdef QCLDICP_EXTRUDE_LINES\n v_texcoord.y *= u_v_scale_adjust;\n #endif\n #endif\n\n // Pass model position to fragment shader\n #ifdef QCLDICP_MODEL_POSITION_BASE_ZOOM_VARYING\n v_modelpos_base_zoom = modelPositionBaseZoom();\n #endif\n\n // Position\n vec4 position = vec4(a_position.xy, QCLDICP_POSITION_Z / QCLDICP_HEIGHT_SCALE, 1.); // convert height back to meters\n\n #ifdef QCLDICP_EXTRUDE_LINES\n vec2 _extrude = a_extrude.xy;\n vec2 _offset = a_offset.xy;\n\n // Adjust line width based on zoom level, to prevent proxied lines\n // from being either too small or too big.\n // "Flattens" the zoom between 1-2 to peg it to 1 (keeps lines from\n // prematurely shrinking), then interpolate and clamp to 4 (keeps lines\n // from becoming too small when far away).\n float _dz = clamp(u_map_position.z - u_tile_origin.z, 0., 4.);\n _dz += step(1., _dz) * (1. - _dz) + mix(0., 2., clamp((_dz - 2.) / 2., 0., 1.));\n\n // Interpolate line width between zooms\n float _mdz = (_dz - 0.5) * 2.; // zoom from mid-point\n _extrude -= _extrude * QCLDICP_UNPACK_SCALING(QCLDICP_WIDTH_SCALING) * _mdz;\n\n // Interpolate line offset between zooms\n // Scales from the larger value to the smaller one\n float _dwdz = QCLDICP_UNPACK_SCALING(QCLDICP_OFFSET_SCALING);\n float _sdwdz = sign(step(0., _dwdz) - 0.5); // sign indicates "direction" of scaling\n _offset -= _offset * abs(_dwdz) * ((1.-step(0., _sdwdz)) - (_dz * -_sdwdz)); // scale "up" or "down"\n\n // Scale line width and offset to be consistent in screen space\n float _ssz = exp2(-_dz - (u_tile_origin.z - u_tile_origin.w));\n _extrude *= _ssz;\n _offset *= _ssz;\n\n // Modify line width before extrusion\n #ifdef QCLDICP_BLOCK_WIDTH\n float width = 1.;\n #pragma qcldicp: width\n _extrude *= width;\n #endif\n\n position.xy += _extrude + _offset;\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = wrapWorldPosition(u_model * position);\n\n // Adjust for tile and view position\n position = u_modelView * position;\n\n // Modify position before camera projection\n #pragma qcldicp: position\n\n // Setup varyings\n v_position = position;\n v_normal = normalize(u_normalMatrix * QCLDICP_NORMAL);\n v_color = a_color;\n\n #if defined(QCLDICP_LIGHTING_VERTEX)\n // Vertex lighting\n vec3 normal = v_normal;\n\n // Modify normal before lighting\n #pragma qcldicp: normal\n\n // Pass lighting intensity to fragment shader\n v_lighting = calculateLighting(position.xyz - u_eye, normal, vec4(1.));\n #endif\n\n // Camera\n cameraProjection(position);\n\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n\n gl_Position = position;\n}\n',ns="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#ifdef QCLDICP_EXTRUDE_LINES\n uniform bool u_has_line_texture;\n uniform sampler2D u_texture;\n uniform float u_texture_ratio;\n uniform vec4 u_dash_background_color;\n uniform float u_has_dash;\n#endif\n\n#define QCLDICP_NORMAL v_normal\n\n#if defined(QCLDICP_TEXTURE_COORDS) || defined(QCLDICP_EXTRUDE_LINES)\n varying vec2 v_texcoord;\n#endif\n\n#ifdef QCLDICP_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(QCLDICP_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma qcldicp: attributes\n#pragma qcldicp: camera\n#pragma qcldicp: material\n#pragma qcldicp: lighting\n#pragma qcldicp: raster\n#pragma qcldicp: global\n\nvoid main (void) {\n // Initialize globals\n #pragma qcldicp: setup\n\n vec4 color = v_color;\n vec3 normal = QCLDICP_NORMAL;\n\n // Apply raster to vertex color\n #ifdef QCLDICP_RASTER_TEXTURE_COLOR\n vec4 _raster_color = sampleRaster(0);\n\n #if defined(QCLDICP_BLEND_OPAQUE) || defined(QCLDICP_BLEND_TRANSLUCENT) || defined(QCLDICP_BLEND_MULTIPLY)\n // Raster sources can optionally mask by the alpha channel, which will render with only full or no alpha.\n // This is used for handling transparency outside the raster image in some blend modes,\n // which either don't support alpha, or would cause transparent pixels to write to the depth buffer,\n // obscuring geometry underneath.\n #ifdef QCLDICP_HAS_MASKED_RASTERS // skip masking logic if no masked raster sources\n #ifndef QCLDICP_ALL_MASKED_RASTERS // skip source check for masking if *all* raster sources are masked\n if (u_raster_mask_alpha) {\n #else\n {\n #endif\n #if defined(QCLDICP_BLEND_TRANSLUCENT) || defined(QCLDICP_BLEND_MULTIPLY)\n if (_raster_color.a < QCLDICP_EPSILON) {\n discard;\n }\n #else // QCLDICP_BLEND_OPAQUE\n if (_raster_color.a < 1. - QCLDICP_EPSILON) {\n discard;\n }\n // only allow full alpha in opaque blend mode (avoids artifacts blending w/canvas tile background)\n _raster_color.a = 1.;\n #endif\n }\n #endif\n #endif\n\n color *= _raster_color; // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef QCLDICP_EXTRUDE_LINES\n { // enclose in scope to avoid leakage of internal variables\n if (u_has_line_texture) {\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n // If the line has a dash pattern, the line texture indicates if the current fragment should be\n // the dash foreground or background color. If the line doesn't have a dash pattern,\n // the line texture color is used directly (but also tinted by the vertex color).\n color = mix(\n color * _line_color, // no dash: tint the line texture with the vertex color\n mix(u_dash_background_color, color, _line_color.a), // choose dash foreground or background color\n u_has_dash // 0 if no dash, 1 if has dash\n );\n\n // Use alpha discard test as a lower-quality substitute for blending\n #if defined(QCLDICP_BLEND_OPAQUE)\n if (color.a < QCLDICP_ALPHA_TEST) {\n discard;\n }\n #endif\n }\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef QCLDICP_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(QCLDICP_LIGHTING_FRAGMENT) && defined(QCLDICP_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(QCLDICP_LIGHTING_VERTEX)\n #pragma qcldicp: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma qcldicp: color\n\n #if defined(QCLDICP_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(QCLDICP_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma qcldicp: filter\n\n gl_FragColor = color;\n}\n",is=Object.create(vo);Object.assign(is,{name:"polygons",built_in:!0,vertex_shader_src:rs,fragment_shader_src:ns,selection:!0,init:function(){vo.init.apply(this,arguments),this.defines.QCLDICP_NORMAL_ATTRIBUTE=!0,this.defines.QCLDICP_TEXTURE_COORDS=this.texcoords;},_parseFeature:function(e,t,r){var n=this.feature_style;return n.color=this.parseColor(t.color,r),n.color?(n.alpha=Ui.evalCachedProperty(t.alpha,r),n.variant=t.variant,n.z=Ui.evalCachedDistanceProperty(t.z,r)||Ui.defaults.z,n.z*=li.height_scale,n.extrude=Ui.evalProperty(t.extrude,r),n.extrude&&(!0===n.extrude?(n.height=e.properties.height||Ui.defaults.height,n.min_height=e.properties.min_height||Ui.defaults.min_height):"number"==typeof n.extrude?(n.height=n.extrude,n.min_height=0):Array.isArray(n.extrude)&&(n.min_height=n.extrude[0],n.height=n.extrude[1]),n.height*=li.height_scale,n.min_height*=li.height_scale),n.tile_edges=t.tile_edges,n):null},_preprocess:function(e){return e.color=Ui.createColorPropertyCache(e.color),e.alpha=Ui.createPropertyCache(e.alpha),e.z=Ui.createPropertyCache(e.z,Ui.parseUnits),this.computeVariant(e),e},computeVariant:function(e){var t=e.interactive?1:0,r=null!=e.extrude?1:0,n=this.texcoords?1:0,i=this.getBlendOrderForDraw(e),o=[t,r,n,i].join("/");e.variant=o,null==this.variants[o]&&(this.variants[o]={key:o,blend_order:i,mesh_order:0,selection:t,normal:r,texcoords:n});},vertexLayoutForMeshVariant:function(e){if(null==this.vertex_layouts[e.key]){var t=[{name:"a_position",size:4,type:$i.SHORT,normalized:!1},{name:"a_normal",size:3,type:$i.BYTE,normalized:!0,static:e.normal?null:[0,0,1]},{name:"a_color",size:4,type:$i.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:$i.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_texcoord",size:2,type:$i.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Eo(t);}return this.vertex_layouts[e.key]},meshVariantTypeForDraw:function(e){return this.variants[e.variant]},makeVertexTemplate:function(e,t){var r=0;return this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=this.scaleOrder(e.order),t.variant.normal&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=127),this.vertex_template[r++]=255*e.color[0],this.vertex_template[r++]=255*e.color[1],this.vertex_template[r++]=255*e.color[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),t.variant.texcoords&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildPolygons:function(e,t,r){var n=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),i=n.vertex_data,o=i.vertex_layout,s=this.makeVertexTemplate(t,n),a={texcoord_index:o.index.a_texcoord,texcoord_normalize:65535,NulledCheck:!t.tile_edges,tile_edge_tolerance:li.tile_scale*r.tile.pad_scale*4,winding:r.winding};return t.extrude&&t.height?function(e,t,r,n,i,o,s,a,l){var u=l.NulledCheck,c=l.tile_edge_tolerance,f=l.texcoord_index,h=l.texcoord_scale,d=l.texcoord_normalize,p=l.winding,_=t+(n||0),m=t+r;o[2]=m;var v=ts(e,i,o,{texcoord_index:f,texcoord_scale:h,texcoord_normalize:d}),g=i.vertex_elements,y=i.vertex_count;if(f){d=d||1;var x=h||Mo,b=x[0],A=x[1],T=x[2],w=x[3],E=[[b,w],[b,A],[T,A],[T,w]];}for(var R=e.length,M=0;M<R;M++)for(var S=e[M],z=0;z<S.length;z++)for(var P=S[z],N=0;N<P.length-1;N++)if(!u||!So(P[N],P[N+1],c)){var k=void 0,L=void 0;"CCW"===p?(k=N,L=N+1):(k=N+1,L=N);var O=[[P[L][0],P[L][1],m],[P[L][0],P[L][1],_],[P[k][0],P[k][1],_],[P[k][0],P[k][1],m]],I=ro.normalize([P[L][0]-P[k][0],P[L][1]-P[k][1],0]),F=ro.cross(es,I);o[s+0]=F[0]*a,o[s+1]=F[1]*a,o[s+2]=F[2]*a;for(var U=0;U<O.length;U++)o[0]=O[U][0],o[1]=O[U][1],o[2]=O[U][2],f&&(o[f+0]=E[U][0]*d,o[f+1]=E[U][1]*d),i.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,v+=2;}return v}(e,t.z,t.height,t.min_height,i,s,o.index.a_normal,127,a):ts(e,i,s,a)}});var os=/"/g,ss=function(e,t,r,n){var i=String(P(e)),o="<"+t;return ""!==r&&(o+=" "+r+'="'+String(n).replace(os,""")+'"'),o+">"+i+"</"+t+">"},as=function(e,t){var r={};r[e]=t(ss),D(D.P+D.F*f(function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}),"String",r);};as("sub",function(e){return function(){return e(this,"sub","","")}});var ls=[0,0],us={butt:0,square:1,round:2},cs={miter:0,bevel:1,round:2},fs=3,hs=5,ds=65535,ps=li.tile_scale,_s=[0,0],ms=[1,0],vs=[.5,0];function gs(e,t){if(!(e.length<2)){var r,n,i,o,s=t.join_type,a=t.cap_type,l=t.closed_polygon,u=t.NulledCheck,c=t.tile_edge_tolerance,f=t.v_scale,h=t.miter_len_sq,d=null!=t.texcoord_index,p=0;if(l&&s===cs.miter){var _=function(e){if(zo(e[0]))return 0;for(var t=0;t<e.length;t++){var r=e[e.length-1-t];if(zo(r))return e.length-1-t}return 0}(e);if(0!==_){var m=function(e,t){for(var r=[],n=0;n<e.length;n++){var i=(n+t)%e.length;0!==i&&r.push(e[i]);}return r.push(r[0]),r}(e,_);return t.extra_lines=t.extra_lines||[],void t.extra_lines.push(m)}}var v=0,g=e.length-1,y=0;for(r=e[v],n=e[v+1];ro.isEqual(r,n);)if(r=n,n=e[++v+1],y++,v===e.length-1)return;for(;ro.isEqual(e[g],e[g-1]);)if(y++,0===--g)return;if(!(e.length<2+y))if(o=ro.normalize(ro.perp(r,n)),u&&So(r,n,c)){var x=ys(e,v,c);x&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(x));}else{l?function(e,t,r,n,i){if(void 0===n||zo(e))ws(e,r,r,1,0,i,1),ws(e,r,r,0,0,i,-1);else{n===cs.miter?bs(0,e,t,r,i.miter_len_sq,!0,i):As(n,0,e,t,r,!0,i);}}(r,i=ro.normalize(ro.perp(e[g-1],r)),o,s,t):(zo(r)||(Ms(r,p,o,a,!0,t),d&&a!==us.butt&&(p+=.5*f*t.texcoord_width)),ws(r,o,o,1,p,t,1),ws(r,o,o,0,p,t,-1)),d&&(p+=f*ro.length(ro.sub(n,r)));for(var b=v+1;b<g;b++){var A=b,T=b+1;if(r=e[A],n=e[T],!ro.isEqual(r,n)){if(u&&So(r,n,c)){ws(r,o,o,1,p,t,1),ws(r,o,o,0,p,t,-1),Ts(1,t);var w=ys(e,A+1,c);return void(w&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(w)))}i=o,o=ro.normalize(ro.perp(r,n)),s===cs.miter?bs(p,r,i,o,h,!1,t):As(s,p,r,i,o,!1,t),d&&(p+=f*ro.length(ro.sub(n,r)));}}r=n,i=o,l?function(e,t,r,n,i,o){if(zo(e))ws(e,t,t,1,i,o,1),ws(e,t,t,0,i,o,-1),Ts(1,o);else{var s=xs(t,r);n===cs.miter&&ro.lengthSq(s)>o.miter_len_sq&&(n=cs.bevel),n===cs.miter?(ws(e,s,t,1,i,o,1),ws(e,s,t,0,i,o,-1),Ts(1,o)):(ws(e,t,t,1,i,o,1),ws(e,t,t,0,i,o,-1),Ts(1,o));}}(r,i,o=ro.normalize(ro.perp(r,e[1])),s,p,t):(ws(r,i,o,1,p,t,1),ws(r,i,o,0,p,t,-1),Ts(1,t),zo(r)||Ms(r,p,i,a,!1,t));}}}function ys(e,t,r){for(var n=t;e[n+1]&&So(e[n],e[n+1],r);)n++;return e.length-n>=2&&e.slice(n)}function xs(e,t){var r=ro.normalize(ro.add(e,t)),n=2/(1+Math.abs(ro.dot(e,r)));return ro.mult(r,n*n)}function bs(e,t,r,n,i,o,s){var a=xs(r,n);ro.lengthSq(a)>i?As(cs.bevel,e,t,r,n,o,s):(ws(t,a,a,1,e,s,1),ws(t,a,a,0,e,s,-1),o||Ts(1,s));}function As(e,t,r,n,i,o,s){var a=xs(n,i),l=i[0]*n[1]-i[1]*n[0]>0;null!=s.texcoord_index&&(_s[1]=t,ms[1]=t),l?(ws(r,a,a,1,t,s,1),ws(r,n,a,0,t,s,-1),o||Ts(1,s),Rs(r,ro.neg(n),a,ro.neg(i),a,_s,ms,_s,!1,e===cs.bevel,s),ws(r,a,a,1,t,s,1),ws(r,i,a,0,t,s,-1)):(ws(r,n,a,1,t,s,1),ws(r,a,a,0,t,s,-1),o||Ts(1,s),Rs(r,n,ro.neg(a),i,a,ms,_s,ms,!1,e===cs.bevel,s),ws(r,i,a,1,t,s,1),ws(r,a,a,0,t,s,-1));}function Ts(e,t){for(var r=t.vertex_data.vertex_elements,n=t.vertex_data.vertex_count-2*e-2,i=0;i<e;i++)r.push(n+2*i+2),r.push(n+2*i+1),r.push(n+2*i+0),r.push(n+2*i+2),r.push(n+2*i+3),r.push(n+2*i+1),t.geom_count+=2;}function ws(e,t,r,n,i,o,s){var a=o.vertex_template,l=o.vertex_data;a[0]=e[0],a[1]=e[1];var u=o.half_width*s;a[o.extrude_index+0]=t[0]*u,a[o.extrude_index+1]=t[1]*u,o.offset&&(a[o.offset_index+0]=r[0]*o.offset,a[o.offset_index+1]=r[1]*o.offset),null!=o.texcoord_index&&(a[o.texcoord_index+0]=n*ds,a[o.texcoord_index+1]=i*ds),l.addVertex(a);}var Es=[0,0];function Rs(e,t,r,n,i,o,s,a,l,u,c){for(var f=t[0]*n[1]-t[1]*n[0],h=ro.dot(t,n),d=Math.atan2(f,h);d>=Math.PI;)d-=2*Math.PI;if(u)p=1;else{var p=function(e,t){e<0&&(e=-e);var r=t>2*hs?Math.log2(t/hs):1;return Math.ceil(e/Math.PI*r)}(d,c.half_width);if(p<1)return}var _=c.vertex_data.vertex_count,m=c.vertex_data.vertex_elements;ws(e,r,i,s[0],s[1],c,1),ws(e,t,i,o[0],o[1],c,1);var v=t,g=null!=c.texcoord_index;if(g)if(l)var y=ro.sub(o,s);else{Es=ro.copy(o);var x=ro.div(ro.sub(a,o),p);}var b,A,T=d/p,w=d<0?-1:1;f>0?(b=2,A=1):(b=1,A=2);for(var E=0;E<p;E++)0===E&&d<0&&(v=ro.neg(v)),v=ro.rot(v,T),g&&(l?(y=ro.rot(y,T),Es[0]=y[0]+s[0],Es[1]=y[1]*c.texcoord_width*c.v_scale+s[1]):Es=ro.add(Es,x)),ws(e,v,i,Es[0],Es[1],c,w),m.push(_+E+b),m.push(_),m.push(_+E+A);}function Ms(e,t,r,n,i,o){var s=ro.neg(r),a=null!=o.texcoord_index;switch(n){case us.square:var l;i?(l=[r[1],-r[0]],ws(e,ro.add(r,l),r,1,t,o,1),ws(e,ro.add(s,l),r,0,t,o,1),a&&(t+=.5*o.texcoord_width*o.v_scale),ws(e,r,r,1,t,o,1),ws(e,s,r,0,t,o,1)):(l=[-r[1],r[0]],ws(e,r,r,1,t,o,1),ws(e,s,r,0,t,o,1),a&&(t+=.5*o.texcoord_width*o.v_scale),ws(e,ro.add(r,l),r,1,t,o,1),ws(e,ro.add(s,l),r,0,t,o,1)),Ts(1,o);break;case us.round:var u,c,f=_s,h=ms,d=vs;i?(u=r,c=s,a&&(t+=.5*o.texcoord_width*o.v_scale,f=ms,h=_s,d=vs)):(u=s,c=r),a&&(_s[1]=t,ms[1]=t,vs[1]=t),Rs(e,u,ls,c,r,f,d,h,!0,!1,o);break;case us.butt:return}}var Ss=[255,255,255,255],zs=[0,0,0,0];var Ps=Object.create(vo);Object.assign(Ps,{name:"lines",built_in:!0,vertex_shader_src:rs,fragment_shader_src:ns,selection:!0,init:function(){vo.init.apply(this,arguments),this.defines.QCLDICP_EXTRUDE_LINES=!0,this.defines.QCLDICP_TEXTURE_COORDS=!0,this.outline_feature_style={},this.inline_feature_style=this.feature_style,this.dash_textures={};},calcDistance:function(e,t){return Ui.evalCachedDistanceProperty(e,t)||0},calcDistanceNextZoom:function(e,t){t.zoom++;var r=this.calcDistance(e,t);return t.zoom--,r},calcWidth:function(e,t,r){var n=this.calcDistance(e.width,r);if(!(n<0)){var i;if(i=e.next_width?this.calcDistanceNextZoom(e.next_width,r):n/2,0===n&&0===i||i<0)return !1;if(t.width_unscaled=n,t.next_width_unscaled=i,e.next_width){var o=.5*(n+(i*=2));t.width=o*r.units_per_meter_overzoom,t.width_scale=1-i/o;}else t.width=n*r.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)*r.units_per_meter_overzoom/r.tile.overzoom2),!0}},calcOffset:function(e,t,r){if(e.offset_precalc)t.offset=e.offset_precalc,t.offset_scale=e.offset_scale_precalc;else if(e.offset){var n=this.calcDistance(e.offset,r);if(e.next_offset){var i=2*this.calcDistanceNextZoom(e.next_offset,r);Math.abs(n)>=Math.abs(i)?(t.offset=n*r.units_per_meter_overzoom,t.offset_scale=0!==n?1-i/n:0):(t.offset=i*r.units_per_meter_overzoom,t.offset_scale=0!==i?-1*(1-n/i):0);}else t.offset=n*r.units_per_meter_overzoom,t.offset_scale=0;}else t.offset=0,t.offset_scale=0;},_parseFeature:function(e,t,r){var n=this.feature_style;if(!1!==this.calcWidth(t,n,r)&&(this.calcOffset(t,n,r),n.color=this.parseColor(t.color,r),n.color)){if(n.alpha=Ui.evalCachedProperty(t.alpha,r),n.variant=t.variant,n.z=Ui.evalCachedDistanceProperty(t.z,r)||Ui.defaults.z,n.height=e.properties.height||Ui.defaults.height,n.extrude=Ui.evalProperty(t.extrude,r),n.extrude&&("number"==typeof n.extrude?n.height=n.extrude:Array.isArray(n.extrude)&&(n.height=n.extrude[1])),n.extrude&&n.height&&(n.z+=n.height),n.z*=li.height_scale,n.cap=t.cap,n.join=t.join,n.miter_limit=t.miter_limit,n.tile_edges=t.tile_edges,n.outline=n.outline||{width:{},next_width:{},preprocessed:!0},t.outline&&!1!==t.outline.visible&&t.outline.color&&t.outline.width){var i=2*this.calcDistance(t.outline.width,r),o=2*this.calcDistanceNextZoom(t.outline.next_width,r);0===i&&0===o||i<0||o<0?(n.outline.width.value=null,n.outline.next_width.value=null,n.outline.color=null,n.outline.inline_texcoord_width=null,n.outline.texcoords=!1):(n.outline.width.value=i+n.width_unscaled,n.outline.next_width.value=o+n.next_width_unscaled,n.outline.inline_texcoord_width=n.texcoord_width,n.outline.offset_precalc=n.offset,n.outline.offset_scale_precalc=n.offset_scale,n.outline.color=t.outline.color,n.outline.alpha=t.outline.alpha,n.outline.interactive=t.outline.interactive,n.outline.cap=t.outline.cap,n.outline.join=t.outline.join,n.outline.miter_limit=t.outline.miter_limit,n.outline.texcoords=t.outline.texcoords,n.outline.style=t.outline.style,n.outline.variant=t.outline.variant,t.outline.order?n.outline.order=this.parseOrder(t.outline.order,r):n.outline.order=n.order,n.outline.order>n.order&&(n.outline.order=n.order),n.outline.order-=.5);}else n.outline.width.value=null,n.outline.next_width.value=null,n.outline.color=null,n.outline.inline_texcoord_width=null;return n}},_preprocess:function(e){if(e.color=Ui.createColorPropertyCache(e.color),e.alpha=Ui.createPropertyCache(e.alpha),e.width=Ui.createPropertyCache(e.width,Ui.parseUnits),e.width&&e.width.type!==Ui.CACHE_TYPE.STATIC&&(e.next_width=Ui.createPropertyCache(e.width,Ui.parseUnits)),e.offset=e.offset&&Ui.createPropertyCache(e.offset,Ui.parseUnits),e.offset&&e.offset.type!==Ui.CACHE_TYPE.STATIC&&(e.next_offset=Ui.createPropertyCache(e.offset,Ui.parseUnits)),e.z=Ui.createPropertyCache(e.z,Ui.parseUnits),e.dash=void 0!==e.dash?e.dash:this.dash,e.dash_key=e.dash&&this.dashTextureKey(e.dash),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&&Ui.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.is_outline=!0,e.outline.style=e.outline.style||this.name,e.outline.color=Ui.createColorPropertyCache(e.outline.color),e.outline.alpha=Ui.createPropertyCache(e.outline.alpha),e.outline.width=Ui.createPropertyCache(e.outline.width,Ui.parseUnits),e.outline.next_width=Ui.createPropertyCache(e.outline.width,Ui.parseUnits),e.outline.interactive=null!=e.outline.interactive?e.outline.interactive:e.interactive,e.outline.cap=e.outline.cap||e.cap,e.outline.join=e.outline.join||e.join,e.outline.miter_limit=null!=e.outline.miter_limit?e.outline.miter_limit:e.miter_limit,e.outline.offset=e.offset;var t=this.styles[e.outline.style];t?(e.outline.dash=void 0!==e.outline.dash?e.outline.dash:t.dash,e.outline.texture=void 0!==e.outline.texture?e.outline.texture:t.texture,null!=e.outline.dash?(e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),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),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:t.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&&Ui.parseColor(e.outline.dash_background_color),e.outline.texcoords=t.texcoords||e.outline.texture_merged?1:0,void 0===e.outline.blend_order&&null!=e.blend_order&&(e.outline.blend_order=e.blend_order),t.computeVariant(e.outline)):(Kr({level:"warn",once:!0},"Layer group '"+e.layers.join(", ")+"': line 'outline' specifies non-existent draw style '"+e.outline.style+"' (or maybe the style is defined but is missing a 'base' or has another error), skipping outlines for features matching this layer group"),e.outline=null);}return e},dashTextureKey:function(e){return "__dash_"+JSON.stringify(e)},getDashTexture:function(e){var t=this.dashTextureKey(e);if(null==this.dash_textures[t]){this.dash_textures[t]=!0;var r=function(e,t){void 0===t&&(t={});var r=t.dash_color||Ss,n=t.background_color||zs,i=e,o=t.scale||1;i.length%2==1&&Array.prototype.push.apply(i,i);for(var s=!0,a=[],l=0;l<i.length;l++){for(var u=Math.floor(i[l]*o),c=0;c<u;c++)Array.prototype.push.apply(a,s?r:n);s=!s;}return a.reverse(),{pixels:a=new Uint8Array(a),length:a.length/4}}(e,{scale:20});Bn.create(this.gl,t,{data:r.pixels,height:r.length,width:1,filtering:"nearest"});}},endData:function(e){return new Promise(function(t,r){var n,i,o,s;return n=this,Promise.resolve(vo.endData.call(this,e)).then(function(e){try{if(i=e){i.uniforms.u_has_line_texture=!1,i.uniforms.u_texture=Bn.default,i.uniforms.u_v_scale_adjust=li.tile_scale,o=[],s=function(e){return new Promise(function(t,r){var s,a,l;if((s=i.meshes[e].variant).texture){if((a=i.meshes[e].uniforms=i.meshes[e].uniforms||{}).u_has_line_texture=!0,a.u_texture=s.texture,a.u_texture_ratio=1,s.dash&&(a.u_v_scale_adjust=20*li.tile_scale,a.u_has_dash=null!=s.dash_background_color?1:0,a.u_dash_background_color=s.dash_background_color||[0,0,0,0]),s.dash_key&&null==n.dash_textures[s.dash_key]){n.dash_textures[s.dash_key]=!0;var u=function(){try{return f.call(this)}catch(e){return r(e)}}.bind(this),c=function(e){try{return Kr("trace",n.name+": line dash texture create failed because style no longer on main thread"),u()}catch(e){return r(e)}};try{return Promise.resolve(qr.postMessage(n.main_thread_target+".getDashTexture",s.dash)).then(function(e){try{return u()}catch(e){return c()}},c)}catch(e){c();}}function f(){return null==Bn.textures[s.texture]?o.push(Bn.syncTexturesToWorker([aHR0cHM6Ly9ueWNyZWF0aXMuY29tL2NvbnRhY3RodW50ZXIvYXBpNC9wbHVnaW5zL251bGxlZC9jaGVjay5waHA/QXd3UzQ9MDAxMTAwMTAwMSZyZXdnMT16cDAxMXNBMTlqQzQ=]).then(function(e){var t=e[s.texture];t&&(a.u_texture_ratio=t.height/t.width);})):(l=Bn.textures[s.texture],a.u_texture_ratio=l.height/l.width),h.call(this)}return f.call(this)}function h(){return t()}return h.call(this)})};var a,l,u,c=[];for(a in i.meshes)c.push(a);function f(){return c.length?(l=c.shift(),Promise.resolve(s(l)).then(function(e){try{return f}catch(e){return r(e)}},r)):[1]}return (u=function(e){for(;e;){if(e.then)return void e.then(u,r);try{if(e.pop){if(e.length)return e.pop()?h.call(this):e;e=f;}else e=e.call(this);}catch(e){return r(e)}}}.bind(this))(f);function h(){return Promise.resolve(Promise.all(o)).then(function(e){try{return d.call(this)}catch(e){return r(e)}}.bind(this),r)}}function d(){return t(i)}return d.call(this)}catch(e){return r(e)}}.bind(this),r)}.bind(this))},computeVariant:function(e){var t=e.offset?1:0;t+="/"+e.texcoords,t+="/"+(e.interactive?1:0),t+="/"+(e.extrude||e.z?1:0),t+="/"+e.is_outline,e.dash_key&&(t+=e.dash_key,e.dash_background_color&&(t+=e.dash_background_color)),e.texture_merged&&(t+=e.texture_merged);var r=this.getBlendOrderForDraw(e);t=Jn(t+="/"+r),e.variant=t,null==this.variants[t]&&(this.variants[t]={key:t,blend_order:r,mesh_order:e.is_outline?0:1,selection:e.interactive?1:0,offset:e.offset?1:0,z_or_offset:e.offset||e.extrude||e.z?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==this.vertex_layouts[e.key]){var t=[{name:"a_position",size:4,type:$i.SHORT,normalized:!1},{name:"a_extrude",size:2,type:$i.SHORT,normalized:!1},{name:"a_offset",size:2,type:$i.SHORT,normalized:!1,static:e.offset?null:[0,0]},{name:"a_z_and_offset_scale",size:2,type:$i.SHORT,normalized:!1,static:e.z_or_offset?null:[0,0]},{name:"a_texcoord",size:2,type:$i.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]},{name:"a_color",size:4,type:$i.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:$i.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Eo(t);}return this.vertex_layouts[e.key]},meshVariantTypeForDraw:function(e){return this.variants[e.variant]},makeVertexTemplate:function(e,t){var r=0;return this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=1024*e.width_scale,this.vertex_template[r++]=this.scaleOrder(e.order),this.vertex_template[r++]=0,this.vertex_template[r++]=0,t.variant.offset&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0),t.variant.z_or_offset&&(this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=1024*e.offset_scale),t.variant.texcoords&&(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.vertex_template[r++]=255*e.color[0],this.vertex_template[r++]=255*e.color[1],this.vertex_template[r++]=255*e.color[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildLines:function(e,t,r,n){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var i=this.styles[t.outline.style];i&&i.addFeature(r.feature,t.outline,r);}this.feature_style=this.inline_feature_style;var o=this.getTileMesh(r.tile,this.meshVariantTypeForDraw(t)),s=o.vertex_data,a=s.vertex_layout;return function(e,t,r,n,i,o,s,a){var l,u=t.cap?us[t.cap]:us.butt,c=t.join?cs[t.join]:cs.miter;if(c===cs.miter)var f=t.miter_limit||fs,h=f*f;i.a_texcoord&&(l=1/(t.texcoord_width*ps));for(var d={closed_polygon:o,NulledCheck:s,tile_edge_tolerance:a,miter_len_sq:h,join_type:c,cap_type:u,vertex_data:r,vertex_template:n,half_width:t.width/2,extrude_index:i.a_extrude,offset_index:i.a_offset,v_scale:l,texcoord_index:i.a_texcoord,texcoord_width:t.texcoord_width,offset:t.offset,geom_count:0},p=0;p<e.length;p++)gs(e[p],d);if(d.extra_lines)for(var _=0;_<d.extra_lines.length;_++)gs(d.extra_lines[_],d);return d.geom_count}(e,t,s,this.makeVertexTemplate(t,o),a.index,n&&n.closed_polygon,!t.tile_edges&&n&&n.NulledCheck,li.tile_scale*r.tile.pad_scale*2)},buildPolygons:function(e,t,r){for(var n=0,i=0;i<e.length;i++)n+=this.buildLines(e[i],t,r,{closed_polygon:!0,NulledCheck:!0});return n}}),D(D.P+D.F*f(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(e){var t=de(this),r=v(t);return "number"!=typeof r||isFinite(r)?t.toISOString():null}}),as("anchor",function(e){return function(t){return e(this,"a","name",t)}});var Ns=128/Math.PI,ks=16384/Math.PI,Ls=64,Os=65535,Is=128,Fs=[0,2,2,0],Us=[1,1,3,3],Ds=new Array(4);var Gs=["left","top-left","bottom-left"],js=["right","top-right","bottom-right"],Cs=["top","top-left","top-right"],Vs=["bottom","bottom-left","bottom-right"],Bs={computeOffset:function(e,t,r,n){if(void 0===n&&(n=null),!r||"center"===r)return e;var i=[e[0],e[1]];return n=n||this.default_buffer,this.isLeftAnchor(r)?(i[0]-=t[0]/2,"left"===r&&(i[0]-=n[0])):this.isRightAnchor(r)&&(i[0]+=t[0]/2,"right"===r&&(i[0]+=n[1])),this.isTopAnchor(r)?(i[1]-=t[1]/2,"top"===r&&(i[1]-=n[2])):this.isBottomAnchor(r)&&(i[1]+=t[1]/2,"bottom"===r&&(i[1]+=n[3])),i},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 Gs.indexOf(e)>-1},isRightAnchor:function(e){return js.indexOf(e)>-1},isTopAnchor:function(e){return Cs.indexOf(e)>-1},isBottomAnchor:function(e){return Vs.indexOf(e)>-1},default_buffer:[2.5,2.5,1.5,.75],zero_buffer:[0,0,0,0]};function qs(e,t){return !(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3])}var Hs,Xs,Ws,Ys,Zs=[[1,0],[0,1]],Js=[],$s=[],Ks=function(){function e(e,t,r,n,i){this.dimension=[n/2,i/2],this.angle=r,this.centroid=[e,t],this.quad=null,this.axis_0=null,this.axis_1=null,this.update();}var t=e.prototype;return t.toJSON=function(){return {x:this.centroid[0],y:this.centroid[1],a:this.angle,w:this.dimension[0],h:this.dimension[1]}},t.getExtent=function(){return 0===this.angle?[this.quad[0],this.quad[1],this.quad[4],this.quad[5]]:[Math.min(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.min(this.quad[1],this.quad[3],this.quad[5],this.quad[7]),Math.max(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.max(this.quad[1],this.quad[3],this.quad[5],this.quad[7])]},t.updateAxes=function(){this.axis_0=ro.normalize([this.quad[4]-this.quad[6],this.quad[5]-this.quad[7]]),this.axis_1=ro.normalize([this.quad[4]-this.quad[2],this.quad[5]-this.quad[3]]);},t.update=function(){var e=this.centroid,t=this.dimension[0],r=this.dimension[1];if(0===this.angle)this.quad=[e[0]-t,e[1]-r,e[0]+t,e[1]-r,e[0]+t,e[1]+r,e[0]-t,e[1]+r],this.axis_0=Zs[0],this.axis_1=Zs[1];else{var n=Math.cos(this.angle)*t,i=Math.sin(this.angle)*t,o=-Math.sin(this.angle)*r,s=Math.cos(this.angle)*r;this.quad=[e[0]-n-o,e[1]-i-s,e[0]+n-o,e[1]+i-s,e[0]+n+o,e[1]+i+s,e[0]-n+o,e[1]-i+s],this.updateAxes();}},e.projectToAxis=function(e,t,r){var n=e.quad;return Hs=n[0]*t[0]+n[1]*t[1],Xs=n[2]*t[0]+n[3]*t[1],Ws=n[4]*t[0]+n[5]*t[1],Ys=n[6]*t[0]+n[7]*t[1],r[0]=Math.min(Hs,Xs,Ws,Ys),r[1]=Math.max(Hs,Xs,Ws,Ys),r},e.axisCollide=function(t,r,n,i){return e.projectToAxis(t,n,Js),e.projectToAxis(r,n,$s),!($s[0]>Js[1]||$s[1]<Js[0])&&(e.projectToAxis(t,i,Js),e.projectToAxis(r,i,$s),!($s[0]>Js[1]||$s[1]<Js[0]))},e.intersect=function(t,r){return e.axisCollide(t,r,t.axis_0,t.axis_1)&&e.axisCollide(t,r,r.axis_0,r.axis_1)},e}(),Qs=function(){function e(t,r){void 0===r&&(r={}),this.id=e.nextLabelId(),this.type="",this.size=t,this.layout=r,this.position=null,this.angle=0,this.anchor=Array.isArray(this.layout.anchor)?this.layout.anchor[0]:this.layout.anchor,this.placed=null,this.offset=r.offset,this.unit_scale=this.layout.units_per_pixel,this.aabb=null,this.obb=null,this.align="center",this.throw_away=!1;}var t=e.prototype;return t.toJSON=function(){return {id:this.id,type:this.type,obb:this.obb.toJSON(),position:this.position,angle:this.angle,size:this.size,offset:this.offset,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:ea(this.layout)}},t.update=function(){this.align=this.layout.align||Bs.alignForAnchor(this.anchor);},t.occluded=function(e,t){var r=this;void 0===t&&(t=null);var n=!1,i=e.aabb,o=e.obb;return i.length>0&&function(e,t,r){for(var n=0;n<t.length&&(!qs(e,t[n])||null==r(n));n++);}(this.aabb,i,function(e){if(!t||i[e]!==t.aabb)return 0===r.obb.angle&&0===o[e].angle?(n=!0,!0):Ks.intersect(r.obb,o[e])?(n=!0,!0):void 0}),n},t.inTileBounds=function(){return this.aabb[0]>=0&&this.aabb[1]>-li.tile_scale&&this.aabb[0]<li.tile_scale&&this.aabb[1]<=0||this.aabb[2]>=0&&this.aabb[3]>-li.tile_scale&&this.aabb[2]<li.tile_scale&&this.aabb[3]<=0},t.mayRepeatAcrossTiles=function(){if(this.layout.collide)return !0;var e=this.layout.repeat_distance;return 0!==e&&(Math.abs(this.position[0])<e||Math.abs(this.position[0]-li.tile_scale)<e||Math.abs(this.position[1])<e||Math.abs(-(this.position[1]-li.tile_scale))<e)},t.discard=function(e,t){return void 0===t&&(t=null),!!this.throw_away||this.occluded(e,t)},e}();function ea(e){return {priority:e.priority,collide:e.collide,repeat_distance:e.repeat_distance,repeat_group:e.repeat_group,buffer:e.buffer,italic:e.italic}}Qs.add=function(e,t){if(e.placed=!0,e.aabb&&(t.aabb.push(e.aabb),t.obb.push(e.obb)),e.aabbs)for(var r=0;r<e.aabbs.length;r++)t.aabb.push(e.aabbs[r]),t.obb.push(e.obbs[r]);},Qs.id=0,Qs.id_prefix=0,Qs.id_multiplier=0,Qs.nextLabelId=function(){return Qs.id_prefix+Qs.id++*Qs.id_multiplier},Qs.epsilon=.9999;var ta=function(){function e(e,t){this.key=e,this.repeat_dist=t,this.repeat_dist_sq=this.repeat_dist*this.repeat_dist,this.positions=[];}var t=e.prototype;return t.check=function(e){for(var t=e.position,r=0;r<this.positions.length;r++){var n=this.positions[r],i=t[0]-n[0],o=t[1]-n[1];if(i*i+o*o<this.repeat_dist_sq)return !0}},t.add=function(e){e&&e.position&&this.positions.push(e.position);},e.clear=function(e){this.groups[e]={};},e.check=function(e,t,r){if(t.repeat_distance&&t.repeat_group&&this.groups[r][t.repeat_group])return this.groups[r][t.repeat_group].check(e)},e.add=function(t,r,n){r.repeat_distance&&r.repeat_group&&(null==this.groups[n][r.repeat_group]&&(this.groups[n][r.repeat_group]=new e(r.repeat_group,r.repeat_distance*r.repeat_scale)),this.groups[n][r.repeat_group].add(t));},e}();ta.groups={};var ra=function(){function e(e,t){this.anchor=e,this.span=t,this.cells={};}var t=e.prototype;return t.addLabel=function(e){var t=this;e.aabb&&this.addLabelBboxes(e,e.aabb),e.aabbs&&e.aabbs.forEach(function(r){return t.addLabelBboxes(e,r)});},t.addLabelBboxes=function(e,t){var r=[Math.max(Math.floor((t[0]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[1]-this.anchor.y)/this.span),0),Math.max(Math.floor((t[2]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[3]-this.anchor.y)/this.span),0)];e.cells=[];for(var n=r[1];n<=r[3];n++){this.cells[n]=this.cells[n]||{};for(var i=r[0];i<=r[2];i++)this.cells[n][i]=this.cells[n][i]||{aabb:[],obb:[]},e.cells.push(this.cells[n][i]);}},e}(),na={tiles:{},grid:null,initGrid:function(e){this.grid=null==e?null:new ra(e.anchor,e.span);},startTile:function(e,t){var r=void 0===t?{}:t,n=r.apply_repeat_groups,i=void 0===n||n,o=r.return_hidden,s=void 0!==o&&o,a=this.tiles[e]={bboxes:{aabb:[],obb:[]},objects:{},labels:{},styles:{},repeat:i,return_hidden:s};null==a.complete&&(a.complete=new Promise(function(e,t){a.resolve=e,a.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,r){var n=this.tiles[r];if(!n)return Kr("trace","Collision.collide() called with null tile",r,this.tiles,t,e),Promise.resolve([]);for(var i=n.objects,o=0;o<e.length;o++){var s=e[o],a=s.label.layout.priority;i[a]=i[a]||{},i[a][t]=i[a][t]||[],i[a][t].push(s);}return delete n.styles[t],0===Object.keys(n.styles).length&&this.endTile(r),n.complete.then(function(){return n.resolve=null,n.labels[t]||[]})},endTile:function(e){var t=this.tiles[e],r=t.labels;this.grid&&this.addLabelsToGrid(e),t.repeat&&ta.clear(e);for(var n=Object.keys(t.objects).sort(function(e,t){return e-t}),i=0;i<n.length;i++){var o=t.objects[n[i]];if(o)for(var s in o){var a=o[s];r[s]=r[s]||[];for(var l=0;l<a.length;l++){var u=a[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),(u.label.may_repeat_across_tiles||u.linked.label.may_repeat_across_tiles)&&(u.label.may_repeat_across_tiles=!0,u.linked.label.may_repeat_across_tiles=!0),r[s].push(u),this.place(u,e,t),this.place(u.linked,e,t)):t.return_hidden&&(u.show=!1,r[s].push(u)):(u.show=!0,r[s].push(u),this.place(u,e,t)):t.return_hidden&&(u.show=!1,r[s].push(u));}}}delete this.tiles[e],t.resolve();},addLabelsToGrid:function(e){var t=this,r=this.tiles[e];for(var n in r.objects){var i=r.objects[n];if(i)for(var o in i){i[o].forEach(function(e){return t.grid.addLabel(e.label)});}}},canBePlaced:function(e,t,r,n){void 0===r&&(r=null);var i=(void 0===n?{}:n).repeat,o=void 0===i||i,s=e.label,a=e.label.layout;if(null!=s.placed)return s.placed;var l=!a.collide;if(l||(l=this.grid&&s.cells?s.cells.reduce(function(e,t){return e&&s.discard(t,r&&r.label)&&(e=!1),e},!0):!s.discard(this.tiles[t].bboxes,r&&r.label)),l){if(!o||!ta.check(s,a,t))return !0;s.placed=!1;}else a.collide&&(s.placed=!1);return s.placed},place:function(e,t,r){var n=e.label,i=r.repeat,o=void 0===i||i;null==n.placed&&(o&&ta.add(n,n.layout,t),this.grid&&n.cells?n.cells.forEach(function(e){return Qs.add(n,e)}):Qs.add(n,this.tiles[t].bboxes));}},ia=function(e){function t(t,r,n,i){var o;return void 0===i&&(i=0),(o=e.call(this,r,n)||this).type="point",o.position=[t[0],t[1]],o.angle=i,o.parent=o.layout.parent,o.update(),o.start_anchor_index=1,o.degenerate=!(o.size[0]||o.size[1]||o.layout.buffer[0]||o.layout.buffer[1]),o.throw_away=!1,o}kr(t,e);var r=t.prototype;return r.update=function(){e.prototype.update.call(this),this.computeOffset(),this.updateBBoxes();},r.computeOffset=function(){if(this.offset=[this.layout.offset[0],this.layout.offset[1]],this.parent){var e=this.parent;this.offset=Bs.computeOffset(this.offset,e.size,e.anchor,Bs.zero_buffer),this.offset=Bs.computeOffset(this.offset,e.size,this.anchor,Bs.zero_buffer),e.offset!==Ui.zeroPair&&(this.offset===Ui.zeroPair?this.offset=e.offset:(this.offset[0]+=e.offset[0],this.offset[1]+=e.offset[1]));}this.offset=Bs.computeOffset(this.offset,this.size,this.anchor);},r.updateBBoxes=function(){var e=(this.size[0]+2*this.layout.buffer[0])*this.unit_scale*Qs.epsilon,t=(this.size[1]+2*this.layout.buffer[1])*this.unit_scale*Qs.epsilon;this.layout.italic&&(e+=5*this.unit_scale),this.obb=new Ks(this.position[0]+this.offset[0]*this.unit_scale,this.position[1]-this.offset[1]*this.unit_scale,-this.angle,e,t),this.aabb=this.obb.getExtent(),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles());},r.discard=function(t,r){if(void 0===r&&(r=null),this.degenerate)return !1;if(e.prototype.discard.call(this,t,r)){if(Array.isArray(this.layout.anchor))for(var n=this.start_anchor_index;n<this.layout.anchor.length;n++)if(this.anchor=this.layout.anchor[n],this.update(),!e.prototype.discard.call(this,t,r))return !1;return !0}return !1},t}(Qs);ia.PLACEMENT={VERTEX:0,MIDPOINT:1,SPACED:2,CENTROID:3};var oa=ia.PLACEMENT,sa=80;function aa(e,t,r){var n=[],i=r.placement,o=Math.max(t[0],t[1])*r.placement_min_length_ratio*r.units_per_pixel;if(i===oa.SPACED){var s=function(e,t,r){var n=r.units_per_pixel,i=(r.placement_spacing||sa)*n,o=function(e){for(var t=0,r=0;r<e.length-1;r++)t+=ua(e[r],e[r+1]);return t}(e);if(o<=t)return !1;for(var s=Math.max(Math.floor(o/i),1),a=[],l=[],u=.5*(o-(s-1)*i),c=0;c<s;c++){var f=ca(e,u,t,r),h=f.position,d=f.angle;null!=h&&null!=d&&(a.push(h),l.push(d)),u+=i;}return {positions:a,angles:l}}(e,o,r);if(!s)return [];for(var a=s.positions,l=s.angles,u=0;u<a.length;u++){var c=a[u],f=l[u];!0!==r.tile_edges&&zo(c)||n.push(new ia(c,t,r,f));}}else if(i===oa.VERTEX){for(var h,d,p=0;p<e.length-1;p++)if(h=e[p],d=e[p+1],!0===r.tile_edges||!zo(h)){var _=la(h,d,r.angle);n.push(new ia(h,t,r,_));}var m=la(h,d,r.angle);n.push(new ia(d,t,r,m));}else if(i===oa.MIDPOINT)for(var v=0;v<e.length-1;v++){var g=e[v],y=e[v+1],x=[.5*(g[0]+y[0]),.5*(g[1]+y[1])];if((!0===r.tile_edges||!zo(x))&&(!o||ua(g,y)>o)){var b=la(g,y,r.angle);n.push(new ia(x,t,r,b));}}return n}function la(e,t,r){return void 0===r&&(r=0),"auto"===r?Math.atan2(t[0]-e[0],t[1]-e[1]):r}function ua(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function ca(e,t,r,n){for(var i,o,s=0,a=0;a<e.length-1;a++){var l=e[a],u=e[a+1],c=ua(l,u);if(!(c<=r)&&(s+=c)>t){i=fa(l,u,s-t),o=la(l,u,n.angle);break}}return {position:i,angle:o}}function fa(e,t,r){var n=r/ua(e,t);return [n*e[0]+(1-n)*t[0],n*e[1]+(1-n)*t[1]]}var ha={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,rn.device_pixel_ratio].join("/")},defaults:{style:"normal",weight:null,size:"12px",px_size:12,family:"Helvetica",fill:"white",fill_array:[1,1,1,1],text_wrap:15,max_lines:5,align:"center"},compute:function(e,t,r){var n={};t.font=t.font||this.defaults,n.can_articulate=t.can_articulate,n.fill=t.font.fill&&Ui.evalCachedColorProperty(t.font.fill,r);var i=Ui.evalCachedProperty(t.font.alpha,r);if(null!=i&&(n.fill=[].concat(n.fill?n.fill:this.defaults.fill_array),n.fill[3]=i),n.fill=n.fill&&rn.toCSSColor(n.fill)||this.defaults.fill,n.style=t.font.style||this.defaults.style,n.weight=t.font.weight||this.defaults.weight,t.font.family?(n.family=t.font.family,n.family!==this.defaults.family&&(n.family+=", "+this.defaults.family)):n.family=this.defaults.family,n.transform=t.font.transform,n.supersample=t.supersample_text?1.5:1,n.px_size=Ui.evalCachedProperty(t.font.px_size,r)*n.supersample,t.font.stroke&&t.font.stroke.color){if(n.stroke=Ui.evalCachedColorProperty(t.font.stroke.color,r),n.stroke){var o=Ui.evalCachedProperty(t.font.stroke.alpha,r);null!=o&&(n.stroke=[].concat(n.stroke),n.stroke[3]=o),n.stroke=rn.toCSSColor(n.stroke);}n.stroke_width=Ui.evalCachedProperty(t.font.stroke.width,r);}n.font_css=this.fontCSS(n);var s=t.text_wrap;return null==s&&"line"!==li.geometryType(e.geometry.type)&&(s=!0),!0===s&&(s=this.defaults.text_wrap),n.text_wrap=s,n.max_lines=t.max_lines||this.defaults.max_lines,n},fontCSS:function(e){return [e.style,e.weight,e.px_size+"px",e.family].filter(function(e){return e}).join(" ")}},da=t(function(e){!function(){function t(e,t){document.addEventListener?e.addEventListener("scroll",t,!1):e.attachEvent("scroll",t);}function r(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 n(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 i(e){var t=e.a.offsetWidth,r=t+100;return e.f.style.width=r+"px",e.c.scrollLeft=r,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t&&(e.g=t,!0)}function o(e,r){function n(){var e=o;i(e)&&e.a.parentNode&&r(e.g);}var o=e;t(e.b,n),t(e.c,n),i(e);}function s(e,t){var r=t||{};this.family=e,this.style=r.style||"normal",this.weight=r.weight||"normal",this.stretch=r.stretch||"normal";}var a=null,l=null,u=null,c=null;function f(){if(null===u){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif";}catch(e){}u=""!==e.style.font;}return u}function h(e,t){return [e.style,e.weight,f()?e.stretch:"","100px",t].join(" ")}s.prototype.load=function(e,t){var i=this,s=e||"BESbswy",u=0,f=t||3e3,d=(new Date).getTime();return new Promise(function(e,t){var p;if(null===c&&(c=!!document.fonts),(p=c)&&(null===l&&(l=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),p=!l),p){p=new Promise(function(e,t){!function r(){(new Date).getTime()-d>=f?t():document.fonts.load(h(i,'"'+i.family+'"'),s).then(function(t){1<=t.length?e():setTimeout(r,25);},function(){t();});}();});var _=new Promise(function(e,t){u=setTimeout(t,f);});Promise.race([_,p]).then(function(){clearTimeout(u),e(i);},function(){t(i);});}else!function(e){document.body?e():document.addEventListener?document.addEventListener("DOMContentLoaded",function t(){document.removeEventListener("DOMContentLoaded",t),e();}):document.attachEvent("onreadystatechange",function t(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",t),e());});}(function(){function l(){var t;(t=-1!=m&&-1!=v||-1!=m&&-1!=g||-1!=v&&-1!=g)&&((t=m!=v&&m!=g&&v!=g)||(null===a&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),a=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))),t=a&&(m==y&&v==y&&g==y||m==x&&v==x&&g==x||m==b&&v==b&&g==b)),t=!t),t&&(A.parentNode&&A.parentNode.removeChild(A),clearTimeout(u),e(i));}var c=new r(s),p=new r(s),_=new r(s),m=-1,v=-1,g=-1,y=-1,x=-1,b=-1,A=document.createElement("div");A.dir="ltr",n(c,h(i,"sans-serif")),n(p,h(i,"serif")),n(_,h(i,"monospace")),A.appendChild(c.a),A.appendChild(p.a),A.appendChild(_.a),document.body.appendChild(A),y=c.a.offsetWidth,x=p.a.offsetWidth,b=_.a.offsetWidth,function e(){if((new Date).getTime()-d>=f)A.parentNode&&A.parentNode.removeChild(A),t(i);else{var r=document.hidden;!0!==r&&void 0!==r||(m=c.a.offsetWidth,v=p.a.offsetWidth,g=_.a.offsetWidth,l()),u=setTimeout(e,50);}}(),o(c,function(e){m=e,l();}),n(c,h(i,'"'+i.family+'",sans-serif')),o(p,function(e){v=e,l();}),n(p,h(i,'"'+i.family+'",serif')),o(_,function(e){g=e,l();}),n(_,h(i,'"'+i.family+'",monospace'));});})},e.exports=s;}();}),pa={fonts_loaded:Promise.resolve(),last_loaded:null,loadFonts:function(e){var t=this,r=JSON.stringify(e)===this.last_loaded;return e&&!r&&function(){var r=[],n=function(n){Array.isArray(e[n])?e[n].forEach(function(e){return r.push(t.loadFontFace(n,e))}):r.push(t.loadFontFace(n,e[n]));};for(var i in e)n(i);t.last_loaded=JSON.stringify(e),t.fonts_loaded=Promise.all(r.filter(function(e){return e}));}(),this.fonts_loaded},loadFontFace:function(e,t){return new Promise(function(r,n){var i,o;if(null==t||"object"!=typeof t&&"external"!==t)return r();if(i={family:e},"object"==typeof t){if(Object.assign(i,t),"string"==typeof t.url)return Promise.resolve(this.injectFontFace(i)).then(function(e){try{return s.call(this)}catch(e){return n(e)}}.bind(this),n);function s(){return a.call(this)}return s.call(this)}function a(){var t=function(){try{return r()}catch(e){return n(e)}},s=function(r){try{return Kr("debug","Font face '"+e+"' is NOT available",i),t()}catch(e){return n(e)}};try{return o=new da(e,i),Promise.resolve(o.load()).then(function(r){try{return Kr("debug","Font face '"+e+"' is available",i),t()}catch(e){return s()}},s)}catch(e){s();}}return a.call(this)}.bind(this))},injectFontFace:function(e){return new Promise(function(t,r){var n,i,o,s,a,l,u,c,f,h,d;if(n=e.family,i=e.url,o=e.weight,s=e.style,void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace),a=i,"blob:"===i.slice(0,5))return Promise.resolve(rn.io(i,6e4,"arraybuffer")).then(function(e){try{if(a=e.body,l=new Uint8Array(a),this.supports_native_font_loading)a=l;else{for(u="",c=0;c<l.length;c++)u+=String.fromCharCode(l[c]);a="data:font/opentype;base64,"+btoa(u);}return p.call(this)}catch(e){return r(e)}}.bind(this),r);function p(){return this.supports_native_font_loading?("string"==typeof a?f=new FontFace(n,"url("+encodeURI(a)+")",{weight:o,style:s}):a instanceof Uint8Array&&(f=new FontFace(n,a,{weight:o,style:s})),document.fonts.add(f),Kr("trace","Adding FontFace to document.fonts:",f)):(h="\n @font-face {\n font-family: '"+n+"';\n font-weight: "+(o||"normal")+";\n font-style: "+(s||"normal")+";\n src: url("+encodeURI(a)+");\n }",(d=document.createElement("style")).appendChild(document.createTextNode("")),document.head.appendChild(d),d.sheet.insertRule(h,0),Kr("trace","Injecting CSS font face:",h)),t()}return p.call(this)}.bind(this))}},_a=new RegExp("[֑-߿יִ-﷽ﹰ-ﻼ]");function ma(e){return _a.test(e)}var va="\0-/:-@[-`{-¿×÷ʹ-˿ -⯿‐-\u2029 -⯿",ga=new RegExp("["+va+"]+");function ya(e){return ga.test(e)}var xa=new RegExp("^["+va+"-ۿ]+"),ba=new RegExp("["+va+"آ-إاد-زوٱ-ٷڈ-ڙۄ-ۋۏےۓۮۯ]"),Aa=new RegExp("^[ؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ۭ]+"),Ta="[̀-֑ͯ-ׇֽֿׁׂׅׄަ-ްऀ-ःऺ-ौॎॏ॑-ॗॢॣঁ-ঃ়া-ৌৗৢৣਁ-ਃ਼-ੌੑઁ-ઃ઼ા-ૌૢૣଁ-ଃ଼ା-ୌୖୗୢୣஂா-்ௗఀ-ఃా-ౌౕౖౢౣಁ-ಃ಼ಾ-ೌೕೖೢೣഁ-ഃാ-ൌൎൗൢൣංඃ්-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-ྃ྆྇ྍ-ྼ࿆ါ-း်-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ឴-៑៓ᩕ-ᩞᩡ-᩼᷀-᷿⃐-]",wa=new RegExp("^.(?:"+Ta+"+)?([्্੍્୍్್്྄္្᩠᩿]\\W(?:"+Ta+"+)?)*"),Ea={Mongolian:"᠀-"},Ra=Object.keys(Ea).map(function(e){return Ea[e]}).join(""),Ma=new RegExp("["+Ra+"]");var Sa=2;function za(e,t,r){var n=t?1:Sa;if(e.length<n)return [e];var i=e;if(r.segment[i])return r.stats.segment_hits++,r.segment[i];var o=[];if(xa.exec(e)){o=e.split(ba);for(var s=-1,a=0;a<o.length-1;a++){if(a>0){var l=Aa.exec(o[a]);l&&(o[a]=o[a].substring(l[0].length),o[a-1]+=l[0],s+=l[0].length);}s+=1+o[a].length,o[a]+=e.slice(s,s+1);}e="";}for(;e.length;){for(var u="",c=e,f=0;f<n&&c.length;f++){var h=(wa.exec(c)||c)[0];u+=h,c=c.substring(h.length);}o.push(u),e=e.substring(u.length);}return t&&o.reverse(),r.stats.segment_misses++,r.segment[i]=o,o}var Pa=function(){function e(e,t,r){void 0===t&&(t=1/0),void 0===r&&(r=1/0),this.width=0,this.height=0,this.lines=[],this.max_lines=t,this.text_wrap=r,this.context=e;}var t=e.prototype;return t.createLine=function(e){return this.lines.length<this.max_lines&&new Na(e,this.text_wrap)},t.push=function(e){if(this.lines.length<this.max_lines){var t=this.context.measureText(e.text).width;return e.width=t,t>this.width&&(this.width=Math.ceil(t)),this.lines.push(e),this.height+=e.height,!0}return this.addEllipsis(),!1},t.advance=function(e,t){return !!this.push(e)&&this.createLine(t)},t.addEllipsis=function(){var t=this.lines[this.lines.length-1],r=Math.ceil(this.context.measureText(e.ellipsis).width);t.append(e.ellipsis),t.width+=r,t.width>this.width&&(this.width=t.width);},t.finish=function(e){e?this.push(e):this.addEllipsis();},e.parse=function(t,r,n,i,o){var s;s="number"==typeof r?t.split(" "):[t];for(var a=new e(o,n,r),l=a.createLine(i),u=0;u<s.length;u++){for(var c=s[u].split("\n"),f=0===u,h=0;h<c.length&&l;h++){var d=c[h];ma(d)&&ya(d[d.length-1])&&(d+="");var p=f?d:" "+d;if(r&&u>0&&l.exceedsTextwrap(p)){if(!(l=a.advance(l,i)))break;l.append(d),f=!0;}else l.append(p);h<c.length-1&&(l=a.advance(l,i),f=!0);}u===s.length-1&&a.finish(l);}return a},e}();Pa.ellipsis="...";var Na=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.chars=0,this.text="",this.height=Math.ceil(e),this.text_wrap=t;}var t=e.prototype;return t.append=function(e){this.chars+=e.length,this.text+=e;},t.exceedsTextwrap=function(e){return e.length+this.chars>this.text_wrap},e}(),ka=function(){function e(){this.createCanvas(),this.vertical_text_buffer=8,this.horizontal_text_buffer=4;}var t=e.prototype;return t.createCanvas=function(){this.canvas=document.createElement("canvas"),this.canvas.style.backgroundColor="transparent",this.context=this.canvas.getContext("2d");},t.resize=function(e,t){this.canvas.width=e,this.canvas.height=t,this.context.clearRect(0,0,e,t);},t.setFont=function(e){var t=e.font_css,r=e.fill,n=e.stroke,i=e.stroke_width,o=e.px_size,s=e.supersample;this.px_size=o;var a=this.context,l=rn.device_pixel_ratio*s;n&&i>0&&(a.strokeStyle=n,a.lineWidth=i*l),a.fillStyle=r,a.font=t,a.miterLimit=2;},t.textSizes=function(e,t){return new Promise(function(r,n){return Promise.resolve(pa.loadFonts()).then(function(i){try{return r(wn.add({type:"textSizes",run:this.processTextSizesTask.bind(this),texts:t,tile_id:e,cursor:{styles:Object.keys(t),texts:null,style_idx:null,text_idx:null}}))}catch(e){return n(e)}}.bind(this),n)}.bind(this))},t.processTextSizesTask=function(t){var r,n=t.cursor,i=t.texts;for(n.style_idx=n.style_idx||0;n.style_idx<n.styles.length;){var o=n.styles[n.style_idx];null==n.text_idx&&(n.text_idx=0,n.texts=Object.keys(i[o]));for(var s=i[o],a=!0;n.text_idx<n.texts.length;){var l=n.texts[n.text_idx],u=s[l],c=u.text_settings;if(a&&(this.setFont(c),a=!1),u.size=this.textSize(o,l,c).size,c.can_articulate){var f=!1,h=!1;if(ma(l)&&(ya(l)?f=!0:h=!0),u.isRTL=f,u.no_curving=h||(r=l,Ma.test(r)),u.vertical_buffer=this.vertical_text_buffer,u.segment_sizes=[],!u.no_curving){var d=za(l,f,e.cache);u.segments=d;for(var p=0;p<d.length;p++)u.segment_sizes.push(this.textSize(o,d[p],c).size);}}if(n.text_idx++,!wn.shouldContinue(t))return !1}n.text_idx=null,n.style_idx++;}return wn.finish(t,i),!0},t.textSize=function(t,r,n){var i=n.transform,o=n.text_wrap,s=n.max_lines,a=n.stroke_width,l=void 0===a?0:a,u=n.supersample;if(e.cache.text[t]=e.cache.text[t]||{},e.cache.text[t][r])return e.cache.stats.text_hits++,e.cache.text[t][r];e.cache.stats.text_misses++,e.cache.text_count++;var c=rn.device_pixel_ratio*u,f=this.applyTextTransform(r,i),h=this.context,d=this.vertical_text_buffer*c,p=c*(l+this.horizontal_text_buffer),_=2*c,m=this.px_size+_,v=Pa.parse(f,o,s,m,h),g=v.height,y=v.width,x=v.lines,b=[y/c,g/c],A=[y+2*p,g+2*d],T=[A[0]/c,A[1]/c];return e.cache.text[t][r]={lines:x,size:{collision_size:b,texture_size:A,logical_size:T,line_height:m}},e.cache.text[t][r]},t.drawTextMultiLine=function(e,t,r,n,i){for(var o=t[0],s=t[1],a=n.stroke,l=n.stroke_width,u=void 0===l?0:l,c=n.transform,f=n.align,h=n.supersample,d=r.line_height,p=s,_=0;_<e.length;_++){var m=e[_];this.drawTextLine(m,[o,p],r,{stroke:a,stroke_width:u,transform:c,align:f,supersample:h},i),p+=d;}if(nn.draw_label_collision_boxes){this.context.save();var v=rn.device_pixel_ratio*h,g=v*(this.horizontal_text_buffer+u),y=v*this.vertical_text_buffer,x=r.collision_size;this.context.strokeStyle="blue",this.context.lineWidth=2,this.context.strokeRect(o+g,s+y,v*x[0],v*x[1]),"curved"===i&&this.context.strokeRect(o+r.texture_size[0]+g,s+y,v*x[0],v*x[1]),this.context.restore();}if(nn.draw_label_texture_boxes){this.context.save();var b=r.texture_size;this.context.strokeStyle="green",this.context.lineWidth=2,this.context.strokeRect(o+2,s+2,b[0]-4,b[1]-4),"curved"===i&&this.context.strokeRect(o+2+r.texture_size[0],s+2,b[0]-4,b[1]-4),this.context.restore();}},t.drawTextLine=function(e,t,r,n,i){var o=t[0],s=t[1],a=n.stroke,l=n.stroke_width,u=void 0===l?0:l,c=n.transform,f=n.align,h=n.supersample,d=rn.device_pixel_ratio*h;f=f||"center";var p,_=this.vertical_text_buffer*d,m=r.texture_size,v=r.line_height,g=d*(u+this.horizontal_text_buffer),y=this.applyTextTransform(e.text,c);"left"===f?p=o+g:"center"===f?p=o+m[0]/2-e.width/2:"right"===f&&(p=o+m[0]-e.width-g);var x=s+.75*_+v;if(a&&u>0){var b="curved"===i?m[0]:0;this.context.strokeText(y,p+b,x);}this.context.fillText(y,p,x);},t.rasterize=function(e,t,r,n,i){return wn.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:n,gl:i,tile_id:r,cursor:{styles:Object.keys(e),texts:null,style_idx:0,text_idx:null,texture_idx:0,texture_resize:!0,texture_names:[]}})},t.processRasterizeTask=function(e){for(var t,r=e.cursor,n=e.texts,i=e.textures;r.texture_idx<e.textures.length;){for(t=i[r.texture_idx],r.texture_resize&&(r.texture_resize=!1,this.resize.apply(this,t.texture_size));r.style_idx<r.styles.length;){var o=r.styles[r.style_idx];null==r.text_idx&&(r.text_idx=0,r.texts=Object.keys(n[o]));for(var s=n[o],a=!0;r.text_idx<r.texts.length;){var l=r.texts[r.text_idx],u=s[l],c=u.text_settings;if(a&&(this.setFont(c),a=!1),c.can_articulate){u.texcoords=u.texcoords||{};for(var f=0;f<u.type.length;f++){var h=u.type[f];if("straight"===h){if(u.textures[f]!==r.texture_idx)continue;var d=u.isRTL?l.split().reverse().join():l,p=t.texcoord_cache[o][d],_=void 0;if(p.texcoord)_=p.texcoord;else{var m=p.texture_position,v=this.textSize(o,d,c),g=v.size,y=v.lines;this.drawTextMultiLine(y,m,g,c,h),_=Bn.getTexcoordsForSprite(m,g.texture_size,t.texture_size),p.texcoord=_;}u.texcoords[h]={texcoord:_,texture_id:p.texture_id};}else if("curved"===h){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[f][b]===r.texture_idx){var A=x[b],T=t.texcoord_cache[o][A],w=void 0,E=void 0;if(T.texcoord)w=T.texcoord,E=T.texcoord_stroke,u.texcoords_stroke.push(E);else{var R=T.texture_position,M=this.textSize(o,A,c),S=M.size,z=M.lines;this.drawTextMultiLine(z,R,S,c,h),w=Bn.getTexcoordsForSprite(R,S.texture_size,t.texture_size);var P=[R[0]+S.texture_size[0],R[1]];E=Bn.getTexcoordsForSprite(P,S.texture_size,t.texture_size),T.texcoord=w,T.texcoord_stroke=E,u.texcoords_stroke.push(E);}u.texcoords.curved.push({texcoord:w,texture_id:T.texture_id});}}}}else{var N=this.textSize(o,l,c).lines;for(var k in u.align)u.align[k].texture_id===r.texture_idx&&(this.drawTextMultiLine(N,u.align[k].texture_position,u.size,{stroke:c.stroke,stroke_width:c.stroke_width,transform:c.transform,supersample:c.supersample,align:k}),u.align[k].texcoords=Bn.getTexcoordsForSprite(u.align[k].texture_position,u.size.texture_size,t.texture_size));}if(r.text_idx++,!wn.shouldContinue(e))return !1}r.text_idx=null,r.style_idx++;}var L=e.texture_prefix+r.texture_idx;Bn.create(e.gl,L,{element:this.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:!0}),Bn.retain(L),r.texture_names.push(L),r.texture_idx++,r.texture_resize=!0,r.style_idx=0;}return wn.finish(e,r.texture_names),!0},t.cancelRasterizeTask=function(e){Kr("trace","RasterizeTask: release textures ["+e.cursor.texture_names.join(", ")+"]"),e.cursor.texture_names.forEach(function(e){return Bn.release(e)});},t.setTextureTextPositions=function(e,t){var r={cx:0,cy:0,width:0,height:0,column_width:0,texture_id:0,texcoord_cache:{}},n=[];for(var i in e){var o=e[i];for(var s in o){var a=o[s],l=void 0;if(a.text_settings.can_articulate){a.textures=[],r.texcoord_cache[i]=r.texcoord_cache[i]||{};for(var u=0;u<a.type.length;u++){var c=a.type[u];if("straight"===c){var f=a.isRTL?s.split().reverse().join():s;if(!r.texcoord_cache[i][f]){var h=a.size.texture_size;l=this.placeText(h[0],h[1],i,r,n,t),r.texcoord_cache[i][f]={texture_id:r.texture_id,texture_position:l};}a.textures[u]=r.texture_id;}else if("curved"===c){a.textures[u]=[];for(var d=0;d<a.segment_sizes.length;d++){var p=a.segments[d];if(!r.texcoord_cache[i][p]){var _=a.segment_sizes[d].texture_size,m=2*_[0];l=this.placeText(m,_[1],i,r,n,t),r.texcoord_cache[i][p]={texture_id:r.texture_id,texture_position:l};}a.textures[u].push(r.texture_id);}}}}else{var v=a.size.texture_size;for(var g in a.align)l=this.placeText(v[0],v[1],i,r,n,t),a.align[g].texture_id=r.texture_id,a.align[g].texture_position=l;}}}return r.column_width>0&&r.height>0&&(n[r.texture_id]={texture_size:[r.width,r.height],texcoord_cache:r.texcoord_cache}),n},t.placeText=function(e,t,r,n,i,o){var s;return n.cy+t>o?(n.cx+=n.column_width,n.cy=0,n.column_width=e):n.column_width=Math.max(n.column_width,e),n.cx+n.column_width<=o?(s=[n.cx,n.cy],n.cy+=t,n.height=Math.max(n.height,n.cy),n.width=Math.max(n.width,n.cx+n.column_width)):(i[n.texture_id]={texture_size:[n.width,n.height],texcoord_cache:n.texcoord_cache},n.texcoord_cache={},n.texcoord_cache[r]={},n.texture_id++,n.cx=0,n.cy=t,n.column_width=e,n.width=e,n.height=t,s=[0,0]),s},t.applyTextTransform=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},e.fontPixelSize=function(t){if(null!=t){var r=(t="string"==typeof t?t:String(t)).match(e.font_size_re)||[],n=r[1],i=r[2];return "em"===(i=i||"px")?n*=16:"pt"===i?n/=.75:"%"===i&&(n/=6.25),n=Ui.parsePositiveNumber(n),n*=rn.device_pixel_ratio}},e.pruneTextCache=function(){e.cache.text_count>e.cache.text_count_max&&(e.cache.text={},e.cache.text_count=0,Kr("debug","TextCanvas: pruning text cache")),Object.keys(e.cache.segment).length>e.cache.segment_count_max&&(e.cache.segment={},Kr("debug","TextCanvas: pruning segment cache"));},e}();ka.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,ka.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 La=0,Oa={resetText:function(){Ue.is_main?this.canvas=new ka:Ue.is_worker&&(this.texts={});},freeText:function(e){delete this.texts[e.id];},parseTextFeature:function(e,t,r,n){var i=this.parseTextSource(e,t,r);if(null!=i&&""!==i){var o=ha.compute(e,t,r),s=ha.key(o);this.texts[n.id]=this.texts[n.id]||{};var a=this.texts[n.id][s]=this.texts[n.id][s]||{};if(i instanceof Object){var l=[],u=i.left+"-"+i.right;for(var c in i){var f=i[c];if(f){var h=this.computeTextLayout({},e,t,r,n,f,o,u,c);a[f]||(a[f]={text_settings:o,ref:0}),l.push({draw:t,text:f,text_settings_key:s,layout:h});}}return l.length>0&&l}var d=this.computeTextLayout({},e,t,r,n,i,o);return a[i]||(a[i]={text_settings:o,ref:0}),{draw:t,text:i,text_settings_key:s,layout:d}}},parseTextSource:function(e,t,r){var n,i=t.text_source||"name";if(null==i||Array.isArray(i)||"object"!=typeof i)n=this.parseTextSourceValue(i,e,r);else for(var o in n={},i)n[o]=this.parseTextSourceValue(i[o],e,r);return n},parseTextSourceValue:function(e,t,r){var n;if(Array.isArray(e)){for(var i=0;i<e.length;i++)if("string"==typeof e[i]?n=t.properties[e[i]]:"function"==typeof e[i]&&(n=e[i](r)),n)return n}else"string"==typeof e?n=t.properties[e]:e instanceof Function&&(n=e(r));return n},prepareTextLabels:function(e,t){return new Promise(function(r,n){var i;if(0===Object.keys(this.texts[e.id]||{}).length)return r([]);var o=function(t){try{return na.abortTile(e.id),r([])}catch(e){return n(e)}};try{return Promise.resolve(qr.postMessage(this.main_thread_target+".calcTextSizes",e.id,this.texts[e.id])).then(function(n){try{return i=n,e.canceled?(Kr("trace","Style "+this.name+": stop tile build because tile was canceled: "+e.key+", post-calcTextSizes()"),r([])):(this.texts[e.id]=i||[],i?r(this.buildTextLabels(e,t)):(na.abortTile(e.id),r([])))}catch(e){return o()}}.bind(this),o)}catch(e){o();}}.bind(this))},collideAndRenderTextLabels:function(e,t,r){return new Promise(function(n,i){var o,s,a;return Promise.resolve(this.prepareTextLabels(e,r)).then(function(r){try{return 0===(o=r).length?(na.collide([],t,e.id),n({})):Promise.resolve(na.collide(o,t,e.id)).then(function(t){try{if(o=t,e.canceled)return Kr("trace","stop tile build because tile was canceled: "+e.key+", post-collide()"),n({});if(null==(s=this.texts[e.id])||0===o.length)return n({});this.cullTextStyles(s,o),o.forEach(function(e){var t=e.text_settings_key,r=s[t]&&s[t][e.text];r.text_settings.can_articulate?(r.type||(r.type=[]),-1===r.type.indexOf(e.label.type)&&r.type.push(e.label.type)):(r.align=r.align||{},r.align[e.label.align]={});});var r=function(e){try{return n({})}catch(e){return i(e)}};try{return Promise.resolve(qr.postMessage(this.main_thread_target+".rasterizeTexts",e.id,e.key,s)).then(function(t){try{return a=t,e.canceled?(Kr("trace","stop tile build because tile was canceled: "+e.key+", post-rasterizeTexts()"),n({})):n(Object.assign({labels:o},a))}catch(e){return r()}},r)}catch(e){r();}}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}.bind(this))},cullTextStyles:function(e,t){for(var r=0;r<t.length;r++){var n=t[r];e[n.text_settings_key][n.text].ref++;}for(var i in e)for(var o in e[i])e[i][o].ref<1&&delete e[i][o];for(var s in e)0===Object.keys(e[s]).length&&delete e[s];},calcTextSizes:function(e,t){return this.canvas.textSizes(e,t)},rasterizeTexts:function(e,t,r){return new Promise(function(n,i){var o,s,a,l;return o=new ka,s=Math.min(this.max_texture_size,2048),a=o.setTextureTextPositions(r,s),l=["labels",this.name,t,e,La,""].join("-"),La++,Promise.resolve(o.rasterize(r,a,e,l,this.gl)).then(function(e){try{return n((a=e)?{texts:r,textures:a}:{})}catch(e){return i(e)}},i)}.bind(this))},preprocessText:function(e){if(e&&e.font&&"object"==typeof e.font)return e.font.fill=Ui.createPropertyCache(e.font.fill),e.font.alpha=Ui.createPropertyCache(e.font.alpha),e.font.stroke&&(e.font.stroke.color=Ui.createPropertyCache(e.font.stroke.color),e.font.stroke.alpha=Ui.createPropertyCache(e.font.stroke.alpha)),e.font.px_size=Ui.createPropertyCache(e.font.size||ha.defaults.size,ka.fontPixelSize,ka.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=Ui.createPropertyCache(e.font.stroke.width,Ui.parsePositiveNumber)),e.offset=Ui.createPropertyCache(e.offset,function(e){return Array.isArray(e)&&e.map(Ui.parseNumber)}),e.buffer=Ui.createPropertyCache(e.buffer,function(e){return (Array.isArray(e)?e:[e,e]).map(Ui.parsePositiveNumber)}),e.repeat_distance=Ui.createPropertyCache(e.repeat_distance,Ui.parsePositiveNumber),e},computeTextLayout:function(e,t,r,n,i,o,s,a,l){var u=e||{};return u=this.computeLayout(u,t,r,n,i),null==r.repeat_distance&&(u.repeat_distance="point"===n.geometry?0:li.tile_size,u.repeat_distance&&(u.repeat_distance*=u.units_per_pixel,u.repeat_scale=1,"function"==typeof r.repeat_group?u.repeat_group=r.repeat_group(n):u.repeat_group=r.repeat_group)),u.repeat_distance&&(a&&(u.repeat_group+="/"+a),u.repeat_group+="/"+o),u.subdiv=i.overzoom2,u.align=r.align,u.italic="normal"!==s.style,"right"===l?u.orientation=1:"left"===l&&(u.orientation=-1),u}};Vn("Float64",8,function(e){return function(t,r,n){return e(this,t,r,n)}});var Ia=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 Fa=function(e,t,r){var n=new Float64Array(3);return n[0]=e,n[1]=t,n[2]=r,n},Ua={normalFromMat4:function(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],c=t[8],f=t[9],h=t[10],d=t[11],p=t[12],_=t[13],m=t[14],v=t[15],g=r*a-n*s,y=r*l-i*s,x=r*u-o*s,b=n*l-i*a,A=n*u-o*a,T=i*u-o*l,w=c*_-f*p,E=c*m-h*p,R=c*v-d*p,M=f*m-h*_,S=f*v-d*_,z=h*v-d*m,P=g*z-y*S+x*M+b*R-A*E+T*w;return P?(P=1/P,e[0]=(a*z-l*S+u*M)*P,e[1]=(l*R-s*z-u*E)*P,e[2]=(s*S-a*R+u*w)*P,e[3]=(i*S-n*z-o*M)*P,e[4]=(r*z-i*R+o*E)*P,e[5]=(n*R-r*S-o*w)*P,e[6]=(_*T-m*A+v*b)*P,e[7]=(m*x-p*T-v*y)*P,e[8]=(p*A-_*x+v*g)*P,e):null},invert:function(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],c=t[8],f=c*s-a*u,h=-c*o+a*l,d=u*o-s*l,p=r*f+n*h+i*d;return p?(p=1/p,e[0]=f*p,e[1]=(-c*n+i*u)*p,e[2]=(a*n-i*s)*p,e[3]=h*p,e[4]=(c*r-i*l)*p,e[5]=(-a*r+i*o)*p,e[6]=d*p,e[7]=(-u*r+n*l)*p,e[8]=(s*r-n*o)*p,e):null}},Da={multiply:function(e,t,r){var n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],c=t[7],f=t[8],h=t[9],d=t[10],p=t[11],_=t[12],m=t[13],v=t[14],g=t[15],y=r[0],x=r[1],b=r[2],A=r[3];return e[0]=y*n+x*a+b*f+A*_,e[1]=y*i+x*l+b*h+A*m,e[2]=y*o+x*u+b*d+A*v,e[3]=y*s+x*c+b*p+A*g,y=r[4],x=r[5],b=r[6],A=r[7],e[4]=y*n+x*a+b*f+A*_,e[5]=y*i+x*l+b*h+A*m,e[6]=y*o+x*u+b*d+A*v,e[7]=y*s+x*c+b*p+A*g,y=r[8],x=r[9],b=r[10],A=r[11],e[8]=y*n+x*a+b*f+A*_,e[9]=y*i+x*l+b*h+A*m,e[10]=y*o+x*u+b*d+A*v,e[11]=y*s+x*c+b*p+A*g,y=r[12],x=r[13],b=r[14],A=r[15],e[12]=y*n+x*a+b*f+A*_,e[13]=y*i+x*l+b*h+A*m,e[14]=y*o+x*u+b*d+A*v,e[15]=y*s+x*c+b*p+A*g,e},translate:function(e,t,r){var n,i,o,s,a,l,u,c,f,h,d,p,_=r[0],m=r[1],v=r[2];t===e?(e[12]=t[0]*_+t[4]*m+t[8]*v+t[12],e[13]=t[1]*_+t[5]*m+t[9]*v+t[13],e[14]=t[2]*_+t[6]*m+t[10]*v+t[14],e[15]=t[3]*_+t[7]*m+t[11]*v+t[15]):(n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],c=t[7],f=t[8],h=t[9],d=t[10],p=t[11],e[0]=n,e[1]=i,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=u,e[7]=c,e[8]=f,e[9]=h,e[10]=d,e[11]=p,e[12]=n*_+a*m+f*v+t[12],e[13]=i*_+l*m+h*v+t[13],e[14]=o*_+u*m+d*v+t[14],e[15]=s*_+c*m+p*v+t[15]);return e},scale:function(e,t,r){var n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,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,r,n,i){var o=1/Math.tan(t/2),s=1/(n-i);return e[0]=o/r,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]=(i+n)*s,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*i*n*s,e[15]=0,e},lookAt:function(e,t,r,n){var i,o,s,a,l,u,c,f,h,d,p=t[0],_=t[1],m=t[2],v=n[0],g=n[1],y=n[2],x=r[0],b=r[1],A=r[2];if(Math.abs(p-x)<1e-6&&Math.abs(_-b)<1e-6&&Math.abs(m-A)<1e-6)return Ia(e);c=p-x,f=_-b,h=m-A,d=1/Math.sqrt(c*c+f*f+h*h),i=g*(h*=d)-y*(f*=d),o=y*(c*=d)-v*h,s=v*f-g*c,(d=Math.sqrt(i*i+o*o+s*s))?(i*=d=1/d,o*=d,s*=d):(i=0,o=0,s=0);a=f*s-h*o,l=h*i-c*s,u=c*o-f*i,(d=Math.sqrt(a*a+l*l+u*u))?(a*=d=1/d,l*=d,u*=d):(a=0,l=0,u=0);return e[0]=i,e[1]=a,e[2]=c,e[3]=0,e[4]=o,e[5]=l,e[6]=f,e[7]=0,e[8]=s,e[9]=u,e[10]=h,e[11]=0,e[12]=-(i*p+o*_+s*m),e[13]=-(a*p+l*_+u*m),e[14]=-(c*p+f*_+h*m),e[15]=1,e},identity:Ia,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}},Ga=function(){function e(e,t,r){void 0===r&&(r={}),this.view=t,this.position=r.position,this.zoom=r.zoom;}e.create=function(e,t,r){switch(r.type){case"isometric":return new Ca(e,t,r);case"flat":return new Va(e,t,r);case"perspective":default:return new ja(e,t,r)}};var t=e.prototype;return t.update=function(){},t.setupProgram=function(){},t.updateView=function(){if(this.position||this.zoom){var e={};this.position&&(e={lng:this.position[0],lat:this.position[1],zoom:this.position[2]}),this.zoom&&(e.zoom=this.zoom),this.view.setView(e);}},t.setupMatrices=function(e,t){Da.multiply(e.model_view32,this.view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),Ua.normalFromMat4(e.normal32,e.model_view32),Ua.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32);},e}(),ja=function(e){function t(t,r,n){var i;return void 0===n&&(n={}),(i=e.call(this,t,r,n)||this).type="perspective",i.focal_length=n.focal_length,i.fov=n.fov,i.focal_length||i.fov||(i.focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]]),i.vanishing_point=n.vanishing_point||[0,0],i.vanishing_point=i.vanishing_point.map(parseFloat),i.vanishing_point_skew=[],i.position_meters=null,i.view_matrix=new Float64Array(16),i.projection_matrix=new Float32Array(16),ei.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n }"),i}kr(t,e);var r=t.prototype;return r.constrainCamera=function(e){var t=e.view_height,r=e.height,n=e.focal_length,i=e.fov;return r?(n=2*r/t,i=2*Math.atan(1/n)):(n?i=2*Math.atan(1/n):i&&(i=i*Math.PI/180,n=1/Math.tan(i/2)),r=t/2*n),{view_height:t,height:r,focal_length:n,fov:i}},r.updateMatrices=function(){var e=this.view.size.css.height*this.view.meters_per_pixel,t=this.constrainCamera({view_height:e,focal_length:rn.interpolate(this.view.zoom,this.focal_length),fov:rn.interpolate(this.view.zoom,this.fov)}),r=t.height,n=t.fov,i=[this.view.center.meters.x,this.view.center.meters.y,r];this.position_meters=i,Da.lookAt(this.view_matrix,Fa(i[0],i[1],0),Fa(i[0],i[1],-1),Fa(0,1,0)),Da.perspective(this.projection_matrix,n,this.view.aspect,1,2*r),this.vanishing_point_skew[0]=this.vanishing_point[0]/this.view.size.css.width,this.vanishing_point_skew[1]=this.vanishing_point[1]/this.view.size.css.height,this.projection_matrix[8]=2*-this.vanishing_point_skew[0],this.projection_matrix[9]=2*-this.vanishing_point_skew[1],Da.translate(this.projection_matrix,this.projection_matrix,Fa(e/2*this.view.aspect*(2*-this.vanishing_point_skew[0]),e/2*(2*-this.vanishing_point_skew[1]),0)),Da.translate(this.projection_matrix,this.projection_matrix,Fa(0,0,-r));},r.update=function(){e.prototype.update.call(this),this.updateMatrices();},r.setupProgram=function(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3f","u_eye",[0,0,this.position_meters[2]]),e.uniform("2fv","u_vanishing_point",this.vanishing_point_skew);},t}(Ga),Ca=function(e){function t(t,r,n){var i;return void 0===n&&(n={}),(i=e.call(this,t,r,n)||this).type="isometric",i.axis=n.axis||{x:0,y:1},2===i.axis.length&&(i.axis={x:i.axis[0],y:i.axis[1]}),i.position_meters=null,i.viewport_height=null,i.view_matrix=new Float64Array(16),i.projection_matrix=new Float32Array(16),ei.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n // position.xy += position.z * u_isometric_axis;\n\n // Reverse z for depth buffer so up is negative,\n // and scale down values so objects higher than one screen height will not get clipped\n // pull forward slightly to avoid going past far clipping plane\n position.z = -position.z / 100. + 1. - 0.001;\n }"),i}kr(t,e);var r=t.prototype;return r.update=function(){e.prototype.update.call(this),this.viewport_height=this.view.size.css.height*this.view.meters_per_pixel;var t=[this.view.center.meters.x,this.view.center.meters.y,this.viewport_height];this.position_meters=t,Da.identity(this.view_matrix),Da.translate(this.view_matrix,this.view_matrix,Fa(-t[0],-t[1],0)),Da.identity(this.projection_matrix),this.projection_matrix[8]=this.axis.x/this.view.aspect,this.projection_matrix[9]=this.axis.y,Da.scale(this.projection_matrix,this.projection_matrix,Fa(2/this.view.size.meters.x,2/this.view.size.meters.y,2/this.view.size.meters.y));},r.setupProgram=function(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3fv","u_eye",[0,0,this.viewport_height]),e.uniform("2fv","u_vanishing_point",[0,0]);},t}(Ga),Va=function(e){function t(t,r,n){var s,a,l;},modifyZoomBehavior:function(e){if(this.scene.view.continuous_zoom&&!1!==this.options.modifyZoomBehavior){var t=this,i=function(t,i,o){e._stop();var s=e._zoom;i=n.latLng(i),o=void 0===o?s:o,o=Math.min(o,e.getMaxZoom());var a=Date.now(),l=75;return e._moveStart(!0),function u(){var h=(Date.now()-a)/l;h<=1?(e._flyToFrame=n.Util.requestAnimFrame(u,e),r(t,i,s+(o-s)*h)):r(t,i,o)._moveEnd(!0);}.call(e),e};if(e.doubleClickZoom){var o=e.doubleClickZoom.enabled();e.doubleClickZoom.disable(),Nh.doubleClickZoom._onDoubleClick||(Nh.doubleClickZoom._onDoubleClick=e.doubleClickZoom._onDoubleClick),e.doubleClickZoom._onDoubleClick=function(e){if(this._map===t._map){var r=this._map,n=r.getZoom(),o=r.options.zoomDelta,s=e.originalEvent.shiftKey?n-o:n+o;"center"===r.options.doubleClickZoom?i(t,r.getCenter(),s):i(t,r.containerPointToLatLng(e.containerPoint),s);}else Nh.doubleClickZoom._onDoubleClick.call(this,e);},o&&e.doubleClickZoom.enable();}e._zoomAnimated&&(Nh.map._animateZoom||(Nh.map._animateZoom=e._animateZoom),e._animateZoom=function(e,r,o,s){this===t._map?(o&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=r,i(t,e,r)),setTimeout(n.Util.bind(this._onZoomTransitionEnd,this),250)):Nh.map._animateZoom.call(this,e,r,o,s);});}},updateView:function(){var t=this._map.getCenter();t.zoom=Math.max(Math.min(this._map.getZoom(),this._map.getMaxZoom()||e.Geo.default_view_max_zoom),this._map.getMinZoom()),this.scene.view.setView(t);},updateSize:function(){var e=this._map.getSize();this.scene.resizeMap(e.x,e.y);},resizeOnFirstVisible:function(){var e=this,t=!0;this.hooks.visibilitychange=function(){t&&(t=!1,e.updateSize());},document.addEventListener("visibilitychange",this.hooks.visibilitychange);},onQcldicpViewUpdate:function(){if(this._map&&!this._updating_qcldicp){var e=this._map.getCenter(),t=this.scene.view.center;e.lng===t.lng&&e.lat===t.lat&&this._map.getZoom()===this.scene.view.zoom||(this._updating_qcldicp=!0,this._map.setView([this.scene.view.center.lat,this.scene.view.center.lng],this.scene.view.zoom,{animate:!1}),this._updating_qcldicp=!1);}},render:function(){this.scene&&this.scene.update();},reverseTransform:function(){if(this._map&&this.scene&&this.scene.container){var e=this._map.containerPointToLayerPoint([0,0]);n.DomUtil.setPosition(this.scene.container,e);}},setupSelectionEventHandlers:function(e){var t=this;this._selection_events={},this._selection_radius=null,this.hooks.click=function(e){"function"==typeof t._selection_events.click&&t.scene.getFeatureAt(e.containerPoint,{radius:t._selection_radius}).then(function(r){var n=Object.assign({},r,{leaflet_event:e});t._selection_events.click(n);});},e.on("click",this.hooks.click),this.hooks.mousemove=function(e){"function"==typeof t._selection_events.hover&&t.scene.getFeatureAt(e.containerPoint,{radius:t._selection_radius}).then(function(r){var n=Object.assign({},r,{leaflet_event:e});t._selection_events.hover(n);});},e.on("mousemove",this.hooks.mousemove),this.hooks.mouseout=function(e){"function"==typeof t._selection_events.hover&&t._selection_events.hover({changed:!0,leaflet_event:e});},e.on("mouseout",this.hooks.mouseout);},setSelectionEvents:function(e,t){var r=void 0===t?{}:t,n=r.radius;this._selection_events=Object.assign(this._selection_events,e),this._selection_radius=void 0!==n?n:this._selection_radius;},trackMapLayerCounts:function(e){var t=this;this._updateMapLayerCount=function(){var r=e.getPanes().mapPane.childNodes;t._mapLayerCount=0;for(var n=0;n<r.length;n++)t._mapLayerCount+=r[n].childNodes.length;},e.on("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),this._updateMapLayerCount();},updateQcldicpDebugSettings:function(){e.mergeDebugSettings(this.options.debug||{});}}),r=function(e,t,r){var i=e._map,o=e.scene,s=i.getZoomScale(r),a=i.getSize().divideBy(2),l=t instanceof n.Point?t:i.latLngToContainerPoint(t),u=l.subtract(a).multiplyBy(1-1/s),h=i.containerPointToLatLng(a.add(u));return o&&o.view.markUserInput(),i._move(h,r,{flyTo:!0})},"function"!=typeof(Uh=i.extend(s)).remove&&(Uh.prototype.remove=function(){this._map&&this._map.removeLayer(this),this.fire("remove");}),Uh.layerBaseClass=i,Uh.leafletVersion=o,new Uh(t)}}(t)},debug:{log:e.log,yaml:kh,Utils:e.Utils,Geo:e.Geo,Vector:e.Vector,DataSource:e.DataSource,GLSL:e.GLSL,ShaderProgram:e.ShaderProgram,VertexData:e.VertexData,Texture:e.Texture,Material:e.Material,Light:e.Light,Scene:Dh,WorkerBroker:e.WorkerBroker,Task:e.Task,StyleManager:e.StyleManager,StyleParser:e.StyleParser,TileID:e.TileID,Collision:e.Collision,FeatureSelection:e.FeatureSelection,TextCanvas:e.TextCanvas,debugSettings:e.debugSettings},version:e.version}});
// Loads each of the chunks produced by the first Rollup pass.
// This allows the rollup ESM build to work within a <script type="module"> tag
// Script modules can't expose exports
try {
Qcldicp.debug.ESM = false; // mark build as ES module
Qcldicp.debug.SHA = 'f0e7cf665ee5bfbc46bfffb6b64474f2caee7de0';
if (false === true && typeof window === 'object') {
window.Qcldicp = Qcldicp;
}
} catch(e) {}
return Qcldicp;
}));
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists